Re: Idle connections / sessions

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: Idle connections / sessions
Дата
Msg-id puqlq7$rlc$1@blaine.gmane.org
обсуждение исходный текст
Список pgsql-jdbc
Oygun Josef schrieb am 12.12.2018 um 10:37:
> Is it possible to terminate idle connections/sessions automatically
> through a timeout in AWS or do I need to run a periodical cron job
> for this?
> 
> Postgres version: 9.6.6 Instance: db.t2.micro RAM : 1GB
> 
> We are running a microservice architecture using docker with
> kubernetes and I can see that every pod on every node that has
> connected to the DB still has a idle connection as long as the node
> is still active even.

An "idle" connection isn't really a problem. 

Long running "idle in transaction" session are a problem however. 

To cope with them, you could use idle_in_transaction_timeout: 

    https://www.postgresql.org/docs/current/runtime-config-client.html#GUC-IDLE-IN-TRANSACTION-SESSION-TIMEOUT

> It is both PGAdmin and the PostgreSQL JDBC Driver that leaves open
> idle connections.

The JDBC driver does not leave any connections "open" or "idle"
It's the application that uses the driver that fails to close them. 

Maybe you need to configure your connection pool to release connections when they are idle.

Thomas



В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Sehrope Sarkuni
Дата:
Сообщение: [pgjdbc/pgjdbc] 9b45e7: refactor: Clean up loading of reading ofkeydata f...
Следующее
От: Dave Cramer
Дата:
Сообщение: [pgjdbc/pgjdbc] 2a639f: Update README.md