<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Connection Pooling on Luther Monson</title>
    <link>https://luth.io/tags/connection-pooling/</link>
    <description>Recent content in Connection Pooling on Luther Monson</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Sun, 09 Aug 2026 16:25:00 -0700</lastBuildDate>
    <atom:link href="https://luth.io/tags/connection-pooling/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Database Connection Pooling with Smart Reset</title>
      <link>https://luth.io/blog/2026/08/db-connection-pooling-smart-reset/</link>
      <pubDate>Sun, 09 Aug 2026 16:25:00 -0700</pubDate>
      <guid>https://luth.io/blog/2026/08/db-connection-pooling-smart-reset/</guid>
      <description>&lt;p&gt;PHP&amp;rsquo;s share-nothing model is one of its best properties. It has one expensive side effect: a request can&amp;rsquo;t keep a&#xA;database connection for the next request. php-fpm gives you &lt;code&gt;PDO::ATTR_PERSISTENT&lt;/code&gt; and &lt;code&gt;mysqli&lt;/code&gt;&amp;rsquo;s &lt;code&gt;p:&lt;/code&gt; hosts. But&#xA;those are per-worker-process. PDO&amp;rsquo;s keep whatever session state the last request left behind. mysqli at least resets&#xA;the session with &lt;code&gt;COM_CHANGE_USER&lt;/code&gt; on reuse. And almost nobody turns them on. So in practice every PHP request does a&#xA;TCP connect, a MySQL handshake and an auth exchange. Then it maybe sends some &lt;code&gt;SET&lt;/code&gt;s, runs its queries and sends&#xA;&lt;code&gt;COM_QUIT&lt;/code&gt;. Multiply that by your request rate and MySQL spends a real share of its time authenticating clients it&#xA;just said goodbye to.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
