Do Apps Dream of Electric Sheep?
Railway's Scale to Zero stops idle containers, including databases, and wakes them on incoming TCP traffic using an L4 socket activation server rather than an HTTP-level proxy. A sleep daemon uses cAdvisor to watch outbound packets and marks a container inactive after about 5–10 minutes with no egress. The container is then stopped and its port is added to an nftables set, so a high-priority PREROUTING rule (O(1) set lookup) redirects new connections to the activation server. That server reads SO_ORIGINAL_DST, starts the container, probes for a listening TCP server every 30 ms for up to 10 s, forwards bytes in both directions, and then removes the redirect so no connections are dropped. Cold starts return an HTTP response in under a second, but replicas, UDP support and the 30-minute forced connection close are noted as limitations, and an always-warm instance is still recommended for production.
Related posts
- Serverless functions vs containers: CI/CD, database connections, cron jobs, and long-running tasks
Railway mediumAdeptServerless functions and container platforms differ in execution model, which changes how you handle deploys, database access, cron jobs, rollbacks and long-running work. Serverless imposes execution limits of 30 seconds to 15 minutes, memory caps, cold starts and no persistent connections, so long jobs need checkpointing, chained invocations or streaming. Railway's containers avoid those limits and add automatic private networking, reference variables for credentials, and cron with skip-if-running semantics that requires jobs to close connections and exit. Rollbacks are similar on both, but schema migrations should stay backward compatible because rolling back code does not reverse them.
- 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.
- Railway vs Cloudflare: How Their Architectures Differ and When to Use Each
Railway mediumAdeptRailway and Cloudflare's Developer Platform feel similar on the surface but rest on opposite compute models. Railway runs long-lived regional containers with stable in-memory state, persistent volumes and up to 32 vCPU/32 GB per instance. Cloudflare Workers are edge-first, single-threaded V8 isolates capped at 128 MB memory and CPU-time limits, with no filesystem or reliable global state, so state needs Durable Objects, KV, D1, R2 or external databases via Hyperdrive. The recommended pattern is to combine them, with Cloudflare as the global front door (CDN, caching, routing, security) and Railway hosting stateful backends, databases and long-running work.
- WireGuard at Modal: Static IPs for serverless containers
Modal hardMaster
Modal built vprox, a high-availability Go VPN proxy on WireGuard, to give multi-tenant serverless containers static outbound IPv4 addresses for things like database IP allowlists. An earlier SOCKS5 approach broke with libraries that don't use the standard socket module, so Modal moved to Layer 3: clients get WireGuard keys and IPs over an HTTPS connect endpoint, idle peers are reaped by last-handshake time, and clients re-register when ping probes fail. Per-container traffic is steered through Linux policy-based routing with a dedicated routing table per container, because an eBPF xdp_redirect approach bypassed netfilter and broke SNAT. Each proxy node hosts many IPs (up to 240 on an AWS c7gn.8xlarge, under $0.01/hr per IP). A reconciliation loop watches cloud instance metadata so IPs can be moved between nodes for failover within seconds.
- Thundering herd of circuit breakers
Zalando Engineering mediumAdeptA client's circuit breaker stayed open for hours because its half-open probes hit a service that the HPA had scaled down to three pods. The sparse probes succeeded, the breaker closed, and the withheld traffic arrived at once, queued for over 100 ms per request, timed out and re-opened the breaker. Each cycle lasted only about three seconds, too short for CPU-averaged autoscaling to notice. Zalando found the cycle by exporting OpenTelemetry traces as CSV into a bespoke uPlot visualizer that plots hundreds of traces at once. Suggested fixes are autoscaling on queue depth or concurrency, longer or heavier half-open probes, pre-scaling before the breaker closes, load shedding, and propagating cancellations.