DatabricksDavid Wein, Sunil Kamath, Haoyu HuangProblem & solution
Improving Lakebase Postgres compute cache
Summary
Lakebase Postgres uses disaggregated storage backed by object storage, so compute-side caching must deliver low latency and high throughput while avoiding inefficient memory use. Its original design paired a conservatively sized PostgreSQL shared buffer with a local file cache (LFC), but the roughly 1 GB shared-buffer cap pushed many hits to slower NVMe storage and could create double buffering. For fixed-size computes with CU >= 80, the new configuration disables the LFC and sets shared buffers to 75% of DRAM, using explicit 2 MB HugeTLB pages to control page-table and TLB overhead. Benchmark tests found huge pages reduced tail read latency by up to ~40% and CPU use by up to ~30%, while production examples reported doubled throughput, 5× fewer storage reads, or 5× lower CPU use. Work is underway to dynamically resize shared buffers and huge pages for autoscaling computes.
Context
Lakebase Postgres stores data in a disaggregated storage layer and uses compute nodes as caching layers. The prior shared buffers plus local file cache design capped shared buffers at 1 GB on fixed computes, causing larger working sets to rely on slower local file storage, while standard filesystem caching could also create double buffering. Large shared buffers introduced page-table, TLB, and process memory-management overhead, especially in the process-per-backend architecture.
Approach / What changed
For fixed-size computes with CU >= 80, the implementation disables the local file cache and sizes PostgreSQL shared buffers to 75% of DRAM. It adds explicit 2 MB HugeTLB page backing across the host, hypervisor, and guest kernel, releasing surplus pages at startup. The team is developing a protocol to scale huge pages with dynamic shared buffers on autoscaling computes.
Takeaways
Fixed-size computes with CU >= 80 now use shared buffers sized to 75% of DRAM instead of the local file cache; an 80 CU endpoint should report shared_buffers as 20971520.
Using 2 MB huge pages reduced page-table sizes by a factor of 512; benchmark results showed up to ~40% lower tail read latency and up to ~30% lower CPU utilization.
Production examples included doubled throughput, storage GetPage/s falling from about 8K to 1.5K, and CPU use dropping from 20 cores to 4 on one workload.
Source and freshness
- Source
- databricks.com
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.