Multi-threaded Handling of UDP Messages

Simon James sjames at btisystems.com
Fri Sep 18 02:29:59 EDT 2009


Hi Trustin

Thanks for the response. 

I think you are right; there would not be much value in a multi-threaded
selector loop.

My question was a dumb one!
I  misunderstood the the role of the executor that is used to construct the
NioDatagramChannelFactory.
In fact, I was able to achieve exactly what I wanted by injecting an
ExecutionHandler with an OrderedMemoryAwareThreadPoolExecutor at the head of
the pipeline.

Thanks again.

Simon


Trustin Lee wrote:
> 
> Hi Simon,
> 
> You are right - Netty uses only one thread for one channel.  Do you
> know if multi-threaded selector loop that handles one UDP channel
> improves throughput / latency?  To be honest, I've never such
> configuration.  For TCP, I didn't see improvement in performance.
> 
> Thanks
> 
> — Trustin Lee, http://gleamynode.net/
> 
> On Wed, Sep 16, 2009 at 5:05 PM, Simon James <sjames at btisystems.com>
> wrote:
>>
>> Hi
>>
>> I apologize if this is a dumb question!
>>
>> I’ve implemented a simple UDP server along the lines of the QOTM example,
>> but using NioDatagramChannelFactory rather than
>> OioDatagramChannelFactory,
>> namely:
>>
>>        DatagramChannelFactory factory =
>>            new NioDatagramChannelFactory(Executors.newCachedThreadPool(),
>> 10);
>>
>>        ConnectionlessBootstrap bootstrap = new
>> ConnectionlessBootstrap(factory);
>>        ChannelPipeline p = bootstrap .getPipeline();
>>        // decoder/encoder omitted for clarity...
>>        p.addLast("handler", new ServerHandler());
>>
>>        bootstrap .bind(new InetSocketAddress(1234));
>>
>> This works OK, except that there is no multi-threading : all incoming
>> messages get handled by the same worker thread.
>> Using ConnectionLessBootstrap, is there a simple way to make it use
>> multiple
>> threads in parallel?
>>
>> Thanks
>>
>> Simon
>>
>> --
>> View this message in context:
>> http://n2.nabble.com/Multi-threaded-Handling-of-UDP-Messages-tp3654751p3654751.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
>>
> 
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
> 
> 

-- 
View this message in context: http://n2.nabble.com/Multi-threaded-Handling-of-UDP-Messages-tp3654751p3667840.html
Sent from the Netty User Group mailing list archive at Nabble.com.



More information about the netty-users mailing list