Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there something like a backlog? #370

Closed
pelcasandra opened this issue Sep 12, 2013 · 3 comments
Closed

Is there something like a backlog? #370

pelcasandra opened this issue Sep 12, 2013 · 3 comments

Comments

@pelcasandra
Copy link

I see Unicorn has a handy feature listen ENV['PORT'], :backlog => Integer(ENV['UNICORN_BACKLOG'] || 200) to reduce the time in attempt to try another worker.

Is there something similar on Puma? I'm seeing this as being a mayor problem as more workers / instances are up and running.

@inspire22
Copy link

How do I set this? It doesn't seem to work in puma.rb config..

@mscoutermarsh
Copy link

@inspire22 I was able to set it by passing a query param to bind. Here's an example config that I tested on Heroku.

workers Integer(ENV['PUMA_WORKERS'] || 3)
threads Integer(ENV['MIN_THREADS']  || 1), Integer(ENV['MAX_THREADS'] || 16)

preload_app!

rackup      DefaultRackup

port = Integer(ENV['PORT'] || 3000)
backlog = Integer(ENV['PUMA_BACKLOG'] || 20)

bind "tcp://0.0.0.0:#{port}?backlog=#{backlog}"

environment ENV['RACK_ENV'] || 'development'

on_worker_boot do
  # worker specific setup
  ActiveSupport.on_load(:active_record) do
    config = ActiveRecord::Base.configurations[Rails.env] ||
                Rails.application.config.database_configuration[Rails.env]
    config['pool'] = ENV['MAX_THREADS'] || 16
    ActiveRecord::Base.establish_connection(config)
  end
end

@david-harkness
Copy link

A way to do this with nginx would be great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants