The user wants a "Page Speed Firefighting Playbook."
The goal is to design a document or guide that helps a team handle performance regressions effectively.
Key elements requested:
- Triage: How to assess and prioritize regressions.
- Experiment Gating: How to prevent regressions from happening during A/B tests or feature launches.
- Rollback Triggers: When to hit the panic button and revert changes.
Target Audience: Engineering teams (Frontend, Backend, SRE/DevOps), Product Managers, QA.
Tone: Operational, actionable, clear, urgent but structured (like an incident response guide).
Structure of the Playbook:
- Introduction/Philosophy: Why does this matter? (Performance is a feature).
- Monitoring & Alerts (The "Smoke Detectors"): You can't fight what you don't see.
- Triage Protocol (The "Fire Assessment"): P1/P2/P3 definitions, who owns what.
- Experiment Gating (The "Fire Prevention"): Integration with CI/CD and A/B testing platforms.
- Rollback Triggers (The "Sprinkler System"): Hard limits for automatic or manual reversion.
- Post-Mortem (The "Investigation"): Learning from the fire.
Drafting Content - Section by Section:
-
Introduction: Keep it brief. Performance budget adherence.
-
1. Monitoring (The Detection):
- Need synthetic (RUM) and Real User Monitoring (RUM).
- Core Web Vitals (LCP, CLS, INP) are the standard metrics.
- Alert channels: Slack/PagerDuty.
-
2. Triage (The Assessment):
- Question: How do we know if it's a real fire?
- Steps:
- Verify the signal (is it a real regression or a blip?).
- Scope the impact (which browser? which geography? which page?).
- Assign Severity (SEV).
- SEV Definitions:
- SEV-1: Site unusable or massive revenue impact.
- SEV-2: Significant degradation.
- SEV-3: Minor regression, aesthetic shifts.
-
3. Experiment Gating (Prevention):
- Context: Usually regressions happen during feature launches or A/B tests.
- Mechanism:
- Pre-merge checks (Lighthouse CI).
- Guardrails in the A/B testing tool (Stats engine detecting slower variants).
- Action: If a variant exceeds the budget, stop traffic allocation or block the merge.
-
4. Rollback Triggers (The Hard Limits):
- Question: When do we give up fixing and just revert?
- Criteria:
- Absolute limits (e.g., LCP > 4s).
- Relative limits (e.g., 20% slower than control).
- Time-to-fix (if we can't fix in 1 hour, rollback).
- Decision Matrix: Clear "If X, Then Y" logic.
-
5. Remediation Steps (The Firefighting):
- Immediate actions: Kill features, rollback commits, scale resources.
- Investigation tools: Chrome DevTools, Flamegraphs, Network waterfall analysis.
-
6. Post-Incident Review:
- Don't blame, just improve the process.
Refining the Formatting:
- Use Markdown for readability.
- Use bolding for emphasis.
- Create tables for SEV levels and Rollback thresholds.
- Add checklists (✅).
Self-Correction/Review during drafting:
- Initial thought: Focus heavily on code optimization.
- Correction: The prompt asks for triaging, gating, and rollback. Focus on process and thresholds, not "how to minify CSS." The user wants the playbook, not the engineering manual.
- Tone check: Make sure it sounds authoritative. Use terms like "Code Yellow" or "Performance Budget" clearly.
Final Polish:
- Organize into "Prevention" (Gating), "Detection" (Monitoring), "Response" (Triage), and "Recovery" (Rollback).
- Add a specific section on "The Decision Tree" for mental visualization.
Let's generate the response based on this structure.
This playbook outlines the operational procedures for maintaining page speed performance, specifically focusing on handling regressions, gating experiments (A/B tests), and establishing clear rollback protocols.
🚨 The Page Speed Firefighting Playbook
Objective: Minimize Time-to-Mitigate (TTM) for performance regressions and prevent sub-par experiences from reaching 100% of users.
I. The Triage Protocol (Detection & Assessment)
When an alert fires or a manual spike is detected.
1. Verify the Signal
Before sounding the alarm, distinguish between a real regression and noise.
- Check RUM (Real User Monitoring): Is there a statistically significant shift in LCP, FID, or CLS? (e.g., p75 shifted > 10%).
- Check Synthetic: Did the latest CI run fail against the performance budget?
- Check Release Velocity: Did this align with a recent deployment? (Check commit hashes).
2. Classify the Severity
Determine the impact level to prioritize resources.
| Severity | Criteria | Impact | Response Time |
|---|
| SEV-1 (Critical) | P75 LCP > 4s OR Error rates spiking due to timeout. | Revenue loss / High bounce rate. | Immediate (All hands on deck). |
| SEV-2 (High) | P75 LCP > 2.5s (but < 4s) OR CLS > 0.25. | Noticeable UX lag, SEO penalty risk. | < 4 Hours (Target next release). |
| SEV-3 (Low) | Minor budget breach (e.g., Bundle size +5%). | Imperceptible to user, technical debt. | < 24 Hours (Add to backlog). |
II. Experiment Gating (Prevention)
Performance checks before and during feature rollouts.
Phase 1: The Code Gate (CI/CD)
Automated hard stops before code merges.
- Lighthouse CI: Run audits on every Pull Request.
- Budget Enforcement:
- Block: If bundle size increases > 100KB (gzipped).
- Block: If Main Thread work increases > 100ms.
- Warning: If LCP increases > 200ms (requires manual approval).
Phase 2: The Live Gate (A/B Testing)
Monitoring performance during the experiment bucketing.
The Trigger Logic:
- Sample Size: Monitor only after the experiment reaches 10% traffic and N=1,000 users per variant.
- The Kill Condition:
- If Treatment P95 LCP > Control P95 LCP + 500ms.
- If Treatment Bounce Rate > Control Bounce Rate + 2%.
Action:
- Auto-Ramp Down: Configure the A/B testing tool (LaunchDarkly/Optimizely) to automatically revert traffic to 0% for the Treatment group if Kill Conditions are met for two consecutive data refresh cycles.
III. Rollback Triggers (Mitigation)
When to revert versus when to patch forward.
Decision Matrix: Rollback vs. Patch
- Rollback: Preferred when regression is severe and root cause is unknown or complex.
- Patch Forward: Preferred when the fix is trivial (e.g., a config flag flip or a single CSS line).
The "Red Button" Thresholds
Initiate a rollback immediately if ANY of the following occur within 15 minutes of a release:
- The "Wall" Trigger: P75 LCP hits the "4 Second Wall."
- The Variance Trigger: JavaScript exception rate increases by > 0.5%.
- The Business Trigger: Conversion rate drops > 5% YoY/HoH.
- The Heaviness Trigger: Total Page Weight exceeds 5MB (indicating unoptimized images/assets).
Execution Checklist
- Halt: Stop the current deployment pipeline.
- Revert: Execute the one-click rollback to the previous stable Git SHA.
- Purge: Trigger a CDN cache purge for the affected paths (ensure users get the old assets immediately).
- Verify: Confirm RUM metrics return to baseline.
IV. Remediation Workflow (Post-Incident)
Fixing the issue once the fire is out.
Root Cause Analysis (The "5 Whys")
Common culprits to investigate first:
- Third-Party Scripts: Did a vendor (Analytics, Chat, Ads) load a heavy script? (Use a blocking rule in the Console to test).
- Image Assets: Was a 4MB hero image uploaded? (Check the CMS).
- Main Thread Blocking: Is a heavy React re-render occurring on load? (Check Profiler).
- Server Side: Is the TTFB (Time to First Byte) slow? (Check Database queries / CDN hit rate).
The "Performance Debt" Ticket
Every regression must result in a ticket if not fixed immediately.
- Tag:
perf-debt
- Requirement: Must include a Lighthouse trace comparison (Before vs. After).
Summary Checklist for On-Call