Recommendations for server process with thousands of listening ports?

"이희승 (Trustin Lee)" trustin at gmail.com
Thu Jun 23 02:03:39 EDT 2011


This is a known issue I forgot to create the corresponding JIRA issue:

   https://issues.jboss.org/browse/NETTY-416

Please put a watch on it so that you are notified when this issue is 
resolved.

HTH

Jordan Sissel wrote:
>
>
> On Wed, Jun 22, 2011 at 6:18 PM, Johnny Luong
> <johnny.luong at trustcommerce.com <mailto: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
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users

-- 
Trustin Lee, http://gleamynode.net/



More information about the netty-users mailing list