[pgpool-hackers: 1784] Eliminating flushing to network

Tatsuo Ishii ishii at sraoss.co.jp
Fri Sep 2 14:04:42 JST 2016


While taking care of bug track item 238:

http://www.pgpool.net/mantisbt/view.php?id=238

I found there's a room to enhance the performance of data transfer
from Pgpool-II to frontend. In an extreme case, such as sending many
rows to frontend, the enhancement was 47% to 62% according to my
benchmark result.

Currently Pgpool-II flushes data to network (calling write(2)) every
time it sends a row data ("Data Row" message) to frontend. For
example, if 10,000 rows needed to be transfer, 10,000 times write()s
are issued. This is pretty expensive. Since after repeating to send
row data, "Command Complete" message is sent, it's enough to issue a
write() with the command complete message. Also there are unnecessary
flushing are in handling the command complete message.

Attached patch tries to fix them. I did a quick benchmark on my laptop
(Ubuntu 14.04 LTS, 2 cores, 16GB mem, SSD) using pgbench (scale factor
= 1) + custom query (SELECT * FROM pgbench_accounts), with master
branch head and with patched version. The graph attached.

Unfortunately, performance in workloads where transferring few rows,
will not be enhanced since such rows are needed to flush to network
anyway.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graph.png
Type: image/png
Size: 18021 bytes
Desc: not available
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20160902/9b8b4dca/attachment.png>


More information about the pgpool-hackers mailing list