If your application calls API calls to other services, then Unicorn is a bad choice. Unicorn is a single-threaded multiprocessor application server, clearly designed for fast and short work with CPU load. HTTP API calls count as long blocking I / O requests. This is not a limitation, but an explicit choice of Unicorn design. This is confirmed by the Unicorn website , βWorse, in some casesβ section.
In theory, Thin can handle such high concurrency workloads because it uses I / O events. However, this requires explicit support for frameworks and applications in the form of an event code. It makes several wireframes and applications. Rails and Sinatra do not.
Thus, this leaves only multithreading application servers. Three applicants: Puma, Rainbows, and Phusion Passenger 4 Enterprise .
- Puma is relatively new. Rainbows are a bit older, but the author makes no guarantees as to whether he works well. Phusion Passenger is mature, has existed for many years and is currently used by more than 150,000 websites, including large ones like Pixar, New York Times, AirBnB, etc.
- The usage models of Puma and Rainbows are similar to Unicorn and Thin, since you start a bunch of processes and connect them to Nginx through the reverse proxy configuration. Phusion Passenger, on the other hand, is designed to integrate directly with Nginx, so it requires much less configuration, process management, and other administrative overhead.
- Phusion Passenger 4 Enterprise is not a strictly multi-threaded server, but a hybrid multi-processor / multi-threaded server. This means that it can run several processes (to increase stability and the ability to use multiple processor cores), each of which has several threads (for high I / O concurrency).
- Phusion Passenger 4 Enterprise brings many advantages , has more features than Puma and Rainbows: for example, it has out-of-band garbage collection, can dynamically configure the number of processes based on traffic, fully automate restart restart, so you do not need scripts, etc.
You may also be interested in this entry for more information.
source share