Skip to content
This repository was archived by the owner on Nov 16, 2020. It is now read-only.
This repository was archived by the owner on Nov 16, 2020. It is now read-only.

Automatically scale pool maximum connections #58

@tonyarnold

Description

@tonyarnold

I see that right now, DatabaseConnectionPoolConfig.maximumConnections is hardcoded to 10 by default.

It would be nice if this number could dynamically scale at startup based on something like:

database maximum available connections / number of workers (cores?) 

My database knowledge is rusty, but they all support some kind of connection reporting, right?, ie for Postgres:

select max_conn,used,res_for_super,max_conn-used-res_for_super res_for_normal 
from 
  (select count(*) used from pg_stat_activity) t1,
  (select setting::int res_for_super from pg_settings where name=$$superuser_reserved_connections$$) t2,
  (select setting::int max_conn from pg_settings where name=$$max_connections$$) t3

Produces:

max_conn used res_for_super res_for_normal
300 175 3 122

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