'Connection Pooling with knex but Idle Connections stay alive
I'm using knex w/ pg and the following configuration (trying to kill idle connection ASAP), but the stay alive for very very long (more than minutes).
const knex = require('knex')({
client: 'pg',
connection: {
host: <myhost>,
port: <myport>,
user: <myuser>,
password: <mypassword>,
database: <mydb>,
},
pool: {
min: 0,
max: 10,
idleTimeoutMillis: 500,
reapIntervalMillis: 500,
},
});
I've added both configurations (idleTimeoutMillis - to have the connections be closed after 500ms, and reapIntervalMillis - to initiate a destruction process every 500ms). Neither configuration changes the fact that the idle connections stay alive for much much longer than that.
Any advice would be hugely appreaciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
