@radicaltools/mcp 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/README.md +41 -23
  2. package/dist/{chunk-OGN3UW2D.js → chunk-Z7THA3L5.js} +670 -64
  3. package/dist/{elkLayout-S62RLGTO.js → elkLayout-TAUBPPVN.js} +1 -1
  4. package/dist/hub-catalogue/concern/concern-api-evolution.radical +935 -0
  5. package/dist/hub-catalogue/concern/concern-architecture-style.radical +1112 -0
  6. package/dist/hub-catalogue/concern/concern-authentication.radical +685 -0
  7. package/dist/hub-catalogue/concern/concern-authorization.radical +1464 -0
  8. package/dist/hub-catalogue/concern/concern-availability.radical +804 -0
  9. package/dist/hub-catalogue/concern/concern-backend-stack.radical +1118 -0
  10. package/dist/hub-catalogue/concern/concern-backup-recovery.radical +1304 -0
  11. package/dist/hub-catalogue/concern/concern-capacity.radical +802 -0
  12. package/dist/hub-catalogue/concern/concern-communication-style.radical +1202 -0
  13. package/dist/hub-catalogue/concern/concern-data-consistency.radical +1081 -0
  14. package/dist/hub-catalogue/concern/concern-data-store.radical +960 -0
  15. package/dist/hub-catalogue/concern/concern-decomposition.radical +1143 -0
  16. package/dist/hub-catalogue/concern/concern-deployment.radical +952 -0
  17. package/dist/hub-catalogue/concern/concern-encryption.radical +1055 -0
  18. package/dist/hub-catalogue/concern/concern-frontend-stack.radical +1340 -0
  19. package/dist/hub-catalogue/concern/concern-infrastructure.radical +1151 -0
  20. package/dist/hub-catalogue/concern/concern-integration-resilience.radical +1079 -0
  21. package/dist/hub-catalogue/concern/concern-messaging.radical +940 -0
  22. package/dist/hub-catalogue/concern/concern-module-boundaries.radical +864 -0
  23. package/dist/hub-catalogue/concern/concern-observability.radical +1048 -0
  24. package/dist/hub-catalogue/concern/concern-personal-data.radical +1434 -0
  25. package/dist/hub-catalogue/concern/concern-rate-limiting.radical +1153 -0
  26. package/dist/hub-catalogue/concern/concern-secrets.radical +1026 -0
  27. package/dist/hub-catalogue/concern/concern-supply-chain.radical +1312 -0
  28. package/dist/hub-catalogue/concern/concern-tenant-isolation.radical +1306 -0
  29. package/dist/hub-catalogue/concern/concern-test-strategy.radical +1193 -0
  30. package/dist/index.js +9440 -3854
  31. package/package.json +1 -1
  32. package/dist/hub-catalogue/adr/adr-api-versioning.radical +0 -53
  33. package/dist/hub-catalogue/adr/adr-auth-strategy.radical +0 -53
  34. package/dist/hub-catalogue/adr/adr-caching-strategy.radical +0 -59
  35. package/dist/hub-catalogue/adr/adr-data-consistency-model.radical +0 -40
  36. package/dist/hub-catalogue/adr/adr-data-store.radical +0 -47
  37. package/dist/hub-catalogue/adr/adr-deployment-strategy.radical +0 -53
  38. package/dist/hub-catalogue/adr/adr-event-schema-evolution.radical +0 -53
  39. package/dist/hub-catalogue/adr/adr-integration-style.radical +0 -50
  40. package/dist/hub-catalogue/adr/adr-ledger-reconciliation-strategy.radical +0 -38
  41. package/dist/hub-catalogue/adr/adr-llm-provider-strategy.radical +0 -40
  42. package/dist/hub-catalogue/adr/adr-marketplace-payments-model.radical +0 -39
  43. package/dist/hub-catalogue/adr/adr-multi-region.radical +0 -60
  44. package/dist/hub-catalogue/adr/adr-multi-tenancy-strategy.radical +0 -41
  45. package/dist/hub-catalogue/adr/adr-observability.radical +0 -59
  46. package/dist/hub-catalogue/adr/adr-realtime-transport.radical +0 -38
  47. package/dist/hub-catalogue/adr/adr-tech-stack.radical +0 -45
  48. package/dist/hub-catalogue/adr/adr-zero-trust-network.radical +0 -40
  49. package/dist/hub-catalogue/blueprint/bp-ai-assistant-platform.radical +0 -1641
  50. package/dist/hub-catalogue/blueprint/bp-analytical-data-platform.radical +0 -1428
  51. package/dist/hub-catalogue/blueprint/bp-ecommerce-platform.radical +0 -1989
  52. package/dist/hub-catalogue/blueprint/bp-fintech-ledger-platform.radical +0 -1701
  53. package/dist/hub-catalogue/blueprint/bp-marketplace-platform.radical +0 -1792
  54. package/dist/hub-catalogue/blueprint/bp-realtime-collaboration.radical +0 -1421
  55. package/dist/hub-catalogue/blueprint/bp-saas-b2b-platform.radical +0 -1713
  56. package/dist/hub-catalogue/fitness-function/ff-accessibility-scan.radical +0 -34
  57. package/dist/hub-catalogue/fitness-function/ff-ai-eval-gate.radical +0 -52
  58. package/dist/hub-catalogue/fitness-function/ff-api-contract.radical +0 -36
  59. package/dist/hub-catalogue/fitness-function/ff-capacity-load-test.radical +0 -67
  60. package/dist/hub-catalogue/fitness-function/ff-carbon-footprint-guard.radical +0 -62
  61. package/dist/hub-catalogue/fitness-function/ff-change-failure-rate.radical +0 -45
  62. package/dist/hub-catalogue/fitness-function/ff-chaos-resilience-test.radical +0 -53
  63. package/dist/hub-catalogue/fitness-function/ff-cost-efficiency-guard.radical +0 -64
  64. package/dist/hub-catalogue/fitness-function/ff-coupling-guard.radical +0 -45
  65. package/dist/hub-catalogue/fitness-function/ff-data-integrity-check.radical +0 -51
  66. package/dist/hub-catalogue/fitness-function/ff-data-residency.radical +0 -43
  67. package/dist/hub-catalogue/fitness-function/ff-dependency-rules.radical +0 -37
  68. package/dist/hub-catalogue/fitness-function/ff-deploy-frequency.radical +0 -46
  69. package/dist/hub-catalogue/fitness-function/ff-dr-drill-success.radical +0 -52
  70. package/dist/hub-catalogue/fitness-function/ff-duplication-guard.radical +0 -53
  71. package/dist/hub-catalogue/fitness-function/ff-error-budget.radical +0 -59
  72. package/dist/hub-catalogue/fitness-function/ff-fail-safe-verification.radical +0 -34
  73. package/dist/hub-catalogue/fitness-function/ff-infra-drift.radical +0 -34
  74. package/dist/hub-catalogue/fitness-function/ff-latency-slo.radical +0 -59
  75. package/dist/hub-catalogue/fitness-function/ff-lead-time.radical +0 -44
  76. package/dist/hub-catalogue/fitness-function/ff-ledger-balance-integrity.radical +0 -45
  77. package/dist/hub-catalogue/fitness-function/ff-license-compliance.radical +0 -43
  78. package/dist/hub-catalogue/fitness-function/ff-mttr.radical +0 -45
  79. package/dist/hub-catalogue/fitness-function/ff-noisy-neighbor-guard.radical +0 -66
  80. package/dist/hub-catalogue/fitness-function/ff-sast-scan.radical +0 -35
  81. package/dist/hub-catalogue/fitness-function/ff-scale-out-verification.radical +0 -66
  82. package/dist/hub-catalogue/fitness-function/ff-security-scan.radical +0 -45
  83. package/dist/hub-catalogue/fitness-function/ff-startup-shutdown-check.radical +0 -66
  84. package/dist/hub-catalogue/fitness-function/ff-sync-convergence-test.radical +0 -45
  85. package/dist/hub-catalogue/fitness-function/ff-test-coverage.radical +0 -43
  86. package/dist/hub-catalogue/fitness-function/ff-web-vitals.radical +0 -57
  87. package/dist/hub-catalogue/pattern/pattern-anti-corruption-layer.radical +0 -88
  88. package/dist/hub-catalogue/pattern/pattern-api-gateway.radical +0 -168
  89. package/dist/hub-catalogue/pattern/pattern-bff.radical +0 -179
  90. package/dist/hub-catalogue/pattern/pattern-bulkhead.radical +0 -114
  91. package/dist/hub-catalogue/pattern/pattern-circuit-breaker.radical +0 -219
  92. package/dist/hub-catalogue/pattern/pattern-cqrs.radical +0 -195
  93. package/dist/hub-catalogue/pattern/pattern-crdt-sync.radical +0 -200
  94. package/dist/hub-catalogue/pattern/pattern-event-driven.radical +0 -210
  95. package/dist/hub-catalogue/pattern/pattern-event-sourced-ledger.radical +0 -211
  96. package/dist/hub-catalogue/pattern/pattern-hexagonal.radical +0 -196
  97. package/dist/hub-catalogue/pattern/pattern-microservices.radical +0 -262
  98. package/dist/hub-catalogue/pattern/pattern-rag-pipeline.radical +0 -213
  99. package/dist/hub-catalogue/pattern/pattern-rate-limiter.radical +0 -114
  100. package/dist/hub-catalogue/pattern/pattern-saga.radical +0 -208
  101. package/dist/hub-catalogue/pattern/pattern-sidecar.radical +0 -123
  102. package/dist/hub-catalogue/pattern/pattern-strangler-fig.radical +0 -227
  103. package/dist/hub-catalogue/pattern/pattern-transactional-outbox.radical +0 -209
  104. package/dist/hub-catalogue/requirement/req-accessibility.radical +0 -48
  105. package/dist/hub-catalogue/requirement/req-ai-autonomous-resolution.radical +0 -51
  106. package/dist/hub-catalogue/requirement/req-ai-groundedness.radical +0 -45
  107. package/dist/hub-catalogue/requirement/req-ai-human-handoff.radical +0 -46
  108. package/dist/hub-catalogue/requirement/req-alerting.radical +0 -52
  109. package/dist/hub-catalogue/requirement/req-api-response-time.radical +0 -51
  110. package/dist/hub-catalogue/requirement/req-api-standard.radical +0 -45
  111. package/dist/hub-catalogue/requirement/req-audit-logging.radical +0 -43
  112. package/dist/hub-catalogue/requirement/req-auth-response-time.radical +0 -45
  113. package/dist/hub-catalogue/requirement/req-auth.radical +0 -43
  114. package/dist/hub-catalogue/requirement/req-autoscaling.radical +0 -62
  115. package/dist/hub-catalogue/requirement/req-availability.radical +0 -50
  116. package/dist/hub-catalogue/requirement/req-backward-compatibility.radical +0 -46
  117. package/dist/hub-catalogue/requirement/req-batch-job-completion.radical +0 -50
  118. package/dist/hub-catalogue/requirement/req-carbon-efficiency.radical +0 -64
  119. package/dist/hub-catalogue/requirement/req-centralised-logging.radical +0 -45
  120. package/dist/hub-catalogue/requirement/req-ci-pipeline-time.radical +0 -43
  121. package/dist/hub-catalogue/requirement/req-code-complexity.radical +0 -43
  122. package/dist/hub-catalogue/requirement/req-config-propagation.radical +0 -45
  123. package/dist/hub-catalogue/requirement/req-data-integrity.radical +0 -35
  124. package/dist/hub-catalogue/requirement/req-data-retention.radical +0 -44
  125. package/dist/hub-catalogue/requirement/req-db-query-response.radical +0 -44
  126. package/dist/hub-catalogue/requirement/req-disaster-recovery.radical +0 -59
  127. package/dist/hub-catalogue/requirement/req-distributed-tracing.radical +0 -45
  128. package/dist/hub-catalogue/requirement/req-encryption.radical +0 -49
  129. package/dist/hub-catalogue/requirement/req-error-rate.radical +0 -45
  130. package/dist/hub-catalogue/requirement/req-error-recovery.radical +0 -34
  131. package/dist/hub-catalogue/requirement/req-event-schema-compatibility.radical +0 -37
  132. package/dist/hub-catalogue/requirement/req-fail-safe-default.radical +0 -55
  133. package/dist/hub-catalogue/requirement/req-fast-startup-graceful-shutdown.radical +0 -69
  134. package/dist/hub-catalogue/requirement/req-gdpr-erasure.radical +0 -44
  135. package/dist/hub-catalogue/requirement/req-graceful-degradation.radical +0 -39
  136. package/dist/hub-catalogue/requirement/req-health-checks.radical +0 -43
  137. package/dist/hub-catalogue/requirement/req-iac.radical +0 -36
  138. package/dist/hub-catalogue/requirement/req-idempotency.radical +0 -47
  139. package/dist/hub-catalogue/requirement/req-input-validation.radical +0 -37
  140. package/dist/hub-catalogue/requirement/req-least-privilege.radical +0 -47
  141. package/dist/hub-catalogue/requirement/req-ledger-immutability.radical +0 -38
  142. package/dist/hub-catalogue/requirement/req-mfa.radical +0 -36
  143. package/dist/hub-catalogue/requirement/req-ml-extraction-accuracy.radical +0 -42
  144. package/dist/hub-catalogue/requirement/req-onboarding-time.radical +0 -42
  145. package/dist/hub-catalogue/requirement/req-page-load-time.radical +0 -59
  146. package/dist/hub-catalogue/requirement/req-payout-latency.radical +0 -46
  147. package/dist/hub-catalogue/requirement/req-presence-latency.radical +0 -46
  148. package/dist/hub-catalogue/requirement/req-rate-limiting.radical +0 -45
  149. package/dist/hub-catalogue/requirement/req-report-generation.radical +0 -44
  150. package/dist/hub-catalogue/requirement/req-resource-efficiency.radical +0 -64
  151. package/dist/hub-catalogue/requirement/req-resource-headroom.radical +0 -53
  152. package/dist/hub-catalogue/requirement/req-resource-isolation.radical +0 -37
  153. package/dist/hub-catalogue/requirement/req-search-response-time.radical +0 -44
  154. package/dist/hub-catalogue/requirement/req-secrets-management.radical +0 -45
  155. package/dist/hub-catalogue/requirement/req-task-success-rate.radical +0 -42
  156. package/dist/hub-catalogue/requirement/req-test-coverage.radical +0 -42
  157. package/dist/hub-catalogue/requirement/req-throughput.radical +0 -55
  158. package/dist/hub-catalogue/requirement/req-vulnerability-scanning.radical +0 -52
  159. package/dist/hub-catalogue/requirement/req-zero-downtime-deploy.radical +0 -39
