Design Per-Second Credit Metering and Billing for Virtual Warehouses

Last updated: November 29, 2026

Quick Overview

Design the system that measures compute usage for every running virtual warehouse at per-second granularity, converts it to credits, enforces resource monitor limits, and produces auditable daily and monthly invoices for each account.

Snowflake
System Design
Software Engineer
Snowflake
November 29, 2026
Software Engineer
System Design Round
System Design
Medium

0

0

0 solved


Design the system that measures compute usage for every running virtual warehouse at per-second granularity, converts it to credits, enforces resource monitor limits, and produces auditable daily and monthly invoices for each account.

Snowflake bills compute by credits per second with a 60 second minimum each time a warehouse resumes, so a metering and ledger design is very relevant to its system design round. The interviewer looks for append-only usage records, idempotent aggregation, and quota enforcement that reacts quickly without blocking queries.

What the Interviewer Expects
  • Emits warehouse lifecycle events (resume, resize, suspend) rather than polling running state
  • Computes billable intervals with the per-resume minimum and size multipliers
  • Stores usage in an append-only, idempotent ledger keyed by event id
  • Enforces resource monitors with near real-time aggregation and suspend actions
  • Keeps invoices reproducible from raw records
Key Topics to Cover
metering
append-only ledger
idempotency
quotas
aggregation
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How would you handle clock skew between compute nodes and the billing service?
  • How do you correct a billing bug after invoices were already issued?
  • How would you show customers usage within minutes, as in a usage view?
  • How do credits for serverless features fit into the same ledger?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Functional: record usage per warehouse, per size and cluster, convert to credits; account and organization rollups; resource monitors that notify or suspend at thresholds; monthly invoices. Non-functi...

High-Level Design

The warehouse control plane emits lifecycle events (resumed, resized, cluster_added, suspended) with an event id, account, size and timestamp into a durable log. A metering service turns event...


Submit Your Answer
Markdown supported

Related Questions