Idle connections keep threads on epollWait()
NettyUser5325
subhirn3 at yahoo.de
Wed Jan 26 06:59:00 EST 2011
Hello,
running the HexDumpProxy Netty example, I observe one client and one server
worker thread to be active per connection, although the connection is idle.
I am planning to write a program that has many connections open from clients
and to a server. It must be highly scalable.
I plan to use Netty/NIO in order to minimize the number of actually required
threads. A thread should only be active if it has to handle I/O, otherwise
it should be returned to the thread pool.
Also I want to use a single instance of a thread pool to limit the maximum
number of I/O threads. For that I pass that thread pool to all my
NioClientSocketChannelFactorys and NioServerSocketChannelFactorys. But if
threads never return to the thread pool for idle connections, then my
program does not accept any more connections.
Idle connections must give their NIO threads back to the thread pool,
otherwise I cannot scale on the number of connections.
Here is the stack trace of the worker threads:
sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:210)
sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:65)
sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:69)
- locked sun.nio.ch.Util$1 at 4d28a245
- locked java.util.Collections$UnmodifiableSet at 57d89cb4
- locked sun.nio.ch.EPollSelectorImpl at 107267a4
sun.nio.ch.SelectorImpl.select(SelectorImpl.java:80)
org.jboss.netty.channel.socket.nio.SelectorUtil.select(SelectorUtil.java:38)
org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:164)
org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
java.lang.Thread.run(Thread.java:662)
Thanks for any ideas.
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Idle-connections-keep-threads-on-epollWait-tp5962446p5962446.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list