Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1svMb0-00ETU9-An for pgsql-general@arkaria.postgresql.org; Mon, 30 Sep 2024 20:02:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1svMaz-0056GI-2U for pgsql-general@arkaria.postgresql.org; Mon, 30 Sep 2024 20:02:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1svMay-0056CA-NP for pgsql-general@lists.postgresql.org; Mon, 30 Sep 2024 20:02:12 +0000 Received: from mail-vk1-xa2b.google.com ([2607:f8b0:4864:20::a2b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1svMav-001qAj-W7 for pgsql-general@lists.postgresql.org; Mon, 30 Sep 2024 20:02:11 +0000 Received: by mail-vk1-xa2b.google.com with SMTP id 71dfb90a1353d-50abf1bd152so451572e0c.2 for ; Mon, 30 Sep 2024 13:02:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727726529; x=1728331329; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=/1TIqr+8H5hrZZtd4THYKggi77Hb6azz5knAq/bvt8M=; b=HlhZxn1f4VTG7ngxxAiRH0eshBQGmU+gkJ8rIVDS4vgEmsOyHaMCutI3Y/1E83pLjk nllIgxKwz0laEUmk+UbQH4IO3DNyqCuxcQ1yghNFjacQ34COtwSATd5UkfZmFRasGTYp qFp6bJ18nb/dd43/tsbxEpvpZ20wQVvuP/s5ugTTHwaq5MoHJcl4mUlz9quukvo7DsA/ 7TmAg3OK/TqzZ7DrDgw3mMyLV83iCn3TMzrK5fzyLo4UhDt6g94E5lEpi4KwtJVppP7A 2LFIX1BAI2/q+M/YyQgn/u1gYRI92D2VC1a8gzTg3zPQm5o4I1ctJSCXhGPr4m6DPd9Y JbiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727726529; x=1728331329; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=/1TIqr+8H5hrZZtd4THYKggi77Hb6azz5knAq/bvt8M=; b=XU3wGOcJf4PMmjwq3FOgd6UtWMiVxqsAL85AikmDNBpBrDNAkXkbAqYfMoLZ/ff5P1 ac4oc80c1Zro8pbiGOx13KysLkgiks3uN778RuquJubZTrPsGmkmwdfhQhCtWtXyNv1M Kkkq1gHyHbtV5hTzA0ROjP0RTTBcTrFtRrMDIfdO86vouPjdR7PvKbNMCi6ZDbfDtRMW 4TIE9crVwUaTBesh6ykXIjc7EFM49NSnihMn0T/sEzqEpN5KQKTP/afh5EArGJugp3jz xuKk7ejkuI8PXIGR2hlaL+SUd/gQhOiNXvizPyapJ9rSxYsI49Fp53J0hQLFYX4Xp1/8 Icbw== X-Gm-Message-State: AOJu0YxZWI++r/3QZpRHspBSakBv+JH8OEgvgwK8upJ3gLqujfPP/GCq vyX+ZUZz0y/6WVH59PkhmuhQ+HLMtDlYfbO0502yuCXwxefqyomsabr5NwZ/TwV+8Qsdk8RMvZx p1IykyztUyk/EZUxKoKt3Bhf0DlxgHu76 X-Google-Smtp-Source: AGHT+IEzOnKzCsFRRrYBF7fKQgAo4Sf4RuIzisB0GrltbY9nJ1yZTTlfhSfLPKhdzkwRZN0SRh27X/1iskH3y6sEsv4= X-Received: by 2002:a05:6122:4585:b0:509:e5b5:d133 with SMTP id 71dfb90a1353d-509e5b5dfb2mr4138808e0c.6.1727726528897; Mon, 30 Sep 2024 13:02:08 -0700 (PDT) MIME-Version: 1.0 From: sud Date: Tue, 1 Oct 2024 01:31:57 +0530 Message-ID: Subject: Question on session timeout To: pgsql-general Content-Type: multipart/alternative; boundary="00000000000006314706235baefe" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000006314706235baefe Content-Type: text/plain; charset="UTF-8" Hello, We are frequently seeing the total DB connection reaching ~2000+ whereas the total number of active sessions in pg_stat_activity staying <100 at any point in time. And when we see the sessions from DB side they are showing most of the sessions with state as 'idle' having backend_start/xact_start showing date ~10days older. We do use application level connection pooling, and we have ~120 sets as both the "max idle" and "max active" connection count and "maxage" as 7 days, so does this suggest any issue at connection pool setup? We do see keep alive queries in the DB (select 1), not sure if that is making this scenario. When checking the "idle_in_transaction_session_timeout" it is set as 24hours and "idle_session_timeout" set as "0". So my question is , should we set the parameter to a lesser value in DB cluster level like ~5minutes or so, so as not to keep the idle sessions lying so long in the database and what would be the advisable value for these parameters? Regards Sud --00000000000006314706235baefe Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,
We are frequently seeing the total DB connectio= n reaching ~2000+ whereas the total number of active sessions in pg_stat_ac= tivity staying <100 at any point in time. And when we see the sessions f= rom DB side they are showing most of the sessions with state as 'idle&#= 39; having backend_start/xact_start showing date ~10days older. We do use a= pplication level connection pooling, and we have ~120 sets as both the &quo= t;max idle" and "max active" connection count and "maxa= ge" as 7 days, so does this suggest any issue at connection pool setup= ?

We do see keep alive queries in the DB (select 1= ), not sure if that is making this scenario. When checking the "idle_i= n_transaction_session_timeout" it is set as 24hours and "idle_ses= sion_timeout" set as "0". So my question is , should we set = the parameter to a lesser value in DB cluster level like ~5minutes or so, s= o as not to keep the idle sessions lying so long in the database and what w= ould be the advisable value for these parameters?

= Regards
Sud
--00000000000006314706235baefe--