Logo: Sre Capacity And System Design

Sre Capacity And System Design

Communautéit
paulip114
sre-capacity-and-system-design

Use when designing or reviewing a distributed system for scale and resilience — NALSD capacity math, load balancing, load shedding, retries, deadlines, graceful degradation, cascading failures, simplicity, and distributed consensus for critical state. Based on Google SRE practice.

Iwwersiicht

Editeurpaulip114
Repositorysre-practice-skills
Skill-Nummsre-capacity-and-system-design
Stären
64
Forks
19
Matgeliwwert Dateien
1
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 1 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    paulip114 huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Sre Capacity And System Design an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/paulip114/sre-practice-skills/tree/main/sre-capacity-and-system-design
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/paulip114/sre-practice-skills.git /tmp/sre-practice-skills
mkdir -p .claude/skills
cp -r /tmp/sre-practice-skills/sre-capacity-and-system-design .claude/skills/sre-capacity-and-system-design
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Sre Capacity And System Design an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Sre Capacity And System Design automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Sre Capacity And System Design net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Capacity, Overload and Reliable System Design

Design with real numbers, survive the loss of your largest failure domain, and make every component degrade gracefully instead of collapsing under load.

Overload and Cascading Failures

A cascading failure is one that grows by positive feedback: one part fails, its load moves to the rest, which then fails too. Most are driven by overload, so the defense is to make every service degrade gracefully instead of falling over.

How cascades happen

  • Server overload → slower responses → more concurrent requests → more memory/CPU → slower still.
  • Resource exhaustion: CPU (queues grow), memory (GC thrash, OOM kills), threads, file descriptors, connection pools.
  • Retry amplification: every layer retries, multiplying load on the struggling backend.
  • Crash loops / health-check churn: overloaded tasks fail health checks, get removed, pushing more load onto survivors.
  • Slow startup / cold caches: restarted tasks can't take full load yet.
  • Triggers: traffic spikes, a lost cluster/zone, bad releases, cache flushes, batch jobs, a planned change that reduces capacity.

Defenses (design time)

  1. Load-test to find the limit and how the service fails beyond it. Know which resource runs out first. A service should keep serving at its capacity under excess load, not collapse.
  2. Load shedding: reject excess requests early and cheaply (based on concurrent requests, queue length or CPU) with an explicit "overloaded" error. Keep queues short — a long queue just adds latency.
  3. Graceful degradation: serve cheaper results (cached, partial, lower quality) when overloaded. Make degraded mode easy to trigger and test it regularly.
  4. Request criticality: tag requests (e.g. critical-plus, critical, sheddable-plus, sheddable) and propagate the tag; shed least critical first. Batch and prefetch traffic should be sheddable.
  5. Retries done right:
    • Exponential backoff with jitter.
    • Per-request retry cap (e.g. 3 attempts).
    • A retry budget per client (e.g. retries ≤ ~10% of requests); stop retrying when exceeded.
    • Retry at one layer only; lower layers return "overloaded, don't retry" so the error doesn't fan out.
  6. Deadlines: every request carries a deadline, propagated (minus elapsed time) to downstream calls. Servers drop work whose deadline has already passed. Beware deadlines set far longer than useful.
  7. Client-side adaptive throttling: clients track requests vs. accepted responses over a recent window and reject locally with probability ≈ max(0, (requests − K·accepts) / (requests + 1)), with K ≈ 2. This stops wasted work at the source when the backend is rejecting.
  8. Load balancing: at the frontend, steer users by proximity and capacity (DNS, anycast, L7). In the datacenter, use subsetting (each client talks to a bounded subset of backends) and balancing on load signals (e.g. weighted round robin or least-loaded), not naive round robin.
  9. Capacity planning: provision for peak plus headroom for losing your largest failure domain (N+2 is common); forecast organic growth and launches; autoscaling with sensible min/max, scaling on the right signal, and awareness that scaling a frontend can overload a backend.
  10. Avoid dangerous behaviors: don't fail health checks just because you're busy; make startup fast and warm caches gradually; avoid synchronized clients (jitter cron and retries); test the full-cluster-loss scenario.

Recovery playbook (during an overload incident)

  1. Stop the feedback loop first: increase capacity if possible, but more importantly reduce load.
  2. Shed or block load: drop sheddable/batch traffic, rate-limit or block the abusive or misbehaving client, turn on degraded mode.
  3. Stop retries amplifying (disable client retries, raise backoff).
  4. Stop health-check churn if it is killing tasks that could serve.
  5. Restart carefully in stages, letting caches warm, rather than all at once.
  6. Add traffic back gradually, watching saturation.
  7. Afterwards: postmortem, with load test and degradation work as action items.

