From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com> To: Li Japin <japinli(at)hotmail(dot)com> Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, "bharath(dot)rupireddyforpostgres(at)gmail(dot)com" <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> Subject: Re: Terminate the idle sessions Date: 2020-08-31 00:51:20 Message-ID: CA+hUKG+o6pbuHBJSGnud=TadsuXySWA7CCcPgCt2QE9F6_4iHQ@mail.gmail.com Views: Whole Thread |Raw Message |Download mbox |Resend email Thread: 2020-06-09 09:02:42 from Li Japin <japinli(at)hotmail(dot)com>📎 2020-06-09 14:35:08 from "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> 2020-06-10 05:20:36 from Li Japin <japinli(at)hotmail(dot)com> 2020-06-10 08:25:18 from Michael Paquier <michael(at)paquier(dot)xyz> 2020-06-10 13:53:12 from Li Japin <japinli(at)hotmail(dot)com> 2020-06-10 14:27:11 from Adam Brusselback <adambrusselback(at)gmail(dot)com> 2020-06-11 13:57:24 from Li Japin <japinli(at)hotmail(dot)com> 2020-08-10 21:42:42 from Cary Huang <cary(dot)huang(at)highgo(dot)ca> 2020-08-10 21:49:36 from "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> 2020-08-11 03:14:58 from Li Japin <japinli(at)hotmail(dot)com>📎 2020-08-14 06:15:28 from Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> 2020-08-14 08:02:27 from Li Japin <japinli(at)hotmail(dot)com> 2020-08-17 13:58:10 from Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> 2020-08-18 01:19:44 from Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> 2020-08-18 02:12:51 from Li Japin <japinli(at)hotmail(dot)com> 2020-08-31 00:51:20 from Thomas Munro <thomas(dot)munro(at)gmail(dot)com>📎 2020-08-31 02:40:37 from Li Japin <japinli(at)hotmail(dot)com> 2020-08-31 03:43:20 from Thomas Munro <thomas(dot)munro(at)gmail(dot)com> 2020-08-31 05:33:02 from Li Japin <japinli(at)hotmail(dot)com>📎 2020-11-13 10:27:47 from "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com> 2020-11-15 10:00:01 from Li Japin <japinli(at)hotmail(dot)com>📎 2020-11-16 05:22:35 from "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com> 2020-11-16 12:40:57 from Li Japin <japinli(at)hotmail(dot)com>📎 2020-11-16 23:59:15 from "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> 2020-11-17 02:45:12 from Li Japin <japinli(at)hotmail(dot)com> 2020-11-17 02:53:59 from "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> 2020-11-17 03:27:05 from Li Japin <japinli(at)hotmail(dot)com>📎 2020-11-17 06:07:35 from "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com> 2020-11-17 09:01:58 from Li Japin <japinli(at)hotmail(dot)com> 2020-11-18 02:40:07 from "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com> 2020-11-18 06:01:28 from Li Japin <japinli(at)hotmail(dot)com> 2020-11-18 06:22:50 from "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com> 2020-11-18 06:57:13 from Li Japin <japinli(at)hotmail(dot)com>📎 2020-11-19 08:32:46 from "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com> 2020-11-19 09:35:05 from japin <japinli(at)hotmail(dot)com>📎 2020-11-20 02:05:09 from "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com> 2020-11-24 00:01:49 from "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com> 2020-11-24 03:39:48 from "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> 2020-11-24 06:22:23 from Li Japin <japinli(at)hotmail(dot)com> 2020-11-24 15:20:15 from "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> 2020-11-25 02:18:28 from Li Japin <japinli(at)hotmail(dot)com>📎 2020-12-01 13:55:49 from Anastasia Lubennikova <a(dot)lubennikova(at)postgrespro(dot)ru> 2021-01-06 23:55:29 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 2021-01-07 02:03:56 from Thomas Munro <thomas(dot)munro(at)gmail(dot)com> 2021-01-07 03:22:54 from Thomas Munro <thomas(dot)munro(at)gmail(dot)com> 2021-01-07 03:51:01 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 2021-01-07 05:40:07 from Thomas Munro <thomas(dot)munro(at)gmail(dot)com> 2021-01-10 20:58:56 from Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 2021-01-13 04:11:45 from "kuroda(dot)hayato(at)fujitsu(dot)com" <kuroda(dot)hayato(at)fujitsu(dot)com> 2021-01-07 05:04:05 from Li Japin <japinli(at)hotmail(dot)com> 2020-11-24 06:22:09 from Li Japin <japinli(at)hotmail(dot)com> 2020-08-31 04:49:05 from Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> Lists: pgsql-hackers
On Tue, Aug 18, 2020 at 2:13 PM Li Japin <japinli(at)hotmail(dot)com> wrote: > On Aug 18, 2020, at 9:19 AM, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> wrote: > The same already happens for idle_in_transaction_session_timeout and > we can use "ALTER ROLE/DATABASE SET" to dislable or loosen them, it's > a bit cumbersome, though. I don't think we should (at least > implicitly) disable those timeouts ad-hockerly for postgres_fdw. > > +1.
This seems like a reasonable feature to me.
The delivery of the error message explaining what happened is probably not reliable, so to some clients and on some operating systems this will be indistinguishable from a dropped network connection or other error, but that's OK and we already have that problem with the existing timeout-based disconnection feature.
The main problem I have with it is the high frequency setitimer() calls. If you enable both statement_timeout and idle_session_timeout, then we get up to huge number of system calls, like the following strace -c output for a few seconds of one backend under pgbench -S workload shows:
% time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 39.45 0.118685 0 250523 setitimer 29.98 0.090200 0 125275 sendto 24.30 0.073107 0 126235 973 recvfrom 6.01 0.018068 0 20950 pread64 0.26 0.000779 0 973 epoll_wait ------ ----------- ----------- --------- --------- ---------------- 100.00 0.300839 523956 973 total
There's a small but measurable performance drop from this, as also discussed in another thread about another kind of timeout[1]. Maybe we should try to fix that with something like the attached?
[1]https://www.postgresql.org/message-id/flat/77def86b27e41f0efcba411460e929ae%40postgrespro.ru