[pgpool-hackers: 3246] Re: select(2) storm
Jesper Pedersen
jesper.pedersen at redhat.com
Wed Feb 20 03:10:26 JST 2019
Hi,
On 2/18/19 10:57 AM, Jesper Pedersen wrote:
> However, if we extended pgpool with a "state machine" which keeps track of
>
> 1) In which "direction" to read from, and hence write to
> 2) Known states where we need to change "direction"
>
> we should see a sizable speedup. If proxy.c is compiled with
> -DSTATE_MACHINE I see a 20%-50% performance improvement. I tested with
> the various pgbench scenarios; -M simple, -M extended, ...
>
> The "state machine" just keep track of the last client message, and last
> server message seen in order to "pair" them - f.ex. P -> 1, B -> 2 and
> so on.
>
Here is an updated version.
This version can deal with server streams such as notifications.
The way it is handled is by using O_NONBLOCK on the sockets, and
switching "direction" upon EAGAIN or EWOULDBLOCK. This is faster than
using select(2) plus the extra logic it would take to keep track of this.
I have successfully used this version against various work loads, and is
even seeing an increased performance, up to 95%.
I'm thinking about if we need select(2) at all...
There is a changelog in the file.
Thanks !
Best regards,
Jesper
-------------- next part --------------
A non-text attachment was scrubbed...
Name: proxy.c
Type: text/x-csrc
Size: 11614 bytes
Desc: not available
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20190219/66465759/attachment.bin>
More information about the pgpool-hackers
mailing list