"I'm just curious why using your own ExecutorService inside the handler is 
preferable to adding someEventExecutorGroup to that handler here.  Doesn't 
that achieve the same function?"

Did you find answer to this? what is the difference between "SslHandler 
sslHandler = new SslHandler(sslEngine, eventExecutorGroup);" vs 
"ctx.pipeline().addFirst(eventExecutorGroup, 
Constants.*SSL_HANDLER_NAME*, sslHandler);"



On Tuesday, 8 October 2013 08:40:30 UTC-7, [email protected] wrote:
>
> Greetings,
>
> I just want to validate my understanding of Netty 4's thread model 
> compared to Netty 3's (specifically as it applies to NIO).
>
> With Netty 3, you would specify a boss thread pool and a worker thread 
> pool (all/most of the examples use Executors.newCachedThreadPool() with the 
> default args).  ChannelHandler events would be called on the I/O threads 
> from the worker group.  Any delay in the handler methods would cause a 
> delay in processing I/O for other connections.  In order to compensate for 
> this, you could add an ExecutionHandler to the pipeline which would cause 
> the handler methods to be fired on an executor thread and therefore 
> wouldn't affect I/O.
>
> In Netty 4, you specify a boss group and worker group, and as channels 
> connect they are registered to specific threads.  So channel 1 will always 
> have it's handler events fired on thread A, channel 2 will always have it's 
> handler events fired on thread B.  Again, any delayed processing that 
> occurs in the handler method will hurt I/O for other channels registered to 
> that worker thread.  To compensate, you specify an EventExecutorGroup so 
> that I/O is not affected with long running tasks.
>
> Assuming everything above is correct...
>
> Assume that I create a DefaultEventExecutorGroup, passing 4 as the number 
> of threads, and assign that to my handler in the pipeline.  Now, 8 channels 
> connect:
>
> Channel A: EventExecutor 1
> Channel B: EventExecutor 2
> Channel C: EventExecutor 3
> Channel D: EventExecutor 4
> Channel E: EventExecutor 1
> Channel F: EventExecutor 2
> Channel G: EventExecutor 3
> Channel H: EventExecutor 4
>
> Each channel is registered to EventExecutor thread.  If Channel A in the 
> above example performs a long running task (say, in channelRead0), then 
> won't Channel E be blocked during this time?  Is that correct or am I not 
> understanding something?  If I am correct, why would I ever want to use an 
> EventExecutor?  I feel like I would be better off using a shared Executor 
> directly from my handler methods (and handling thread synchronization 
> myself).  At least in that case I wouldn't be blocking other clients.
>
> Thank you,
> Sean
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/netty/8430beb8-55ac-4e98-97e0-1acdd3e1323a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to