databricks Databricks Blog ·

Databricks details autoscaling for Lakebase Postgres

blogdatadatabricksengineer
announcement

This deep dive explains how Lakebase Postgres automatically scales compute resources, eliminating the need for manual instance sizing. The system uses in-place VM resizing driven by an algorithm that tracks CPU load, memory utilization, and the database's working set. This approach addresses limitations of traditional stateful Postgres architectures by separating compute from durable state. The goal is to optimize compute usage and performance by dynamically adjusting capacity based on real-time workload demands.

  • Architectural Foundation for Autoscaling
  • CPU Load Tracking
  • Memory Use Monitoring
  • Compute-Cache Working Set Estimation
  • Time-Windowed Working Set Calculation
Notes (6)
  • Architectural Foundation for Autoscaling

    Lakebase Postgres achieves autoscaling by decoupling the compute layer from the durable storage layer. This architecture allows compute nodes to start, stop, move, or change size without disrupting the underlying database, which is crucial for dynamic resource adjustment.

  • CPU Load Tracking

    The autoscaling algorithm monitors the VM's one-minute CPU load average every five seconds. It aims to keep CPU load at or below 90% of capacity, increasing compute units (cpuGoalCU) when load rises and decreasing when sustained load falls.

  • Memory Use Monitoring

    Memory is tracked at two frequencies: overall VM metrics every five seconds and Postgres-specific memory usage every 100 milliseconds. The goal is to maintain memory use below 75% of allocated RAM to prevent out-of-memory issues and allow headroom for new allocations.

  • Compute-Cache Working Set Estimation

    A third signal estimates the database's active working set to ensure optimal performance by fitting data closer to Postgres. This uses a modified HyperLogLog algorithm to probabilistically estimate the number of distinct pages accessed, which influences the compute-cache size (lfcGoalCU).

  • Time-Windowed Working Set Calculation

    To account for changing workloads, the HyperLogLog implementation stores timestamps instead of simple bits, allowing for time-bound estimates of distinct pages accessed. This enables the system to estimate working sets for various windows, from one to 60 minutes, collected every 20 seconds.

  • Dynamic Resizing Logic

    The final scaling target is determined by taking the largest of the three goal compute sizes (CPU, memory, working set), constrained by user-configured minimum and maximum limits. This allows the system to scale up or down based on the most pressing resource demand.

Read the original announcement →

https://www.databricks.com/blog/autoscaling-lakebase-postgres

Related releases