<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">Thank you :)
<div><br /></div>
</div>
<div name="messageSignatureSection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;"><br />
<div class="matchFont">— Stephen</div>
</div>
<div name="messageReplySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">On Mar 17, 2019, 5:58 PM -0700, Tatsuo Ishii &lt;ishii@sraoss.co.jp&gt;, wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">I have pushed the proposed patches to all supported branches.<br />
<br />
Best regards,<br />
--<br />
Tatsuo Ishii<br />
SRA OSS, Inc. Japan<br />
English: http://www.sraoss.co.jp/index_en.php<br />
Japanese:http://www.sraoss.co.jp<br />
<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #e67e22;">
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #3498db;">On Feb 27, 2019, 10:51 AM -0800, Stephen Eilert &lt;contact@stepheneilert.com&gt;, wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #d35400;">On Feb 26, 2019, 6:27 PM -0800, Tatsuo Ishii &lt;ishii@sraoss.co.jp&gt;, wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #34495e;">
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #2ecc71;">Hi,<br />
<br />
Apologies if this has been discussed before, but if so I can’t find a relevant thread.<br /></blockquote>
<br />
I think this has not been discussed before. Thank you for the report.<br />
<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #2ecc71;">We are experiencing some strange behavior on our PGPool nodes. In some of them, load average is well in excess of 100 – although CPU is over 70% idle (rest spent in system), so this pointed to I/O. Checking on AWS, we see that there is a lot of disk activity, including writes. This was surprising, as we did not expect the pgpool machines to have any significant disk usage, nor we can find anything in the documentation that would indicate it to be the case.<br />
<br />
After some sysdig usage, the only file getting heavily written to appears to be /var/log/postgresql/pgpool_status<br />
<br />
It is multiple 6 bytes writes a second, all with the same data, by pgpool. So this shouldn’t be a problem as it is not too much data. Except that it seems to be getting flushed right away (fsync?).<br />
<br />
Is this behavior expected? The PG node status have not changed at any time, there are two nodes, always up. Why would the file get rewritten dozens (even hundreds, depending on load) of times per second?<br />
<br />
Would this be caused by a misconfiguration?<br /></blockquote>
<br />
I appears that every time a client connects to Pgpool-II, and<br />
Pgpool-II creates new connections to PostgreSQL node, it issues<br />
fsync(). Maybe you disabled connection cache or set very short life<br />
time for connection cache?<br />
<br />
Anyway, I think current behavior of Pgpool-II is not best optimized<br />
and I would like to propose attached patch to enhance it. It eliminate<br />
the necessity of fsync(): instead of every time a connection is<br />
created to PostgreSQL, fsync() will be issued only once for the first<br />
time a connection is created to PostgreSQL.<br />
<br />
The patch should be able to applied to 3.7.<br />
<br />
<br /></blockquote>
<br />
Hi,<br />
<br />
That would explain it.<br />
<br />
Our clients are a bunch of microservices running in Kubernetes. There are a lot of them. Their behavior is, whenever they need to perform any database operation, they will establish a new connection, perform any queries needed, then close the connection as soon as they are done. This is so because we experienced issues in the past with holding connections for longer periods. And not all of them require constant database communication(they may be idle waiting for API calls themselves), so it was also wasteful<br />
<br />
I don't have enough understanding of pgpool's internals yet, but it looks to me that the patch would solve this issue.<br />
<br />
Thanks for the response. We have increased resources in the pgpool machine for now while we wait a patch. Load is still very high, but manageable.<br />
<br />
– Stephen<br />
_______________________________________________<br /></blockquote>
<br />
It seems that I missed one thing and jumped the gun.<br />
<br />
From what you have explained, it is not only when new client connections are created to PGPool, but they need to ALSO be created to PostgreSQL itself, for this behavior to manifest, right?<br /></blockquote>
<br />
Yes.<br />
<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #3498db;">Then this doesn’t fully explain it. Connection cache is on (attached pgpool config file).<br />
<br />
We do reach the configured 500 connection limit on pgpool processes quite often (after which pgpool will spawn another process). Could this be related?<br /></blockquote>
<br />
But you have:<br />
<br />
child_life_time = 300<br />
# Pool exits after being idle for this many seconds<br />
child_max_connections = 250<br />
# Pool exits after receiving that many connections<br />
# 0 means no exit<br />
connection_life_time = 180<br />
# Connection to backend closes after being idle for this many seconds<br />
# 0 means no close<br />
<br />
with these settings, Pgpool-II child process would die at some point<br />
(because child_life_time = 300, child_max_connections = 250), or<br />
closes the connection to backend (connection_life_time = 180). After<br />
these events happen, connections to backend in those process does not<br />
exist and you will hit the issue.<br />
<br />
Best regards,<br />
--<br />
Tatsuo Ishii<br />
SRA OSS, Inc. Japan<br />
English: http://www.sraoss.co.jp/index_en.php<br />
Japanese:http://www.sraoss.co.jp<br />
_______________________________________________<br />
pgpool-general mailing list<br />
pgpool-general@pgpool.net<br />
http://www.pgpool.net/mailman/listinfo/pgpool-general<br /></blockquote>
</blockquote>
</div>
</body>
</html>