hackoregon / civic-devops

Master collection point for issues, procedures, and code to manage the HackOregon Civic platform
MIT License
11 stars 4 forks source link

Provide more headroom for unbounded idle connections #179

Open MikeTheCanuck opened 6 years ago

MikeTheCanuck commented 6 years ago

As a temporary workaround, the database will need to accommodate more long-lived idle connections for some of the APIs that haven't implemented a connection pooling or idle-connection-killing strategy yet (see #177 and #178).

The first step is to increase max_connections. However, that will require additional measures: https://stackoverflow.com/questions/30778015/how-to-increase-the-max-connections-in-postgres#32584211

And we risk seeing available memory on the DB server drop precipitously as we pursue this kind of workaround.

MikeTheCanuck commented 6 years ago

Changes in /data/postgresql/databases/postgresql.conf:

Changes in /etc/sysctl.conf:

Then we rebooted the postgresql instance by running the following:

sudo systemctl stop postgresql
sudo systemctl start postgresql