Wednesday, 21 August 2013

How does event based Nginx handle request single-threadly?

How does event based Nginx handle request single-threadly?

I have read several pose including this one: How does Nginx handle HTTP
requests? But there is one thing I still don't get it.
I understand how Nodejs handle request asyncly since node can be server
side script AND a web server. When you write code in node you know that
all functions will return quickly (asyncly), and for those not, you can do
whatever necessary (fork a process, use webworker, a thread, etc). But
Nginx is different. Nginx is just a HTTP server (Correct me if I'm wrong).
Assume we have some java code written with thread in mind, and now we try
to in Nginx. How does Nginx makes sure 1, all IOs are handled asyncly? 2,
if there is any computational intensive code block, how does it make sure
it doesn't block other requests?

No comments:

Post a Comment