Orb’s billing engine is designed to deliver both flexibility and real-time scale. Unlike traditional systems, Orb’s query-based approach enables real-time invalidation, alerting, and actionable insights—without sacrificing the ability to flexibly model, backfill, or correct billing logic. Real-time performance and flexibility are not mutually exclusive: Orb’s architecture ensures you get both, even at very large scale.

Orb’s billing engine is designed so that billing is the output of a deterministic query, not a side effect of streaming state mutations. This approach differs from most billing systems, which process usage in streams and mutate internal counters or aggregations to track billable quantities.

By decoupling invoicing from ingest‑time side effects, Orb eliminates errors such as double‑counting, drift between counters and source data, and silent corruption. This ensures billing accuracy and auditability.

Core concept: billing as a query

Billing is treated as a pure function. Usage events are stored immutably. When generating an invoice, Orb queries:

“Given this customer, this billing period, and this subscription and pricing configuration, what should the invoice look like?”

Invoices are derived from:

  • Raw usage events: All usage data is stored immutably and forms the foundation for invoice calculation.
  • Immutable metric definitions: Metrics themselves are immutable. If usage events need to be amended, Orb applies amendments as a read-path overlay, layering corrections or changes on top of the original events to calculate the correct set of events to honor.
  • Versioned pricing objects: Pricing changes are tracked over time, supporting accurate billing for any period.
  • Versioned subscription timelines: Subscription changes are recorded as timelines, allowing for precise reconstruction of billing states.

This model provides the following benefits:

  • Deterministic results: The same inputs always yield the same output, ensuring consistency and predictability.
  • Full auditability: Every line item is traceable to its underlying usage and configuration, supporting robust audits.
  • Safe backfilling: Delayed data or configuration fixes can be re-run safely without risk of corruption.
  • Simulation capability: Pricing changes or plan migrations can be tested before being applied, enabling safe experimentation.
  • Scalability: Heavy computation is performed offline, so production traffic is not impacted by expensive aggregations.

Just-in-time invalidation and invoice computation

Orb does not run full-period queries only at invoicing time. Instead, a dependency graph and invalidation system track how each invoice fragment depends on usage, pricing, and configuration. When relevant data changes—such as a late-arriving usage event, plan migration, or pricing update—only the affected invoice fragments are invalidated.

When an invoice is generated, Orb computes only the invoices and fragments that are out of date, based on the latest state. This approach provides:

  • Efficiency: Only the minimal set of invoices are recomputed, even as data changes across millions of subscriptions.
  • Correctness: Every invoice reflects the latest, correct state, regardless of the number of changes or corrections.
  • Safety: The system is idempotent and auditable, with every change traceable and reversible.

This invalidation and dependency-tracking mechanism enables high-scale, real-time billing operations without sacrificing accuracy or auditability.

Why this matters — real‑world impact

Most billing platforms mutate counters when events are ingested. This makes backfilling difficult and corrections risky. Orb’s architecture avoids these problems by not relying on pre-aggregated counters.

If pricing changes, usage is delayed, or a subscription is misconfigured, Orb allows the inputs to be fixed and billing to be re-run. This is not possible in stream-mutation systems without manual intervention.

This architecture enables:

  • Rapid revenue reconciliation: Finance teams can reconcile revenue quickly, even after changes or corrections.
  • Safe backfilling of data: Engineers can backfill data without risk of corrupting billing records.
  • Iterative pricing changes: Product managers can iterate on pricing safely and efficiently.

To support real-time product experiences—such as usage alerts, rate limiting, and in-app metering—Orb uses a complementary real-time alerting pipeline. This stream-based system consumes events as they arrive and powers operational workflows, while billing logic remains query-based for maximum flexibility. This provides both fast, actionable usage data and accurate invoices built on immutable event history.

By default, Orb executes SQL over the entire billing period, supporting any usage metric that can be described in SQL. For live thresholds, the same expression is auto‑translated into an incremental plan that streams in near‑real‑time. At large scale, Orb can spin up hosted rollups to pre‑aggregate hot paths, while raw events continue to be sent unchanged.

Real‑time alerting performance & scale

  • SQL fidelity end‑to‑end: Every alert expression starts as a SQL query over full event history, and Orb translates it into a streaming plan whenever possible.
  • Fast alerting for streaming metrics: For any metric that can be evaluated incrementally, Orb maintains strict SLAs for the time from event to alert.
  • Flexible by design: If a metric cannot be computed in-stream, Orb schedules periodic evaluation automatically.
  • Optional hosted rollups: For extreme volumes, Orb can materialize rollups while raw events are still sent.
  • Field‑tested reliability: The system is used by companies processing upwards of a million events per second.

Raw data, high‑throughput analytics

All usage events are stored in a columnar OLAP store. This provides:

  • High throughput: Production clusters sustain much higher throughput than typical OLAP stores.
  • Flexible analytics: Query raw events via Orb’s SQL‑powered API to break down usage by any property.
  • Retroactive metrics: Define a new metric and calculate it back to day zero without re‑ingesting data.
  • Simulation: The same raw dataset powers Orb Simulations, replaying historical events through hypothetical pricing.

Because the source of truth is immutable event history—not lossy counters—flexibility is not traded for scale.

Summary

Orb’s query‑based billing architecture treats every invoice as a reproducible calculation, not a one‑time side effect. When billing logic changes or corrections are needed, the system provides a path to fix issues without rewriting history. This is the foundation for trusted, flexible, and future-proof billing systems.