Recommendations for server process with thousands of listening ports?
Jordan Sissel
jls at semicomplete.com
Thu Jun 23 01:43:41 EDT 2011
On Wed, Jun 22, 2011 at 6:18 PM, Johnny Luong <
johnny.luong at trustcommerce.com> wrote:
>
> Hi,
>
> If you take a look at the javadoc for NioServerSocketChannelFactory,
> you'll see a section underneath about how it deals with the threading
> which I think explains what you are seeing.
>
>
> http://docs.jboss.org/netty/3.2/api/org/jboss/netty/channel/socket/nio/NioServerSocketChannelFactory.html
>
> The threads that are used for doing the "work" are not the same ones as
> the ones doing accept calls on each of the bound ports.
>
> - -Johnny
Right, I get that much.
Is there no way to limit thread usage? Having thousands of mostly-idle
threads ends up consuming quite a bit of memory.
I was hoping to use a handful of threads for the entire application, not
strictly one per server port.
Here's some sample code:
https://github.com/jordansissel/experiments/blob/master/java/netty/manysockets/ServerTest.java
When this runs, it uses about 1.4GB of memory only having started the server
sockets - that's pretty huge - only listening on 1 port results in 26mb used
total by the process:
% ps -o rss,args -p 4414
RSS COMMAND
1416232 java -cp netty-3.2.4.Final.jar:build ServerTest
What are my options here?
-Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20110622/49ee79e4/attachment-0001.html
More information about the netty-users
mailing list