Forum Discussion

koef's avatar
koef
Icon for Nimbostratus rankNimbostratus
Aug 21, 2024

Issue with worker_connections limits in Nginx+

Hello Nginx Community,

We are using Nginx+ for our Load Balancer and have encountered a problem where the current worker_connections limit is insufficient.

I need our monitoring system to check the current value of worker_connections for each Nginx worker process to ensure that the active worker_connections are below the maximum allowed.

The main issue is that I cannot determine the current number of connections for each Nginx worker process.

In my test configuration, I set worker_connections to 28 (which is a small value used only for easily reproducing the issue). With 32 worker processes, the total capacity should be 32 * 28 = 896 connections.

Using the /api/9/connections endpoint, we can see the total number of active connections:

{
  "accepted": 2062055,
  "dropped": 4568,
  "active": 9,
  "idle": 28
}

Despite the relatively low number of active connections, the log file continually reports that worker_connections are insufficient.

Additionally, as of Nginx+ R30, there is an endpoint providing per-worker connection statistics (accepted, dropped, active, and idle connections, total and current requests). However, the reported values for active connections are much lower than 28:

$ curl -s http://<some_ip>/api/9/workers | jq | grep active
      "active": 2,
      "active": 0,
      "active": 1,
      "active": 2,
      "active": 1,
      "active": 1,
      "active": 0,
      "active": 0,
      "active": 3,
      "active": 0,
      "active": 0,
      "active": 0,
      "active": 2,
      "active": 2,
      "active": 0,
      "active": 1,
      "active": 0,
      "active": 0,
      "active": 0,
      "active": 0,
      "active": 0,
      "active": 0,
      "active": 0,
      "active": 2,
      "active": 1,
      "active": 2,
      "active": 1,
      "active": 0,
      "active": 1,
      "active": 0,
      "active": 0,
      "active": 1,

 

Could you please help us understand why the active connections are reported as lower than the limit, yet we receive logs indicating that worker_connections are not enough?

Thank you for your assistance.