LumenForgee

Casebook

The infrastructure casebook

Eight situations we meet again and again. Each describes what goes wrong, the approach we take and the measurements that tell us it worked.

These scenarios describe generic engineering patterns, not individual client projects. They contain no client names, dates or results; the measurements describe what we track, not outcomes we promise.

Observability

Telemetry costs grow faster than traffic

Platforms that adopted metrics and tracing quickly, without budgets per service.

What goes wrong

A team adds a label such as a user or order ID to a request metric. The number of time series explodes, queries slow down, and storage costs rise every month while the dashboards people actually use stay the same.

Approach

  • Inventory series by metric and label to find the few attributes responsible for most of the volume.
  • Set a cardinality budget per service and enforce it in the collector by dropping or aggregating attributes.
  • Move high-cardinality detail from metrics to traces, where it is sampled.
  • Introduce tail-based sampling that keeps all errors and slow traces.

How success is measured

  • Active series per service against its budget
  • Telemetry volume per request served
  • Share of errors and slow requests still captured in traces
  • Query latency of the most-used dashboards
Databases

A routine migration locks the busiest table

Teams that run migrations automatically on deploy against large, write-heavy tables.

What goes wrong

A migration that adds a column with a default or a constraint needs a strong lock. While it waits for a long-running transaction, every new query on the table queues behind it. Connections fill up and the application stops responding — even though the migration itself would have been quick.

Approach

  • Set lock_timeout and statement_timeout for every migration so it fails fast instead of blocking traffic.
  • Rewrite risky changes as expand/contract phases: nullable columns, concurrent index builds, validated constraints added in two steps.
  • Run backfills as throttled, resumable jobs.
  • Lint migrations in CI for operations that rewrite tables or take strong locks.

How success is measured

  • Lock wait time during deployments
  • Migrations rejected by CI versus migrations that caused incidents
  • Backfill throughput while p95 query latency stays within budget
  • Deployments needing a maintenance window (target: none)
Multi-tenancy

One tenant's batch job slows everyone down

B2B SaaS platforms where all tenants share databases and worker pools.

What goes wrong

All tenants share one database and one worker pool. When a large tenant runs an export or an integration floods the API, it consumes connections and CPU that everyone needs. Support tickets arrive from customers who did nothing unusual.

Approach

  • Introduce per-tenant quotas at every shared resource: request rate, concurrent jobs, connections and query time.
  • Separate interactive and batch work into different queues and pools.
  • Make isolation a tier: heavy tenants can move to a dedicated schema or database without code changes.
  • Expose per-tenant usage so limits are visible to the customer and to support.

How success is measured

  • p95 latency for small tenants while a large tenant runs batch work
  • Quota rejections per tenant and their trend
  • Connection pool saturation by workload class
  • Time needed to move a tenant to a stronger isolation tier
Identity & secrets

A credential leaks and nobody knows what depends on it

Platforms with long-lived shared secrets distributed through configuration files.

What goes wrong

A long-lived password is shared by several services and copied into configuration. When it leaks, rotating it risks an outage because nobody has a complete list of consumers, and some of them only read configuration at start-up.

Approach

  • Build a secret inventory with owners, consumers and rotation intervals.
  • Move consumers to fetch secrets at runtime from a central store with a short cache.
  • Rotate with an overlap window in which old and new credentials both work.
  • Replace shared static passwords with per-service, short-lived credentials where possible.

How success is measured

  • Time from decision to complete rotation
  • Share of credentials that are dynamic or rotated automatically
  • Authentication failures during rotation (target: none)
  • Secrets detected in repositories or logs, blocked before merge
Release engineering

A faulty release reaches every user at once

Teams deploying several times a week with all-at-once rollouts.

What goes wrong

Every deployment switches all traffic to the new version. When a defect slips through tests, all users are affected immediately, and rollback depends on a person noticing the problem and knowing the right procedure under pressure.

Approach

  • Introduce progressive delivery: small traffic steps with pauses long enough to judge.
  • Define automated analysis comparing the new version with the stable baseline.
  • Make rollback automatic when analysis fails, and rehearse manual rollback as well.
  • Keep database changes compatible with both versions during a rollout.

How success is measured

  • Share of users exposed when a faulty version is detected
  • Time from failed analysis to traffic restored
  • Change failure rate and time to restore over a quarter
  • Releases promoted manually against a failed analysis (target: none)
API contracts

A small API change breaks integrations nobody knew about

Platforms with public or partner APIs and no formal compatibility checks.

What goes wrong

A developer renames a response field or tightens validation. Internal tests pass, but external integrations that relied on the old behaviour fail. There is no list of who uses which endpoint and no agreed way to announce changes.

Approach

  • Make the contract (OpenAPI, Protobuf or AsyncAPI) the source of truth and lint it in CI.
  • Add an automatic compatibility check that blocks breaking changes without a new version.
  • Track usage per client and endpoint so deprecations can be targeted.
  • Announce deprecations in documentation and at runtime with the Deprecation and Sunset headers.

How success is measured

  • Breaking changes caught in CI versus reported by integrators
  • Traffic still using deprecated endpoints as the sunset date approaches
  • Time from deprecation notice to last call
  • Integrator-reported incidents per release
Resilience

A third-party outage takes the whole product down

Services that call several external APIs synchronously from shared thread or connection pools.

What goes wrong

One external dependency slows down instead of failing. Calls wait for the full timeout, shared pools fill up, and unrelated features that use the same pools stop responding. The outage looks internal although its cause is outside.

Approach

  • Give each external dependency its own timeout, connection pool and concurrency limit (bulkheads).
  • Add circuit breakers that fail fast once a dependency is clearly unhealthy.
  • Define a degraded mode per feature: cached data, a simplified flow or a clear message.
  • Test the degraded modes with injected latency and errors before they are needed.

How success is measured

  • Availability of unrelated features while a dependency is slow
  • Time for circuit breakers to open and recover
  • Requests served in degraded mode versus failed
  • Fault-injection tests run per quarter
Data consistency

The search index slowly drifts from the database

Systems that update a search index from application code after each write.

What goes wrong

Application code writes to the database and then updates the search index in a separate call. Occasional failures and races leave the index out of date. Nobody notices until customers report it, and the only fix is a slow full reindex.

Approach

  • Feed the index from the database change stream instead of from application code.
  • Make indexing idempotent and versioned so replays are safe.
  • Run continuous reconciliation that samples records and compares source and index.
  • Build new indexes in the background and switch with an alias, so reindexing needs no downtime.

How success is measured

  • Lag between a database write and its visibility in search
  • Mismatch rate found by reconciliation sampling
  • Duration of a full reindex and its impact on live queries
  • Customer reports of stale search results