Recommendations for server process with thousands of listening ports?

Jordan Sissel jls at semicomplete.com
Wed Jun 22 18:14:53 EDT 2011


Howdy :)

I have a service that currently listens on thousands of tcp and udp ports
(for different channels of data); due to various problems, I am rewriting it
in Java and decided to use Netty.

I've tried a few different ways of doing things -

First, one NioServerSocketChannelFactory (or NioDatagramChannelFactory) per
listening port. Problem is, after a few thousand server channels (via
ConnectionlessBootstrap and ServerBootstrap), I get OOM while creating
threads.

Second, one NioServerSocketChannelFactory shared across all TCP server ports
and one NioDatagramChannelFactory for all UDP server ports. Problem here is
that after about a few hundred open sockets with error
"org.jboss.netty.channel.ChannelException: Failed to bind to: /0.0.0.0:15725"
- watching strace shows bind(2) successfully bind on this port, for example,
so the cause is not a bind specific failure. Trolling the logs, I see about
911 successful TCP server sockets before tcp fails with this message

I am using NioServerSocketChannelFactory with
Executors.newCachedThreadPool().

I can try to make some standalone code that reproduces this behavior for
further study, but if there's anything obvious I'm missing, please let me
know.

-Jordna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20110622/5acae044/attachment.html 


More information about the netty-users mailing list