All writing
SaaS engineeringUnit economicsCapacity planning

Scaling a SaaS while preserving unit economics

Connect tenant consumption, capacity steps and product limits so growth increases delivered value faster than operating cost.

A SaaS doubles its paying customers and triples its infrastructure bill. The explanation may be simple growth, but it may also be a change in workload: larger imports, more retained data, expensive exports or a small group of customers using an unlimited feature far more heavily than everyone else.

The engineering problem is connecting product promises to resource consumption. Scaling capacity without understanding that relationship can make the service faster while making the business less sustainable.

I would model cost by tenant cohort and business operation, then use that model to guide architecture, admission and product limits. All prices, volumes and margins in the worked example below are hypothetical. They illustrate decisions rather than report customer financial results or vendor pricing.

Separate the bill, allocated cost and marginal cost

The cloud bill is observed spend. Allocated cost assigns portions of shared spend to tenants according to a rule. Marginal cost estimates the extra resources required for additional usage. These quantities answer different questions.

Allocating an idle database equally across tenants can explain today's total spend, but it does not mean one more tenant causes that amount of new cost. Conversely, a large new tenant can trigger a database capacity step whose cost exceeds its ordinary proportional allocation.

Keep the attribution method visible. Shared CPU can be approximated using measured workload time or another justified proxy. Storage and transfer may be attributable more directly. Request counts are poor proxies when requests have very different costs.

AWS's 2017 tenant-cost article explains the attribution challenge in pooled infrastructure. The 2023 cost-visibility article discusses correlating tenant consumption with shared-resource cost. Those methods support an accounting view; the product still needs a workload model to predict capacity changes.

Choose a unit that reflects delivered value

Cost per HTTP request can fall when the frontend adds inexpensive polling. That improvement may have no business value. Choose a unit such as completed analysis, processed document, active workspace-month or successful export, depending on the product.

Track attempted and completed work separately. Retries, invalid inputs and canceled jobs consume resources. A high cost per successful result can come from low success yield even when each attempt is efficient.

Include a direct workload footprint: compute time, database work, storage growth, transfer, provider calls and support-heavy failure paths. Keep engineering payroll and company-wide overhead separate unless the decision explicitly includes them. Mixing several cost boundaries makes comparisons hard to interpret.

A hypothetical tenant pays $100 per month and completes 1,000 jobs. Assume each job costs $0.03 in variable infrastructure and provider spend, plus $20 of allocated shared infrastructure. Its infrastructure contribution is:

Text
revenue                               $100variable workload cost: 1,000 × $0.03   $30allocated shared infrastructure        $20remaining before other costs           $50

This is not a complete company gross-margin calculation. It omits other cost-of-service items and depends on the allocation rule. It is useful for comparing the workload's engineering cost against the product promise.

If the same plan permits 10,000 jobs, variable workload cost becomes $300. No amount of spreading the $20 shared allocation over more usage repairs that mismatch. The team needs a cheaper workload, a different limit or a different commercial contract.

Model the distribution, including expensive tenants

The average tenant can hide a long tail. Segment by meaningful consumption patterns: small interactive users, large batch users, data-heavy customers and integrations with high retry rates. Inspect the most expensive operations within each cohort.

Separate legitimate heavy usage from defects. A customer may be using an advertised unlimited export feature exactly as promised. Another may be triggering a malformed job that retries repeatedly. The first is a product-economics decision; the second is a correctness and admission problem.

Use tenant identity in consumption telemetry without putting private payloads into metrics. High-cardinality operational metrics can themselves become expensive. A dedicated usage-event pipeline can retain detailed attribution while real-time alerts use bounded dimensions.

Record both quantity and cost-relevant shape. A document count without size, page count or transformation type may not predict processing cost. A query count without scan volume or execution time may not explain database demand.

Identify capacity steps before growth reaches them

Some costs grow smoothly; others jump. A database storage limit, worker-concurrency ceiling, index footprint or provider quota can require a larger footprint at a particular workload point.

Model the capacity step and the reliability reserve. The next tier may provide more capacity than immediately needed, temporarily increasing allocated unit cost. That can be acceptable if it preserves the recovery objective and supports expected growth.

Do not extrapolate from a quiet test with uniformly small tenants. Use realistic data distributions, hot accounts, background work and deployment overlap. Test failure-mode capacity as well as the ordinary peak.

Autoscaling responds after a signal and provisioning delay. A burst shorter than that delay must be handled by reserve capacity, bounded queues or admission. Scaling every worker at once can exhaust a shared database or provider quota even when compute is available.

Track queue age and useful completion rate. A system can accept unlimited jobs while silently increasing completion delay. That is a product-contract breach, not evidence of successful scaling.

Reduce cost at the operation boundary

Eliminate duplicated work, bound queries, batch compatible operations and avoid unnecessary payload transfer. Measure the completed business operation and its effect on other tenants.

Caching can reduce repeated expensive computation when scope and acceptable staleness are defined. A global cache that omits tenant or permission scope can turn an economic improvement into a data leak. A cache whose cold misses overload the origin needs a recovery capacity plan.

For long jobs, checkpoint progress and avoid redoing all work after interruption. Use stable operation identity for paid provider calls and external effects. A worker retry should not buy the same transformation repeatedly because the local response was lost.

Consider workload placement: batch jobs with flexible deadlines may use a different capacity pool from interactive requests. The scheduler should preserve fairness and critical work rather than allowing the largest customer to occupy every slot.

Make product limits enforceable and understandable

Limits should follow the resource or value model: processed pages, export size, concurrent jobs, retained storage or another meaningful dimension. A vague “fair use” promise is difficult for both customers and operators to apply.

Enforce limits server-side at admission, and account for concurrent requests. Checking current usage and then incrementing it separately can admit several operations beyond the quota. Use a transactional reservation or another concurrency-safe budget mechanism.

