Question

Currently am running backgroud jobs with sidekiq, while running its giving "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,

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.
Was it helpful?

Solution

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.

Either reduce the sidekiq concurrency or increase the pool size(I recommend increasing the pool size).

Postgres allows 100 concurrent connections by default

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top