Maximize Netty performances

Virat Gohil virat4lug at gmail.com
Sat Mar 7 12:16:40 EST 2009


On Fri, Mar 6, 2009 at 7:17 PM, Patrizio Munzi <patrizio.munzi at eris4.com>wrote:

> Hi Frederic,
> thanks for your tips.
> ;-)
> In particular that one on ChannelGroup, it solved the problem in my other
> post.
>
> About OrderedMemoryAwareThreadPoolExecutor I don't think I need it.
>
> BR,
>   Patrizio
>
>
> Frederic Bregier wrote:
>
>> Hi Patrizio,
>>
>> For me, you have almost all.
>>
>> I could suggest the following:
>> - adding the .setOption("reuseAddress", true)   both on server (using
>> "child.reuseAddress") and client sides
>>
>> - adding if necessary an OrderedMemoryAwareThreadPoolExecutor in your
>> pipeline
>>  (that you could create once for all connections and reuse it)
>>  bewteen you "encoder" and "handler". This is only needed if your handler
>>  is doing stuff like database, file access, or any heavy computations.
>>  Heavy can depend on each case of software, so it is up to you to check
>>  if it is better or not.
>>
>> - perhaps using DefaultChannelGroup to add any created channel to it
>>  (either in client or server) in order to allow a shutdown of Netty
>>  more easily:
>>
>>  In your "handler", you can add in the channelConnected a
>> "myChannelGroup.add(channel)"
>>
>>  Again in the "handler" in channelClosed, add a
>> "myChannelGroup.remove(channel)"
>>
>>  And finaly in your global exit command (like shutdown in your other
>> post):
>>  myChannelGroup.close().awaitUninterruptibly(); // it should close all
>> opened
>>      // channel, even the father in Server version
>>  then your "orderedMemoryAwareThreadPoolExecutor".shutdownNow(); // if you
>> added one
>>  then your "channelFactory" (from new NioXXXSocketChannelFactory)
>>        "channelFactory".releaseExternalResources(); // should release all
>> internals
>>    // like thread pools.
>>
>> I think it is all... ;-)
>>  HTH,
>> Frederic
>>
>> -----
>> Hardware/Software Architect
>>
>>
>
> --
>
> *Patrizio Munzi*
>


Hi Frederic,

Thank you very much for sharing these tips with us. The tips will also be
very useful for me too!! :)

Cheers!

Virat
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20090307/19282dca/attachment.html 


More information about the netty-users mailing list