I was deploy rails aplication on the basic droplet. There are nginx, ruby 2.0.0 through rvm, rails 4.0.1, foreman. All of this deploy with capistrano 3. When I start unicorn instances, they take all of the free CPU and CPU load is 100% whole time untill unicorn work. There is my unicorn.rb:
worker_processes 4
working_directory "/var/www/apps/estate/current" # available in 0.94.0+
listen "/var/www/apps/estate/socket/.unicorn.sock", :backlog => 64
listen 8080, :tcp_nopush => true
timeout 30
pid "/var/www/apps/estate/run/unicorn.pid"
stderr_path "/var/www/apps/estate/log/unicorn.stderr.log"
stdout_path "/var/www/apps/estate/log/unicorn.stdout.log"
preload_app true
GC.respond_to?(:copy_on_write_friendly=) and
GC.copy_on_write_friendly = true
check_client_connection false
before_fork do |server, worker|
defined?(ActiveRecord::Base) and
ActiveRecord::Base.connection.disconnect!
old_pid = "#{server.config[:pid]}.oldbin"
if old_pid != server.pid
begin
sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU
Process.kill(sig, File.read(old_pid).to_i)
rescue Errno::ENOENT, Errno::ESRCH
end
end
end
after_fork do |server, worker|
defined?(ActiveRecord::Base) and
ActiveRecord::Base.establish_connection
end
What might be wrong with my settings?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart.
If you run into issues leave a comment, or add your own answer to help others.
×