Effective use of thread pool in server + client setup

"이희승 (Trustin Lee)" trustin at gmail.com
Mon Jul 25 16:12:07 EDT 2011


When you construct a ChannelFactory, always specify 
Executors.newCachedThreadPoolExecutor().  You can create a single 
cachedThreadPoolExecutor and specify it many times.

Netty will pull as many threads as it needs then.  With NIO transport, 
you can specify the maximum number of I/O worker threads so that the 
cachedThreadPool never explodes with too many threads.

HTH

George wrote:
> I am using the NIO
>
> I vaguely remember reading from one of the previous release documents,
> to use the same NioSocketChannelFactory for both server and client in an
> app.
>
> But I don't exactly remember whether its NioSocketChannelFactory or the
> ThreadPool.
>
>
> 2011/7/25 Marc-André Laverdière <marcandre.laverdiere at gmail.com
> <mailto:marcandre.laverdiere at gmail.com>>
>
>     Are you using OIO or NIO?
>
>     The core worker threads are reccomended to be 2x the number of cores
>     NIO needs a few worker threads and then a bigger thread pool in an
>     executor handler
>     OIO just needs as many worker threads as your application needs.
>
>     On 7/23/11, George <georgel2004 at gmail.com
>     <mailto:georgel2004 at gmail.com>> wrote:
>      > Hello,
>      >
>      > Suggestion is needed for a high bandwidth throughput oriented app.
>      >
>      > In most of the example codes, i notice separate threadpool for
>     boss and
>      > workers except the proxy dump.
>      >
>      > I have a setup where the code acts as a server and client as well.
>      >
>      > How many threadpools should i create in such setup?
>      >
>      > 1 thread pool that acts as server boss, server worker, client
>     boss and
>      > client worker
>      > 2 thread pools that acts as server + client boss and server +
>     client worker
>      > 4 threadpools 1 each for server boss, server worker, client boss,
>     client
>      > worker.
>      >
>      > --
>      > Thanks
>      > George L
>      >
>
>
>     --
>     Marc-André LAVERDIÈRE
>     "Perseverance must finish its work so that you may be mature and
>     complete,
>     not lacking anything." -James 1:4
>     http://asimplediscipleslife.blogspot.com/
>     mlaverd.theunixplace.com <http://mlaverd.theunixplace.com>
>
>     _______________________________________________
>     netty-users mailing list
>     netty-users at lists.jboss.org <mailto:netty-users at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/netty-users
>
>
>
>
> --
> Thanks
> George L
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users

-- 
Trustin Lee, http://gleamynode.net/



More information about the netty-users mailing list