From: | Li Japin <japinli(at)hotmail(dot)com> |
---|---|
To: | Thomas Munro <thomas(dot)munro(at)gmail(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 05:33:02 |
Message-ID: | 0EFE4882-BC7C-4246-815C-4779BB40E450@hotmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> On Aug 31, 2020, at 11:43 AM, Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
>
> On Mon, Aug 31, 2020 at 2:40 PM Li Japin <japinli(at)hotmail(dot)com> wrote:
>> Could you give the more details about the test instructions?
>
> Hi Japin,
>
> Sure. Because I wasn't trying to get reliable TPS number or anything,
> I just used a simple short read-only test with one connection, like
> this:
>
> pgbench -i -s10 postgres
> pgbench -T60 -Mprepared -S postgres
>
> Then I looked for the active backend and ran strace -c -p XXX for a
> few seconds and hit ^C to get the counters. I doubt the times are
> very accurate, but the number of calls is informative.
>
> If you do that on a server running with -c statement_timeout=10s, you
> see one setitimer() per transaction. If you also use -c
> idle_session_timeout=10s at the same time, you see two.
Hi, Thomas,
Thanks for your point out this problem, here is the comparison.
Without Optimize settimer usage:
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
41.22 1.444851 1 1317033 setitimer
28.41 0.995936 2 658622 sendto
24.63 0.863316 1 659116 599 recvfrom
5.71 0.200275 2 111055 pread64
0.03 0.001152 2 599 epoll_wait
0.00 0.000000 0 1 epoll_ctl
------ ----------- ----------- --------- --------- ----------------
100.00 3.505530 2746426 599 total
With Optimize settimer usage:
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
49.89 1.464332 1 1091429 sendto
40.83 1.198389 1 1091539 219 recvfrom
9.26 0.271890 1 183321 pread64
0.02 0.000482 2 214 epoll_wait
0.00 0.000013 3 5 setitimer
0.00 0.000010 2 5 rt_sigreturn
0.00 0.000000 0 1 epoll_ctl
------ ----------- ----------- --------- --------- ----------------
100.00 2.935116 2366514 219 total
Here’s a modified version of Thomas’s patch.
Attachment | Content-Type | Size |
---|---|---|
v3-0001-Allow-terminating-the-idle-sessions.patch | application/octet-stream | 9.4 KB |
v3-0002-Optimize-setitimer-usage.patch | application/octet-stream | 3.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2020-08-31 05:56:41 | Re: Hybrid Hash/Nested Loop joins and caching results from subplans |
Previous Message | Yugo NAGATA | 2020-08-31 05:31:10 | Re: Implementing Incremental View Maintenance |