I am working on a RESTfull application which requires high scalability. I am considering Netty based frameworks for RESTfull applications. I went through some of the available options and tried to get what they can offer as a non-blocking implementation. Here are my findings:
Before having the above findings, I wanted to use some ready to use framework and get the work done faster.
I know it's an opinion based question. But, still I seriously need help for choosing right framework for my application. If in case, there is no Netty based REST framework: would it be wise to go for plumbing low level Netty based NIO code in my application? Any help appreciated. Thanks in advance.
Netty's asynchronous, non-blocking I/O model is designed for highly scalable architectures and may allow for higher throughput than an analogous blocking model. Basically, a non-blocking server runs all requests asynchronously on a single thread (no function should “block” the event loop).
The main purpose of Netty is building high-performance protocol servers based on NIO (or possibly NIO. 2) with separation and loose coupling of the network and business logic components. It might implement a widely known protocol, such as HTTP, or your own specific protocol.
1.2. 1. Who uses Netty? Netty has a vibrant and growing user community that includes large companies such as Apple, Twitter, Facebook, Google, Square, and Instagram, as well as popular open source projects such as Infinispan, HornetQ, Vert.
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.
If you really want non-blocking you need to do non-blocking from the ground up and have proper REST clients. Otherwise as stated in my comment the performance difference will be negligible and in many cases worse for NIO (Netty with thread sharing).
There only two libraries that I know do non-blocking from the ground up Vert.x and somewhat Finagle (its missing other things like non-blocking data access).
You should also know Tomcat and various other servlet containers that can work with JAX-RS support NIO. The issue is that even though NIO is supported it will still be a single thread per request. Only Play, Finagle, Vert.x and pure Netty (regardless of NIO) support a different shared threading model and thus have different mechanisms for doing concurrency.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With