Cloud Native 4 min read

Boost Kubernetes Ingress Performance: Tuning Nginx Keep‑Alive for Double QPS

A Kubernetes‑deployed business app sees its QPS drop from over 100k with a NodePort service to about 50k when exposed via Ingress, but adjusting Nginx keep‑alive parameters in the ingress‑controller can restore and even exceed the original performance while also enabling high availability.

Full-Stack DevOps & Kubernetes
Full-Stack DevOps & Kubernetes
Full-Stack DevOps & Kubernetes
Boost Kubernetes Ingress Performance: Tuning Nginx Keep‑Alive for Double QPS

Background: A business application running in Kubernetes delivers over 100,000 QPS when exposed through a Service NodePort, but only about 50,000 QPS when exposed via an Ingress controller.

Parameter optimization: The Ingress controller is based on Nginx; improving Nginx’s keep‑alive settings can close the performance gap. See the official Nginx ConfigMap documentation for reference.

Key Nginx upstream parameters to adjust:

keep-alive: "100"
keep-alive-requests: "110"
upstream-keepalive-connections: "20000"
upstream-keepalive-requests: "110"
upstream-keepalive-timeout: "100"

What is Keep‑Alive mode? In HTTP, the non‑Keep‑Alive mode creates a new TCP connection for each request/response pair, while Keep‑Alive (persistent connection) reuses the same connection for subsequent requests, eliminating the overhead of repeatedly establishing connections.

Reason for the performance boost: Enabling the upstream keep‑alive parameters makes Nginx reuse TCP connections to the Kubernetes Service, avoiding connection‑setup costs and allowing much higher request throughput.

How to achieve high availability for nginx‑ingress‑controller

The ingress controller is deployed as a DaemonSet with a nodeSelector on two worker nodes, sharing the host’s IP address. Combining Nginx keep‑alive with LVS (Linux Virtual Server) provides high availability for the ingress controller.

Performancehigh availabilityKubernetesNginxIngress
Full-Stack DevOps & Kubernetes
Written by

Full-Stack DevOps & Kubernetes

Focused on sharing DevOps, Kubernetes, Linux, Docker, Istio, microservices, Spring Cloud, Python, Go, databases, Nginx, Tomcat, cloud computing, and related technologies.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.