4 ms·
How does Passenger deal with blocking I/O from applications if it is single threaded? Does the entire event loop block while doing I/O?
by cmbaus 13y ago
How does Passenger deal with blocking I/O from applications if it is single threaded? Does the entire event loop block while doing I/O?
- trustfundbaby 13y agoPassenger spawns copies of your application and (I think this is the default now, it wasn't before) puts your requests in a queue, so that as the app instances finish processing requests they snatch a new request off the queue. If they are all busy then the requests back up on the queue until one of them becomes available.
- FooBarWidget 13y agoThere are two components at work. One is the Phusion Passenger core, which is evented and uses only non-blocking I/O. At no point does the event loop block. The other component is the Ruby application process. I believe you are talking about this component. Concurrency on the Ruby application process side is handled using two strategies: 1. Multiprocessing. 1 process per concurrent connection, with a buffering layer. This is architecturally the same as how Unicorn works when behind an Nginx reverse proxy. 2. Multithreading. 1 thread per concurrent connection, possibly with multiple processes. This is architecturally similar to Puma, though not entirely the same. It should be noted that multithreading support is available in the Enterprise version only.