Scale, load tests and the "busy" rule
Note for AI agents: This page is baseline guidance, not an exact prescription. Read it, tell your owner what applies to their project, and get their approval before you change anything. Your project's own rules take precedence. If something important for this project is missing here, suggest it to your owner.
For agents
- Scale rules apply from class L. Measure before optimizing; never skip a scale finding with ‘fine at today’s size’.
- Users should not meet ‘busy’: 429 for reads and 503 for writes with Retry-After are a last safety, and capacity trouble is never a 500.
- Assume many users share one IP (mobile carriers); logged-in limits are per account.
Which class?
This topic has items from class L. The blocks below are cumulative: read up to your own class.
- S: 0 items
- M: 0 items
- L: 9 items
- XL: 5 items
Audit checklist
Every project
No additional items for this class.
+ If it has users, personal data or API keys (M)
No additional items for this class.
+ If it has an admin panel, file uploads, many users or a store app (L)
- Shared-IP users are assumed
- What: Designs and tests assume many users share one IP (CGNAT); logged-in limits are per account.
- How to check: Read limiter keys and tests.
- Evidence: Limiter configuration.
- “Busy” is a last resort, and never a 500
- What: The system is built so users rarely see “busy”; reads return 429 and writes 503 with Retry-After only as a last safety; capacity or connection trouble is never reported as a 500; at target load steps the error rate is zero or a finding.
- How to check: Run a load step and read statuses.
- Evidence: Load report with error rates.
- Industry standard list (S1–S16) is kept and “busy” is handled correctly
- What: A list of standard mechanisms (retries with backoff and jitter, idempotency keys, early load shedding, timeouts, circuit breaker, caching, background job guarantees, graceful shutdown, rate limits, security headers, monitoring, bounded queues, one error path, compression) with a status per item; capacity problems return 429 or 503 with Retry-After, never 500.
- How to check: Find the list; test overload and read the status code and headers.
- Evidence: List with status; overload test output.
- Limits and capacities are listed in one place
- What: Every rate limit and capacity is in one list: value, window, capacity reasoning, what an attacker could do, side effects.
- How to check: Find the inventory document and compare it with limiter code.
- Evidence: Inventory document.
- Rate limits are per account and tolerate shared IPs
- What: Limits are per account; unauthenticated endpoints also have IP limits, tuned for mobile carriers that put thousands of users behind one IP (CGNAT).
- How to check: Read the limiter configuration and thresholds; test many users from one IP.
- Evidence: Limit table; test results.
- Every external call has a time limit
- What: Database queries, storage, e-mail, notifications, AI calls and external processes all have an upper time limit.
- How to check: Search for HTTP client and process calls without a timeout setting.
- Evidence: Configuration or code lines with timeouts.
- Lists use cursor pagination and indexes are checked
- What: Every list is paginated by cursor (no OFFSET, no unbounded queries); new queries are checked with
EXPLAIN; indexes are added to both schema and migration. - How to check: Search for
OFFSETand queries withoutLIMIT; look for EXPLAIN notes; compare schema and migration indexes. - Evidence: Endpoint list with cursor parameters; EXPLAIN output for new queries.
- What: Every list is paginated by cursor (no OFFSET, no unbounded queries); new queries are checked with
- Small frequent writes are batched
- What: Frequent small writes (views, progress, likes) are collected and sent as one request every few seconds.
- How to check: Watch the network calls of a screen over a minute.
- Evidence: Request count measurement.
- Query counts are measured per endpoint
- What: Each endpoint’s number of database queries is measured and a guard keeps it from growing unnoticed.
- How to check: Find the query-count test.
- Evidence: Guard test name and thresholds.
+ If it targets millions of users (XL)
- Scale findings are not dismissed as “fine at today’s size”
- What: Findings that need no decision are fixed at a high standard; findings that need a decision are presented to the owner; “done” is proven by a commit, a before and after measurement and a test that fails when it breaks.
- How to check: Read the findings list and its statuses.
- Evidence: Findings with commit and measurement.
- Scale rules are measured
- What: One event updates only its own item; memory, timers and subscriptions stay bounded on long lists; data loads gradually near the end of the list; small frequent writes are batched; query counts per endpoint have a guard; hot single rows use sharded counters; optimizations are decided by measurement.
- How to check: Run a long-scroll test and read the query count guard output.
- Evidence: Measurements before and after; guard test name.
- Load tests with a coverage map and an attack drill
- What: Load tests use real request patterns (burst, long run, writes, a huge account, a database restart, media upload, attack drill); every endpoint and scheduled job is in a coverage map; a new endpoint without a map entry fails a guard; with hit-rate “busy” responses at target steps counted as findings.
- How to check: Read the load test folder and the map; check the guard.
- Evidence: Latest run report; coverage map.
- Audits and big runs follow the rounds rule
- What: Before any long or costly run (load test, mass scan, cloud machine) the scenario is checked against the current code and a small smoke run is done; audit rounds fix findings first, then start a new full round.
- How to check: Read the last audit or load-test record.
- Evidence: Smoke-run log; round records.
- Disaster recovery plan with RPO and RTO
- What: A written plan states acceptable data loss (RPO), recovery time (RTO) and step-by-step recovery.
- How to check: Find the plan; check that a drill was run.
- Evidence: Plan and drill record.
Common mistakes
- Returning a 500 when the real problem is capacity or connections.
- One event rebuilding a whole list or page.
- Unlimited growth of timers, subscriptions or items in memory on long lists.
- Thousands of items loaded at once instead of near the end of the list.
- Retrying immediately and all together instead of backoff with jitter.
- Load test scenarios that call removed features and skip new ones.
- Starting a costly run with no smoke test.
- Optimizing structure without measuring end to end.
Sources
- Well-Architected: Reliability Pillar — AWS
- REL05-BP03 Control and limit retry calls — AWS
- Well-Architected: make mutating operations idempotent — AWS
- REL05-BP01 Implement graceful degradation — AWS
- Well-Architected: throttle requests — AWS
- REL12-BP03 Test scalability and performance requirements — AWS
- REL12-BP04 Test resiliency using chaos engineering — AWS
- RFC 6585: Additional HTTP Status Codes — IETF
- RFC 9110: HTTP Semantics — IETF
- 429 Too Many Requests — MDN Web Docs
- Retry-After header — MDN Web Docs
- The Idempotency-Key HTTP Header Field (Internet-Draft) — IETF
- The Twelve-Factor App: IX. Disposability — 12factor.net
- PostgreSQL: Using EXPLAIN — PostgreSQL Global Development Group
- Pro Build Guide v1.2: compiled team practices — Pro Build Guide