Search code examples
ruby-on-railsruby-on-rails-5

Who sets RAILS_MAX_THREADS environment variable when running Puma or Passenger?


Who sets RAILS_MAX_THREADS environment variable when running Puma or Passenger on Linux?

How can I query the value of RAILS_MAX_THREADS from the linux command line while Puma or Passenger is running?


Solution

  • It's our responsibility to set RAILS_MAX_THREADS environment variable, that's why in most of the places it's written as

    <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
    

    Means, if the constant is defined, then take that value, or use 5 by default. You can set it while running the deployment script, e.g.,

    export RAILS_MAX_THREADS=10
    

    Hope that helps!