Guide

In a shared system, the cloud bill arrives as one number. To know whether a tenant is profitable, you must allocate that shared cost back to tenants. That requires metering: recording each tenant's use of the resources that drive cost, then charging each tenant in proportion.

The big idea

Metering works like a utility meter. A house doesn't pay a flat fee for electricity regardless of use. It pays for what it consumes. In a pooled system, the meters are CPU time, database work and stored bytes, recorded per tenant. The result shows which tenants drive cost, including those that look good on revenue but cost the company more.

Cost allocation is an estimate. For the pooled tier, precision of about ±20% is enough to find the outliers.

Walking through it

Say the monthly infrastructure bill is $120,000, split across three cost pools. You meter each pool's driver per tenant:

Cost pool          Monthly cost    Metered driver
API compute        $60,000         request-seconds of CPU
Database           $40,000         storage GB and query time
Object storage     $20,000         GB stored

Tenant Acme uses: 8% of CPU request-seconds, 15% of database, 2% of storage

Acme's cost = 0.08 x 60,000 + 0.15 x 40,000 + 0.02 x 20,000
            = 4,800 + 6,000 + 400
            = $11,200 per month

Acme pays $9,000 per month
gross margin = (9,000 - 11,200) / 9,000 = about -24%

Acme is unprofitable, and the database line is the reason: $6,000 of its $11,200 cost. That one number drives several decisions. You might add a usage-based charge for heavy database use. You might move Acme to a dedicated shard and price that in. You might optimize the queries Acme's workload triggers. Without metering, nobody notices, and Acme looks like a great customer because it pays the most.

The practical pipeline is simple. Emit a usage event per request or job, tagged with the tenant ID. Aggregate the events in the data warehouse. For siloed tenants, tagging cloud resources with tenant IDs is enough. For pooled tenants, allocate each cost pool by its metered driver, as above.

Common mistakes

  • Allocating shared cost evenly. Equal splits hide the heavy users, which is the opposite of what you need.
  • Judging a customer by revenue. The biggest payer can also be the biggest cost. Compare revenue with metered cost.
  • Skipping tenant tags on new features. Usage that isn't tagged by tenant can't be attributed later.

Check yourself

  1. Using the example, what is Acme's margin, and what drives it?

    About −24%. Database usage drives it: $6,000 of Acme's $11,200 cost.

  2. Why allocate costs by metered drivers rather than evenly?

    Tenants use CPU, database and storage in different amounts. Metered drivers match cost to the tenant that causes it.

Key takeaways

  • A shared bill needs metering before it can be attributed to tenants.
  • Allocate each cost pool by the driver that causes it.
  • A customer who pays the most can still be unprofitable.
  • Cost per tenant informs usage-based pricing, dedicated shards and query work.

Further learning

See FinOps and SaaS economics for how this connects to margins.