Maximize Netty performances

Patrizio Munzi patrizio.munzi at eris4.com
Fri Mar 6 08:47:40 EST 2009


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*
Product Specialist
Viale Bruno Buozzi, 19 - 00197 Roma (Italy)
tel: +39 06 4543 3540
fax: +39 06 4543 3587
mobile: +39 393 7195 164
mail: patrizio.munzi at eris4.com <mailto:patrizio.munzi at eris4.com>
web: http://www.eris4.com <http://www.eris4.com/>
skype: eris4_munzi <skype:eris4_munzi?add>




More information about the netty-users mailing list