Review checklist for a service

  • Known capacity per task and per cluster, from load tests, with the limiting resource identified?
  • Behavior beyond capacity tested — sheds instead of collapsing?
  • Deadlines set and propagated; expired work dropped?
  • Retries bounded per request and per client, at one layer, with backoff + jitter?
  • Request criticality defined and used for shedding?
  • Degraded mode exists and is exercised?
  • Capacity covers peak with loss of the largest failure domain?
  • Health checks distinguish "dead" from "busy"?

Reliable System Design Review

Non-abstract large system design (NALSD)

Design iteratively and make every design concrete: put real numbers on it and check it would fit on real machines and networks. An elegant abstract design that needs 10× the hardware you have is not a design.

Procedure
  1. Clarify requirements. Users, operations (reads/writes), data size, request rate, latency and availability SLOs, consistency needs, growth over 1–3 years.
  2. Is it possible at all? Sketch the simplest design ignoring scale (one machine). Does it meet functional requirements?
  3. Can we do better? Improve the algorithm/data layout before adding machines (e.g. O(n) → O(log n), precompute, index).
  4. Make it scale. Distribute: shard, replicate, cache, batch. For each component, calculate:
    • Peak QPS (incl. growth and a safety factor), per-request CPU, memory, disk and network cost.
    • Storage size including replication and indices.
    • Number of machines = max over resources of (demand ÷ per-machine capacity), plus headroom.
    • Latency budget across hops vs. the SLO. Use references/estimation-cheatsheet.md for back-of-envelope numbers.
  5. Make it reliable. Place replicas across failure domains (machine, rack, zone, region); provision N+2 for the largest domain; decide degradation behavior when a component is lost.
  6. Iterate. Re-run the numbers after each change; record assumptions so they can be checked against reality later (load tests, production metrics).

Output a bill of materials (machines/resources per component per region) and the assumptions behind it.

Simplicity review

Complexity is the enemy of reliability. Distinguish essential complexity (inherent in the problem) from accidental complexity (from our solutions), and attack the latter.

Ask in review:

  • Can the design be explained in a few sentences and a single diagram?
  • Is every component, flag, and option needed now? Remove unused code and features ("negative lines of code" are a win).
  • Are APIs minimal and hard to misuse? Are modules loosely coupled with clear ownership?
  • Are releases small and frequent rather than large and rare?
  • Is the system boring in the good sense — predictable, using well-understood technology?
  • Track complexity over time (number of dependencies, config knobs, services); push back when it grows without need.

Critical state and distributed consensus

For state that must be consistent across replicas (leader election, locks, configuration, metadata, queues that must not lose or duplicate work):

  • Use a proven consensus system (Paxos/Raft-based: e.g. etcd, ZooKeeper, Spanner-like stores) instead of ad-hoc heartbeats or "whoever writes last wins". Heartbeat-based leader election suffers split-brain under network partitions.
  • Understand the trade-off (CAP): under partition you choose between availability and consistency — for critical state, choose consistency.
  • Performance: consensus needs a quorum round-trip per write; place replicas so a quorum is close together for latency, while still spread enough to survive the failure domains you care about. Typically 5 replicas tolerate 2 failures; 3 tolerate 1.
  • Batch and pipeline proposals to increase throughput; serve reads from leader leases or followers only when stale reads are acceptable.
  • Monitor: number of healthy replicas, leader changes, proposal latency, lagging replicas, quorum loss risk.
  • Keep the consensus system small and dedicated; put bulk data elsewhere and store only pointers/metadata in it.

Review checklist

  • Requirements quantified (QPS, data size, SLOs, growth)?
  • Capacity math shown per component, with assumptions written down?
  • Failure domains identified; design survives loss of largest one at peak?
  • Critical state handled by a consensus system, with replica placement justified?
  • Degradation plan when a dependency fails?
  • Accidental complexity challenged; the simplest workable design chosen?

Sources

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Sre Capacity And System Design?

Use when designing or reviewing a distributed system for scale and resilience — NALSD capacity math, load balancing, load shedding, retries, deadlines, graceful degradation, cascading failures, simplicity, and distributed consensus for critical state. Based on Google SRE practice.

Firwat Sre Capacity And System Design op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Sre Capacity And System Design besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Sre Capacity And System Design an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/paulip114/sre-practice-skills/tree/main/sre-capacity-and-system-design an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Sre Capacity And System Design benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Sre Capacity And System Design benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Sre Capacity And System Design domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Sre Capacity And System Design gratis?

Jo. paulip114 huet de Skill ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