Migrating Millions of Concurrent Websockets to Envoy
Slack moved its websocket ingress tier, serving millions of concurrent connections, from HAProxy to Envoy Proxy. HAProxy reloads spawned long-lived draining processes that had to be reaped and rate-limited. Envoy's dynamic clusters, hot restarts and panic routing removed that operational overhead. Envoy config was generated through custom Chef resources with --mode validate checks, and traffic shifted region by region via NS1 weighted DNS in 10–100% steps on a parallel stack, completing in six months with no customer impact. Key lessons: the organically grown HAProxy config hid behaviours services depended on, a test suite for load balancer routing would have saved effort, and limiting Chef libraries to a subset of Envoy features kept them simple but made later additions like vhosts awkward.
Related posts
- The Adventures of Rendezvous in Heroku’s New Architecture
Heroku Engineering mediumAdeptMoving Heroku's Rendezvous proxy, which splices CLI and one-off dyno connections across NATs, from EC2 Classic to VPC behind AWS Network Load Balancers with TLS termination broke one customer's request-scoped one-off dyno workflow with H12 router timeouts. The root cause was a single-threaded agent loop using IO.select on the raw TCP socket. The NLB's larger TLS frames left decrypted bytes buffered inside OpenSSL's SSLSocket where IO.select couldn't see them, so the loop blocked until an idle timeout longer than the router's 30s limit. The fix split the agent into one thread per direction and changed the read logic so buffered SSL data is drained before selecting again.
- Slack’s Migration to a Cellular Architecture
Slack Engineering mediumAdeptSlack moved its critical user-facing services in us-east-1 to a cellular architecture where each availability zone is a cell that can be drained, after a 2021 gray-failure network outage in one AZ caused user-visible errors across all AZs. Services are "siloed": they receive traffic only from their own AZ and send traffic only to backends in that AZ. Draining therefore only requires redirecting user requests at the edge, not changing RPC clients written in Hack, Go, Java and C++. Edge Envoy load balancers use weighted clusters and RTDS weights pushed from Slack's xDS control plane, Rotor, so operators can shift traffic away from an AZ gracefully in seconds at 1% granularity, without depending on resources inside the failed AZ.
- Traffic 101: Packets Mostly Flow
Slack Engineering mediumAdeptA Slack request reaches its main region in AWS us-east-1 through a chain of hops. DNS answers come from Route53, or from NS1 for websocket records, and use edns-client-subnet to pick the nearest edge PoP. From there, Layer 4 NLBs pass traffic to Envoy-based Layer 7 tiers (envoy-wss for websockets, envoy-edge for API traffic), which route to internal services like Gatewayserver, Applink, Flannel, Imgproxy and Supra/Miata. Traffic from a PoP to the main region rides the AWS backbone, encrypted by Nebula. Failure handling is layered: a backup websocket domain uses an NS1 filter chain that shuffles among the three nearest regions to avoid thundering herds, a Degraded Mode falls back to the HTTP API when websockets fail, an Edge Pop Drain tool flips DNS to drain unhealthy PoPs automatically, and CloudFront has a backup CDN domain with client-side failover.
- Productionizing Envoy Mobile at Lyft
Lyft Engineering easyNoviceNearly all network requests from Lyft's iOS and Android apps now run through Envoy Mobile, replacing URLSession and OkHttp after a gradual rollout starting December 2021, and it matches or beats them on business metrics across billions of daily requests. Envoy's native stats streamed to gRPC/statsd endpoints caught at least three production incidents that existing analytics missed. On the iOS Driver app, OOM crashes dropped 69.3% and hangs 47.9%, and ANRs fell 30% on Android partner apps. Lessons include success rates varying up to 10% across carriers and libraries, and an Android connectivity bug fixed by mimicking the OS's IPv4-to-IPv6 dual-stack address mapping.
- Building the Next Evolution of Cloud Networks at Slack – A Retrospective
Slack Engineering mediumAdeptA year after launching Whitecastle, its AWS network redesign built on Transit Gateway, Slack found that proxy environment variables (http_proxy/no_proxy) were the biggest migration drag. Languages honor them inconsistently: Java ignores them, and CIDR support differs between Ruby, Go and Python. Partial migrations pushed huge, bursty traffic through Transit Gateway, which required CloudWatch attachment-level monitoring and help from AWS to scale. The team replaced VPC peering with Transit Gateway without downtime by adding a less-specific 10.0.0.0/8 route before deleting the peering routes. Later improvements included multiple workload VPCs per region, cross-account private Route53 zone associations, a self-discovering network tester backed by DynamoDB, and a Slack bot for looking up network details.