Fulfill multiple requests in Phusion passengers in their threads?

I have a Ruby on Rails application deployed with a Phusion + Apache web server. Is each request executed in its own theme generated by Phusion Passenger?

+4
source share
2 answers

A passenger (along with most other application servers) performs no more than one request per stream. Typically, there is only one thread for each process. From Phusion Passenger docs :

Phusion Passenger supports two concurrency models:

  • process : single-threaded, multiprocessor concurrency I / O. Each application process has only one thread and can only process one request at a time . This is the concurrency model that Ruby applications have traditionally used. It has excellent compatibility (it can work with applications that are not designed for streaming protection), but these are unsuitable workloads in which the application must wait for a large number of external I / O operations (for example, HTTP API calls) and uses more memory since Each process has a large memory overhead.

  • thread : multi-threaded, multi-processor concurrency I / O. Each application process has several threads (configured through PassengerThreadCount). This model provides much better concurrency I / O and uses less memory because threads share memory with each other within the same process. However, using this model can lead to compatibility issues if the application is not designed to provide thread safety.

(Emphasize my own)

+5
source

An open-source passive version uses only one thread for each application, as indicated in your apache virtual host files (not sure about nginx). Thus, you could have several instances of your application running on the same Apache server, but you would need to install your application in several directories and point to them vhosts entries and put in front of it some kind of load balancer. The passenger company provides much greater control over concurrency.

EDIT: clarity.

0
source

Source: https://habr.com/ru/post/1500836/


All Articles