Non-blocking HTTP server, java nio, python tornado eventlet

Hi I'm trying to figure out if a tornado / eventlet based http server is better than threaded. While I look at the object, I see that it is a single-thread database server that runs one handler function after selecting / poll / epoll on the socket.

  • My first question is that it is a tornado / eventlet, similar to the nio library in java, and the java nio server, not blocking and fast.
  • My second question is that since this event-based server is a single thread. If one of the connections blocks the io file or the solw client, it will hang the entire server.
  • My third question: what is a compromise if not a blocking server quickly, why is it not more common than apache

These issues are related, and I would be very grateful that I did not understand these problems correctly.

thank

+3
source share
1 answer

Non-blocking servers are the best choice if all your libraries provide non-blocking apis. As already mentioned in your second question, if the library is blocking (for example, the lib database makes a blocking call), all processes / threads are blocked and the system freezes. Not all available libraries are asynchronous, which makes it difficult to use a tornado / eventlet for all use cases. Also, in a multi-core box, you need to run several instances of non-blocking servers in order to fully use the box capacity.

Tornado/Event java nio. Tornado Eventlet. Tornado , - (IO) . , . , , , , . Java NIO .

Eventlet , . . IO , eventlet ( ).

Apache webapps , -

  • .

-, , . async-, twisted/event/Java NIO.

+3

Source: https://habr.com/ru/post/1792729/


All Articles