我通过bundle exec pumactl -F config/puma.rb phased-restart
重启了8个puma worker,运行良好。现在我遇到了越来越多的Postgres错误:
PG::TRDeadlockDetected: ERROR: deadlock detected
我发现有大约50个空闲的PostgreSQL进程正在运行:
postgres: myapp myapp_production 127.0.0.1(59950) idle
postgres: myapp myapp_production 127.0.0.1(60141) idle
...
当我运行bundle exec pumactl -F config/puma.rb stop
时,它们消失了。使用bundle exec pumactl -F config/puma.rb start
启动应用程序后,我得到了正好16个空闲进程。(在我看来过多了八个。)我该如何更好地管理这些进程?感谢您的帮助!
更新
我的puma.rb文件:
environment 'production'
daemonize true
pidfile 'tmp/pids/puma.pid'
state_path 'tmp/pids/puma.state'
threads 0, 1
bind 'tcp://0.0.0.0:3010'
workers 8
quiet
PG::ConnectionBad (FATAL: remaining connection slots are reserved for non-replication superuser connections)
。 - Railsana