Lakebase Architecture: Accelerating Postgres Writes

For years, PostgreSQL has been the darling of database administrators and data engineers worldwide, revered for its robustness, extensibility, and adherence to SQL standards. Yet, like any battle-tested technology, it has its Achilles’ heel. For write-heavy Online Transaction Processing (OLTP) workloads, a fundamental mechanism designed for durability has inadvertently become a significant performance bottleneck: Full Page Writes (FPW). Today, we’re diving deep into the Lakebase architecture, a groundbreaking shift promising to shatter these limitations and unlock unprecedented write performance for PostgreSQL.

Imagine a system where every write operation, no matter how small, triggers the logging of an entire 8KB data page. This is the reality of FPW in traditional PostgreSQL. While crucial for preventing data corruption during unexpected crashes by ensuring entire modified pages are durably recorded before being applied to disk, this “belt-and-suspenders” approach inflates the Write-Ahead Log (WAL) volume dramatically. In extreme cases, FPW can increase WAL traffic by a factor of 15, directly impacting I/O throughput, network bandwidth, and replication lag. This is particularly detrimental in modern cloud-native environments where resources are elastic and applications demand near-instantaneous data ingestion.

Deconstructing the FPW Conundrum: The Birth of Disaggregation

At its core, the FPW mechanism is a safety net woven into the fabric of PostgreSQL’s transactional integrity. When a data page is modified after a checkpoint, and before the next checkpoint, FPW ensures that the entire page’s contents are written to the WAL. This is to guard against “torn pages” – scenarios where a crash occurs mid-write to a disk block, leaving only a partial update. By having the complete page in the WAL, PostgreSQL can reconstruct the correct state upon recovery.

The problem? This safety measure becomes a performance killer under heavy write loads. Every INSERT, UPDATE, or DELETE that touches a page not yet written to WAL post-checkpoint results in a full page write. For applications with many small, frequent updates across a large dataset, this means a disproportionate amount of data is being written to WAL, overwhelming storage subsystems and saturating network links. The traditional monolithic architecture, where compute and storage are tightly coupled to local disks, exacerbates this issue. Disk I/O becomes the ultimate bottleneck, and scaling out often means replicating this monolithic problem.

This is where the Lakebase architecture emerges as a paradigm shift. Instead of clinging to the FPW mechanism as a necessary evil tied to local disk durability, Lakebase fundamentally disaggregates compute and storage. Compute nodes become stateless, focused solely on processing transactions and streaming Write-Ahead Log (WAL) records. The critical innovation lies in how these WAL records are handled and how durability is ensured without the FPW overhead.

In Lakebase, WAL records are streamed not to local disks, but to a Paxos-based quorum of “safekeepers.” These safekeepers, part of the distributed storage layer, provide immediate, durable acknowledgment of WAL records. Crucially, because the compute nodes have no local disk and are stateless, the very concept of a “torn page” in the traditional sense becomes impossible. If a compute node fails, it’s simply replaced, and it can pick up where it left off by reading the WAL stream from the safekeepers. This elimination of the FPW requirement is the foundational element enabling massive write performance gains.

Reimagining Read Performance: Intelligent Storage and Image Generation

Disabling FPW wholesale would, in a traditional system, lead to an unbounded chain of WAL application to reconstruct any given page on demand, rendering read operations prohibitively slow. Lakebase addresses this elegantly by pushing “image generation” down to the storage layer, specifically to components called “pageservers.”

Think of pageservers as intelligent, distributed storage nodes. When a read request arrives for a specific data page, the pageserver doesn’t need to replay an entire history of WAL deltas. Instead, it retrieves the most recent materialized image of that page. It then applies any subsequent WAL deltas since that image was created to reconstruct the precise version of the page required for the read.

This “image generation pushdown” is key. By periodically materializing page images and managing the application of deltas, Lakebase ensures that the delta chains remain bounded. This keeps read latencies consistently low, even with a high volume of writes. The result is not just faster writes, but also improved and more predictable read performance, with reported improvements in p99 read latencies of 30-50%. This is a critical balancing act: eliminating the write bottleneck without sacrificing read efficiency.

The impact on WAL traffic is nothing short of astounding. With FPW eliminated, WAL volume per transaction can shrink from an average of 58KB (often dominated by full page writes) to under 4KB – a reduction of over 94%. This drastically reduces storage costs associated with WAL archiving, improves replication speed, and alleviates pressure on storage infrastructure. For OLTP workloads, this translates to observed write throughput increases of up to 5x. Furthermore, for specific use cases like Synced Tables, where data is efficiently ingested into specialized structures, ingestion throughput can jump by an impressive 3x, moving from around 17,000 rows per second to over 62,000.

The Ecosystem and the Verdict: A Strategic Evolution, Not a Revolution

The Lakebase architecture, as currently implemented, is primarily associated with major cloud database providers like Databricks (Lakebase Serverless) and Neon. This signifies a strategic evolution within managed PostgreSQL offerings, where the complexity of this disaggregated architecture is abstracted away from the end-user. For these providers, rolling out this optimization has been a relatively seamless process, leveraging existing PostgreSQL WAL mechanisms like XLOG_FPW_CHANGE to signal the change in behavior.

It’s important to acknowledge that the underlying principles of disaggregated compute and storage are not entirely novel. Concepts akin to this have been explored and implemented in various distributed database systems and cloud data platforms. Some industry observers view “Lakebase” as a proprietary marketing term for this architectural pattern. The underlying idea of using a reliable object store (like S3) for authoritative, older data and managing recent changes in a more performant, transactional layer is a well-established pattern.

However, the true genius of Lakebase lies in its successful application and refinement within the context of PostgreSQL. It takes a deeply ingrained, albeit problematic, core mechanism of PostgreSQL (FPW) and circumvents it by fundamentally altering the storage and durability model. This isn’t a minor tweak; it’s a sophisticated re-architecture that addresses a long-standing limitation.

So, should you adopt Lakebase? For most small-to-medium, monolithic PostgreSQL deployments, the existing architecture is likely sufficient and simpler to manage. The benefits of Lakebase are most pronounced for high-scale, write-intensive OLTP applications that are currently experiencing WAL contention, I/O bottlenecks, or struggling with replication lag. If your application fits this profile, and you are utilizing a managed PostgreSQL service that offers this architecture (like Databricks Serverless or Neon), then the answer is a resounding yes.

Lakebase represents a significant advancement for managed PostgreSQL. By intelligently disaggregating compute and storage, it effectively tackles the FPW bottleneck, unlocking substantial write performance gains and enhancing read stability. It enables PostgreSQL to scale linearly with compute resources under heavy write loads in a way that was previously difficult or impossible for monolithic deployments. This is not just an optimization; it’s a strategic evolution that positions PostgreSQL to thrive in the most demanding, write-heavy cloud-native applications.

Hardware Attestation: Monopoly Enabler?
Prev post

Hardware Attestation: Monopoly Enabler?

Next post

Obsidian Plugin Security: Trojan Deployment Risk

Obsidian Plugin Security: Trojan Deployment Risk