Distinguish reserved, consumed and released usage. If a job reserves a budget and then fails before performing billable work, the policy may release it. If it consumes a provider service before failure, the economic cost remains even if the product chooses not to charge the customer.

Give customers visibility into usage and impending limits. A surprise rejection at the end of a long upload wastes their time and your resources. Where possible, estimate and admit before expensive processing, then reconcile actual usage under a documented rule.

Pricing and limits need product and commercial ownership. Engineering supplies measured consumption and feasible enforcement. It should not silently redefine a sold plan through a technical throttle.

Evaluate isolation as an economic choice

Pooled infrastructure can improve utilization while creating noisy-neighbor risk and attribution complexity. Dedicated resources can simplify isolation and some accounting while increasing idle capacity and operational footprint.

A hybrid model may isolate large or contractually distinct tenants while pooling routine workloads. That adds routing, provisioning, upgrade and support complexity. Price the whole operating model rather than only the tenant's compute instance.

Use measured thresholds and requirements to justify a move. A large tenant may need a separate queue budget before it needs a separate database. A compliance constraint may require isolation regardless of utilization. Keep those reasons distinct.

If a customer moves between pools, preserve identity, data ownership and accepted operations through a migration plan. A routing flag cannot make two stores consistent or undo writes accepted by the destination.

Plan for cost incidents as well as availability incidents

A bug can keep the service available while generating large provider or transfer costs. Detect abnormal attempts per operation, repeated processing, unexpected storage growth and new high-cost paths after deployment.

Use spending and usage safeguards with a clear response policy. A hard global stop may protect the bill while violating critical customer obligations. Prefer scoped containment where possible: pause the affected job type or tenant, preserve accepted work and notify the responsible operator.

Keep attribution evidence sufficient to distinguish customer demand from a software defect. Reconciliation should detect missing or duplicated usage records. The same usage data may influence invoices, so corrections need an audit trail rather than silent overwrites.

Review the cost of recovery. Rebuilding an index, replaying a backlog or restoring a database can create a temporary spend spike. Budgeting only for normal operation can leave the team reluctant to perform necessary recovery work.

Reserve cost before beginning expensive work

A job may have an estimated footprint before admission and an actual footprint afterward. Use a reservation record to connect them. For a document transformation, estimate from bounded input properties, reserve the permitted budget, then reconcile against the work actually delivered. The estimate and its error are part of the operating model.

Reservation must be concurrency-safe. Two requests reading “ten units remaining” cannot each independently reserve ten. The authoritative budget needs an atomic conditional update or equivalent transactional admission. Give the reservation the logical job identity so a retry returns the existing reservation instead of consuming another allowance.

Track reserved, consumed, released and unresolved amounts separately. A worker killed before performing paid work can release its reservation under a defined recovery rule. A worker killed after an uncertain provider call needs reconciliation before releasing it. Otherwise the customer can receive an effect while the system repeatedly returns its allowance.

Do not let a reservation expiry erase business uncertainty. Expiry can reclaim scheduling ownership, but the completed or partially completed operation still needs a record. The same distinction appears in worker leases: time passing does not prove that the old owner stopped producing effects.

Forecast a growing cohort rather than the average customer

Return to the hypothetical $100 plan. A cohort performing 1,000 jobs at $0.03 each contributes differently from one performing 10,000. If the second cohort is growing faster, last month's blended unit cost will understate next month's operating requirement.

Forecast the mix, not just total customer count. For each cohort, include job distribution, retained data, retry yield and any provider quota. Then identify the shared capacity step. A small number of large accounts can force a larger database even when their aggregate request count appears modest.

A sensitivity review should show what changes the decision: more expensive provider calls, a lower completion yield, larger inputs or a new retention promise. Keep prices dated and volumes labeled as forecasts. The purpose is to identify a threshold at which the product or architecture needs review, rather than present one precise prediction as certainty.

Customer-facing limits should follow the sold value and an enforceable resource model. A concurrency cap can protect the service while allowing a job allowance to remain generous. A processed-page limit can reflect cost more accurately than a file count. Explain the chosen unit to customers before they submit expensive work.

A cost incident needs a containment path

Suppose a deployment causes each accepted job to repeat a paid transformation because the provider response is not saved. Availability stays healthy and customers receive results, but attempts per logical operation rise. An ordinary uptime alert misses the defect.

Instrument the paid effect under a stable operation identity and detect abnormal repetitions. A scoped kill switch can pause that job class while preserving accepted work. The repair should reconcile uncertain effects before replaying the backlog; otherwise the recovery procedure repeats the cost incident.

Budget the replay as well. A day of retained jobs released at once can exhaust provider quotas and delay current work. Drain under a controlled concurrency and cost allowance, prioritize deadline-sensitive operations and keep customers informed through their durable job status. Recovery is another workload, with its own resource and economic footprint.

Decide with comparable evidence

For an architectural change, compare cost per successful operation, completion objectives, failure-mode capacity and operational effort under comparable workloads. Keep observed savings separate from forecasts and state the price assumptions' date.

Break results down by cohort. A change that benefits small tenants can increase large-tenant cost, or the reverse. An aggregate improvement may conceal a plan that remains economically unsustainable.

Record the next limiting resource and the conditions that require a new capacity or product decision. Growth should trigger a known review, not a surprise bill followed by an emergency rewrite.

The engineering goal is to preserve a useful relationship between what customers receive and what delivering it costs. Tenant-aware measurement, explicit admission and recovery-aware capacity make that relationship visible enough to improve.

About the author

Israel Oduguwa

Senior full-stack software engineer working on platform architecture, payment infrastructure and AI systems. Creator of SafeStripe and AI evaluation expert at micro1.

View my engineering work