I worked on creating a public API that will have many concurrent accesses and one aspect that I thought was to use asynchronous I / O to address the scalability aspect.
At first, I thought that Nginx was used as an event-driven HTTP server, because it works asynchronously, in other words, from Tomcat. The API will be built in Java, and for this I decided to use the following components:
- Tomcat 7 - HTTP / Web Server + Java Container
- Netty.io or HttpCore?
- Resteasy (REST layer, w / HttpServlet30Dispatcher servlet)
- MongoDB (with Java Async driver)
I saw a lot of discussion about Servlet 3.0, because the new version supports asynchronous requests (using NIO). Based on my problem and in the model above, I have a few questions:
- Do I need to use Netty.io once when I plan to use Servlet 3.0, which also supports asynchronous requests?
- Using an event-driven web server (such as Jetty) is different than using a process-based web server such as Tomcat 7 (which supports Servlet 3.0), which is not an event-driven web server.
- On many sites, I have seen that Netty.io works so that a stream can accept many requests, rather than the classic single-threaded peer request method. In practice, how does it work?
- Asynchronous request processing (Servlet 3.0) and non-blocking IO (NIO) are different concepts? How?
- I never see a REST API using NIO, is this a good approach? What potential problems can I have?
Poulsen
source share