Learn: load testing and web security from zero
Ten short lessons. No prior knowledge needed. Each ends with something you can try in Anvil on a site you own.
- What load testing is
- Percentiles: p50, p95, p99
- Throughput, latency and queues
- Saturation and bottlenecks
- Caching and CDNs
- Errors and status codes
- Autoscaling and its delay
- Reliability words: SLI, SLO, error budget, RTO, RPO
- Security basics
- Chaos engineering 101
LESSON 1 - WHAT LOAD TESTING IS
A load test sends many simulated visitors to your site at once and measures how it copes. You do it before a busy day (a sale, a launch, a match) so you find the breaking point on your terms, not your customers'.
Three kinds: load (expected traffic), stress (push past it until something breaks) and spike (a sudden jump). Anvil's "Black Friday" preset is a ramp to 10x; "Big Sale" is a spike.
Try it in Anvil: add a site you own, run an in-cluster test with 10 users for 30 seconds.
LESSON 2 - PERCENTILES: P50, P95, P99
The average hides pain. Percentiles tell you what slow visitors feel.
Example: 10 requests: nine take 100 ms and one takes 2,000 ms. The average is 290 ms and looks fine. The p50 (median) is 100 ms. The p95 and p99 are about 2,000 ms: one visitor in ten had a terrible time.
p95 means 95% of requests were faster than this number. p99 is the same for 99%. Watch p95 or p99 for user experience; the higher the percentile, the more it reveals rare but nasty slowness.
Try it in Anvil: run a test and look at the "response time p95" chart; hover to see it at each moment.
LESSON 3 - THROUGHPUT, LATENCY AND QUEUES
Throughput is requests served per second. Latency is how long one request takes. They are linked by Little's law: requests in flight = throughput x latency.
Example: 150 requests/s at 0.2 s latency means about 30 requests in flight. If latency becomes 3.8 s at the same throughput, about 570 requests are waiting. That pile-up is a queue, and queues are what users feel as "the site is down".
Try it in Anvil: open a finished run and read "requests / second" next to "p95".
LESSON 4 - SATURATION AND BOTTLENECKS
When a resource (CPU, a database, a connection limit) is fully busy, extra visitors just wait. The signature in a chart: requests/second goes flat while latency keeps rising. Anvil's "what happened" box calls this out.
To find the bottleneck, check each layer in order: the CDN or proxy, the app's CPU, the database, then connections. The first thing at 100% is your ceiling; raising anything else changes nothing. Fix it, then re-run to prove the fix.
Example: A test showed a flat ~150 req/s. The cause was a single app process out of CPU - and a health check that failed under that load, which pulled it out of service and turned "slow" into "down".
LESSON 5 - CACHING AND CDNS
The cheapest request is the one that never reaches your server. A CDN (like Cloudflare) can answer repeated requests from its own memory for a few seconds. For read-heavy pages this can cut server load by 99%.
Careful: a cached test measures the CDN, not your server. Use bypass caches (adds a random query string) to test your real origin, and run both to see the difference.
Example: The same endpoint handled ~150 req/s uncached and over 3,000 req/s with edge caching, and only 0.16% of requests reached the servers.
LESSON 6 - ERRORS AND STATUS CODES
429 rate limited (on purpose). 403 blocked by a firewall. 502/503/504 the server or a proxy could not answer. none the connection itself failed. The status tells you which layer gave up - check it before guessing.
Anvil stops a test automatically if more than half the requests fail for 15 seconds, so you do not knock your own site over.
LESSON 7 - AUTOSCALING AND ITS DELAY
Autoscalers add servers when load rises. They are not instant: noticing, starting a server, pulling its image and passing health checks takes 30 seconds to a few minutes. A spike that doubles traffic in 10 seconds does its damage first.
For events you know about, scale up before they start and keep 30-50% headroom. Use the Big Sale preset (sudden spike) to see how your system reacts to a jump, not just a ramp.
LESSON 8 - RELIABILITY WORDS: SLI, SLO, ERROR BUDGET, RTO, RPO
SLI: a measurement, e.g. "share of requests under 500 ms". SLO: the goal for it, e.g. "99.9% over 30 days". Error budget: the allowed failure.
Example: 99.9% over a 30-day month allows about 43 minutes of failure. If an incident used 30 minutes, you have 13 minutes left, so you slow down risky changes.
RTO (recovery time objective): how long you can be down after a disaster. RPO (recovery point objective): how much recent data you can afford to lose (a 15-minute RPO means backups or replicas no older than 15 minutes).
Anvil does not measure RTO or RPO. They are disaster-recovery targets you prove by deliberately breaking things and restoring from backups (see lesson 10).
LESSON 9 - SECURITY BASICS
The security scan is passive: it reads what your site already sends. What it commonly finds:
- ▸ HTTPS and HSTS: HSTS tells browsers to always use the secure version, so nobody is tricked onto an insecure copy.
- ▸ TLS versions and ciphers: old versions (TLS 1.0/1.1) and weak ciphers should be off.
- ▸ CSP and clickjacking headers: rules that stop other sites framing yours or running injected scripts.
- ▸ Cookies:
SecureandHttpOnlyflags protect session cookies. - ▸ Anti-forgery (CSRF) tokens: stop another site making a logged-in visitor submit a form without knowing.
- ▸ Exposed files such as
/.gitor/.env: these can leak passwords and tokens. Treat any hit as urgent.
Severity guide: CRITICAL/HIGH fix now, MEDIUM soon, LOW hardening, INFO awareness. Fix the "fix these first" list, then re-scan.
LESSON 10 - CHAOS ENGINEERING 101
Chaos engineering means breaking things on purpose, safely, to learn before a real incident does. The method: state what "healthy" means (a steady state), limit the blast radius, inject one failure at a time under load, watch, stop if it gets worse, then fix what you learn and run it again.
Example: Killing one of several web servers caused no errors. Killing the single database-writing server caused 8 seconds of failures. Fixes that are not re-tested are only claims; the re-run is the proof.
Start tiny: kill one non-critical instance during a quiet hour while a small load test runs.