Large-Scale Infrastructure Operations Questions
Operating infrastructure at high scale and volume: 24/7 high-availability operations, remote troubleshooting across large fleets, and managing platform reliability for large user bases. Covers the operational patterns and constraints that only appear at scale, including capacity, fleet management, and platform integrity. The scale-specific operations discipline.
Describe the role of an API gateway in a multi-region deployment. Which gateway features (SSL termination, routing, authentication, rate limiting, circuit breaking, observability) are most critical to ensure reliability and low latency globally, and how would you architect redundancy for the gateway itself?
Sample Answer
Role: The API gateway in a multi-region deployment is the global entry point that enforces security, routes traffic to nearest healthy backend, shapes traffic, and provides a consistent observability surface. Its job for SREs is to minimize latency, protect backend capacity, and enable fast failover.
Critical features and why:
- Global routing/traffic steering: latency-based or geo-DNS + Anycast to send clients to the lowest-latency/closest region; essential for low latency.
- SSL termination: terminate at the edge/POPs to avoid extra RTTs; use modern TLS+HTTP/2/QUIC for performance.
- Authentication: validate tokens (JWT/OAuth) at the gateway to fail fast; prefer stateless token validation at edge to avoid cross-region calls.
- Rate limiting & quotas: enforce per-key and global limits at the gateway to protect downstream services; implement hybrid (local counters + global sync) to avoid global coordination latency.
- Circuit breaking & retries: fail fast and short-circuit unhealthy backends regionally to preserve capacity and reduce tail latency.
- Observability: distributed tracing, metrics (latency, error rates), and structured logs at the gateway are critical for SLOs and incident response.
Recommended architecture for redundancy and reliability:
- Active-active deployment: deploy gateways in every region/edge POP. Use Anycast or a global load balancer (Cloud IDS/Global LB + health checks) for client routing and automated failover.
- Stateless gateway instances: keep config in a central store (GitOps + CDN/config distribution) so instances can be autoscaled and replaced quickly.
- Health checks & locality aware routing: route only to healthy regions; use weighted failover to drain traffic gracefully.
- Configuration and secret sync: replicate TLS certs and auth keys via secure vaults and signed artifacts; use versioned rollout and canary to avoid config-induced outages.
- Rate-limit design: prefer local enforcement with periodic reconciliation to avoid a single point of coordination; for strict global quotas use a fast global store or token-bucket tokens issued by a regional broker.
- Observability & runbooks: centralize metrics/trace ingestion (sampling at gateway), alert on gateway latency/error ratios, and predefine regional failover playbooks.
Trade-offs: terminating TLS at edge reduces latency but increases key distribution complexity. Global limits provide stronger guarantees but add latency/complexity; balance with SLOs.
Design a testable disaster recovery (DR) system that supports automated full failover drills for critical services including synthetic verification tests and data integrity checks. Describe how to schedule drills, isolate test traffic from production, automate validation, and handle rollback after failed tests while minimizing customer impact and meeting compliance requirements.
Sample Answer
Requirements & constraints:
- Full automated failover drill for critical services with minimal customer impact
- Synthetic verification + data integrity checks
- Scheduled + ad-hoc runs, isolation of test traffic, automated validation, rollback on failure
- Auditability for compliance, RBAC
High-level architecture:
- Orchestrator (Kubernetes Job/Argo Workflows or Jenkins/Concourse pipeline) drives drill steps
- DR Playbook service (YAML/JSON per-service drill definitions)
- Environment controller (provisions isolated DR namespace/tenants, test network overlays)
- Traffic switcher (feature-flagged DNS / traffic steering via Envoy or global load balancer)
- Synthetic test runner (k6/Robot/pytest suites) and data-integrity checker (schema checks, checksums, row counts, test DB clones)
- Observability & validation engine (Prometheus + custom validators) reads SLOs, metrics, logs
- Audit & reporting (immutable logs to S3 + signed attestations)
Drill flow:
- Pre-checks: capacity, backups, schema compatibility, consent windows (business calendar)
- Snapshot production data to isolated test copies (snapshots, logical backups) with PII masking
- Provision isolated DR environment: separate VPC/subnets, namespaces, service accounts
- Controlled failover: orchestrator triggers traffic switcher to route a small percentage (canary) of synthetic traffic only to DR env; production traffic untouched
- Synthetic verification: health endpoints, end-to-end flows, latency/throughput tests run as suites; data-integrity: replay subset of write workload against test DB and verify checksums/consistency
- Progressive ramp: if green, increase percentage and run full failover simulation; if any validator fails, trigger rollback
Isolation of test traffic:
- Use separate DNS names / header-based routing or mTLS client certs to ensure synthetic requests are distinguishable
- Network-level isolation via test VPC peering and egress controls
- No production write paths enabled from test env unless using read-only snapshots
Automation & validation:
- Validators codified as pass/fail with thresholds; observability exposes SLOs and slis
- Orchestrator polls validators and enforces timeouts
- Failure modes captured: critical, warning with remediation playbooks
- All actions logged with timestamps, operator IDs, CI run IDs for compliance
Rollback & minimizing customer impact:
- Default to "non-disruptive" canary-first approach; only escalate to full traffic switch after multi-stage green checks
- On failure: immediate traffic re-route back to production via traffic switcher (atomic DNS/ratelimit rollback), terminate DR env to prevent drift, and run automated remediation (restore snapshots, re-sync)
- Post-failure: run automated incident creation with attachments, and require manual approval for repeat attempts
Compliance & audit:
- Immutable logs, signed attestations, encryption-at-rest/in-transit, PII masking, role-based approvals, retention policies
- Pre-drill approvals and blackout windows recorded; drill reports with evidence (screenshots, test results, hashes) stored for audits
Trade-offs:
- Full production write simulation expensive and risky — prefer sampled replay onto masked clones
- Faster drills vs deeper tests: balance via tiering of services (critical vs non-critical)
Implementation notes:
- Use Infrastructure-as-Code (Terraform) and GitOps for playbooks
- Use feature flags and canary tooling (Flagd/LaunchDarkly + Istio/Envoy)
- Continuous improvement: run quarterly full drills, weekly mini-canaries, and automated postmortems.
Design a secrets management and key rotation strategy for 2000 services across 50 clusters and multiple clouds that ensures zero-downtime rotations, strong auditability, and compliance. Consider centralized vaults, cloud KMS, sidecar injection, ephemeral credentials, and patterns for secret distribution and revocation.
Sample Answer
Requirements (clarify):
- Zero-downtime rotations for 2000 services across 50 clusters & multiple clouds
- Strong auditability (immutable logs, tamper-evidence) and compliance (RBAC, MFA, policy enforcement, attestations)
- Support centralized control, cloud-native KMS, sidecar/CSI injection, ephemeral creds, and safe revocation
High-level architecture:
- Central logical Vault layer (HashiCorp Vault or equivalent) deployed per region for HA + cross-region replication; back-end master keys wrapped by cloud KMS or HSM (multi-cloud KMS integration)
- Transit encryption handled by Vault; secrets versioned and lease-based
- K8s clusters use CSI driver + a small secret sidecar agent per pod (or workload) that fetches and caches secrets with short TTLs; non-K8s VMs use lightweight agent
- Dynamic credentials issued on demand (database, cloud IAM) with short leases/ephemeral tokens
- Centralized audit pipeline: Vault audit devices -> immutable store (WORM/S3 with Object Lock or SIEM) and streaming to Splunk/Elastic/Cloud logging
Key rotation & zero-downtime pattern:
- Use key/versioned secret abstraction (SecretID v1, v2...) and dual-read mode during rotation.
- Staged rollouts: issue rotated secret versions while services continue reading current version until rotation signal.
- Sidecar supports multi-version reads: attempts new version then falls back to older version during transition window.
- Ephemeral creds: rotate underlying long-lived credentials inside Vault, and issue short leases to services — rotation becomes issuance of new leases rather than forcing immediate change.
- Grace period & health checks: orchestrate rollout using deployment controllers to restart or hot-reload config when new secret becomes available; monitor health before deprecating old version.
- Revoke path: revoke leases centrally — Vault revocation propagates to agents which expire cached secrets; for immediate revocation, agents proactively drop connections and trigger reconnects.
Secret distribution & revocation patterns:
- Pull model by trusted agents (preferred) vs push for legacy systems.
- Agents cache secrets with enforced TTL and refresh policy; don't persist to disk unless encrypted with envelope keys.
- Revocation via lease revoke APIs, CRLs for cert-based secrets, and IAM revoke for cloud tokens. Agents subscribe to a revocation/transient channel to receive immediate revoke signals.
- For DB/cloud creds: use brokered dynamic credentials created by Vault, revokable instantly.
Auditability & compliance:
- All access and mutation events recorded with context (caller identity, host, pod, workload identity) and shipped to immutable audit store.
- Enforce MFA and short-lived operator creds for secret admin tasks; use OIDC + fine-grained policies.
- Periodic attestation and automated evidence generation for auditors (rotation history, lease records, revocations).
- Use HSM/cloud-KMS for root key material; key usage logged to meet compliance.
Operational considerations / scaling:
- Autoscale Vault performance nodes; offload heavy crypto to KMS/HSM.
- Rate-limit secret issuance and use caching to reduce load.
- Chaos-test rotations and revocations in staging; run canary rotations before global.
- Alerts: failed refresh/error rates, high cache hit/miss, revocation failures, audit delivery lag.
Trade-offs:
- Pull + short TTL = stronger security, more load on Vault (mitigate with caching/replication).
- Sidecar complexity vs simplicity of mounted secrets; sidecars give better control for graceful rotation.
- Immediate revocation may cause transient outages for stateful sessions—use application-level reconnect logic and rolling invalidation.
This strategy ensures zero-downtime rotations by issuing new versions/ephemeral tokens, providing controlled rollout and graceful fallback; guarantees auditability via immutable logs and KMS/HSM-backed key material; and supports compliance with RBAC, MFA, and automated evidence for auditors.
For a mid-level SRE candidate: describe a project where you reduced operational toil by at least 30%. Include the initial manual steps, your automation approach, how you measured the reduction, and how you validated reliability improvements.
Sample Answer
Situation: At my last role we supported a Kubernetes-backed billing service. On-call engineers spent ~25 hours/week on a repeated release-and-restart workflow and post-deploy verification — mostly manual — which blocked higher-value work.
Task: Reduce operational toil by ≥30% while keeping or improving reliability.
Action:
- I documented the existing manual steps: (1) build image, (2) push to registry, (3) update Helm values, (4) helm upgrade, (5) run smoke tests, (6) manually roll back on failures, (7) update runbook and Slack channel. This happened ~12 times/week and took ~2 hrs per deploy.
- Automated the pipeline with Jenkins + declarative pipelines and integrated Terraform/Helm. I wrote idempotent deployment jobs in Groovy and a small Python library to run deterministic smoke tests and health-checks against /metrics and business endpoints.
- Implemented automated canary promotion: deploy to 5% of pods, run smoke + acceptance tests, promote to 100% if green; otherwise auto-roll back.
- Replaced manual Slack pings with PagerDuty alerts triggered by Prometheus alertmanager when canary failures occurred and posted structured results to a deployment channel.
- Added runbook-driven playbooks as code and CI gating to prevent manual bypass.
Result / Measurement:
- Baseline: measured toil by logging time-per-deploy and counting deploy frequency for 4 weeks. Baseline weekly toil = 25 hours.
- After automation, average weekly toil dropped to 13.5 hours — a 46% reduction (measured over 6 weeks).
- Reliability improved: MTTR for deploy-related incidents fell from 2.4 hours to 0.6 hours; failed deployments decreased 60%; SLO compliance for 99.9% uptime improved from 98.7% to 99.93% over the quarter.
- Validation: ran rollback drills and chaos tests (killing canary pods) to ensure automation behaved correctly; verified auto-rollbacks and alerting; ran load tests during promotion to ensure no regressions.
Learning: Automate repeatable human steps, add safety gates (canaries + tests), and measure both time saved and service-level metrics to prove value.
Design a cross-region caching strategy for user session data where some fields require low-latency consistency (e.g., authentication token) and other fields can be eventually consistent (e.g., preference flags). Explain cache partitioning, TTLs, replication, and fallback patterns to the authoritative store.
Sample Answer
Clarify requirements:
- Strong read-after-write/low-latency consistency for auth-critical fields (auth token, user session validity).
- Eventual consistency acceptable for user preferences, UI flags.
- Cross-region reads with low latency; tolerance for temporary divergence for non-critical fields.
- High availability and clear rollbacks during region outages.
Design (high level):
- Multi-tier cache: (1) local per-node in-memory LRU (very short-lived), (2) regional Redis cluster (primary cache), (3) authoritative store (global DB like Spanner/Cockroach / primary user store).
Cache partitioning:
- Partition by user-id using consistent hashing so a user’s session keys map to the same regional cache shard; ensures even load and easier targeted invalidation.
- Separate key namespaces for strong vs eventual fields, e.g., session:{user}:auth and session:{user}:prefs. This allows different policies per namespace.
Replication & consistency:
- Auth namespace: synchronous replication across at least majority of regional replicas (or use a distributed consensus-backed store / Redis with CRDT or Redis Raft) so reads in-region see most recent writes. Use short TTL (e.g., 30s–120s) and write-through from app -> cache -> authoritative store (or write to DB then invalidate/refresh cache synchronously) to guarantee freshness.
- Prefs namespace: asynchronous replication between regions (eventual). Longer TTLs (minutes to hours). Use update propagation via CDC or pub/sub to reduce load on authoritative DB.
TTLs & eviction:
- Auth token: very short TTL plus Signed Tokens (JWT) with expiry to reduce need for lookups; keep a blacklist/allowlist in strongly-consistent store for revocation. Use “cache-aside” or write-through with immediate invalidation on write.
- Preferences: longer TTL and support stale-while-revalidate: serve stale cached value while background job refreshes from authoritative store.
Fallback patterns:
- Read-through / cache-aside for both namespaces: app checks cache, on miss reads authoritative store and populates cache.
- Stale-while-revalidate for prefs: return cached value immediately, trigger async refresh; return stale only up to a max window configured.
- For auth: on cache miss, synchronously read authoritative store; if authoritative store unreachable, fail-safe: allow token if locally validated signature + not blacklisted (configurable risk), else deny — document as SRE-runbook with incident thresholds.
- Circuit breakers and graceful degradation: if cross-region replication lag exceeds threshold, route reads to local authoritative replica or force revalidation.
Operational considerations:
- Instrument replication lag, cache hit ratio, TTL expirations, and token revocation latency. SLOs: auth validation p99 < X ms; correctness SLO for revoked tokens < Y seconds.
- Automated reconciliation jobs for prefs (detect drift), and periodic cache priming for high-traffic users.
- Security: encrypt cache-in-transit and at-rest, rotate keys, and monitor suspicious access patterns.
Trade-offs:
- Strong consistency for auth increases latency and operational complexity; mitigate with short JWTs and local signature checks.
- Eventual prefs reduce cross-region write amplification at cost of temporary divergence—acceptable for UI flags.
This design balances low-latency auth correctness with scalable, eventually-consistent session metadata, with clear fallback, monitoring, and runbook steps for SRE operations.
Unlock Full Question Bank
Get access to all 41 Large-Scale Infrastructure Operations interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.