With so many choices for the application server (Passenger, Thin, Unicorn, Mongrel, Puma and Rainbows!), I'm wondering what would be appropriate for the following scenario:
Rails is used purely for API backend (all assets are served with Nginx). Some of the API calls rely on other API services, so sometimes they take a while to finish.
The responsive app is used with mobile, tablet and desktop clients, so there's no guarantees about the client's connection.
What application server do you think is appropriate in this case? What things should be considered when choosing?
What is a back-end API? A back-end API is a programming interface that helps developers to interact with back-end services for example server. When choosing a backend API, there are a multitude of options available. There are certain things that you need to keep in mind that will lead you to your goals.
A backend server is generally an application server that software on the web server can call on behalf of the end user to perform business logic. ... A backend server is any remote server managing data. A webserver is a specific type of backend server used for “internet” traffic.
REST and GraphQL are both standard ways to develop backend APIs. But over the past decade REST APIs have dominated as a choice for developing backend API's. And many companies and developers use it actively in their projects. But REST has some limitations, and there's another alternative available – GraphQL.
Often, an API is considered a backend "component". And, for instance, a database can also be treated as another backend component. The APIs you are likely referring to here are web APIs, so could be considered as backend components.
If your application makes API calls to other services then Unicorn is a bad choice. Unicorn is a single-threaded multi-process application server, explicitly designed for fast, short-running CPU-bound workloads. Making HTTP API calls counts as long-running blocking I/O requests. This is not a limitation, but an explicit design choice of Unicorn. This is confirmed by the Unicorn website, section "Just Worse in Some Cases".
In theory Thin can handle such high-concurrency workloads because it uses evented I/O. However this requires explicit framework and application support in the form of evented code. Few frameworks and applications do this. Rails and Sinatra do not.
So this leaves only multithreading-capable application servers. The three contenders are Puma, Rainbows and Phusion Passenger 4 Enterprise.
You may also be interested in this writeup for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With