Re: kqueue
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>,
Thomas Munro <thomas.munro@enterprisedb.com>,
Marko Tiikkaja <marko@joh.to>,
Alvaro Herrera <alvherre@2ndquadrant.com>,
Robert Haas <robertmhaas@gmail.com>,
Pg Hackers <pgsql-hackers@postgresql.org>,
Noah Misch <noah@leadboat.com>
Date: 2016-09-13T22:06:23Z
Lists: pgsql-hackers
I wrote: > At -j 10 -c 10, all else the same, I get 84928 TPS on HEAD and 90357 > with the patch, so about 6% better. And at -j 1 -c 1, I get 22390 and 24040 TPS, or about 7% better with the patch. So what I am seeing on OS X isn't contention of any sort, but just a straight speedup that's independent of the number of clients (at least up to 10). Probably this represents less setup/teardown cost for kqueue() waits than poll() waits. So you could spin this as "FreeBSD's poll() implementation is better than OS X's", or as "FreeBSD's kqueue() implementation is worse than OS X's", but either way I do not think we're seeing the same issue that was originally reported against Linux, where there was no visible problem at all till you got to a couple dozen clients, cf https://www.postgresql.org/message-id/CAB-SwXbPmfpgL6N4Ro4BbGyqXEqqzx56intHHBCfvpbFUx1DNA%40mail.gmail.com I'm inclined to think the kqueue patch is worth applying just on the grounds that it makes things better on OS X and doesn't seem to hurt on FreeBSD. Whether anyone would ever get to the point of seeing intra-kernel contention on these platforms is hard to predict, but we'd be ahead of the curve if so. It would be good for someone else to reproduce my results though. For one thing, 5%-ish is not that far above the noise level; maybe what I'm measuring here is just good luck from relocation of critical loops into more cache-line-friendly locations. regards, tom lane
Commits
-
Add kqueue(2) support to the WaitEventSet API.
- 815c2f0972c8 13.0 landed
-
Add WL_EXIT_ON_PM_DEATH pseudo-event.
- cfdf4dc4fc96 12.0 cited
-
Be conservative about alignment requirements of struct epoll_event.
- a3b30763cc86 9.6.0 cited
-
Make idle backends exit if the postmaster dies.
- ac1d7945f866 9.6.0 cited