# Nginx Ingress TCP Connection Limit During Load Testing in Kubernetes

**URL:** <https://discuss.kubernetes.io/t/nginx-ingress-tcp-connection-limit-during-load-testing-in-kubernetes/31604>\
**Category:** General Discussions\
**Created:** [February 15, 2025, 12:43pm UTC](https://discuss.kubernetes.io/t/nginx-ingress-tcp-connection-limit-during-load-testing-in-kubernetes/31604 "2025-02-15T12:43:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DDODDOIM](https://avatars.discourse-cdn.com/v4/letter/d/f17d59/32.png) [@DDODDOIM](https://discuss.kubernetes.io/u/DDODDOIM)\
**Post date:** [February 15, 2025, 12:43pm UTC](https://discuss.kubernetes.io/t/nginx-ingress-tcp-connection-limit-during-load-testing-in-kubernetes/31604/1 "2025-02-15T12:43:39Z")

</div>

Kubernetes version: Latest  
Cloud being used: (put bare-metal if not on a public cloud)  
Installation method:  
Host OS: Ubuntu 22.04  
CNI and version: Calico  
CRI and version:

I’m running a community site on a Kubernetes environment and using Nginx Ingress as below:  
Nginx Ingress Controller → Nginx SVC[Nginx Pods (serving JS files, etc.)]

During load testing with many concurrent users, the TCP connection count on the Ingress side goes up to around 1200, while each of the 3 Nginx Pods sees its TCP connection count rise above 300 but then gets capped at around 75.  
It seems like certain connections are being limited when high traffic occurs.

I want the Nginx Pods to handle all incoming connections and process user requests quickly. However, tweaking the Ingress upstream count, worker connections, and other settings didn’t help. I also tried looking into the internal load balancer (like `balancer.lua`), but couldn’t find a solution.

If anyone knows how to address this issue or has suggestions on what to check, please let me know. Thanks in advance! 😊

---

<div class="post-metadata">

**Author:** ![jayeshmahajan](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/jayeshmahajan/32/15459_2.png) [@jayeshmahajan](https://discuss.kubernetes.io/u/jayeshmahajan)\
**Post date:** [February 16, 2025, 4:25pm UTC](https://discuss.kubernetes.io/t/nginx-ingress-tcp-connection-limit-during-load-testing-in-kubernetes/31604/2 "2025-02-16T16:25:51Z")

</div>

1. Do you have autoscaling enabled?

```auto
kubectl autoscale deployment nginx-ingress-controller \
    --cpu-percent=60 --min=2 --max=10

```

1. Check ingress controller limits  
kubectl describe deployment nginx-ingress-controller -n ingress-nginx

```auto
resources:
  requests:
    cpu: "500m"
    memory: "512Mi"
  limits:
    cpu: "2000m"
    memory: "2Gi"

```

1. check if nginx pods has cpu, memory or other resources limits.
2. Nginx worker settings Nginx’s **worker\_processes** and **worker\_connections** settings directly impact how many concurrent connections can be processed.

```auto
worker_processes auto;
worker_rlimit_nofile 100000;

events {
    worker_connections 16384;
    multi_accept on;
}

```

1. Ingress controller may have limits, try to see if you want to tune it and if it helps.

```auto
metadata:
  annotations:
    nginx.ingress.kubernetes.io/proxy-connect-timeout: "30s"
    nginx.ingress.kubernetes.io/proxy-read-timeout: "600s"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "600s"
    nginx.ingress.kubernetes.io/proxy-buffering: "off"
    nginx.ingress.kubernetes.io/proxy-request-buffering: "off"
    nginx.ingress.kubernetes.io/keep-alive-requests: "10000"
    nginx.ingress.kubernetes.io/upstream-keepalive-connections: "1024"
    nginx.ingress.kubernetes.io/upstream-keepalive-timeout: "300s"
    nginx.ingress.kubernetes.io/upstream-keepalive-requests: "10000"

```
