Kill Switches
Instantly disable features when things go wrong
A kill switch instantly disables a feature without deploying code. Third-party service acting up? Toggle the flag off. All users get the fallback behavior within milliseconds.
The Pattern
No rollback. No hotfix. No 3am deployment. Just a toggle.
Implementation
1. Wrap the Feature
Every significant feature gets a flag:
2. Set Default to Safe
Default should be the safe, proven behavior:
- Default variant:
false(old behavior) - Enabled variant:
true(new behavior)
If the flag service is unreachable, users get the old behavior.
3. Enable in Production
Once the feature is ready, enable the flag:
4. When Things Break
You notice increased errors. Disable the flag:
Within milliseconds, all connected clients receive the SSE event and switch to the old behavior.
What Makes a Good Kill Switch
Fast propagation. Flipswitch uses SSE - flag changes reach clients in milliseconds, not minutes.
No dependencies. The kill switch check shouldn't depend on the broken feature. If your new search is crashing the database, don't fetch the flag from that database.
Clear fallback. The old behavior must work. If you've removed the old code, the kill switch won't help.
Default to safe. If Flipswitch is unreachable, the default value should be the safe option.
Flaky Third-Party Services
Third-party services can be unreliable: timeouts, intermittent errors, rate limiting, or complete outages. Kill switches let you gracefully handle these situations without code deploys.
Complete Bypass with Fallback
When a service is completely down, skip it entirely and use fallback behavior:
Address validation service having issues? Disable it - orders continue with unvalidated addresses (flag for manual review later).
Optional Enrichment
Some services add value but aren't critical to core functionality:
Recommendation service slow or failing? Disable it - product pages load faster without recommendations.
Cached Fallback
Use stale cached data when a service is unavailable:
Exchange rate API having issues? Switch to cached rates - transactions continue with slightly stale pricing.
Combining with Monitoring
Set up alerts that trigger kill switch consideration:
Some teams automate this:
Graceful Degradation
Kill switches work best for features that can be cleanly disabled. For tightly coupled features, consider graceful degradation:
Degrade from full to standard to basic as problems escalate.