Sar*_*mAr 5 postgresql activerecord ruby-on-rails ruby-on-rails-3 sidekiq
目前正在使用sidekiq运行backgroud作业,同时运行它的"ActiveRecord :: ConnectionTimeoutError".
This is my current database.yml file,
production:
adapter: postgresql
encoding: unicode
database: app_production
username: password
password:
host: app.domain.com
pool: 25
Run Code Online (Sandbox Code Playgroud)
这是我的sidekiq.yml文件,
production:
concurrency: 25
timeout: 300
Run Code Online (Sandbox Code Playgroud)
在运行其给定连接超时错误时
这个错误是在背景中,
could not obtain a database connection within 5 seconds (waited 5.82230675 seconds). The max pool size is currently 25; consider increasing it.
Run Code Online (Sandbox Code Playgroud)
您的postgres数据库允许的最大连接数为25.但是您已将sidekiq的并发设置为25.因此,如果您运行sidekiq的所有并发线程,则您的应用服务器将无法使用任何数据库连接.
减少sidekiq并发性或增加池大小(我建议增加池大小).
Postgres默认允许100个并发连接