简体   繁体   中英

Nginx + FastCGI with blocking calls

The main advantage of Nginx is cited as it not needing to spawn separate threads for each request it receives.

Now, if we were to run a python based web application using FastCGI, and this web application has blocking calls, would this create a bottleneck?

Since there is only a limited number of workers running(1 per processor?), wont a blocking call by a python script make it cooperative multiprocessing?

Nginx talks to a fastcgi process over a socket connection.

If the fastcgi process blocks, that means that it won't be sending data over the socket.

This won't block nginx as such, because it keeps processing events (data from other connections). It uses non-blocking techniques like select , poll or equivalent OS-dependent functions (with a timeout) to query sockets without blocking.

But it will stall whatever client is waiting for the fastcgi output.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM