DEV Community

Danny C.
Danny C.

Posted on

Specialist Sessions: Lakebase Autoscaling

Specialist Sessions: Lakebase Autoscaling

Presenters:

  • Michele D'Addetta | Senior Specialist Solutions Engineer

  • Matteo Monaldi | Senior Specialist Solutions Engineer

  • Matt Slack | Senior Specialist Solutions Architect

Agenda

  • Introduction

  • Use Cases Patterns & Qualification

  • Concepts & Architecture

  • Pricing Model

  • Cost monitoring

  • Security

  • Authentication and Authorization

  • Advanced Topics

  • Extensions, Deployment and Data API

  • Demos

  • Product Walkthrough & UC Synchronization

  • Key Takeaways

Introduction

Analytics and operational use cases are starting to converge. AI-assisted applications are accelerating the trend.

Customer Challenges

  • Provisioning: How to choose, setup and integrate an operational database, including data synchronization?

  • Complex to integrate: How to make it easy for application teams to use?

  • Scaling: How to scale and troubleshoot custom deployments and data synchronization?

  • Difficult to manage: How to scale and deploy quickly? How to minimize risk of having multiple databases across dev, test, staging, prod environments?

  • Automation: Outdated developer experience.

Application Architecture

  • Build your app on Lakebase today: Application -> Lakebase -> Lakehouse

  • Serve data from the lakehouse: Lakehouse -> Lakebase -> Application

  • Specific Use Cases include analytics over transactional data, order processing, interactive workflow sign-off, data serving, state for an agent, personalized recommendations, customer segmentation, feature store, order history (analytics), and chatbot history (training data).

