Cost as a system design constraint: estimating monthly Azure cost from capacity numbers, the usual cost drivers (compute, database, egress, telemetry, idle environments), design and commercial levers, unit economics, and FinOps practice.
I treat cost like latency: an estimated, measured number in the design. From the capacity table I derive instance counts, database tier, storage GB-months, egress and telemetry volume, price them in the Azure pricing calculator with stated assumptions, and express the result as unit economics โ cost per 1,000 orders or per tenant per month. The usual drivers are always-on compute, a database sized for peak, log ingestion, cross-region traffic and idle non-production environments. Design levers: autoscale and scale to zero, cache to shrink the database, queues to flatten peaks, storage tiers and retention. Commercial levers: reservations or savings plans for the base, spot for batch. The trade-off: every saving costs something โ headroom, latency, resilience or engineering time โ so I price each against its reliability impact.
"I'd treat cost as a non-functional requirement with a number, not a surprise at the end. I take the capacity estimate โ say 300 requests a second average, 1,500 at peak, 2 TB of data growing 500 GB a year, 5 TB a month of egress โ and turn each line into a billable unit: instance-hours, database vCores, GB-months, GB of egress, GB of logs ingested. I price them in the Azure pricing calculator with my assumptions written down, and then I divide by a business unit, like cost per 1,000 orders or per tenant per month, because that's what finance can plan with.
In my experience the bill is dominated by a few predictable things: compute that's always on and sized for peak, a database tier chosen for the worst hour of the year, telemetry nobody samples, and non-production environments that run all weekend. For example, at [company] we [had an Azure bill of around $X a month where Application Insights ingestion was the second-largest line]. I [introduced sampling, moved verbose logs to a cheaper table plan and cut retention for debug data, and scheduled dev and test environments to shut down out of hours], [and the bill dropped about 35% with no change to our SLOs]. Then I'd look at design changes: caching to drop a database tier, a queue to flatten a peak so I don't provision for it, scale-to-zero for spiky workloads on Container Apps or Functions, and lifecycle policies to move old blobs to cool or archive.
The mistake I see is cutting cost by cutting redundancy โ dropping zone redundancy or backups to save a few hundred dollars โ without pricing the outage risk. Or the opposite, buying reservations before right-sizing, which locks in waste for a year or three. My order is: measure, remove waste, right-size, redesign the expensive parts, then commit with reservations for the steady base. Cost is a design constraint like any other, and the senior move is making the trade-off explicit."
| Line | Capacity input | Billable unit | Driver to check |
|---|---|---|---|
| API compute | 1,500 req/s peak รท ~500 req/s per replica = 3 + 1 spare | vCPU/GiB-seconds or instance-hours | Peak vs average: autoscale or reserve the base |
| Database | 300 writes/s, 2 TB | vCores, storage GB, backup GB | Sized for peak hour; can a cache drop a tier? |
| Cache | 10 GB hot set | Redis tier | Often pays for itself by shrinking the DB |
| Storage | +500 GB/year | GB-month by tier, operations | Lifecycle to cool/archive |
| Egress | 5 TB/month | GB out of Azure, cross-region | CDN (Front Door) caching, keep traffic in region |
| Telemetry | 50 GB/day logs | GB ingested + retention | Sampling, levels, table plans |
| Non-prod | 3 environments | Same as prod if cloned | Smaller SKUs, shut down out of hours |
Unit prices change and vary by region and agreement, so I always price with the Azure pricing calculator for Australia East at the time and quote the assumptions rather than memorised numbers.
| Lever | Typical saving | Risk / cost | When not to |
|---|---|---|---|
| Remove idle / orphaned resources | 5โ15% | Very low | Never a reason not to |
| Right-size (CPU, DB tier) | 10โ30% | Less headroom | Just before a known peak |
| Autoscale / scale to zero | High for spiky loads | Cold starts | Latency-critical steady loads |
| Reservations / savings plans | Up to roughly half off pay-as-you-go for steady base | 1โ3 year commitment | Before right-sizing |
| Spot VMs | Large discounts for interruptible work | Eviction | Stateful or user-facing |
| Telemetry sampling and retention | Often large | Less detail in rare cases | Audit logs you must keep |
| Caching | Lets DB drop a tier | Staleness, invalidation | Strongly consistent reads |
A [SaaS] platform costing [$31k] by shutting down non-production overnight and at weekends ([-12%]), sampling and re-tiering telemetry ([-9%]), adding Redis so Azure SQL could drop from [16 to 8 vCores] ([-8%]), and buying a savings plan for the steady compute base ([-6%]). SLO attainment stayed at [99.96%].
Checks whether the candidate can estimate and reduce the running cost of a design with the same rigour as performance and reliability, without trading away safety blindly.
Green flags
Red flags
cost = ฮฃ (units consumed ร unit price)
units consumed = f(traffic, data, retention, redundancy, environments)
Every design choice changes a term: zone redundancy multiplies some resources, a cache trades Redis cost for database cost, a CDN trades Front Door cost for egress and origin compute.
load
^ peak (1,500 req/s, 2 h/day)
| /\
| ____/ \____ average 300 req/s
+---------------------> time
Provisioning for peak all day pays for idle capacity ~90% of the time. Options: autoscale (Container Apps, App Service, AKS HPA/KEDA), queue-based load levelling (accept work quickly, process at a steady rate), or reserve the base and pay-as-you-go for the burst.
LogLevel filtering, daily caps, and cheaper table plans for low-value logs.Total monthly cost tells you little; cost per business unit tells you whether the design scales. If cost per 1,000 orders rises as volume grows, something is super-linear (a fan-out, a cross-partition query, an unsampled log). Track it monthly.
env, team, product), Azure Cost Management views, budgets with alerts.Never trade away backups, zone redundancy for critical stores, or security controls (WAF, private endpoints, Defender) without pricing the risk: expected outage cost = probability ร impact. A $300/month saving that adds a 1% annual chance of a $500k outage is a bad deal.
Usage to find which tables ingest the most data.Two cheap, high-impact changes in a .NET 10 service: sampled telemetry and log levels that keep noisy categories out of paid ingestion.
using Azure.Monitor.OpenTelemetry.AspNetCore;
var builder = WebApplication.CreateBuilder(args);
// Azure Monitor OpenTelemetry distro: sample traces instead of sending every request.
// 0.2 keeps 20% of traces; errors still show up in metrics, which are not sampled.
builder.Services.AddOpenTelemetry().UseAzureMonitor(o =>
{
o.SamplingRatio = 0.2f;
});
// Keep chatty framework categories out of paid log ingestion.
builder.Logging.AddFilter("Microsoft.AspNetCore", LogLevel.Warning);
builder.Logging.AddFilter("Microsoft.EntityFrameworkCore.Database.Command", LogLevel.Warning);
var app = builder.Build();
app.MapGet("/health", () => Results.Ok());
app.Run();
Finding the biggest telemetry cost in Log Analytics:
Usage
| where TimeGenerated > ago(30d) and IsBillable == true
| summarize IngestedGB = sum(Quantity) / 1024 by DataType
| order by IngestedGB desc
A scale-to-zero worker in Azure Container Apps (Bicep excerpt): replicas follow queue length instead of running all day.
scale: {
minReplicas: 0
maxReplicas: 20
rules: [
{
name: 'orders-queue'
custom: {
type: 'azure-servicebus'
metadata: { queueName: 'orders', messageCount: '50' }
identity: 'system'
}
}
]
}
Seniors make cost visible and comparable: a number in the design, a unit cost the business understands, and tags so the bill maps to teams and products. The best savings come from design (fewer always-on resources, smaller hot data, less telemetry noise) rather than haggling over SKUs, and the worst ones come from quietly removing resilience. Measure with Azure Cost Management and Advisor, and review it monthly like any other SLO.
| Option | When it fits | Cost / risk | When not to |
|---|---|---|---|
| Serverless / scale to zero (Functions Flex Consumption, Container Apps) | Spiky or low traffic, background work | Cold starts, per-execution pricing at high volume | Steady high load (reserved compute is cheaper) |
| Reserved / savings plan | Steady base load known for 1โ3 years | Commitment | Unstable or shrinking workloads |
| Cache to shrink DB | Read-heavy with tolerable staleness | Redis cost, invalidation | Write-heavy, strongly consistent reads |
| Tiered storage and retention | Data rarely read after N days | Retrieval latency and fees | Frequently accessed data |
| Multi-region | Business needs regional resilience | Roughly 2ร infrastructure | When zone redundancy meets the SLO |
I choose by how much platform the team wants to run:
The trade-off is control versus operations: each step towards AKS gives more control and more work. I start with the simplest option that meets the requirements and move only when I hit a concrete limit.
Cardinality is the number of unique label combinations; each is a separate time series. A user_id label multiplies a metric's series by the number of active users, and on a histogram that is again multiplied by every bucket, so 20 routes ร 5 status codes ร 17 buckets ร 50,000 users is 85 million series.
I confirm it with prometheus_tsdb_head_series (or the Azure Monitor workspace's active series and ingestion metrics), find the metric with topk(10, count by (__name__) ({__name__=~".+"})), and the label with count(count by (user_id) (...)). I stop the bleeding without a deploy by dropping the label in the OpenTelemetry Collector or with Prometheus labeldrop, then remove the tag in code and move per-user questions to traces and logs.
The trade-off: per-user detail is real value, but metrics are the wrong place for unbounded data.
A capacity estimate turns user numbers into load. Start with daily active users ร actions per user to get requests per day, divide by ~86,400 s (round to 10^5) for average requests/s, then multiply by a peak factor (2โ10ร, often 3ร). For storage, multiply writes per day by record size and 365, then add indexes and replicas. For bandwidth, multiply requests/s by payload size.
Example: 10M DAU ร 20 reads = 200M reads/day โ 2,300/s average, ~7,000/s peak.
The point is not precision โ it's deciding whether one database and a cache are enough or you need partitioning. The trade-off is speed versus accuracy: round hard, but state every assumption.
How to tell it (STAR)
**S:** Our [SaaS] Azure bill was growing faster than revenue, and finance asked for a [25%] cut. **T:** I had to find savings without hurting reliability. **A:** I broke the bill down by service and tag, shut non-production down out of hours, sampled and re-tiered telemetry, added a cache so the database could drop a tier, and only then committed to a savings plan for the steady base. **R:** The bill fell from [~$48k] to [~$31k] a month, a [35%] cut, and SLO attainment stayed at [99.96%].
Last updated 23 Nov 2026.