Plan rollback incident analysis and load tests
Plan rollback incident analysis and load tests
A reliable release has a decision policy, a reversible artifact and measurable user outcomes. Deploy a small canary, compare it with a healthy baseline, and pause or roll back on agreed indicators. Do not automatically roll back an incompatible data migration. Record timestamps, observed impact, contributing conditions and corrective actions; distinguish observations from hypotheses. Test capacity in a permitted isolated environment with explicit rate limits and stop criteria.
package main
import ( "fmt")
func decision(total, bad int, compatible bool) string { if total < 100 || bad < 0 || bad > total { return "hold" } if float64(bad)/float64(total) > 0.02 { if !compatible { return "hold for recovery plan" } return "rollback" } return "continue observing"}func main() { fmt.Println(decision(10, 0, true)) fmt.Println(decision(1000, 30, true)) fmt.Println(decision(1000, 30, false)) fmt.Println(decision(1000, 10, true))}This example uses invented thresholds, not a universal release policy. Lack of data blocks a decision; a schema incompatibility blocks simple rollback. A production gate compares baseline/canary traffic mix, saturation, latency, success rates and multiple time windows. Store previous verified artifacts and rehearse rollback or forward recovery.
Expected output:
holdrollbackhold for recovery plancontinue observingRun a small controlled local workload
package main
import ( "fmt" "net/http" "net/http/httptest")
func main() { h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.URL.Path == "/ok" { w.WriteHeader(204) return } w.WriteHeader(503) }) var success, failed int for _, p := range []string{"/ok", "/ok", "/busy"} { w := httptest.NewRecorder() h.ServeHTTP(w, httptest.NewRequest("GET", p, nil)) if w.Code < 400 { success++ } else { failed++ } } fmt.Println(success, failed)}This deterministic handler-level exercise checks outcome accounting, not throughput, latency or network capacity. A real load test must use representative payloads, bounded offered load, timeouts, concurrency controls and recorded percentiles, errors and saturation. Stop when resource or error limits are exceeded; never target systems without permission. In an incident, connect the evidence to a timeline and assign actionable follow-ups with owners.
Expected output:
2 1Try it locally
For a synthetic run with 20 attempts and 3 failures, stop if the failure fraction exceeds 10%; hold for no observations. Print decisions for both cases.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Reliability and observability 08: Plan rollback incident analysis and load tests
Check the lesson objective before moving on.
What should block a simple rollback?
What does an in-memory handler outcome test establish?