Workload Restrictions (What NOT to do)

  • Large scale migrations.

  • Migration from non-postgres databases (Especially true for GraphQL and NoSQL DBs!).

  • Run workloads which require more than 1000 concurrent connections (4000 for Lakebase autoscaling), 2TB of Storage (8TB for Lakebase autoscaling), or more than 64GB of memory.

  • Run OLAP workloads in an OLTP database, expecting improved performances (it won't).

  • Splitting a large dataset into multiple branches or projects to workaround those restrictions is strongly discouraged.

Customer Adoption & Testimonials

The solution is resonating with over 1000+ customers who value the easy-to-use Postgres database integrated with the Lakehouse, which evolves the analytical data platform into an operational AI data platform delivering low-latency insights without complex stacks.

Notable customers include: Adobe, Bridgestone, Chevron Phillips Chemical Company LP, Dream11, easyJet, Ensemble Health Partners, Epsilon, Erste Group, Ford, FordDirect, Gjensidige, Hertz, Ibotta, iFood, Insight, Insulet, Krafton, Milliman, Opendoor, Quantum Capital Group, Quartile, Red Ventures, Rolls-Royce, RWE, SSE Energy Solutions, Supercell, T-Mobile, The Standard, WGU, and Yipit Data.

  • Jelle Van Etten, Head of Global Data Platform at Heineken: Our analytical data platform is now evolving to be an operational AI data platform and needs to deliver insights to applications at low latency.

  • David Menninger, Executive Director, ISG Software Research: Giving customers a unified, developer-friendly stack that reduces complexity and accelerates innovation.

  • Niklas Nordansjö, Data Platform Lead, Tibber AS: Integration makes it easy to serve analytical and transactional data helping us deliver real-time insights to our customers.

Lakebase 101

Fully-managed Postgres built for intelligent applications.

Postgres Database Engine

  • Fastest growing database engine of the last decade.

  • High performance: <10ms latency, >10ks QPS.

  • Full Postgres SQL engine: transactions (ACID), indexes, views, pk/fk enforcement, joins, CTEs, triggers, stored procedures.

  • Rich ecosystem: Extensions (incl: PostGIS, pgvector), Drivers (Java, Python, etc), Tools (pgAdmin, DBeaver, PSQL).

Separation of Storage and Compute

Fully managed, easy to use, and enterprise ready.

  • Decoupled compute and storage: Independent compute/storage scaling, Pause/resume provisioned compute. Serverless Infra: hardened compute & encrypted storage.

  • High-availability and recovery: Multi High Availability Zone Failover, Readable Secondaries, Point-in-Time Recovery up to 35 days powered by copy-on-write clone.

  • Secure: Identity & OAuth, Private Link / IP ACLS, Transport Layer Security (TLS) encryption.

  • Management / observability: Built in monitoring, Apps resource, Terraform; Billing Tags.

Integrated with Lakehouse

  • Fully-Managed Data Synchronization: Sync from Lakehouse table to Postgres. Sync from Postgres to Lakehouse table (coming soon). Modes include Snapshot, Triggered, and Continuous. Multiple table syncs in a pipeline.

  • AI Platform (Online Feature Store): High performance feature lookup. Feature store for real-time serving, with offline training data in Lakehouse.

  • Integrated with Unity Catalog: Register Postgres database as Catalog. Governed by UC. Lakehouse Federation.

  • Query Editor and Schema Browser: Native Postgres query editor. Browse Postgres schema.

Branching and Development

Treat your database like code.

  • Lakebase Branching: Instant, zero-copy isolation lets teams safely build and test without touching production and live workloads.

  • Ephemeral environments: Create and decommission dev/test branches quickly with no storage duplication.

  • Git-style workflow for data: Bring CI/CD to your database for feature branches and rapid experimentation. Branching tree examples include branching the Main dataset into Production, Schema Migrations, and isolated development tags (e.g., github branches, bugfix branches, and feature-test branches).

Recovery and Backups

Precise restoration, at scale.

  • Scheduled snapshots: Create instant database backups on a schedule.

  • Rapid, precise recovery: Restore to an exact moment within a managed window (up to 35 days) for quick incident recovery.

  • Safe validation: Use an isolated, zero-copy branch before applying changes to reduce the risk of bad restores to production.

Autoscaling, with scale to zero

Ready when you need it, without paying for idle capacity.

  • Only pay for active use: Pay only when your database is active. Idle instances drop to zero to keep costs low.

  • Automatic scale to zero: Unused databases automatically suspend after a configurable idle period with no manual intervention.

  • Instant readiness: Sub-second start times mean responsive apps and fast setup for dev/testing.

Horizontal Read Scalability

High concurrency without operational complexity.

  • Read isolation: Dedicated read-only compute serves queries without impacting write workloads.

  • Independent scaling: Add or remove read query capacity without changing write compute.

  • Shared data layer: All compute accesses a single underlying data set, with no data duplication.

Built into the Data Intelligence Platform

Avoid separate stacks and proprietary governance models.

  • Operational workloads on one platform: Enable agents and applications to read and write data alongside analytics workloads.

  • Share a common data foundation: Operational data is immediately available without copying or ETL pipelines.

  • Built-in governance and security: Apply consistent access control, auditing, and policies across all data.

Use Cases Patterns

Ideal Use Cases

  • Serve Analytical Data to Applications (reverse ETL): Low-latency dashboards and operational stores backing internal or customer facing applications. Examples include e-commerce companies serving recent order info, or customer-facing dashboards for monitoring performance of digital promotions.

  • Support Model Serving and Feature Serving (reverse ETL): Perform automatic feature store lookups for real-time ML use cases. Examples include assessing customer likelihood to buy a product, or recommending the next best action for call center agents.

  • Store Application State: Chatbot agent stores conversation history and customer preference; Apps that need a human review element to manage sign offs.

Flow Diagrams

  • Reverse ETL (Apps): Gold/Silver/Bronze -> Managed Synchronization (Lakeflow) -> Lakebase Postgres -> Read by App.

  • Reverse ETL (Feature Store): Gold/Silver/Feature Tables -> Managed Synchronization (Lakeflow) -> Lakebase Postgres -> Read (real-time lookups) -> Model Serving.

  • Application / Agent State Store: App / Agent -> Write to Lakebase Postgres -> LH Federation or Lakeflow (coming soon) -> UC.

  • Reverse and forward ETL: UC -> Lakeflow -> Lakebase -> Read by App. App -> Write/read Lakebase -> LH Federation or Lakeflow (coming soon) -> UC. (Note: writes to a particular table are unidirectional).

Use Case Qualification

Qualifying Options

  • OLAP (Use DBSQL): Goal is to analyze aggregated data often at large scale for analytics and/or BI. Aggregate queries over large volume of data often TBs. Low concurrency needs. Lakebase does NOT provide a low-latency alternative to DBSQL for analytics.

  • OLTP (Use Lakebase): Goal is high-performance read/write of individual rows of data in an application. High QPS (>10K), low latency <10ms. Transactions, constraints etc.

Qualification Questions & Criteria

  • What is overall data size and what is expected growth? 8 TB across all databases in an instance (limit will be raised soon).

  • What does update pattern look like? Supports up to 10k rows / seconds.

  • What are your freshness expectations? Lag between delta and Lakebase ~5+ seconds.

  • What are query patterns and performance needs? Point lookups and small range scans. Scans < 100k rows. Simple joins utilizing keys. QPS < 100k, ~10 ms latency.

Pricing Model

Decoupled storage & compute, with provisioned compute.

  • Storage uses the Storage Unit SKU where branches incur storage usage in GB-month, calculated as 1 GB-month equaling 1 GB stored for 1 month, 0.25 GB stored for 4 months, or 30 GB stored for 1 day.

  • Storage branch types include Root (production) and Child branches, where Child branches can be either Expiring (perfect for developer and CI/CD workflows) or Non-expiring.

  • Compute uses the Database Serverless Compute SKU, where Compute (R/W and Read Replicate) incur compute usage in CU-hours.

  • Data Synchronization uses the Automated Serverless Compute SKU where the pipeline is priced the same as Spark Declarative Pipeline.

Cost monitoring

System Table Queries

Use to get complete costs for your autoscaling project and (optionally) branch. Join system.billing.usage table with system.billing.list_prices to convert usage to currency.

  • Lakebase (autoscaling) product: filter by billing_origin_product = 'LAKEBASE'. This is for Autoscaling projects. Provisioned uses DATABASE.

  • Compute: filter by sku_name ilike "%DATABASE_SERVERLESS_COMPUTE%". Aggregating this gives complete compute usage.

  • Storage (total): filter by sku_name ilike "%STORAGE%". Aggregating this gives complete storage usage.

  • Storage for non-expiring branches (logical volume): filter by product_features.lakebase.storage_type = 'BRANCH_DATA_STORAGE'.

  • Storage for expiring branches: filter by product_features.lakebase.storage_type = 'BRANCH_HISTORY_STORAGE'.

  • Storage for PITR: filter by product_features.lakebase.storage_type = 'BRANCH_DATA_STORAGE'. This is primarily applicable to the root branch.

  • Project and branch: filter by usage_metadata.project_id = "" and usage_metadata.branch_id = "" to filter for a specific project or branch.

Example SQL Query:

SELECT
  sku_name,
  usage_date,
  usage_metadata.project_id,
  usage_metadata.branch_id,
  usage_metadata.endpoint_id,
  SUM(usage_quantity) AS usage_quantity
FROM system.billing.usage
WHERE 
  billing_origin_product = 'LAKEBASE' 
  AND (
    sku_name LIKE '%DATABASE_SERVERLESS_COMPUTE%'
    OR sku_name LIKE '%STORAGE%'
    OR sku_name LIKE '%JOBS_SERVERLESS_COMPUTE%'
  )
  AND usage_date >= CURRENT_DATE - INTERVAL 1 DAY
  AND workspace_id = 7474647659036830
GROUP BY ALL
ORDER BY usage_date

Enter fullscreen mode Exit fullscreen mode

Monitoring via UI & Audit

  • Billing System tables: Track usage by billing origin product (ONLINE_TABLES), Online Table Capacity Units using Automated Serverless Compute (JOBS_SERVERLESS SKU), Storage (STORAGE), and Delta sync (JOBS_SERVERLESS SKU). Usage breakdown by custom tags is also available.

  • Audit: Online table access/creation/deletion is available at system.access.audit. DBSQL access to Postgres tables is available in system.query.history. PostgREST audit logs should come in near future.

  • Metrics Tab Dashboard: Tracks Transactions per second (general observability for committed transaction throughput), Rows per second (rows fetched, returned, inserted, updated, and deleted), Open connections, Storage utilization, CPU utilisation %, Page read throughput %, Buffer cache hit rate %, Local SSD cache hit rate %, and Deadlock per second.

  • External Tools: Additionally, it's possible to use tools like pgAdmin or other pg-integrated tools to build dashboards to monitor the health of your postgres instance.

Concepts & Architecture

Object Hierarchy

  • Workspace -> Project(s) -> Branch(es)

  • A Branch contains: R/W Compute, Read Replica(s), Role(s), Database(s).

  • Database(s) contain Schema(s).

Traditional PostgreSQL vs Decoupled Architecture

  • Traditional Monolithic Design: Compute, memory, background processes, and storage are all on one node. Benefits include low latency, microsecond disk access, the ability to co-locate the app server and DB for faster interactions, and no cold starts. However, limitations and risks include single points of failure (machine, datacenter, or disk failure) resulting in downtime or data loss, inefficient resource utilization across storage/compute and time (peak times), slow restores from backups that are dependent on storage size, complex HA/DR setup, and high operational overhead (capacity planning, backups, replication, failover, manual recovery).

  • Lakebase Decoupled compute and storage features a Computes layer containing multiple stateless Postgres instances, a Multi-Tenant Storage layer containing Pageserver and Safekeepers, and WAL streams from Safekeepers to Pageserver syncing with Object storage for 99.999999999% availability.

High Availability and Read Replicas

  • Stateless compute simplifies availability.

  • Compute failover: Seconds to mins depending on location of failure.

  • Storage redundancy: Spread across Availability Zones (AZ1, AZ2, AZ3). Pageserver failover and multi-AZ safekeeper replication ensure data is never lost as Pageserver syncs with object storage.

  • Read replicas: Perform read operations on same data. There is no replication or duplication.

Caching in Lakebase

  • Traditional: Backend -> Shared Buffers (10 GB/sec, 10 nanosec) -> OS File Cache (10 GB/sec, 1 microsec) -> Disk (1 GB/sec, 10 microsec).

  • Lakebase: Backend -> Shared Buffers (10 GB/sec, 10 nanosec) -> Local File Cache (LFC) (10 GB/sec, 1 microsec) -> Page Server (1 GB/sec, 1 millisecond). This multilayer cache maintains low latency despite network separation.

Point In Time Recovery (PITR) & Branching

  • Based on copy-on-write. Copy on Writes minimizes extra storage and leaves shared data unmodified.

  • PITR: Create a child instance based on WAL to restore a past state (time or LSN) in the event of data loss on the main branch.

  • Branching: Create branches for development, testing, and temporary environments without impacting the main branch (e.g., main -> test A, test B, test C).

Autoscaling and Scale-to-zero

  • Virtue of decoupled compute and storage.

  • Can vertically scale compute without scaling storage.

  • Managed within a K8S cluster. Supports auto-scaling and scale-to-zero with auto-termination during inactivity.

Security

Connectivity Deep Dive

Traffic routes through an Ingress Security Layer (IP ACLs, Private Link, DDOS protection).
Architectural Flow:

  • Users and Services (via HTTPS or direct Postgresql Wire Protocol using OAuth or Local Credentials) access the Ingress Security Layer.

  • The Ingress layer directs traffic to either the Control Plane (UI, REST API, Management) or directly to the Dedicated PG Compute in the Customer Workspace within the Serverless Compute Plane.

  • The Control Plane communicates securely with the Serverless Compute Plane.

  • Dedicated PG Compute connects internally to optional services like SDP, Model Serving, and Apps/Agents.

  • Dedicated PG Compute writes to the Storage Service. Crucially, cross-workspace access is blocked at this network layer (Customer 1 cannot access Customer 2's workspace or storage).

  • The Storage Service commits data to Long-term Storage.

Authentication

  • PostgreSQL Authentication: Postgres Lakebase account authentication and PostgreSQL login.

  • Managed Authentication: Workspace user credentials (OAuth), Service Authentication, Workspace user authentication (OAuth), and Managed OAuth M2M authentication.

Authorization

  • PostgreSQL Authorization: Native permissions and privileges.

  • Unity Catalog Governance: Unified Authorization and UC-managed governance applied to native services such as Notebooks, REST API, DB SQL, PostgREST API, Model Serving and Apps.

Read/Write Postgres tables

  • The PostgREST access approach uses the Online table direct URL endpoint, requires an OAuth token from UI or with SP for authentication, operates in Read access mode, and offers the lowest latency.

  • The Postgres SQL access approach uses the Postgres Host URL endpoint, requires an OAuth token from UI, workspace, SP, or PAT token for authentication, operates in Read/Write access mode, and offers low latency.

Forward and Reverse ETL

Synchronization Options

Decision tree for moving data from Lakehouse to Postgres:

  • Snapshot: Runs once to take a complete copy of the source table into Postgres. Subsequent syncs replace all destination data atomically. Can be triggered manually, through API, or on a schedule. Extremely efficient for one-off or infrequent bulk loads. 10x more performant versus other modes. Ideal when more than 10% of source data changes at a time.

  • Triggered: Starts with a snapshot, then only incremental changes since last sync are applied. Refreshes are manually triggered or scheduled. Balances update lag and cost; fetches only changes since last run. Best for periodic updates. More frequent triggers may be more expensive than Continuous mode.

  • Continuous: Starts with a snapshot, then incrementally applies changes in real time as soon as they happen. No manual intervention needed. Provides the lowest lag and most up-to-date data. Higher cost due to constant pipeline. Best for high-velocity use cases or applications demanding fresh data.

Advanced Topics

Postgres Extensions

  • Supports an ever-growing list of extensions. The list of available extensions can be retrieved from Postgres directly via: SELECT * FROM pg_available_extensions ORDER BY name;

  • Install via: CREATE EXTENSION ;

  • Popular extensions: pg_stat_statements (query metrics), pgcrypto, pg_prewarm (cache prewarming), TimescaleDB Apache (timeseries), neon, postgis (geospatial), pg_graphql (GraphQL support), pg_vector.

  • Note: Extensions that directly manipulate Postgres storage are not supported as this would be incompatible with the storage infrastructure.

Deployment

Asset Bundles (YAML configuration): Define infrastructure as code (projects, branches, endpoints with autoscaling limits).

bundle:
  name: lakebase-app

resources:
  postgres_projects:
    my_app:
      project_id: "my-app"
      display_name: "My Application"
      pg_version: 17

  postgres_branches:
    dev_branch:
      parent: ${resources.postgres_projects.my_app.id}
      branch_id: "dev"
      no_expiry: true

  postgres_endpoints:
    dev_endpoint:
      parent: ${resources.postgres_branches.dev_branch.id}
      endpoint_id: "primary"
      endpoint_type: "ENDPOINT_TYPE_READ_WRITE"
      autoscaling_limit_min_cu: 0.5
      autoscaling_limit_max_cu: 4

Enter fullscreen mode Exit fullscreen mode

Python SDK: Manage programmatically.

w = WorkspaceClient()

op = w.postgres.create_project(
    project=Project(
        spec=ProjectSpec(
            display_name='My App',
            pg_version='17',
            project_id='my-app'
        )
    )
)
project = op.wait()

dev_branch = w.postgres.create_branch(
    parent=project.name,
    branch=Branch(
        spec=BranchSpec(
            no_expiry=True,
            branch_id='dev'
        )
    )
).wait()

endpoint = w.postgres.create_endpoint(
    parent=dev_branch.name,
    endpoint=Endpoint(
        spec=EndpointSpec(
            endpoint_type=EndpointType.ENDPOINT_TYPE_READ_WRITE,
            autoscaling_limit_min_cu=0.5,
            autoscaling_limit_max_cu=4.0,
            endpoint_id='primary'
        )
    )
).wait()

Enter fullscreen mode Exit fullscreen mode

Data API

pgREST API over HTTP — no custom backend required

  • Full CRUD Support: GET //table?... (read), POST (insert rows), PATCH / PUT (update), DELETE (remove rows).

  • Authentication: OAuth bearer tokens on all requests. The authenticator Postgres role assumes caller identity. Enabled per project in the App.

  • Authorization: Table- and schema-level GRANTS control visibility. Row-level security (RLS) restricts per-user row access. RLS is strongly recommended for multi-tenant and sensitive data.

  • Features: Rich filtering + sorting, pagination built-in, and built-in functions.

  • Typical Use Cases include Web & Mobile Apps, where Lakebase is called directly over HTTPS with no custom backend needed for basic CRUD.

  • Typical Use Cases include Microservices & Serverless, where operational data is read and written via REST from any function or service.

  • Typical Use Cases include Third-Party Integrations, where API access is controlled and auditable for external tools and partners.

Example REST Request:

curl \
  -H "Authorization: Bearer $OAUTH_TOKEN" \
  "$REST_ENDPOINT/public/clients?select=id,name&limit=10"

Enter fullscreen mode Exit fullscreen mode

Postgres vs Lakebase Summary

  • Architecture: Traditional PostgreSQL utilizes a monolithic architecture where compute, memory, and storage are on the same node. Lakebase uses decoupled shared storage and stateless compute.

  • Caching & Latency: Traditional uses local disk and shared buffers with no network hop. Lakebase uses a multilayer cache (shared buffers to compute-local LFC to pageserver) to ensure low latency despite network separation.

  • PITR: Traditional backups are manual, slow, and storage-intensive. Lakebase backups and restores are instant.

  • HA & Read Scaling: Traditional involves complex setups for replication and failover. Lakebase features built-in read replicas with shared storage, automated compute failure tolerance, and a lower overall operational burden.

  • Developer Experience: Traditional offers slow provisioning and makes experimentation difficult. Lakebase supports Git-like branching, instant point-in-time restores, and DevOps-friendly workflows.

  • Cost Model: Traditional requires overprovisioning for peak loads, resulting in inefficient usage. Lakebase leverages pay-per-use autoscale compute, bottomless storage, and efficient multi-tenant resource pooling.

Key Takeaways

  • Managed Postgres, natively integrated with Lakehouse.

  • Decoupled compute & storage.

  • Seamless data sync.

  • Secure by design.

  • Optimized for modern use cases.

Upcoming Releases

Available on AWS unless otherwise specified:

  • Performance and resilience: Up to 128TB of storage (Generally Available), Increased autoscaling limits (Generally Available), Synchronize data and operational metadata to Delta tables (Public Preview), Scheduled snapshots (Generally Available).

  • Security and Compliance: Customer Managed Encryption Keys (Public Preview), HIPAA (Generally Available), SOC2 (Generally Available).

  • Product Availability: Available on Azure (Generally Available), Expanded AWS Regions (Generally Available).

Top comments (0)