On Mon, May 21, 2018 at 7:27 PM, Mateusz Guzik <mjguzik@gmail.com> wrote:
> I have benchmarked the change on a FreeBSD box and found an big
> performance win once the number of clients goes beyond the number of
> hardware threads on the target machine. For smaller number of clients
> the win was very modest.
Thanks for the report! This is good news for the patch, if we can
explain a few mysteries.
> 3 variants were tested:
> - stock 10.3
> - stock 10.3 + pdeathsig
> - stock 10.3 + pdeathsig + kqueue
For the record, "pdeathsig" refers to another patch of mine[1] that is
not relevant to this test (it's a small change in the recovery loop,
important for replication but not even reached here).
> [a bunch of neat output from ministat]
So to summarise your results:
32 connections: ~445k -> ~450k = +1.2%
64 connections: ~416k -> ~544k = +30.7%
96 connections: ~331k -> ~508k = +53.6%
As you added more connections above your thread count, stock 10.3's
TPS number went down, but with the patch it went up. So now we have
to explain why you see a huge performance boost but others reported a
modest gain or in some cases loss. The main things that jump out:
1. You used TCP sockets and ran pgbench on another machine, while
others used Unix domain sockets.
2. You're running a newer/bleeding edge kernel.
3. You used more CPUs than most reporters.
For the record, Mateusz and others discovered some fixable global lock
contention in the Unix domain socket layer that is now being hacked
on[2], though it's not clear if that'd affect the results reported
earlier or not.
[1] https://www.postgresql.org/message-id/CAEepm%3D0w9AAHAH73-tkZ8VS2Lg6JzY4ii3TG7t-R%2B_MWyUAk9g%40mail.gmail.com
[2] https://reviews.freebsd.org/D15430
--
Thomas Munro
http://www.enterprisedb.com