Skip to content

Running out of connections #137

Closed
Closed
@matteeyah

Description

@matteeyah

Summary

I've been getting a couple of connection errors in production. I have about 110-120 free connection on the database, but SolidQueue is reporting it couldn't get a connection.

Here's the error in question:

2024-01-29 14:28:07.568 [optonal_prod] worker.1 [SolidQueue] could not obtain a connection from the pool within 5.000 seconds (waited 5.081 seconds); all pooled connections were in use

Here's my config/database.yml

default: &default
  adapter: postgresql
  encoding: unicode
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

development:
  <<: *default
  database: optonal_development
  username: <%= 'postgres' if File.exist?('/.dockerenv') %>
  password:
  host: <%= 'db' if File.exist?('/.dockerenv') %>

test:
  <<: *default
  database: optonal_test
  username: <%= ENV.fetch('POSTGRES_USER', '') %>
  password: <%= ENV.fetch('POSTGRES_PASSWORD', '') %>
  host: <%= ENV.fetch('CI', '').empty? ? '' : 'postgres' %>

production:
  <<: *default
  database: optonal_production

Here's my config/solidqueue.yml

default: &default
   dispatchers:
     - polling_interval: 1
       batch_size: 500
   workers:
     - queues: [ real_time, background ]
       threads: 5
       processes: 1
       polling_interval: 0.1

development:
 <<: *default

test:
 <<: *default

production:
 <<: *default

Proposal

Document which connection pool SolidQueue uses to connect to the database. Document how many connections does SolidQueue need (e.g. threads * processes).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions