Video in progress
What do you think of the "testing in production" approach, and how do you organize it safely?
No test environment fully reproduces prod traffic, data and configuration, so checking in prod doesn't replace the earlier tests, it continues them. I organize it through feature flags, canaries, synthetic monitoring and shadow traffic, with automatic rollback.
📖 Answer
This doesn't mean "we ship to prod without writing tests". The point is to find, quickly and with small damage, the bugs that pre-prod tests can't catch: real load, odd corners of real data, third-party behavior.
The tools and when I use them:
- Feature flag. The code is in prod but switched off; first internal staff, then 1%, 10%... Launch is separated from deploy, and if there's a problem you turn the flag off, with no rollback deploy needed.
- Canary. The new version gets a small slice of traffic; the error rate, p99 latency and a business metric (for example, the share of successful payments) are automatically compared with the old version. If the difference passes a threshold, it rolls back automatically.
- Synthetic monitoring. A robot that runs the main flow in prod every 1-5 minutes: login, catalog, a payment with a test card in a sandbox. It tells you before users do.
- Shadow/dark traffic. A copy of prod requests is sent to the new version and the responses are compared, but the user gets the old version's response. Very useful in a rewrite or migration.
Safety conditions:
- synthetic users and orders are clearly marked and excluded from analytics, accounting and payouts, otherwise you'll end up sending an author money for a test payment;
- shadow traffic must have no side effects: write operations are switched off or directed to a separate database;
- observability must be ready: without metrics split by version, a canary tells you nothing.
When it's not needed: a small internal system with a few dozen users a day. Here the infrastructure cost outweighs the benefit, and a plain smoke test and a fast rollback are enough.
Sign up to mark studied questions and save your progress.