Worker threads in NioServerSocketChannelFactory vs. ExecutionHandler

Marc-André Laverdière marcandre.laverdiere at gmail.com
Tue Jun 21 00:35:31 EDT 2011


Hello,

In the case of NIO, you will obtain better performance with an
ExecutionHandler _if_ your requests take time to execute. This is
because you can keep fewer threads as worker threads that will focus
on handling the lower-level stuff.

On 6/19/11, Norman Maurer <norman.maurer at googlemail.com> wrote:
> As far as I remember you should not use a FixedThreadPool with netty.
> Just use a cached one and use the workercount to specify it. I think
> it is because of how netty use the pool internal...
>
>
> bye
> norman
>
>
> Am Samstag, 18. Juni 2011 schrieb Ersin Er <ersin.er at gmail.com>:
>> One more related question:
>> Considering the following constructor:
>> public NioServerSocketChannelFactory(            Executor bossExecutor,
>> Executor workerExecutor,
>>
>>             int workerCount)
>> How is workerCount ad workerExecutor (and its pool size) related? Isn't
>> the number of I/O worker threads fixed by the workerExecutor? What happens
>> if I pass a Executors.newFixedThreadPool(8) as workerThreads to this
>> constructor?
>>
>>
>> Thanks again,
>> On Sun, Jun 19, 2011 at 00:03, Ersin Er <ersin.er at gmail.com> wrote:
>> Well, I guess I could not ask the question the right way. Actually by
>> digging more into documentation and source code I think I understood the
>> difference. Anyway let me restate what I understood:
>>
>>
>> There are two types of "worker" thread pools in Netty. First one (set
>> in NioServerSocketChannelFactory constructor ) is responsible for doing
>> I/O operations and the second one (added as a handler to the pipeline,
>> namely ExecutionHandler) is responsible for application logic. Right?
>>
>>
>>
>> Thanks.
>> On Sat, Jun 18, 2011 at 17:52, "이희승 (Trustin Lee)" <trustin at gmail.com>
>> wrote:
>> The first one is used for boss threads and the second one is for worker
>> threads.  A worker thread performs actual reads and writes.  A boss thread
>> accepts a new incoming connection or makes a new connection attempt.  Once
>> a new connection is accepted or a connection attempt succeeds, the new
>> channel is handed off to one of the worker threads.  For now, there's no
>> way to set the boss thread count.
>>
>> HTH
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
>>
>>
>> --
>> Ersin Er
>>
>>
>>
>> --
>> Ersin Er
>>
>>
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users


-- 
Marc-André LAVERDIÈRE
"Perseverance must finish its work so that you may be mature and complete,
not lacking anything." -James 1:4
http://asimplediscipleslife.blogspot.com/
mlaverd.theunixplace.com



More information about the netty-users mailing list