I have a Ruby on Rails application that gets an extremely high volume of requests at very specific times, and sometimes Passenger's request queue goes above 100 and users get a 503.
How do I set a higher number of threads?
I am using Passenger and Nginx, deploying with Capistrano using the capistrano-passenger gem.
This article at Phusion Passenger seems to answer your question directly, and provide some guidance for related questions.
Step 3: configure Passenger
Purely single-threaded multi-process scenarios
Configure:
passenger_max_pool_size <desired_app_processes>; passenger_min_instances <desired_app_processes>; passenger_pre_start to have your app started automatically at web server boot.
Multithreaded scenarios
In order to use multithreading you must use Passenger Enterprise. The open source version of Passenger does not support multithreading.
Configure:
passenger_max_pool_size <CHOSEN_NUMBER_OF_PROCESSES>; passenger_min_instances <CHOSEN_NUMBER_OF_PROCESSES>; passenger_concurrency_model thread; passenger_thread_count <desired_app_threads_per_process>; passenger_pre_start to have your app started automatically at web server boot. If desired_app_processes is 1, then you should set passenger_spawn_method direct. By using direct spawning instead of
smart spawning, Passenger will not keep a Preloader process around, saving you some memory (learn more at Spawn methods). This is because a Preloader process is useless when there's only 1 application process.