Maximize Netty performances

Frederic Bregier fredbregier at free.fr
Thu Mar 5 12:07:35 EST 2009


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
-- 
View this message in context: http://n2.nabble.com/Maximize-Netty-performances-tp2416633p2430715.html
Sent from the Netty User Group mailing list archive at Nabble.com.




More information about the netty-users mailing list