Analyzer ngx-downstream-keepalive-stats

Name

ngx-downstream-keepalive-stats - HTTP Downstream Request Connection Keepalive Statistics

This analyzer focuses specifically on HTTP keep-alive statistics for downstream client connections in Nginx-based applications such as OpenResty and Kong. It monitors how effectively client connections are being reused, tracking keep-alive success rates, connection closure patterns, and client behavior. The analyzer helps optimize downstream connection handling, identify client-side issues, and tune keep-alive timeout settings to balance resource usage with connection efficiency.

Resource Category

Network I/O.

Application Type & Technical Stack

  • OpenResty
  • Kong
  • APISIX

Command Line Syntax

The analyzer can be invoked directly on the command-line via the orxray utility from the openresty-xray-cli software package.

Alternatively, the analyzer can also be invoked manually or automatically on the web console UI of OpenResty XRay (like on the Advanced web page).

# PID is the target process PID.
orxray analyzer run ngx-downstream-keepalive-stats -p PID

# trace a shell command directly
orxray analyzer run ngx-downstream-keepalive-stats -c SHELL_CMD

# PGID is the process group ID or any process's PID within the target process
# group.
orxray analyzer run ngx-downstream-keepalive-stats -p -PGID

# trace any processes started from the specified executable path.
orxray analyzer run ngx-downstream-keepalive-stats --exe /path/to/exe/file

Tracing Multiple Processes

Supported.

Output Formats

  • Plain Texts

Output Example

[
  {
    "title": "Downstream Http Request Keepalive Statistics of All Hosts",
    "subtitle": "total 14 requests",
    "type": "pie",
    "id": "",
    "series": {
      "data": {
        "New Created Connection": 5,
        "Keepalive": 7,
        "Client Sent Close Header": 2
      },
      "name": "keepalive classes",
      "valueUnit": "calls"
    },
    "ver": 1,
    "kind": "All Request"
  },
  {
    "title": "Downstream Http Request Keepalive Statistics by Host",
    "subtitle": "",
    "series": {
      "data": [
        {"data": [0, 0, 0, 2], "name": "Client Sent Close Header"},
        {"data": [0, 0, 0, 0], "name": "Client HTTP/0.9"},
        {"data": [0, 0, 0, 0], "name": "Client HTTP/1.0"},
        {"data": [0, 0, 0, 0], "name": "Server Keepalive Not Configured"},
        {"data": [0, 0, 0, 0], "name": "Server Chunk Response"},
        {"data": [0, 0, 0, 0], "name": "Keepalive Requests Count Reach Max"},
        {"data": [0, 0, 0, 0], "name": "Keepalive Disable By The Browser"},
        {"data": [0, 0, 0, 0], "name": "Reading Request Body"},
        {"data": [0, 0, 0, 0], "name": "Special Response"},
        {"data": [0, 0, 0, 0], "name": "Connection Upgrade"},
        {"data": [0, 0, 0, 0], "name": "Server Active Disable Keepalive"},
        {"data": [1, 1, 1, 2], "name": "New Created Connection"},
        {"data": [2, 2, 0, 3], "name": "Keepalive"}
      ],
      "name": ""
    },
    "ver": 1,
    "categories": [
      "static.test.com",
      "opm.test.org",
      "test.org",
      "test.com"
    ],
    "type": "bar"
  }
]

Author

The OpenResty Inc. Team.

Copyright (C) by OpenResty Inc. All rights reserved.