Netty and Protocol Buffers.

"이희승 (Trustin Lee)" trustin at gmail.com
Tue Jun 21 05:45:48 EDT 2011


Marco Villalobos wrote:
> I have a question on proper use of netty with protocol buffers.
> I made extensive use of the LocalTime example in the documentation.
>
> And I have some questions about best practices.
>
> Let's say that there is a multithreaded application called X in which
> many threads needs to make client calls to the netty server.
>
> And we are using protocol buffers nio with netty.
>
> FIRST QUESTION
>
> In application X, how many clients should it use?
>
> a) ONE client
> b) A pool of clients?

If there are not many instances of application X connecting to the 
server, you could keep a pool of clients to get better throughput by 
utilizing more cores of the server.  Otherwise, the server load will 
overweigh the throughput gain.

> SECOND QUESTION
>
> In the example,
>
> http://docs.jboss.org/netty/3.2/xref/org/jboss/netty/example/localtime/LocalTimeClientHandler.html
>
> Would this be an inefficient implementation of a handler considering
> that it will block at line 71 ?

Handler itself does not call that method at all.  It's the main thread 
that calls it.  Therefore, I wouldn't say it's inefficient.  If you have 
to deal with multiple connections and requests, it will be inefficient 
and you will have to make it asynchronous.

HTH

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



More information about the netty-users mailing list