Skip to content

Conversation

@adj5672
Copy link

@adj5672 adj5672 commented Jan 6, 2026

In my app, I use WsWebSocketContainer to create websocket client.
As the number of sessions increases, memory usage also increased. So "OOM Killed" occured frequently.
I know that It is a normal situation in thread-per-connection model which is current applied.
Current model have advantage that It is very intuitive and sometimes it behaves like kind of rate limiter.

But I think that threads for R/W may not working busy in some case.
Also platform thread will be created twice of session count and it allocate a lot of default stack memory.
furthermore context switching cost expensive too when using platform thread.

So I think that instead of create two platform thread per session, using virtual thread will be helpful in some cases.
Since I may not understand overall about websocket codes and architecture, I just create draft pull request.
Adding choice to use virtual threads would be helpful for optimizing memory usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant