Reputation: 6860
I am a newbie to this and I am sorry if my question may seem to be too naive to experienced netty , tomcat users.
I am running a Netty websocket server(using the sample code and running on port 8090) configured through spring inside tomcat(running on port 8080). I am trying to understand the threading models of both and overall how would it work.
As I understand, tomcat by deafult sets the maxThreads = 200
(max number of active threads).
While netty uses boss threads to create and connect/bind sockets and then pass them off to the worker threads , which do the actual asynchronous I/O.
Now I am trying to understand :
If the threads used by Netty would be taken from the tomcat pool and hence decrease the number of active threads) ?
For each websocket connection would a separate thread be allocated and used (I am not very clear about websocket implementation, though I think the answer to this should be no).
Overall , how would it affect the number of simultaneous clients connecting to the webapp and the websocket server?
EDIT :
And accordingly are there any specific points that should be kept in mind while coding the weboscket server ?
Upvotes: 4
Views: 2152
Reputation: 23557
In Netty you specify the ThreadPool by passing an Executor to the constructor. So as long as you don't use the same pool as you use in Tomcat it should not effect the available threads.
Netty's Webseocket implementation can be used with its NIO transport. In this case you would share a number of threads between connections. So there isn't a 1:1 mapping from connection to threads.
Upvotes: 5