(1) Passenger spawns new process and keeps them in a pool to handle concurrent requests. You can check the existing value by executing this command in your application directory:
$ passenger-status
(2) There are 3 configurations to play with:
- passenger_max_pool_size - This defines the maximum processes that can be held in the pool. If you have more than 1 ruby application running, it is the total of all the application process. The default value is 6.
- passenger_min_instants - The minimum amount of process to keep for a particular application. The default value is 1.
- passenger_max_instants - The maximum amount of process possible for a particular application. The default value is 0.
(3) For "passenger_max_pool_size", it is usually set in passenger.conf or Nginx's http block. E.g.
$ pico /etc/nginx/passenger.conf passenger_max_pool_size 10;
(4) The maximum pool size is determined by the total amount of RAM you have and RAM required per process. The equation (for single threaded setup) is as follow:
max_app_processes = (TOTAL_RAM * 0.75) / RAM_PER_PROCESS
RAM_PER_PROCESS can be observed and estimated by checking the running processes.
(5) While the other 2 config can be set in Nginx's server block as they are application-level config. E.g.
$ pico /etc/nginx/sites-available/default server { ... passenger_min_instances 2; passenger_max_instances 4; ... }
(6) Reload application or Nginx to reflect the new configuration.
Reference: https://www.phusionpassenger.com/library/config/nginx/reference