<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>pgpool Archives | Clever Cloud</title>
	<atom:link href="https://www.clever.cloud/blog/tag/pgpool/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.clever.cloud/blog/tag/pgpool/</link>
	<description>From Code to Product</description>
	<lastBuildDate>Wed, 07 Jul 2021 09:04:00 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://cdn.clever-cloud.com/uploads/2023/03/cropped-cropped-favicon-32x32.png</url>
	<title>pgpool Archives | Clever Cloud</title>
	<link>https://www.clever.cloud/blog/tag/pgpool/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Pgpool-II: getting the most of PostgreSQL</title>
		<link>https://www.clever.cloud/blog/features/2021/07/07/introducing-pgpool-ii/</link>
		
		<dc:creator><![CDATA[Emmanuel Bosquet]]></dc:creator>
		<pubDate>Wed, 07 Jul 2021 09:04:00 +0000</pubDate>
				<category><![CDATA[Features]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[pgpool]]></category>
		<category><![CDATA[postgresql]]></category>
		<guid isPermaLink="false">https://www2.cleverapps.io/wp/blog/technology/2021/07/07/introducing-pgpool-ii/</guid>

					<description><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/07/pg-pool2-1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="pg pool2 1" decoding="async" fetchpriority="high" srcset="https://cdn.clever-cloud.com/uploads/2021/07/pg-pool2-1.jpg 1400w, https://cdn.clever-cloud.com/uploads/2021/07/pg-pool2-1-300x116.jpg 300w, https://cdn.clever-cloud.com/uploads/2021/07/pg-pool2-1-1024x395.jpg 1024w, https://cdn.clever-cloud.com/uploads/2021/07/pg-pool2-1-768x296.jpg 768w, https://cdn.clever-cloud.com/uploads/2021/07/pg-pool2-1-1368x528.jpg 1368w" sizes="(max-width: 1400px) 100vw, 1400px" /></p>Are you having too many simultaneous connections on your PostgreSQL database? Do you dream of balancing the load of your requests across a PostgreSQL cluster? Either way, we've got the solution for you.

Clever Cloud is proud to introduce the native support of Pgpool-II on all application instances, for no additional fee.

<span id="more-3001"></span>

<a href="https://www.clever.cloud/developers/deploy/addon/postgresql/pgpool">See the Clever Cloud documentation on Pgpool-II</a>.
<h2 id="what-is-pgpool-ii">What is Pgpool-II?</h2>
It is a middleware that comes in between your application and your PostgreSQL database (<a href="https://www.pgpool.net/mediawiki/index.php/Main_Page">official website</a>). As its name suggests, it <em>pools</em> your app's connections to PostgreSQL, by saving and reusing them, and letting them wait when they are too many.

Pgpool-II also serves as a load balancer for PostgreSQL replicas for superior scaling. More on this below.

Pgpool-II now works out of the box on all Clever Cloud machines. Only exception: if you use docker, you'll have to configure the Dockerfile yourself.
<h2 id="no-more-connection-refused">No more <code>connection refused</code></h2>
Pgpool-II overall smoothens the use of PostgreSQL.
<ul>
 	<li><strong>Accessed on a Unix socket</strong>: faster than a TCP socket. Gotta chase those nanoseconds.</li>
 	<li><strong>Connection reuse</strong>: Pgpool saves connections and reuses them when similar ones come in (same user, same database…).</li>
 	<li><strong>Managing exceeding connections</strong>: Normally, PostgreSQL takes only so many concurrent connections, and discards any additional ones, which compromises the app. Pgpool-II, instead, queues the excess connections for later. No more <code>connection refused</code>.</li>
</ul>
<h2 id="what-do-i-have-to-do">What do I have to do?</h2>
Barely anything. By changing only one environment variable in your code, your app will send its requests to Pgpool-II directly.

In a typical PHP app, you would connect to a PostgreSQL add-on by doing:
<pre><code class="language-PHP">$host = getenv("POSTGRESQL_ADDON_HOST");
</code></pre>
You just need to change that into:
<pre><code class="language-PHP">$host = getenv("CC_PGPOOL_SOCKET_PATH");
</code></pre>
That's all there is to change in your code. User, password, all other calls to environment variables remain the same. See <a href="https://www.clever.cloud/developers/deploy/addon/postgresql/pgpool/#usage">the doc</a> for details.

Now in the Clever Cloud Console, go to your app's environment variables, set <code>CC_ENABLE_PGPOOL</code> to <code>true</code>, and you're good to go!
<h2 id="load-balancing-lets-go-big">Load balancing: let's go big</h2>
Suppose your web app is BIG. You've got a few <code>INSERT</code> queries to make (registering a new customer for instance), and a ton of <code>SELECT</code> queries (searches, filling pages with products, you name it). It becomes wise to create <em>replicas</em> of your database, a PostgreSQL feature. These identical instances, called <em>followers</em>, are exact copycats of your <em>leader</em> database. On the graph they are called <em>primary</em> and <em>standby</em>, respectively. There can be several <em>standby</em> nodes.

<center>
<img style="width: 600px;" src="https://cdn.clever-cloud.com/uploads/2021/08/pgpool.png" /></center>