@@ -0,0 +1,802 @@
1
+ {
2
+ "hub": {
3
+ "id": "concern-capacity",
4
+ "category": "concern",
5
+ "name": "Capacity and scaling",
6
+ "description": "How much load it carries: the expected load and its peak, how it scales to meet it, what it does when overloaded, and how often the capacity is proven with a load test.",
7
+ "tags": [
8
+ "reliability",
9
+ "performance",
10
+ "capacity",
11
+ "scaling",
12
+ "autoscaling",
13
+ "load-shedding",
14
+ "backpressure",
15
+ "load-testing"
16
+ ],
17
+ "requiredMetamodel": "c4-ddd-governance-builtin",
18
+ "concern": {
19
+ "id": "capacity",
20
+ "trigger": "LIST NODES WHERE (type = \"container\" OR type = \"webapp\") AND external != true",
21
+ "why": "these elements run on capacity of their own, so the load they must carry, how they scale and what they do when overloaded has to be decided.",
22
+ "group": "reliability"
23
+ },
24
+ "sources": [
25
+ {
26
+ "title": "Google SRE book, chapter 21: Handling Overload",
27
+ "url": "https://sre.google/sre-book/handling-overload/"
28
+ },
29
+ {
30
+ "title": "Google SRE book, chapter 22: Addressing Cascading Failures",
31
+ "url": "https://sre.google/sre-book/addressing-cascading-failures/"
32
+ },
33
+ {
34
+ "title": "Amazon Builders' Library: Using load shedding to avoid overload",
35
+ "url": "https://aws.amazon.com/builders-library/using-load-shedding-to-avoid-overload/"
36
+ },
37
+ {
38
+ "title": "AWS Well-Architected Framework, Reliability Pillar",
39
+ "url": "https://docs.aws.amazon.com/wellarchitected/latest/reliability-pillar/welcome.html"
40
+ },
41
+ {
42
+ "title": "The Twelve-Factor App, VIII. Concurrency",
43
+ "url": "https://12factor.net/concurrency"
44
+ },
45
+ {
46
+ "title": "Grafana k6 documentation",
47
+ "url": "https://grafana.com/docs/k6/latest/"
48
+ }
49
+ ],
50
+ "templateParams": [
51
+ {
52
+ "key": "SCALING",
53
+ "title": "Scaling",
54
+ "label": "How does it scale to the peak?",
55
+ "hint": "This decides whether capacity follows the load by itself, and what the element must be like for that (stateless, quick to start).",
56
+ "defaultValue": "horizontal",
57
+ "options": [
58
+ {
59
+ "value": "vertical",
60
+ "label": "a fixed fleet sized for the peak",
61
+ "description": "A set number of instances (or one bigger machine) provisioned for the peak with headroom, changed by a reviewed change. Pick it when the load is predictable within a factor of 2, the element keeps state that is hard to split, or the load is small enough that autoscaling saves little."
62
+ },
63
+ {
64
+ "value": "horizontal",
65
+ "label": "horizontal autoscaling",
66
+ "description": "Stateless instances added and removed by the platform on CPU, request rate or queue length (Kubernetes HPA or KEDA, ECS Service Auto Scaling, VM scale sets). Pick it when the load varies by more than 2 times over a day or a season and the element keeps no state of its own."
67
+ },
68
+ {
69
+ "value": "serverless",
70
+ "label": "serverless functions or containers",
71
+ "description": "The platform starts an instance per demand, down to zero (AWS Lambda, Google Cloud Run, Azure Functions or Container Apps). Pick it for spiky or mostly idle traffic, requests that finish in seconds, and when a cold start fits the latency target."
72
+ }
73
+ ]
74
+ },
75
+ {
76
+ "key": "OVERLOAD",
77
+ "title": "Overload",
78
+ "label": "What does it do when more arrives than it can handle?",
79
+ "hint": "Scaling takes minutes and has a ceiling. Without a rule for overload, everything slows down until everything times out.",
80
+ "defaultValue": "shed",
81
+ "options": [
82
+ {
83
+ "value": "shed",
84
+ "label": "shed load early",
85
+ "description": "Above a concurrency limit it refuses new requests at once (503 with Retry-After), lowest priority first, so those it accepts stay fast. Pick it for synchronous APIs and pages where a caller waits and a fast \"try again\" beats a slow timeout."
86
+ },
87
+ {
88
+ "value": "backpressure",
89
+ "label": "queue with backpressure",
90
+ "description": "Work goes into a bounded queue processed at the rate the workers sustain; when the queue is full, producers are slowed or refused. Pick it when the work can be done later (orders, e-mails, imports) and the caller does not wait for the result."
91
+ },
92
+ {
93
+ "value": "both",
94
+ "label": "both: shed requests, queue work",
95
+ "description": "The synchronous part sheds load, the asynchronous part queues it with backpressure. Pick it when the element both answers callers and processes work in the background."
96
+ }
97
+ ]
98
+ },
99
+ {
100
+ "key": "LOADTEST",
101
+ "title": "Load tests",
102
+ "label": "When is the capacity proven with a load test?",
103
+ "hint": "Capacity estimates are wrong until measured; regressions in performance arrive with ordinary changes.",
104
+ "defaultValue": "release",
105
+ "options": [
106
+ {
107
+ "value": "release",
108
+ "label": "on every release candidate",
109
+ "description": "The pipeline runs a load test at the peak against a production-like environment and stops the release on a regression. Pick it when releases are frequent, an environment of production size is affordable, and performance regressions have reached users before."
110
+ },
111
+ {
112
+ "value": "scheduled",
113
+ "label": "monthly and before peak events",
114
+ "description": "A full-scale test every month and 4 weeks before each announced peak event, finding the breaking point. Pick it when a production-size environment is costly to keep, or releases rarely change the hot paths."
115
+ }
116
+ ]
117
+ },
118
+ {
119
+ "key": "EXPECTED_RPS",
120
+ "label": "Expected load in a normal busy hour (requests per second)",
121
+ "defaultValue": "100",
122
+ "type": "number"
123
+ },
124
+ {
125
+ "key": "PEAK_FACTOR",
126
+ "label": "How many times that load is the peak (a sale day, a campaign)?",
127
+ "defaultValue": "5",
128
+ "type": "number"
129
+ },
130
+ {
131
+ "key": "P95_MS",
132
+ "label": "Response time at the 95th percentile under load (ms)",
133
+ "defaultValue": "500",
134
+ "type": "number"
135
+ }
136
+ ]
137
+ },
138
+ "nodes": [
139
+ {
140
+ "id": "need",
141
+ "type": "need",
142
+ "label": "Carries the load it is given",
143
+ "x": 0,
144
+ "y": 0,
145
+ "kind": "brief",
146
+ "source": "Hub concern pack: Capacity and scaling",
147
+ "description": "The element serves a load that changes over the day and peaks on known and unknown occasions. It must carry the peak at an acceptable response time without paying for the peak all year, must not collapse when more arrives than it can handle, must not overwhelm what it depends on, and its real limits must be known before users find them."
148
+ },
149
+ {
150
+ "id": "req-peak",
151
+ "type": "requirement",
152
+ "label": "Peak load carried",
153
+ "x": 260,
154
+ "y": 0,
155
+ "ears_type": "ubiquitous",
156
+ "action": "serve {{PEAK_FACTOR}} times {{EXPECTED_RPS}} requests per second, sustained for 15 minutes, with a 95th percentile response time under {{P95_MS}} ms and fewer than 0.1 % errors",
157
+ "rationale": "A service sized for the average fails at the peak; a load figure with a latency and error bound is what a load test can check (AWS Well-Architected REL 7)."
158
+ },
159
+ {
160
+ "id": "req-headroom",
161
+ "type": "requirement",
162
+ "label": "Headroom kept",
163
+ "x": 260,
164
+ "y": 130,
165
+ "ears_type": "state-driven",
166
+ "precondition": "the busiest hour of the last 7 days used more than 70 % of the provisioned CPU, memory or connection pool",
167
+ "action": "raise the provisioned capacity by a reviewed change before the next expected peak",
168
+ "rationale": "A fixed fleet does not follow the load; 30 % headroom at the observed peak leaves room for growth and for an instance lost (Google SRE book, Introduction: demand forecasting and capacity planning).",
169
+ "hubWhen": {
170
+ "SCALING": [
171
+ "vertical"
172
+ ]
173
+ }
174
+ },
175
+ {
176
+ "id": "req-autoscale",
177
+ "type": "requirement",
178
+ "label": "Scales out in time",
179
+ "x": 260,
180
+ "y": 260,
181
+ "ears_type": "event-driven",
182
+ "trigger": "load rises from {{EXPECTED_RPS}} to {{PEAK_FACTOR}} times {{EXPECTED_RPS}} requests per second within 5 minutes",
183
+ "action": "add instances, ready to serve within 3 minutes, so that the 95th percentile returns under {{P95_MS}} ms, and remove them only after 15 minutes below the scaling target",
184
+ "rationale": "Autoscaling helps only if new instances are ready before the queue grows; a slow scale-in avoids flapping (Kubernetes HPA documentation; AWS Well-Architected REL 7).",
185
+ "hubWhen": {
186
+ "SCALING": [
187
+ "horizontal"
188
+ ]
189
+ }
190
+ },
191
+ {
192
+ "id": "req-cold-start",
193
+ "type": "requirement",
194
+ "label": "Cold starts bounded",
195
+ "x": 260,
196
+ "y": 390,
197
+ "ears_type": "event-driven",
198
+ "trigger": "a request arrives and no warm instance is free",
199
+ "action": "answer it within 1 second including the start, keeping enough instances warm (provisioned concurrency or minimum instances) for {{EXPECTED_RPS}} requests per second",
200
+ "rationale": "Cold starts land on users at the start of every spike; warm capacity for the normal load keeps them to the burst only.",
201
+ "hubWhen": {
202
+ "SCALING": [
203
+ "serverless"
204
+ ]
205
+ }
206
+ },
207
+ {
208
+ "id": "req-downstream",
209
+ "type": "requirement",
210
+ "label": "Dependencies not flooded",
211
+ "x": 260,
212
+ "y": 520,
213
+ "ears_type": "unwanted-behaviour",
214
+ "unwanted_condition": "it scales out faster than its database or another dependency accepts connections",
215
+ "action": "cap its concurrency at what the dependency's connection limit allows, and reach the database through a connection pooler (Amazon RDS Proxy, PgBouncer)",
216
+ "rationale": "A function that scales to a thousand instances opens a thousand connections; the database falls over first (Amazon Builders' Library, load shedding).",
217
+ "hubWhen": {
218
+ "SCALING": [
219
+ "serverless"
220
+ ]
221
+ }
222
+ },
223
+ {
224
+ "id": "req-shed",
225
+ "type": "requirement",
226
+ "label": "Excess load shed",
227
+ "x": 260,
228
+ "y": 650,
229
+ "ears_type": "unwanted-behaviour",
230
+ "unwanted_condition": "requests in flight exceed its concurrency limit, or the oldest waiting request has waited longer than {{P95_MS}} ms",
231
+ "action": "refuse new requests at once with 503 and a Retry-After header, lowest priority first (health checks and paying customers last), so that the requests it accepts keep a 95th percentile under {{P95_MS}} ms",
232
+ "rationale": "Refusing early keeps the accepted work fast; queueing everything makes every request slow and invites retries that deepen the overload (Google SRE book, chapter 21; Amazon Builders' Library).",
233
+ "hubWhen": {
234
+ "OVERLOAD": [
235
+ "shed",
236
+ "both"
237
+ ]
238
+ }
239
+ },
240
+ {
241
+ "id": "req-backpressure",
242
+ "type": "requirement",
243
+ "label": "Backpressure on producers",
244
+ "x": 260,
245
+ "y": 780,
246
+ "ears_type": "unwanted-behaviour",
247
+ "unwanted_condition": "its work queue reaches its bound because the workers fall behind",
248
+ "action": "slow or refuse new work with 429 and a Retry-After header, never drop work already accepted, and drain the backlog within 15 minutes after the peak",
249
+ "rationale": "An unbounded queue hides overload until memory or the wait runs out; a bound pushes the pressure back to the producer, who can wait or retry (Google SRE book, chapter 22).",
250
+ "hubWhen": {
251
+ "OVERLOAD": [
252
+ "backpressure",
253
+ "both"
254
+ ]
255
+ }
256
+ },
257
+ {
258
+ "id": "req-loadtest-release",
259
+ "type": "requirement",
260
+ "label": "Release load-tested",
261
+ "x": 260,
262
+ "y": 910,
263
+ "ears_type": "event-driven",
264
+ "trigger": "a release candidate is built",
265
+ "action": "run a load test at {{PEAK_FACTOR}} times {{EXPECTED_RPS}} requests per second for 15 minutes against a production-like environment, and stop the release when the 95th percentile exceeds {{P95_MS}} ms or errors exceed 0.1 %",
266
+ "rationale": "Performance regressions arrive with ordinary changes; a gate on every candidate finds them before users do.",
267
+ "hubWhen": {
268
+ "LOADTEST": [
269
+ "release"
270
+ ]
271
+ }
272
+ },
273
+ {
274
+ "id": "req-loadtest-scheduled",
275
+ "type": "requirement",
276
+ "label": "Capacity tested monthly",
277
+ "x": 260,
278
+ "y": 1040,
279
+ "ears_type": "event-driven",
280
+ "trigger": "30 days have passed since the last load test, or an announced peak event is 4 weeks away",
281
+ "action": "run a load test that ramps past {{PEAK_FACTOR}} times {{EXPECTED_RPS}} requests per second until the 95th percentile exceeds {{P95_MS}} ms, and record that breaking point, which must be at least 1.5 times the expected peak",
282
+ "rationale": "Knowing the breaking point, and keeping it 50 % above the peak, leaves time to act before a peak event instead of during it.",
283
+ "hubWhen": {
284
+ "LOADTEST": [
285
+ "scheduled"
286
+ ]
287
+ }
288
+ },
289
+ {
290
+ "id": "sc-peak",
291
+ "type": "scenario",
292
+ "label": "Peak load test",
293
+ "x": 520,
294
+ "y": 0,
295
+ "given": "a production-like environment",
296
+ "when": "load rises to {{PEAK_FACTOR}} times {{EXPECTED_RPS}} requests per second and holds for 15 minutes",
297
+ "then": "the 95th percentile stays under {{P95_MS}} ms and errors under 0.1 %"
298
+ },
299
+ {
300
+ "id": "sc-headroom",
301
+ "type": "scenario",
302
+ "label": "Headroom alert",
303
+ "x": 520,
304
+ "y": 130,
305
+ "given": "a fixed fleet",
306
+ "when": "the weekly busiest hour uses 75 % of its CPU",
307
+ "then": "an alert opens a capacity change, merged before the next expected peak",
308
+ "hubWhen": {
309
+ "SCALING": [
310
+ "vertical"
311
+ ]
312
+ }
313
+ },
314
+ {
315
+ "id": "sc-autoscale",
316
+ "type": "scenario",
317
+ "label": "Ramp to peak",
318
+ "x": 520,
319
+ "y": 260,
320
+ "given": "the element at {{EXPECTED_RPS}} requests per second",
321
+ "when": "load ramps to {{PEAK_FACTOR}} times that in 5 minutes",
322
+ "then": "new instances serve within 3 minutes and the 95th percentile is back under {{P95_MS}} ms",
323
+ "hubWhen": {
324
+ "SCALING": [
325
+ "horizontal"
326
+ ]
327
+ }
328
+ },
329
+ {
330
+ "id": "sc-cold-start",
331
+ "type": "scenario",
332
+ "label": "Burst after idle",
333
+ "x": 520,
334
+ "y": 390,
335
+ "given": "the element idle at its minimum instances",
336
+ "when": "a burst of {{PEAK_FACTOR}} times {{EXPECTED_RPS}} requests per second arrives",
337
+ "then": "every request is answered within 1 second",
338
+ "hubWhen": {
339
+ "SCALING": [
340
+ "serverless"
341
+ ]
342
+ }
343
+ },
344
+ {
345
+ "id": "sc-downstream",
346
+ "type": "scenario",
347
+ "label": "Concurrency capped",
348
+ "x": 520,
349
+ "y": 520,
350
+ "given": "a database that accepts 200 connections",
351
+ "when": "load would scale the element beyond that",
352
+ "then": "connections stay under 200 and excess requests are throttled, not failed by the database",
353
+ "hubWhen": {
354
+ "SCALING": [
355
+ "serverless"
356
+ ]
357
+ }
358
+ },
359
+ {
360
+ "id": "sc-shed",
361
+ "type": "scenario",
362
+ "label": "Twice the peak",
363
+ "x": 520,
364
+ "y": 650,
365
+ "given": "the element at full capacity",
366
+ "when": "load reaches 2 times {{PEAK_FACTOR}} times {{EXPECTED_RPS}} requests per second",
367
+ "then": "excess requests get 503 within 50 ms and accepted ones keep a 95th percentile under {{P95_MS}} ms",
368
+ "hubWhen": {
369
+ "OVERLOAD": [
370
+ "shed",
371
+ "both"
372
+ ]
373
+ }
374
+ },
375
+ {
376
+ "id": "sc-backpressure",
377
+ "type": "scenario",
378
+ "label": "Queue full",
379
+ "x": 520,
380
+ "y": 780,
381
+ "given": "workers slower than the producers",
382
+ "when": "the queue reaches its bound",
383
+ "then": "producers get 429 with Retry-After, no accepted message is lost, and the backlog is gone 15 minutes after the load drops",
384
+ "hubWhen": {
385
+ "OVERLOAD": [
386
+ "backpressure",
387
+ "both"
388
+ ]
389
+ }
390
+ },
391
+ {
392
+ "id": "sc-loadtest-release",
393
+ "type": "scenario",
394
+ "label": "Regression stopped",
395
+ "x": 520,
396
+ "y": 910,
397
+ "given": "a release candidate that makes the hot path 50 % slower",
398
+ "when": "the pipeline runs its load test",
399
+ "then": "the test fails on the {{P95_MS}} ms threshold and the release does not deploy",
400
+ "hubWhen": {
401
+ "LOADTEST": [
402
+ "release"
403
+ ]
404
+ }
405
+ },
406
+ {
407
+ "id": "sc-loadtest-scheduled",
408
+ "type": "scenario",
409
+ "label": "Breaking point found",
410
+ "x": 520,
411
+ "y": 1040,
412
+ "given": "a production-size environment",
413
+ "when": "the monthly test ramps the load until latency breaks",
414
+ "then": "the breaking point is recorded and is at least 1.5 times {{PEAK_FACTOR}} times {{EXPECTED_RPS}} requests per second",
415
+ "hubWhen": {
416
+ "LOADTEST": [
417
+ "scheduled"
418
+ ]
419
+ }
420
+ },
421
+ {
422
+ "id": "adr-vertical",
423
+ "type": "adr",
424
+ "label": "Fixed fleet sized for the peak",
425
+ "x": 780,
426
+ "y": 0,
427
+ "concern": "capacity",
428
+ "status": "accepted",
429
+ "date": "",
430
+ "context": "This element runs on capacity someone has to provide. The forces: load is not flat (a busy hour, a campaign, a sale day can be several times the usual), and a service sized for the average falls over at the peak; an overloaded service does not slow down gracefully, it queues, times out and retries until it serves nobody (a cascading failure); adding instances takes minutes and only helps when the element keeps no state of its own; whatever it calls (a database, a partner) has limits of its own that scaling out can break; idle capacity costs money every hour; and the only way to know the breaking point is to measure it before users find it.",
431
+ "decision": "The element runs a fixed number of instances sized so that the peak ({{PEAK_FACTOR}} times {{EXPECTED_RPS}} requests per second) uses at most 70 % of CPU, memory and connection pools, and losing one instance still carries it (N+1). Capacity changes by a reviewed change in the infrastructure code (Terraform, Pulumi, Helm values), driven by a headroom alert on the weekly busiest hour. Overload: {{OVERLOAD}}. Load tests: {{LOADTEST}}. Choose bigger instances over more of them only while the element keeps state that cannot be split; otherwise add instances.",
432
+ "consequences": "• Predictable cost and behaviour; nothing scales by surprise.\n• Paying for the peak all the time: at a peak factor of {{PEAK_FACTOR}}, most of the capacity idles most of the day.\n• An unexpected peak above the headroom is handled only by the overload rule, until someone adds capacity.\n• Vertical growth has a ceiling: the largest instance type.",
433
+ "alternatives": "1. Horizontal autoscaling: follows the load and saves idle cost, but the element must be stateless and start fast.\n2. Serverless: no capacity to plan, but cold starts and per-request cost at steady high load.",
434
+ "hubWhen": {
435
+ "SCALING": [
436
+ "vertical"
437
+ ]
438
+ }
439
+ },
440
+ {
441
+ "id": "adr-autoscale",
442
+ "type": "adr",
443
+ "label": "Horizontal autoscaling",
444
+ "x": 780,
445
+ "y": 130,
446
+ "concern": "capacity",
447
+ "status": "accepted",
448
+ "date": "",
449
+ "context": "This element runs on capacity someone has to provide. The forces: load is not flat (a busy hour, a campaign, a sale day can be several times the usual), and a service sized for the average falls over at the peak; an overloaded service does not slow down gracefully, it queues, times out and retries until it serves nobody (a cascading failure); adding instances takes minutes and only helps when the element keeps no state of its own; whatever it calls (a database, a partner) has limits of its own that scaling out can break; idle capacity costs money every hour; and the only way to know the breaking point is to measure it before users find it.",
450
+ "decision": "The element runs stateless instances that the platform adds and removes: on Kubernetes, a HorizontalPodAutoscaler on CPU or on request rate (through KEDA or the Prometheus Adapter); elsewhere ECS Service Auto Scaling, Azure VM scale sets or Container Apps scale rules. Minimum replicas carry {{EXPECTED_RPS}} requests per second with one zone lost; maximum replicas carry 1.5 times the peak ({{PEAK_FACTOR}} times the normal load); scale-in waits 15 minutes. Instances start serving within 60 seconds and hold no session or file of their own. Overload: {{OVERLOAD}}. Load tests: {{LOADTEST}}. Choose the metric that rises first with load: request rate or concurrency for APIs, queue length for workers, CPU only when the work is CPU-bound.",
451
+ "consequences": "• Capacity follows the load; idle cost drops at night.\n• The element must be stateless and start fast; sessions and uploads live in shared stores.\n• Scaling takes minutes; a spike faster than that is met by the overload rule.\n• The maximum is a deliberate ceiling: at it, an alert asks whether to raise it or shed load.\n• Downstream limits (database connections) cap how far scaling helps.",
452
+ "alternatives": "1. A fixed fleet sized for the peak: simpler, but pays for the peak all year.\n2. Serverless: scales per request to zero, at the cost of cold starts and platform limits.",
453
+ "hubWhen": {
454
+ "SCALING": [
455
+ "horizontal"
456
+ ]
457
+ }
458
+ },
459
+ {
460
+ "id": "adr-serverless",
461
+ "type": "adr",
462
+ "label": "Serverless scaling",
463
+ "x": 780,
464
+ "y": 260,
465
+ "concern": "capacity",
466
+ "status": "accepted",
467
+ "date": "",
468
+ "context": "This element runs on capacity someone has to provide. The forces: load is not flat (a busy hour, a campaign, a sale day can be several times the usual), and a service sized for the average falls over at the peak; an overloaded service does not slow down gracefully, it queues, times out and retries until it serves nobody (a cascading failure); adding instances takes minutes and only helps when the element keeps no state of its own; whatever it calls (a database, a partner) has limits of its own that scaling out can break; idle capacity costs money every hour; and the only way to know the breaking point is to measure it before users find it.",
469
+ "decision": "The element runs on a serverless platform that starts instances per demand: AWS Lambda, Google Cloud Run, Azure Functions (Flex Consumption) or Azure Container Apps. Warm capacity (provisioned concurrency or minimum instances) carries {{EXPECTED_RPS}} requests per second; maximum concurrency is capped at what its database and other dependencies accept, with a connection pooler (Amazon RDS Proxy, PgBouncer) in front of the database. Overload: {{OVERLOAD}}. Load tests: {{LOADTEST}}. Choose the platform by request duration (Lambda up to 15 minutes; Cloud Run and Container Apps for containers and longer requests), cold start of the runtime, and cost at the steady load: above a few million requests a day, compare with containers on autoscaling.",
470
+ "consequences": "• No capacity to plan or idle fleet to pay for; scaling is per request.\n• Cold starts add latency at the start of every burst; warm capacity costs money.\n• Account and regional concurrency limits apply and must be raised ahead of peaks.\n• Scaling out can flood the database: the concurrency cap and the pooler are not optional.\n• Ties the element to the platform's runtime, limits and pricing.",
471
+ "alternatives": "1. Containers with horizontal autoscaling: no cold starts and cheaper at steady load, but capacity to manage.\n2. A fixed fleet: predictable, but sized for a peak that rarely comes.",
472
+ "hubWhen": {
473
+ "SCALING": [
474
+ "serverless"
475
+ ]
476
+ }
477
+ },
478
+ {
479
+ "id": "adr-shed",
480
+ "type": "adr",
481
+ "label": "Shed load at a concurrency limit",
482
+ "x": 780,
483
+ "y": 390,
484
+ "concern": "capacity",
485
+ "status": "accepted",
486
+ "date": "",
487
+ "context": "This element runs on capacity someone has to provide. The forces: load is not flat (a busy hour, a campaign, a sale day can be several times the usual), and a service sized for the average falls over at the peak; an overloaded service does not slow down gracefully, it queues, times out and retries until it serves nobody (a cascading failure); adding instances takes minutes and only helps when the element keeps no state of its own; whatever it calls (a database, a partner) has limits of its own that scaling out can break; idle capacity costs money every hour; and the only way to know the breaking point is to measure it before users find it.",
488
+ "decision": "Each instance limits the requests in flight and refuses the excess at once with 503 and Retry-After, before doing any work for it. The limit adapts to the measured latency (Envoy's adaptive concurrency filter, Netflix concurrency-limits, or the framework's own limiter such as ASP.NET Core's concurrency limiter), or is set from the load test at the knee of the latency curve. Requests carry a priority: health checks and the paying path are shed last, background and bulk calls first. Clients retry with exponential backoff and jitter, at most 3 times.",
489
+ "consequences": "• Accepted requests stay fast under overload; the service does not collapse.\n• Some callers see 503 at the peak; that is visible and must be explained to them.\n• The priority of each route is a product decision, written down next to the code.\n• Retries without backoff would undo it; clients are part of the design.",
490
+ "alternatives": "1. Unbounded queueing: no refusals, but every request slows down until all time out.\n2. Per-client rate limits only: protects against one noisy caller, not against total load.",
491
+ "hubWhen": {
492
+ "OVERLOAD": [
493
+ "shed",
494
+ "both"
495
+ ]
496
+ }
497
+ },
498
+ {
499
+ "id": "adr-backpressure",
500
+ "type": "adr",
501
+ "label": "Bounded queue with backpressure",
502
+ "x": 780,
503
+ "y": 520,
504
+ "concern": "capacity",
505
+ "status": "accepted",
506
+ "date": "",
507
+ "context": "This element runs on capacity someone has to provide. The forces: load is not flat (a busy hour, a campaign, a sale day can be several times the usual), and a service sized for the average falls over at the peak; an overloaded service does not slow down gracefully, it queues, times out and retries until it serves nobody (a cascading failure); adding instances takes minutes and only helps when the element keeps no state of its own; whatever it calls (a database, a partner) has limits of its own that scaling out can break; idle capacity costs money every hour; and the only way to know the breaking point is to measure it before users find it.",
508
+ "decision": "Work that the caller does not wait for goes into a bounded queue: Amazon SQS, RabbitMQ (with x-max-length and reject-publish overflow), or Kafka with a consumer group, depending on what the platform already runs. Workers scale on queue length or consumer lag (KEDA scalers) up to what downstream systems accept. When the queue is full, producers get 429 with Retry-After or block with a timeout; accepted work is never dropped, and messages that fail repeatedly go to a dead-letter queue.",
509
+ "consequences": "• Peaks are absorbed by the queue and processed at a sustainable rate.\n• Results arrive later at the peak; the product must accept that delay for this work.\n• The queue length and the age of the oldest message become the signals to watch.\n• Producers must handle 429 and retry; a producer that drops work on 429 loses it.",
510
+ "alternatives": "1. Processing everything synchronously: simple, but the caller waits and peaks hit the database directly.\n2. An unbounded queue: never refuses, but hides overload until memory or the delay is unacceptable.",
511
+ "hubWhen": {
512
+ "OVERLOAD": [
513
+ "backpressure",
514
+ "both"
515
+ ]
516
+ }
517
+ },
518
+ {
519
+ "id": "ff-loadtest-release",
520
+ "type": "fitness-fn",
521
+ "label": "Load test gates release",
522
+ "x": 1040,
523
+ "y": 0,
524
+ "category": "operational",
525
+ "threshold": "95th percentile under {{P95_MS}} ms and errors under 0.1 % at {{PEAK_FACTOR}} times {{EXPECTED_RPS}} requests per second for 15 minutes",
526
+ "description": "The pipeline runs a k6 test against a production-like environment for every release candidate; the thresholds fail the run, and the pipeline stops the release.\n\nTool: Grafana k6\n\n```js\n// k6 run peak.js (in the release pipeline, against staging)\nimport http from 'k6/http'\nimport { check } from 'k6'\n\nconst NORMAL = {{EXPECTED_RPS}}\nconst PEAK = NORMAL * {{PEAK_FACTOR}}\n\nexport const options = {\n scenarios: {\n peak: {\n executor: 'ramping-arrival-rate',\n startRate: NORMAL, timeUnit: '1s',\n preAllocatedVUs: 200, maxVUs: 2000,\n stages: [\n { target: PEAK, duration: '5m' }, // ramp to the peak\n { target: PEAK, duration: '15m' }, // hold it\n ],\n },\n },\n thresholds: {\n http_req_duration: ['p(95)<{{P95_MS}}'],\n http_req_failed: ['rate<0.001'],\n },\n}\n\nexport default function () {\n const res = http.get(`${__ENV.BASE_URL}/orders?page=1`)\n check(res, { 'status 200': (r) => r.status === 200 })\n}\n```",
527
+ "hubWhen": {
528
+ "LOADTEST": [
529
+ "release"
530
+ ]
531
+ }
532
+ },
533
+ {
534
+ "id": "ff-loadtest-scheduled",
535
+ "type": "fitness-fn",
536
+ "label": "Breaking point measured",
537
+ "x": 1040,
538
+ "y": 130,
539
+ "category": "operational",
540
+ "threshold": "Breaking point (95th percentile above {{P95_MS}} ms) at least 1.5 times {{PEAK_FACTOR}} times {{EXPECTED_RPS}} requests per second, measured at most 30 days ago",
541
+ "description": "A scheduled job runs a Gatling simulation that ramps well past the peak; the assertions fail when latency breaks below 1.5 times the peak. The report is kept, and the job runs again 4 weeks before each announced peak event.\n\nTool: Gatling (Java DSL)\n\n```java\nimport static io.gatling.javaapi.core.CoreDsl.*;\nimport static io.gatling.javaapi.http.HttpDsl.*;\nimport io.gatling.javaapi.core.*;\nimport io.gatling.javaapi.http.*;\n\npublic class BreakingPointSimulation extends Simulation {\n static final double NORMAL = {{EXPECTED_RPS}};\n static final double PEAK = NORMAL * {{PEAK_FACTOR}};\n\n HttpProtocolBuilder protocol = http.baseUrl(System.getenv(\"BASE_URL\"));\n ScenarioBuilder browse = scenario(\"orders\").exec(http(\"list orders\").get(\"/orders?page=1\"));\n\n {\n setUp(browse.injectOpen(\n rampUsersPerSec(NORMAL).to(PEAK).during(300),\n rampUsersPerSec(PEAK).to(PEAK * 1.5).during(600),\n constantUsersPerSec(PEAK * 1.5).during(600)))\n .protocols(protocol)\n .assertions(\n global().responseTime().percentile(95.0).lt({{P95_MS}}),\n global().failedRequests().percent().lt(0.1));\n }\n}\n```",
542
+ "hubWhen": {
543
+ "LOADTEST": [
544
+ "scheduled"
545
+ ]
546
+ }
547
+ },
548
+ {
549
+ "id": "ff-headroom",
550
+ "type": "fitness-fn",
551
+ "label": "Headroom watched",
552
+ "x": 1040,
553
+ "y": 260,
554
+ "category": "operational",
555
+ "threshold": "CPU and memory at the busiest hour of the week at most 70 % of what is provisioned",
556
+ "description": "A Prometheus alert compares the highest hourly CPU and memory use of the last 7 days with the requests provisioned for the element, and opens a capacity ticket above 70 %.\n\nTool: Prometheus alerting rule (kube-state-metrics and cAdvisor metrics)\n\n```yaml\ngroups:\n - name: capacity\n rules:\n - alert: OrderApiHeadroomLow\n expr: |\n max_over_time(\n (sum(rate(container_cpu_usage_seconds_total{namespace=\"shop\",pod=~\"order-api-.*\"}[5m]))\n / sum(kube_pod_container_resource_requests{namespace=\"shop\",pod=~\"order-api-.*\",resource=\"cpu\"}))[7d:1h]\n ) > 0.70\n labels: { severity: ticket }\n annotations:\n summary: \"Order API used over 70 % of its provisioned CPU at the week's busiest hour: plan a capacity change\"\n```",
557
+ "hubWhen": {
558
+ "SCALING": [
559
+ "vertical"
560
+ ]
561
+ }
562
+ },
563
+ {
564
+ "id": "ff-autoscale-ceiling",
565
+ "type": "fitness-fn",
566
+ "label": "Autoscaling not at its ceiling",
567
+ "x": 1040,
568
+ "y": 390,
569
+ "category": "operational",
570
+ "threshold": "The autoscaler sits at its maximum replicas for no more than 15 minutes in a row",
571
+ "description": "A Prometheus alert fires when the HorizontalPodAutoscaler has run at its maximum for 15 minutes: the ceiling is too low or the load is beyond plan, and someone decides which.\n\nTool: Prometheus alerting rule over kube-state-metrics\n\n```yaml\ngroups:\n - name: autoscaling\n rules:\n - alert: OrderApiAtMaxReplicas\n expr: |\n kube_horizontalpodautoscaler_status_current_replicas{namespace=\"shop\",horizontalpodautoscaler=\"order-api\"}\n >= kube_horizontalpodautoscaler_spec_max_replicas{namespace=\"shop\",horizontalpodautoscaler=\"order-api\"}\n for: 15m\n labels: { severity: page }\n annotations:\n summary: \"Order API has been at its maximum replicas for 15 minutes\"\n```",
572
+ "hubWhen": {
573
+ "SCALING": [
574
+ "horizontal"
575
+ ]
576
+ }
577
+ },
578
+ {
579
+ "id": "ff-serverless-throttles",
580
+ "type": "fitness-fn",
581
+ "label": "No throttled invocations",
582
+ "x": 1040,
583
+ "y": 520,
584
+ "category": "operational",
585
+ "threshold": "0 throttled invocations in any 5 minutes, and concurrency below 80 % of the reserved limit",
586
+ "description": "CloudWatch alarms on the function's throttles and on its concurrent executions against the reserved concurrency; Cloud Run and Azure Functions have the same metrics in Cloud Monitoring and Azure Monitor.\n\nTool: Amazon CloudWatch alarms (AWS CloudFormation)\n\n```yaml\nOrderApiThrottles:\n Type: AWS::CloudWatch::Alarm\n Properties:\n AlarmName: order-api-throttles\n Namespace: AWS/Lambda\n MetricName: Throttles\n Dimensions: [{ Name: FunctionName, Value: order-api }]\n Statistic: Sum\n Period: 300\n EvaluationPeriods: 1\n Threshold: 0\n ComparisonOperator: GreaterThanThreshold\n TreatMissingData: notBreaching\nOrderApiConcurrencyNearCap:\n Type: AWS::CloudWatch::Alarm\n Properties:\n AlarmName: order-api-concurrency-80pct\n Namespace: AWS/Lambda\n MetricName: ConcurrentExecutions\n Dimensions: [{ Name: FunctionName, Value: order-api }]\n Statistic: Maximum\n Period: 60\n EvaluationPeriods: 5\n Threshold: 160 # 80 % of a reserved concurrency of 200\n ComparisonOperator: GreaterThanThreshold\n```",
587
+ "hubWhen": {
588
+ "SCALING": [
589
+ "serverless"
590
+ ]
591
+ }
592
+ },
593
+ {
594
+ "id": "ff-shed",
595
+ "type": "fitness-fn",
596
+ "label": "Overload is shed fast",
597
+ "x": 1040,
598
+ "y": 650,
599
+ "category": "operational",
600
+ "threshold": "At twice the peak: refused requests answered with 503 in under 50 ms (95th percentile), accepted ones under {{P95_MS}} ms",
601
+ "description": "A k6 overload test drives twice the peak and checks two things separately: refusals are fast 503s, and the requests that were accepted kept their latency. A service that slows everything down instead fails the test.\n\nTool: Grafana k6\n\n```js\nimport http from 'k6/http'\nimport { Trend } from 'k6/metrics'\n\nconst accepted = new Trend('accepted_duration', true)\nconst refused = new Trend('refused_duration', true)\n\nexport const options = {\n scenarios: {\n overload: { executor: 'constant-arrival-rate', rate: 2 * {{PEAK_FACTOR}} * {{EXPECTED_RPS}}, timeUnit: '1s',\n duration: '10m', preAllocatedVUs: 500, maxVUs: 5000 },\n },\n thresholds: {\n accepted_duration: ['p(95)<{{P95_MS}}'],\n refused_duration: ['p(95)<50'],\n http_req_failed: ['rate<0.001'], // anything but 200 or 503\n },\n}\n\nhttp.setResponseCallback(http.expectedStatuses(200, 503))\n\nexport default function () {\n const res = http.get(`${__ENV.BASE_URL}/orders?page=1`)\n ;(res.status === 503 ? refused : accepted).add(res.timings.duration)\n}\n```",
602
+ "hubWhen": {
603
+ "OVERLOAD": [
604
+ "shed",
605
+ "both"
606
+ ]
607
+ }
608
+ },
609
+ {
610
+ "id": "ff-backlog",
611
+ "type": "fitness-fn",
612
+ "label": "Backlog drains",
613
+ "x": 1040,
614
+ "y": 780,
615
+ "category": "operational",
616
+ "threshold": "Consumer lag grows for no more than 15 minutes in a row; 0 accepted messages dropped",
617
+ "description": "A Prometheus alert fires when the workers' lag has kept growing for 15 minutes, meaning they cannot keep up even after scaling; the dead-letter queue is watched separately.\n\nTool: Prometheus alerting rule over kafka_exporter metrics (for SQS: CloudWatch ApproximateAgeOfOldestMessage)\n\n```yaml\ngroups:\n - name: backpressure\n rules:\n - alert: OrderWorkersFallingBehind\n expr: deriv(sum(kafka_consumergroup_lag{consumergroup=\"order-workers\"})[15m:1m]) > 0\n for: 15m\n labels: { severity: page }\n annotations:\n summary: \"Order workers' lag has grown for 15 minutes: they cannot keep up\"\n```",
618
+ "hubWhen": {
619
+ "OVERLOAD": [
620
+ "backpressure",
621
+ "both"
622
+ ]
623
+ }
624
+ }
625
+ ],
626
+ "relations": [
627
+ {
628
+ "id": "req-peak--derives--need",
629
+ "sourceId": "req-peak",
630
+ "targetId": "need",
631
+ "relationType": "derives"
632
+ },
633
+ {
634
+ "id": "req-headroom--derives--need",
635
+ "sourceId": "req-headroom",
636
+ "targetId": "need",
637
+ "relationType": "derives"
638
+ },
639
+ {
640
+ "id": "req-autoscale--derives--need",
641
+ "sourceId": "req-autoscale",
642
+ "targetId": "need",
643
+ "relationType": "derives"
644
+ },
645
+ {
646
+ "id": "req-cold-start--derives--need",
647
+ "sourceId": "req-cold-start",
648
+ "targetId": "need",
649
+ "relationType": "derives"
650
+ },
651
+ {
652
+ "id": "req-downstream--derives--need",
653
+ "sourceId": "req-downstream",
654
+ "targetId": "need",
655
+ "relationType": "derives"
656
+ },
657
+ {
658
+ "id": "req-shed--derives--need",
659
+ "sourceId": "req-shed",
660
+ "targetId": "need",
661
+ "relationType": "derives"
662
+ },
663
+ {
664
+ "id": "req-backpressure--derives--need",
665
+ "sourceId": "req-backpressure",
666
+ "targetId": "need",
667
+ "relationType": "derives"
668
+ },
669
+ {
670
+ "id": "req-loadtest-release--derives--need",
671
+ "sourceId": "req-loadtest-release",
672
+ "targetId": "need",
673
+ "relationType": "derives"
674
+ },
675
+ {
676
+ "id": "req-loadtest-scheduled--derives--need",
677
+ "sourceId": "req-loadtest-scheduled",
678
+ "targetId": "need",
679
+ "relationType": "derives"
680
+ },
681
+ {
682
+ "id": "sc-peak--verifies--req-peak",
683
+ "sourceId": "sc-peak",
684
+ "targetId": "req-peak",
685
+ "relationType": "verifies"
686
+ },
687
+ {
688
+ "id": "sc-headroom--verifies--req-headroom",
689
+ "sourceId": "sc-headroom",
690
+ "targetId": "req-headroom",
691
+ "relationType": "verifies"
692
+ },
693
+ {
694
+ "id": "sc-autoscale--verifies--req-autoscale",
695
+ "sourceId": "sc-autoscale",
696
+ "targetId": "req-autoscale",
697
+ "relationType": "verifies"
698
+ },
699
+ {
700
+ "id": "sc-cold-start--verifies--req-cold-start",
701
+ "sourceId": "sc-cold-start",
702
+ "targetId": "req-cold-start",
703
+ "relationType": "verifies"
704
+ },
705
+ {
706
+ "id": "sc-downstream--verifies--req-downstream",
707
+ "sourceId": "sc-downstream",
708
+ "targetId": "req-downstream",
709
+ "relationType": "verifies"
710
+ },
711
+ {
712
+ "id": "sc-shed--verifies--req-shed",
713
+ "sourceId": "sc-shed",
714
+ "targetId": "req-shed",
715
+ "relationType": "verifies"
716
+ },
717
+ {
718
+ "id": "sc-backpressure--verifies--req-backpressure",
719
+ "sourceId": "sc-backpressure",
720
+ "targetId": "req-backpressure",
721
+ "relationType": "verifies"
722
+ },
723
+ {
724
+ "id": "sc-loadtest-release--verifies--req-loadtest-release",
725
+ "sourceId": "sc-loadtest-release",
726
+ "targetId": "req-loadtest-release",
727
+ "relationType": "verifies"
728
+ },
729
+ {
730
+ "id": "sc-loadtest-scheduled--verifies--req-loadtest-scheduled",
731
+ "sourceId": "sc-loadtest-scheduled",
732
+ "targetId": "req-loadtest-scheduled",
733
+ "relationType": "verifies"
734
+ },
735
+ {
736
+ "id": "ff-loadtest-release--implements--adr-vertical",
737
+ "sourceId": "ff-loadtest-release",
738
+ "targetId": "adr-vertical",
739
+ "relationType": "implements"
740
+ },
741
+ {
742
+ "id": "ff-loadtest-release--implements--adr-autoscale",
743
+ "sourceId": "ff-loadtest-release",
744
+ "targetId": "adr-autoscale",
745
+ "relationType": "implements"
746
+ },
747
+ {
748
+ "id": "ff-loadtest-release--implements--adr-serverless",
749
+ "sourceId": "ff-loadtest-release",
750
+ "targetId": "adr-serverless",
751
+ "relationType": "implements"
752
+ },
753
+ {
754
+ "id": "ff-loadtest-scheduled--implements--adr-vertical",
755
+ "sourceId": "ff-loadtest-scheduled",
756
+ "targetId": "adr-vertical",
757
+ "relationType": "implements"
758
+ },
759
+ {
760
+ "id": "ff-loadtest-scheduled--implements--adr-autoscale",
761
+ "sourceId": "ff-loadtest-scheduled",
762
+ "targetId": "adr-autoscale",
763
+ "relationType": "implements"
764
+ },
765
+ {
766
+ "id": "ff-loadtest-scheduled--implements--adr-serverless",
767
+ "sourceId": "ff-loadtest-scheduled",
768
+ "targetId": "adr-serverless",
769
+ "relationType": "implements"
770
+ },
771
+ {
772
+ "id": "ff-headroom--implements--adr-vertical",
773
+ "sourceId": "ff-headroom",
774
+ "targetId": "adr-vertical",
775
+ "relationType": "implements"
776
+ },
777
+ {
778
+ "id": "ff-autoscale-ceiling--implements--adr-autoscale",
779
+ "sourceId": "ff-autoscale-ceiling",
780
+ "targetId": "adr-autoscale",
781
+ "relationType": "implements"
782
+ },
783
+ {
784
+ "id": "ff-serverless-throttles--implements--adr-serverless",
785
+ "sourceId": "ff-serverless-throttles",
786
+ "targetId": "adr-serverless",
787
+ "relationType": "implements"
788
+ },
789
+ {
790
+ "id": "ff-shed--implements--adr-shed",
791
+ "sourceId": "ff-shed",
792
+ "targetId": "adr-shed",
793
+ "relationType": "implements"
794
+ },
795
+ {
796
+ "id": "ff-backlog--implements--adr-backpressure",
797
+ "sourceId": "ff-backlog",
798
+ "targetId": "adr-backpressure",
799
+ "relationType": "implements"
800
+ }
801
+ ]
802
+ }