ShopifyFrancisco MejiaBenchmark
Iterating Towards a More Scalable Ingress
Summary
Shopify’s infrastructure uses Kubernetes to serve millions of requests per minute, and its growth exposed ingress performance problems during frequent application deployments. After replacing Google Cloud Load Balancer Controller (glbc) with endpoint-aware ingress-nginx, the Edgescale team focused on reducing the NGINX reloads that caused latency increases. They added dynamic configuration: the controller POSTs endpoint lists to an NGINX HTTP endpoint, where lua-nginx-module updates an in-memory shared dictionary instead of regenerating the configuration file and reloading NGINX. Reload avoidance preserves keepalive connections and load-balancing state while reducing the resource effects of replacing worker processes. Tests found ingress-nginx outperformed glbc by multiple orders of magnitude at the 99.99th latency percentile or higher, while dynamic configuration produced its largest gains during deploys, especially beyond the 80th percentile.
Context
Shopify migrated from Google Cloud Load Balancer Controller (glbc) to ingress-nginx because glbc showed underperforming load balancing and request queueing, particularly during deployments. Even with endpoint awareness, ingress-nginx required further optimization for Shopify’s scale.
Approach / What changed
The ingress controller sends updated endpoint lists to an NGINX HTTP endpoint. A Lua configuration module updates an in-memory shared dictionary containing endpoint data for all services, allowing deployments to change application endpoints without regenerating the NGINX configuration file or triggering a reload.
Takeaways
NGINX reloads during deployments increased latency and resource consumption by replacing worker processes, resetting keepalive connections, and losing load-balancing state.
Dynamic configuration uses lua-nginx-module and an internal shared dictionary to update service endpoints without reloading NGINX.
Ingress-nginx outperformed glbc by multiple orders of magnitude at the 99.99th latency percentile or higher, while dynamic configuration improved results most clearly during deployments.
FAQ
How does ingress-nginx update endpoints without reloading NGINX?
The ingress controller sends a POST request containing the current endpoint list to /configuration/backends. A Lua module receives it and updates the shared dictionary holding endpoint configurations for all backends.
Why do NGINX reloads hurt deployment latency?
Reloads start new worker processes and gracefully shut down old ones, increasing memory consumption and resetting keepalive connections and load-balancing state. Clients then establish new connections, requiring the server to handle connection requests at a faster rate.
When did dynamic configuration provide the greatest performance improvement?
Its largest improvement appeared while application deploys were running under load. In that comparison, ingress-nginx with dynamic configuration showed a substantial performance increase after the 80th latency percentile.
Source and freshness
- Source
- shopify.engineering
- Published
- Added to Yomu
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.