Pgpool-II will direct the <strong>write queries</strong> to the <em>primary</em>, and dispatch the <strong>read queries</strong> to the <em>standby</em> nodes, thus balancing the load and increasing throughput.

More details <a href="https://www.clever.cloud/developers/deploy/addon/postgresql/pgpool/#how-to-configure-pgpool-ii">in the doc</a>. All you have to do is create as many PostgreSQL add-ons as you want replicas, and ask us to do the plumbing for you.]]></description>
										<content:encoded><![CDATA[<p><img width="1400" height="540" src="https://cdn.clever-cloud.com/uploads/2021/07/pg-pool2-1.jpg" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="pg pool2 1" decoding="async" srcset="https://cdn.clever-cloud.com/uploads/2021/07/pg-pool2-1.jpg 1400w, https://cdn.clever-cloud.com/uploads/2021/07/pg-pool2-1-300x116.jpg 300w, https://cdn.clever-cloud.com/uploads/2021/07/pg-pool2-1-1024x395.jpg 1024w, https://cdn.clever-cloud.com/uploads/2021/07/pg-pool2-1-768x296.jpg 768w, https://cdn.clever-cloud.com/uploads/2021/07/pg-pool2-1-1368x528.jpg 1368w" sizes="(max-width: 1400px) 100vw, 1400px" /></p>Are you having too many simultaneous connections on your PostgreSQL database? Do you dream of balancing the load of your requests across a PostgreSQL cluster? Either way, we've got the solution for you.

Clever Cloud is proud to introduce the native support of Pgpool-II on all application instances, for no additional fee.

<span id="more-3001"></span>

<a href="https://www.clever.cloud/developers/deploy/addon/postgresql/pgpool">See the Clever Cloud documentation on Pgpool-II</a>.
<h2 id="what-is-pgpool-ii">What is Pgpool-II?</h2>
It is a middleware that comes in between your application and your PostgreSQL database (<a href="https://www.pgpool.net/mediawiki/index.php/Main_Page">official website</a>). As its name suggests, it <em>pools</em> your app's connections to PostgreSQL, by saving and reusing them, and letting them wait when they are too many.

Pgpool-II also serves as a load balancer for PostgreSQL replicas for superior scaling. More on this below.

Pgpool-II now works out of the box on all Clever Cloud machines. Only exception: if you use docker, you'll have to configure the Dockerfile yourself.
<h2 id="no-more-connection-refused">No more <code>connection refused</code></h2>
Pgpool-II overall smoothens the use of PostgreSQL.
<ul>
 	<li><strong>Accessed on a Unix socket</strong>: faster than a TCP socket. Gotta chase those nanoseconds.</li>
 	<li><strong>Connection reuse</strong>: Pgpool saves connections and reuses them when similar ones come in (same user, same database…).</li>
 	<li><strong>Managing exceeding connections</strong>: Normally, PostgreSQL takes only so many concurrent connections, and discards any additional ones, which compromises the app. Pgpool-II, instead, queues the excess connections for later. No more <code>connection refused</code>.</li>
</ul>
<h2 id="what-do-i-have-to-do">What do I have to do?</h2>
Barely anything. By changing only one environment variable in your code, your app will send its requests to Pgpool-II directly.

In a typical PHP app, you would connect to a PostgreSQL add-on by doing:
<pre><code class="language-PHP">$host = getenv("POSTGRESQL_ADDON_HOST");
</code></pre>
You just need to change that into:
<pre><code class="language-PHP">$host = getenv("CC_PGPOOL_SOCKET_PATH");
</code></pre>
That's all there is to change in your code. User, password, all other calls to environment variables remain the same. See <a href="https://www.clever.cloud/developers/deploy/addon/postgresql/pgpool/#usage">the doc</a> for details.

Now in the Clever Cloud Console, go to your app's environment variables, set <code>CC_ENABLE_PGPOOL</code> to <code>true</code>, and you're good to go!
<h2 id="load-balancing-lets-go-big">Load balancing: let's go big</h2>
Suppose your web app is BIG. You've got a few <code>INSERT</code> queries to make (registering a new customer for instance), and a ton of <code>SELECT</code> queries (searches, filling pages with products, you name it). It becomes wise to create <em>replicas</em> of your database, a PostgreSQL feature. These identical instances, called <em>followers</em>, are exact copycats of your <em>leader</em> database. On the graph they are called <em>primary</em> and <em>standby</em>, respectively. There can be several <em>standby</em> nodes.

<center>
<img style="width: 600px;" src="https://cdn.clever-cloud.com/uploads/2021/08/pgpool.png" /></center>

Pgpool-II will direct the <strong>write queries</strong> to the <em>primary</em>, and dispatch the <strong>read queries</strong> to the <em>standby</em> nodes, thus balancing the load and increasing throughput.

More details <a href="https://www.clever.cloud/developers/deploy/addon/postgresql/pgpool/#how-to-configure-pgpool-ii">in the doc</a>. All you have to do is create as many PostgreSQL add-ons as you want replicas, and ask us to do the plumbing for you.]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
