Slack Built a Big Red Button to Drain an Entire Data Center in Five Minutes
From the publisher’s feed, collected in the ZeroLabs newsroom.
How a 48-minute outage from a single flaky network link led Slack to spend 18 months rebuilding their core infrastructure — and why the button they built is more interesting than it sounds.On June 30, 2021, a network link connecting one AWS availability zone failed — and Slack users felt it, despite Slack running in multiple availability zones. The postmortem question was brutal: why did a single AZ failure affect users at all? The answer drove 18 months of architecture work, ended with a button that could evacuate an entire data center in under five minutes, and taught the industry something important about the difference between multi-AZ and truly fault-isolated.Part 1: The Failure That Shouldn’t Have HappenedThe June 2021 incident was, on paper, unremarkable.A network link connecting one AWS availability zone to its neighbors developed an intermittent fault at 11:45am PDT. The hardware problem was detected and automatically resolved 48 minutes later. Total hardware downtime: less than an hour.But Slack’s users felt it. And that is the part that didn’t make sense.Slack ran across multiple AWS availability zones in us-east-1 — precisely the architecture cloud providers design to survive this kind of failure. AZs have independent power, cooling, and networking. A failure in one should not cascade to others. And yet:“We were led to wonder why, in fact, this outage was visible to our users at all.” — Slack Engineering BlogThe answer was gray failure — one of the most dangerous failure modes in distributed systems. When the network link became intermittent, different parts of Slack’s system developed different views of reality:Systems inside the impacted AZ believed they had full connectivity to everything else inside itSystems outside the AZ saw it as completely unavailableClients in the same AZ had inconsistent views depending on which network path their connection happened to traverseA clean hard failure is easy to detect and act on. Something is down — alerts fire, traffic reroutes, done. A gray failure is different. It passes health checks most of the time. It fails occasionally. It creates inconsistent behavior that no single alert can capture and no automated system can reliably act on.The engineers watching dashboards during the incident could see what was happening. Nearly every graph segmented by availability zone told the same story: one AZ was the problem. What they couldn’t do was act on that signal quickly. There was no switch. No button. No mechanism to tell all systems “this AZ is bad — avoid it.”48 minutes of user impact. 99.99% SLA means less than 1 hour of downtime per year is acceptable. A single incident nearly consumed the entire annual budget.The team made a decision: build the button.Part 2: 18 Months to Build a 5-Minute FixThe button’s design requirements were specific and non-negotiable:Drain an AZ within 5 minutes with no user-visible errorsOperable from outside the affected AZ — because when a network is degraded, you can’t rely on SSH-ing into the affected zone to fix itBidirectional — drain fast, restore gradually (starting at 1%, not 100%)Here is the core of what the drain mechanism does:class AZDrainButton: def drain_az(self, target_az: str): """Drain all traffic from target_az within 5 minutes. Operable from any AZ — does not rely on target_az control plane.""" # Step 1: Update load balancer weights to 0 for target_az # Uses the cloud provider API — operates outside the AZ itself for service in self.critical_services: self.lb_api.set_weight( service=service, az=target_az, weight=0 # no new traffic; existing connections drain naturally ) # Step 2: Update internal service discovery to prefer other AZs self.consul_api.set_az_preference( preferred_azs=[az for az in ALL_AZS if az != target_az], avoid_az=target_az ) return self.monitor_drain_progress(target_az, timeout_minutes=5) def gradual_restore(self, target_az: str, start_pct: float = 0.01): """Restore traffic to recovering AZ incrementally — starting at 1%.""" current_pct = start_pct while current_pct self.lb_api.set_weight(target_az, weight=current_pct) if self.error_rate_acceptable(target_az): current_pct = min(current_pct * 2, 1.0) # double until 100% else: self.lb_api.set_weight(target_az, weight=0) # back to zero breakBut building the button was the easy part. The button only works if the architecture beneath it is designed for AZ isolation. And Slack’s architecture wasn’t.Before the cellular migration, Slack’s core services were distributed across AZs — but not isolated within them. A typical request might be load-balanced to a webapp in AZ-1, which calls a backend service in AZ-3, which reads from a database in AZ-2. Cross-AZ calls everywhere. No natural blast-radius boundary. Any AZ degradation could affect any request.The cellular architecture changed the fundamental unit of deployment. Instead of distributing services across AZs and letting them call each other freely, each cell contains a complete serving stack:Its own webapp instancesIts own backend service instancesIts own cache tierCross-cell traffic exists only for data that genuinely requires global consistency. Everything else stays within the cell. A failure in Cell B affects requests routed to Cell B — and only those requests. The other cells keep running.The difference between multi-AZ and cellular isn’t where you run things. It’s whether a failure in one place can reach the others.The migration took 1.5 years. Not because the engineering was slow, but because migrating live services that millions of professionals depend on every day required careful sequencing, temporary compatibility shims, and a refusal to take shortcuts that would compromise stability during the transition.Part 3: The Architecture Before and AfterThe architectural transformation is clearest when you see the two states side by side.Pre-cellular Slack — requests freely cross AZ boundaries, gray failure in any AZ can affect any requestPost-cellular Slack — each cell is isolated, the drain button sets traffic weight to 0% for the affected AZThe hardest architectural decision in the migration was not technical — it was philosophical. Every service required a CAP theorem decision:Partition-tolerant with availability — serve potentially stale data from an isolated cell, keep users active. Slack’s messaging delivery path chose this. Users can still send messages even if the cell is partitioned.Partition-tolerant with consistency — refuse to serve if current data can’t be verified. Slack’s billing and auth services chose this. Better to reject a request than process it on stale data.The split mattered because it determined which services could be fully siloed and which required centralized coordination. Stateless services — clean, straightforward: 3–4 independent instances, one per AZ, route to closest healthy cell. Stateful services — harder, required cross-cell replication, more complex topologies, more migration time.One operational requirement that emerged from the migration surprised the team: cell-scoped monitoring. After cellularizing services, global aggregated metrics became actively misleading. A global p99 latency of 120ms might hide that Cell B has a p99 of 400ms while Cells A and C are at 90ms. Every cell now has its own dashboards, its own alerts, and its own error budget — because the drain button is only useful if operators can see which cell to drain.The unexpected dividend: cellular architecture turned out to be a deployment safety pattern as much as a reliability pattern. A canary deployment that goes wrong in Cell A doesn’t affect Cells B and C. Operators see the degradation in one cell while the rest of the fleet stays healthy. Reliability and deployment safety were the same investment.Part 4: What Every Engineer Should Take AwaySlack’s cellular architecture migration is the clearest available case study in the difference between distributing infrastructure across availability zones and isolating it within them. The lessons here apply to any team running services in multi-AZ environments.1. Multi-AZ does not guarantee AZ failure isolation. Running services in multiple AZs provides hardware redundancy. It does not provide traffic isolation if your services freely call each other across AZ boundaries. A gray failure in any AZ can affect any request. Cell boundaries are what actually contain failures.2. Gray failures require human judgment, not automated remediation. The ambiguous, view-dependent nature of gray failures makes reliable automated detection nearly impossible. Build a fast drain mechanism. Keep a human in the decision loop. The goal is not autonomous failure response — it’s human-triggered response that completes in minutes.3. Your mitigation tools must operate from outside the affected system. A drain button that requires SSH access to the affected AZ fails exactly when you need it most. Control-plane infrastructure for incident mitigation should be hosted in AZs that are deliberately separate from the ones being managed.4. Fast drain and slow restore are both required. Restoring 100% of traffic instantly to a recovering AZ can trigger a second cascade — cold caches encountering sudden full load. Start at 1%. Gate on error rates. Double the percentage only when the system looks genuinely healthy.5. Test the drain mechanism before an incident forces you to. Slack runs controlled production drains of individual services regularly. If the drain button is only exercised during real incidents, its failure modes will surface at the worst possible moment. Chaos engineering applies to mitigation tools, not just to production services.The 48-minute outage on June 30, 2021 cost Slack nearly its entire annual downtime budget in one incident. The 18 months that followed turned that near-miss into infrastructure that can absorb the same class of failure in under 5 minutes — with a single button press, by any operator with dashboard access.That is what proactive reliability engineering looks like.Engineering GlossaryAvailability zones — Isolated data centers within the same geographic region, designed so that a failure in one AZ does not affect others — each AZ has independent power, cooling, and networking.CAP theorem — The theoretical result stating that a distributed data store can provide at most two of: Consistency (all nodes return the same data), Availability (every request receives a response), and Partition tolerance (the system continues operating despite network partitions).Gray failure — A failure mode where different components have different views of system availability — some servers see one AZ as fully available while servers in that AZ see the others as unavailable, creating an inconsistent state harder to detect than a clean hard failure.Read the full technical deep-dive — including Slack’s interactive cellular architecture diagrams, the complete AZ drain implementation, and source links: techlogstack.com/explore/slack-cellular-architecture-2023Follow TechLogStack on Medium for one real engineering breakdown per week — in plain English, the way your smartest friend would explain it.Slack Built a Big Red Button to Drain an Entire Data Center in Five Minutes was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.