To use or not to use netty?

Enno Shioji eshioji at gmail.com
Sat Jan 9 00:54:11 EST 2010


Hi Trustin,


Thanks for the reply!

> JEE containers are basically same with Tomcat and other Web application
> servers if you do not use more advanced features like EJB.  I don't
> think switching from a JEE container to Tomcat will improve scalability.
I probably should have been more specific.. We used to use EJB to
handle our business logic, but that deprived us from doing our own
thread management, and that's why we are moving out from EJB.

> If you are writing a special purpose HTTP server that must support
> massive concurrency, media streaming, proxying, long polling, ..., then
> Netty is the way to go.
Sounds like that's exactly what we need :) We are also talking about
implementing custom binary codec etc., so I guess having the freedom
will pay.

We decided to deal with the network issue in the 3rd iteration, so
when the time comes, I'll probably recommend netty and try using it.
Perhaps we might be using netty within a web container...
Until that, I'm looking forward to playing with netty :)


Thanks again for your time!


Regards,
Enno




On Sat, Jan 9, 2010 at 8:40 AM, "Trustin Lee (이희승)" <trustin at gmail.com> wrote:
> Since there was no reply, let me step in.
>
> Enno Shioji wrote:
>> Hi,
>>
>> To put it in a nut shell, my questions is "When is it appropriate to use
>> netty instead of containers such as tomcat, jetty etc.?"
>>
>>
>> Well, let me explain my situation..
>>
>> I have an app. that accepts tasks from clients (other servers), chops it up
>> to smaller subtasks, dispatches them to a group of servers, receive the
>> calculated results from these servers, aggregate the result and sends a HTTP
>> callback to the original client. 1 instance of our app will manage several
>> hundred worker servers, between which several hundred transactions / second
>> will be taking place.
>
> I see.  Data mediation server is similar to a proxy server in terms of
> the actual implementation.  If all operations (i.e. talking to the
> servers that actually do the subtask) are done asynchronously (perhaps
> using Netty here, too), you could handle all requests with very small
> number of threads.  So, I'd say Netty fits very well for this use case.
>  Check out Dave's testimonial in the web site.
>
>> This app. used to use a JEE container to accept connections and apache
>> HTTPClient to send data. However, in order to deal with scalability issues,
>> we decided to move out from the JEE container.
>
> JEE containers are basically same with Tomcat and other Web application
> servers if you do not use more advanced features like EJB.  I don't
> think switching from a JEE container to Tomcat will improve scalability.
>
>> So, I was considering web containers such as Tomcat, Jetty etc. but then I
>> stumbled on netty. Personally I'm inclined to use netty, because of the
>> freedom I think it will give us. For example, in our current system,
>> servants (worker severs that do the calculation) periodically poll our app.,
>> but we could change it to a comet like protocol or to a push-model.
>>
>> However, the problem is that we have no experience with network application
>> framework such as netty, or any event-driven network programming for that
>> matter. Also, although performance is important for us, it is unlikely that
>> our app will serve more than e.g. 2000 concurrent connections (that is,
>> unless we change to a comet style protocol). I also assume it will be more
>> to code if we choose netty vs. e.g. a servlet container.
>
> Yes.  At the cost of longer code, you get full control over HTTP
> connection and better performance for your use case (data mediation).
>
>> I guess nobody can give a definitive answer to such a question, as it just
>> depends on my particular situation, but I wanted to know if there are
>> anybody who had to make similar decisions, and if so, I wanted to know what
>> their experience was like.
>>
>> Also, just in general, when do you think it makes sense to use netty? Or
>> perhaps more importantly, when does it NOT make sense to use netty?
>
> If you are writing an ordinary web application with UI on a browser,
> using Netty directly is not a good idea obviously.
>
> However, if someone writes a servlet adaptor on top of Netty HTTP, then
> you could even run a web framework on top of Netty, which means you can
> restart a web application faster than ever.  Just thinking out loud! :)
>
> If you are writing a special purpose HTTP server that must support
> massive concurrency, media streaming, proxying, long polling, ..., then
> Netty is the way to go.
>
> HTH,
> Trustin
>
> --
> what we call human nature in actuality is human habit
> http://gleamynode.net/
>
>
>



More information about the netty-users mailing list