Keeping Billing Infrastructure Costs Linear With Revenue

Why we run the entire UsageBox stack on serverless services and what that does to the ops budget.

6 min read

cloud cost optimizationserverless scalinginfrastructure efficiency

Our first billing backend ran on two n1-standard-4 instances and a manually tuned Postgres cluster. It cost real money even when customers were asleep. Moving to UsageBox’s serverless stack cut the bill and the on-call rotation. Here’s how the numbers worked out.

Cost Profile Before the Switch

  • Two always-on VM instances: ~$420/month
  • Managed Postgres with replicas: ~$300/month
  • Monitoring, backups, patch windows: a few engineer days every sprint

None of that spend moved with revenue. Idle weekends cost the same as peak launches.

Serverless Tradeoffs

  • Cloud Run: scales to zero. We pay only for CPU seconds while handling ingestion bursts.
  • Firestore: storage and read/write costs track directly with event volume.
  • Pub/Sub + Cloud Tasks: cheap queueing with built-in retry logic so we stopped running our own workers.

The infrastructure bill now follows usage curves instead of staying flat.

Numbers After Migration

  • 10k events/month ≈ $40 all-in
  • 1M events/month ≈ $260 (mostly Firestore writes and reads)
  • No VM patching, no database failover drills, no weekend pager duty

We still budget for spikes, but Cloud Run handled a 12x launch-day surge without intervention. The alternative would have been over-provisioning instances just in case.

How to Keep Costs Predictable

  1. Track ingestion volume and average event size weekly, Firestore billing is sensitive to payload size.
  2. Batch tiny events when possible. We aggregate noisy signals into five-second windows to avoid write amplification.
  3. Set alerts on Cloud Run concurrency so you know when to bump limits before throttling kicks in.
  4. Export usage metrics to BigQuery or your warehouse to compare infrastructure spend against billing revenue.

Serverless won’t always be the cheapest option, but for elastic workloads like metering it keeps costs and maintenance aligned with the value you deliver.

Key Topics

  • •cloud cost optimization
  • •serverless scaling
  • •infrastructure efficiency

Related Articles

Explore more articles on similar topics to deepen your understanding of usage-based billing.

Qwen API Pricing 2026: Qwen3.8 Max, Flash & Free Quota

Qwen API pricing, October 2026: Qwen3.8 Max at $2/$6 and Flash at $0.15/$0.47 per 1M tokens, the cheaper Global deployme...

10 min readRead more

Nano Banana Pro API Pricing 2026: Cost per Image, 1K to 4K

Nano Banana Pro API pricing, October 2026: $0.134 per 1K or 2K image and $0.24 at 4K, half in Batch, vs $0.0336 for Nano...

8 min readRead more

OpenCode Zen & Go Pricing 2026: Go Plus, Limits, Free Models

OpenCode Zen and Go pricing, October 2026: Go at $10 and Go Plus at $40 with per-model dollar limits, Zen pay-as-you-go ...

10 min readRead more

Explore More Articles

Discover our complete collection of usage-based billing guides and implementation patterns.

View all articles