<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Databases on Luther Monson</title>
    <link>https://luth.io/categories/databases/</link>
    <description>Recent content in Databases on Luther Monson</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Tue, 15 Sep 2026 21:08:00 -0700</lastBuildDate>
    <atom:link href="https://luth.io/categories/databases/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Clustered SQLite in ePHPm, Part 3: CDC Over the Cluster Channel</title>
      <link>https://luth.io/blog/2026/09/clustered-sqlite-cdc-cluster-channel/</link>
      <pubDate>Tue, 15 Sep 2026 21:08:00 -0700</pubDate>
      <guid>https://luth.io/blog/2026/09/clustered-sqlite-cdc-cluster-channel/</guid>
      <description>&lt;p&gt;By the end of &lt;a href=&#34;https://luth.io/blog/2026/08/clustered-sqlite-adding-turso/&#34;&gt;Part 2&lt;/a&gt; ePHPm v0.7.0 ran exactly one SQLite engine in&#xA;process. That was Turso, for single-node and clustered mode alike. The sidecar was gone. What I skipped over is how a&#xA;replica actually gets the primary&amp;rsquo;s writes, and what happens when the primary dies with data on it. That&amp;rsquo;s this post.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://luth.io/blog/2026/08/clustered-sqlite-sqld-sidecar/&#34;&gt;Part 1: Replication by sidecar with sqld&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://luth.io/blog/2026/08/clustered-sqlite-adding-turso/&#34;&gt;Part 2: Adding Turso&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Part 3: CDC over the cluster channel (this post)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;cdc-from-the-engine-itself&#34;&gt;CDC from the engine itself&lt;/h3&gt;&#xA;&lt;p&gt;Turso has change data capture built in. Turn it on for a connection and every committed change lands in a &lt;code&gt;turso_cdc&lt;/code&gt;&#xA;table. Each row has a monotonically increasing &lt;code&gt;change_id&lt;/code&gt;, the table, the rowid, and before/after images of the record.&#xA;The primary tails that table and ships transaction batches. Replicas apply them. That&amp;rsquo;s the whole design. It landed as&#xA;an experimental path in &lt;a href=&#34;https://github.com/ephpm/ephpm/pull/186&#34;&gt;#186&lt;/a&gt; at the end of July. The tailer and applier live&#xA;in litewire (&lt;a href=&#34;https://github.com/ephpm/litewire/pull/10&#34;&gt;litewire#10&lt;/a&gt;).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Security and Performance Hardening of a Rust Database Proxy</title>
      <link>https://luth.io/blog/2026/08/hardening-rust-database-proxy/</link>
      <pubDate>Thu, 27 Aug 2026 20:30:00 -0700</pubDate>
      <guid>https://luth.io/blog/2026/08/hardening-rust-database-proxy/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://github.com/ephpm/litewire&#34;&gt;litewire&lt;/a&gt; is the piece of ePHPm that lets PHP apps talk MySQL to a SQLite file. I&#xA;wrote about &lt;a href=&#34;https://luth.io/blog/2026/07/sqlite-production-database-protocol-translation/&#34;&gt;how it works&lt;/a&gt; and about &lt;a href=&#34;https://luth.io/blog/2026/08/faking-mysql-quirks-wordpress/&#34;&gt;the MySQL quirks&#xA;WordPress depends on&lt;/a&gt;. This one is the less visible half of August:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;an audit pass on litewire&lt;/li&gt;&#xA;&lt;li&gt;a multi-tenant mode that turned a database proxy into a security boundary&lt;/li&gt;&#xA;&lt;li&gt;a performance regression I shipped and then had to go find&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;It&amp;rsquo;s written in Rust. Memory safety is supposed to be the part I don&amp;rsquo;t have to think about, and it mostly is. The&#xA;use-after-free in this story was in a dependency. The worst bug wasn&amp;rsquo;t a memory bug at all.&lt;/p&gt;</description>
    </item>
    <item>
      <title>What Does One More WordPress Site Cost?</title>
      <link>https://luth.io/blog/2026/08/what-does-one-more-wordpress-site-cost/</link>
      <pubDate>Tue, 25 Aug 2026 20:20:00 -0700</pubDate>
      <guid>https://luth.io/blog/2026/08/what-does-one-more-wordpress-site-cost/</guid>
      <description>&lt;p&gt;ePHPm v0.7.0 shipped per-site multi-tenancy. Point &lt;code&gt;[server] sites_dir&lt;/code&gt; at a directory and every &lt;code&gt;Host&lt;/code&gt; maps to its own&#xA;docroot and its own Turso database file. One process serves all of them. The first question anybody asks about that is&#xA;&amp;ldquo;how many sites fit on a box?&amp;rdquo; The honest way to answer it is to turn the question around. What does &lt;strong&gt;one more&lt;/strong&gt; site&#xA;cost? If you know the marginal RAM, file descriptors, CPU and disk for a tenant, the box size falls out of arithmetic.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Clustered SQLite in ePHPm, Part 2: Adding Turso</title>
      <link>https://luth.io/blog/2026/08/clustered-sqlite-adding-turso/</link>
      <pubDate>Wed, 19 Aug 2026 20:37:00 -0700</pubDate>
      <guid>https://luth.io/blog/2026/08/clustered-sqlite-adding-turso/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://luth.io/blog/2026/08/clustered-sqlite-sqld-sidecar/&#34;&gt;Part 1&lt;/a&gt; ended with ePHPm running two SQLite engines. rusqlite ran&#xA;in-process for a single node, and an embedded sqld child process ran for a cluster. The sidecar fell off a cliff past&#xA;four concurrent writers. The best fix I could ship was a semaphore set to 1. This post is about replacing both engines&#xA;with one, and about how I decided that engine was ready.&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://luth.io/blog/2026/08/clustered-sqlite-sqld-sidecar/&#34;&gt;Part 1: Replication by sidecar with sqld&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Part 2: Adding Turso (this post)&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://luth.io/blog/2026/09/clustered-sqlite-cdc-cluster-channel/&#34;&gt;Part 3: CDC over the cluster channel&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h3 id=&#34;the-thesis&#34;&gt;The thesis&lt;/h3&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://github.com/tursodatabase/turso&#34;&gt;Turso Database&lt;/a&gt; is a rewrite of SQLite in Rust:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Rolling Your Own KV Store Instead of Embedding Redis</title>
      <link>https://luth.io/blog/2026/08/rolling-your-own-kv-store/</link>
      <pubDate>Mon, 17 Aug 2026 20:44:00 -0700</pubDate>
      <guid>https://luth.io/blog/2026/08/rolling-your-own-kv-store/</guid>
      <description>&lt;p&gt;Every PHP deployment I&amp;rsquo;ve run eventually grew a Redis. Sessions, the WordPress object cache, Laravel&amp;rsquo;s cache and locks,&#xA;rate limiting. &lt;a href=&#34;https://github.com/ephpm/ephpm&#34;&gt;ePHPm&lt;/a&gt; is supposed to be one binary that replaces nginx + php-fpm +&#xA;Redis, so it needed a cache in the box. I didn&amp;rsquo;t want to write one. This post covers why I did anyway and how it&amp;rsquo;s&#xA;built. It also covers the bug that sat in its eviction code from March until last month. Then I compare it against a&#xA;stock Redis on the same machine with &lt;code&gt;redis-benchmark&lt;/code&gt; doing the talking.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Faking MySQL&#39;s Quirks Well Enough to Fool WordPress</title>
      <link>https://luth.io/blog/2026/08/faking-mysql-quirks-wordpress/</link>
      <pubDate>Sun, 16 Aug 2026 15:50:00 -0700</pubDate>
      <guid>https://luth.io/blog/2026/08/faking-mysql-quirks-wordpress/</guid>
      <description>&lt;p&gt;Last month I wrote about &lt;a href=&#34;https://luth.io/blog/2026/07/sqlite-production-database-protocol-translation/&#34;&gt;running SQLite behind a MySQL socket&lt;/a&gt;&#xA;with &lt;a href=&#34;https://github.com/ephpm/litewire&#34;&gt;litewire&lt;/a&gt;. I ended on &amp;ldquo;passing an install suite is not the same thing as&#xA;behaving like MySQL&amp;rdquo;. That turned out to be accurate. On August 10th a few things happened at once:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;I put a real WordPress 7.0.3 site through a benchmark on ePHPm.&lt;/li&gt;&#xA;&lt;li&gt;I A/B tested the new in-process database bridge against the wire path.&lt;/li&gt;&#xA;&lt;li&gt;I started building &lt;a href=&#34;https://github.com/ephpm/db-wordpress&#34;&gt;ephpm/db-wordpress&lt;/a&gt;, a &lt;code&gt;wpdb&lt;/code&gt; drop-in that talks to the&#xA;database in-process instead of over a socket.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Between them they produced six litewire issues in about three hours. None of them broke the install. All of them made&#xA;WordPress quietly do the wrong thing.&lt;/p&gt;</description>
    </item>
    <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>
    <item>
      <title>Clustered SQLite in ePHPm, Part 1: Replication by Sidecar</title>
      <link>https://luth.io/blog/2026/08/clustered-sqlite-sqld-sidecar/</link>
      <pubDate>Sat, 08 Aug 2026 20:14:00 -0700</pubDate>
      <guid>https://luth.io/blog/2026/08/clustered-sqlite-sqld-sidecar/</guid>
      <description>&lt;p&gt;Most PHP sites I have run in the last twenty years did not need a MySQL server. They needed &lt;em&gt;a&lt;/em&gt; database, and MySQL was the&#xA;one every framework spoke. With &lt;a href=&#34;https://github.com/ephpm/ephpm&#34;&gt;ePHPm&lt;/a&gt; I have been trying to get rid of that server for&#xA;the common case. The piece that makes it possible is &lt;a href=&#34;https://github.com/ephpm/litewire&#34;&gt;litewire&lt;/a&gt;. PHP connects with&#xA;plain &lt;code&gt;pdo_mysql&lt;/code&gt;. litewire speaks the MySQL wire protocol, and the queries land in a SQLite file. WordPress and Laravel&#xA;don&amp;rsquo;t know the difference. No &lt;code&gt;mysqld&lt;/code&gt;, no child processes, just &lt;code&gt;ephpm&lt;/code&gt; and a &lt;code&gt;.db&lt;/code&gt; file.&lt;/p&gt;</description>
    </item>
    <item>
      <title>SQLite as a Production Database via Protocol Translation</title>
      <link>https://luth.io/blog/2026/07/sqlite-production-database-protocol-translation/</link>
      <pubDate>Sat, 25 Jul 2026 20:40:00 -0700</pubDate>
      <guid>https://luth.io/blog/2026/07/sqlite-production-database-protocol-translation/</guid>
      <description>&lt;p&gt;Most of the PHP sites I&amp;rsquo;d put on &lt;a href=&#34;https://github.com/ephpm/ephpm&#34;&gt;ePHPm&lt;/a&gt; don&amp;rsquo;t need a MySQL server. A brochure&#xA;WordPress, an internal Laravel tool, a preview environment that lives for an afternoon. What they do need is something&#xA;that &lt;em&gt;looks&lt;/em&gt; like MySQL, because &lt;code&gt;mysqli&lt;/code&gt; and &lt;code&gt;pdo_mysql&lt;/code&gt; are the only database drivers their code has ever been&#xA;pointed at. I mentioned this in the &lt;a href=&#34;https://luth.io/blog/2026/06/ephpm-pragmatism/&#34;&gt;ePHPm pragmatism post&lt;/a&gt; as a one-paragraph&#xA;&amp;ldquo;because&amp;rdquo;. This is the longer version, now that WordPress 7.0 and Laravel 13 both install and run end to end on it.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
