Netty performance

20,485

Solution 1

Not really, a good reason to use Netty is to improve the reliability of the connections and leave you to code what the connection does rather than worry about the details of everything which can go wrong. (Often only comes by finding out the hard way)

Netty may help you scale over 1K connections. However if you don't need so many connections you might find that simple code performs best.

Solution 2

Not really, as Peter noted.

However, I've found that Netty also offers a very nice API for building a server. Although there is a bit of a learning curve to the API, it's well made and creating a new server can be trivial. It's also quite efficient code-wise, so you would have very little code, if you have a simple protocol and implementation.

This is ONLY if you are building a server for something other than HTTP. If you are talking about an HTTP web application, go with the tried an true. Apache for straight HTML pages, Tomcat if you need Servlets.

Solution 3

HTTP web app is not necessarily go to apache httpd and tomcat:

  1. Check this and this to see how superior nginx is compare to apache httpd
  2. Click here to see How Play!framework (based on Netty) outperforms those based on Tomcat/Servlet

Solution 4

Netty is very fast, especially with many connections.

In my experience:

  • It's more scalable than the standard Java IO. In particular, the old synchronous Java IO packages require you to tie up one thread per connection. This can become problematic with tens of thousands of connections!
  • It's approximately the same speed as what you would get if you wrote custom networking code using Java NIO, but it's a lot simpler to just use Netty directly rather than go down this route.

Solution 5

Twitter used Netty in its Search System:

Ref: Twitter Search is Now 3x Faster

Share:
20,485
M4rk
Author by

M4rk

Updated on July 04, 2020

Comments

  • M4rk
    M4rk almost 4 years

    Is there any real difference to the performance when you use Netty and if you don't use it in an application with tens of thousand of connections?

  • Tim Gautier
    Tim Gautier about 10 years
    This information was 6 years out of date when you posted it almost a year ago. Is it accurate today?
  • Scott Mitchell
    Scott Mitchell over 9 years
    One of the benefits of Netty is that it is not limited to HTTP/REST, and allows you flexibility to implement your own protocols. Can you clarify the following: "Netty has limitations that the plethora of Grails plugins can expand far beyond using Tomcat NIO.". Netty provides OIO, NIO, and linux EPOLL native transports. Are you claiming there are limitations with these implementations? I would be interested in some metrics or information to substantiate these claims.
  • Hal50000
    Hal50000 about 8 years
    Netty gives you no performance gains over Tomcat/NIO. It's benefit is that it's simpler -- it handles a subset of what Tomcat can do.