简体   繁体   English

postgresql中的数据库连接超时错误

[英]Database connection timeout error in postgresql

Currently am running backgroud jobs with sidekiq, while running its giving "ActiveRecord::ConnectionTimeoutError". 目前正在使用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

This is is my sidekiq.yml file, 这是我的sidekiq.yml文件,

production:
    concurrency: 25
    timeout: 300

While running its giving connection timeout error 在运行其给定连接超时错误时

This error was am getting in the backgroud, 这个错误是在背景中,

could not obtain a database connection within 5 seconds (waited 5.82230675 seconds). The max pool size is currently 25; consider increasing it.

Maximum number of connections allowed to your postgres database is 25. But you have set your concurrency for sidekiq as 25. So if you have all the concurrent threads for sidekiq running, you will not have any database connection available for your app server. 您的postgres数据库允许的最大连接数为25.但是您已将sidekiq的并发设置为25.因此,如果您运行sidekiq的所有并发线程,则您的应用服务器将无法使用任何数据库连接。

Either reduce the sidekiq concurrency or increase the pool size(I recommend increasing the pool size). 减少sidekiq并发性或增加池大小(我建议增加池大小)。

Postgres allows 100 concurrent connections by default Postgres默认允许100个并发连接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM