Idle connections keep threads on epollWait()
이희승 (Trustin Lee)
trustin at gmail.com
Wed Jan 26 11:22:11 EST 2011
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
It is highly scalable. Try to increase the number of connections and you will see the number of threads stays stable. Netty will return the threads to its pool only when there is zero connections to manage. It's because even an idle connection needs to be registered to an NIO Selector and polled until disconnection to get notified when the idle connection is activated. For more information, consult tutorials about Java NIO.
"NettyUser5325" <subhirn3 at yahoo.de> wrote:
>
>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.
>_______________________________________________
>netty-users mailing list
>netty-users at lists.jboss.org
>https://lists.jboss.org/mailman/listinfo/netty-users
- --
Trustin Lee, http://gleamynode.net/
Sent from a mobile device. Please excuse my brevity.
-----BEGIN PGP SIGNATURE-----
Version: APG v1.0.8
iIkEAREIADEFAk1ASjIqHFRydXN0aW4gSGV1aXNldW5nIExlZSA8dHJ1c3RpbkBn
bWFpbC5jb20+AAoJEJb7nbIZ8zONjrYA/1gbTHzJDalccx9HpumeWjOm6hTQ94Z6
TwG3WmrxLawLAQCNJA0ym6yUlrM5jPHMZekfrbC/mJrtc6azOenDo0zcVA==
=/oXm
-----END PGP SIGNATURE-----
More information about the netty-users
mailing list