pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Idle_session_timeout
5+ messages / 4 participants
[nested] [flat]

* Idle_session_timeout
@ 2023-10-04 15:38  Rajesh Kumar <rajeshkumar.dba09@gmail.com>
  0 siblings, 3 replies; 5+ messages in thread

From: Rajesh Kumar @ 2023-10-04 15:38 UTC (permalink / raw)
  To: Pgsql-admin <pgsql-admin@lists.postgresql.org>

Hi all,

I was facing issue with idle connections not closed.

So, I thought of automating it and set the parameter idle_session_timeout
to 5min. But I got a message from application team that they are getting
jdbc error continuously and they are saying connection is getting
terminated. So I had to turn it off now.


How to use this parameter correctly?

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Idle_session_timeout
@ 2023-10-04 15:51  Scott Ribe <scott_ribe@elevated-dev.com>
  parent: Rajesh Kumar <rajeshkumar.dba09@gmail.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Scott Ribe @ 2023-10-04 15:51 UTC (permalink / raw)
  To: Rajesh Kumar <rajeshkumar.dba09@gmail.com>; +Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>

> On Oct 4, 2023, at 9:38 AM, Rajesh Kumar <rajeshkumar.dba09@gmail.com> wrote:
> 
> So, I thought of automating it and set the parameter idle_session_timeout to 5min. But I got a message from application team that they are getting jdbc error continuously and they are saying connection is getting terminated. So I had to turn it off now.

You're not doing anything incorrectly. You just have a mismatch between expectations on the database vs application side.

Either:

the application is allowed to keep connections open permanently, and the database has to be configured to support enough connections

-OR-

the database has a more limited number of connections, and the application manages connecting and disconnecting







^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Idle_session_timeout
@ 2023-10-04 16:23  Goran Pulevic <goranmp@gmail.com>
  parent: Rajesh Kumar <rajeshkumar.dba09@gmail.com>
  2 siblings, 1 reply; 5+ messages in thread

From: Goran Pulevic @ 2023-10-04 16:23 UTC (permalink / raw)
  To: Rajesh Kumar <rajeshkumar.dba09@gmail.com>; +Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>

You need to talk to your application team and find out about their
connection related timeouts. Things like max-idle-time, server-lifetime,
etc. (They almost certainly use a db library which implements some kind of
client side connection pool).
In short: their timeouts should be lower than the server's
idle_session_timeout.
Something like: max-idle-time <  server-lifetime <   idle_session_timeout

On Wed, 4 Oct 2023 at 17:41, Rajesh Kumar <rajeshkumar.dba09@gmail.com>
wrote:

> Hi all,
>
> I was facing issue with idle connections not closed.
>
> So, I thought of automating it and set the parameter idle_session_timeout
> to 5min. But I got a message from application team that they are getting
> jdbc error continuously and they are saying connection is getting
> terminated. So I had to turn it off now.
>
>
> How to use this parameter correctly?
>
>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Idle_session_timeout
@ 2023-10-04 19:42  Rajesh Kumar <rajeshkumar.dba09@gmail.com>
  parent: Goran Pulevic <goranmp@gmail.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Rajesh Kumar @ 2023-10-04 19:42 UTC (permalink / raw)
  To: Goran Pulevic <goranmp@gmail.com>; +Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>

Looks like they are fine with keeping one connection open per client_addr
and close remaining idle >5mns. Seems like they already have a query
deployed in golang and it doesn't seem to be work well for some reason

What's the best choice to automate this. The platform is kubernetes and
cron is not possible for now. Any idea what's the best now?

On Wed, 4 Oct, 2023, 9:53 PM Goran Pulevic, <goranmp@gmail.com> wrote:

> You need to talk to your application team and find out about their
> connection related timeouts. Things like max-idle-time, server-lifetime,
> etc. (They almost certainly use a db library which implements some kind of
> client side connection pool).
> In short: their timeouts should be lower than the server's
> idle_session_timeout.
> Something like: max-idle-time <  server-lifetime <   idle_session_timeout
>
> On Wed, 4 Oct 2023 at 17:41, Rajesh Kumar <rajeshkumar.dba09@gmail.com>
> wrote:
>
>> Hi all,
>>
>> I was facing issue with idle connections not closed.
>>
>> So, I thought of automating it and set the parameter idle_session_timeout
>> to 5min. But I got a message from application team that they are getting
>> jdbc error continuously and they are saying connection is getting
>> terminated. So I had to turn it off now.
>>
>>
>> How to use this parameter correctly?
>>
>>

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Idle_session_timeout
@ 2023-10-04 20:34  Laurenz Albe <laurenz.albe@cybertec.at>
  parent: Rajesh Kumar <rajeshkumar.dba09@gmail.com>
  2 siblings, 0 replies; 5+ messages in thread

From: Laurenz Albe @ 2023-10-04 20:34 UTC (permalink / raw)
  To: Rajesh Kumar <rajeshkumar.dba09@gmail.com>; Pgsql-admin <pgsql-admin@lists.postgresql.org>

On Wed, 2023-10-04 at 21:08 +0530, Rajesh Kumar wrote:
> I was facing issue with idle connections not closed.
> 
> So, I thought of automating it and set the parameter idle_session_timeout to 5min.
> But I got a message from application team that they are getting jdbc error
> continuously and they are saying connection is getting terminated.
> So I had to turn it off now.

Yes, if the connection is forcibly closed by the server, the client won't be happy.

If you say "idle connections not closed", that is the fault of the application.
The application has to explicitly close all connections it does not need any more.

Yours,
Laurenz Albe





^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2023-10-04 20:34 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-10-04 15:38 Idle_session_timeout Rajesh Kumar <rajeshkumar.dba09@gmail.com>
2023-10-04 15:51 ` Scott Ribe <scott_ribe@elevated-dev.com>
2023-10-04 16:23 ` Goran Pulevic <goranmp@gmail.com>
2023-10-04 19:42   ` Rajesh Kumar <rajeshkumar.dba09@gmail.com>
2023-10-04 20:34 ` Laurenz Albe <laurenz.albe@cybertec.at>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox