Analyzer ngx-upstream-no-keepalive

Name

ngx-upstream-no-keepalive - capture the packets that have no HTTP upstream ‘keepalive’ configuration

This analyzer uses function probe technology to identify and capture network packets for upstream connections without HTTP keepalive enabled in NGINX-based applications. It leverages function probes to monitor the application’s runtime behavior and dynamically analyze keepalive usage patterns. The analyzer generates PCAP files that clearly demonstrate the performance overhead of connection establishment, helping pinpoint performance bottlenecks caused by missing keepalive configurations. This is valuable for optimizing upstream connection management and reducing latency from frequent TCP handshakes.

Resource Category

Network I/O.

Application Type & Technical Stack

  • OpenResty
  • Nginx
  • 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-upstream-no-keepalive -p PID

# trace a shell command directly
orxray analyzer run ngx-upstream-no-keepalive -c SHELL_CMD

Tracing Multiple Processes

Not supported.

Output Formats

  • Plain Texts

Output Example

{
  "flows": [
      {
          "up_retmote_addr": "10.1.2.4 443",
          "down_retmote_addr": "10.1.34.26 40418",
          "down_local_addr": "172.16.11.240 443",
          "up_local_addr": "172.16.11.240 43232",
          "method": "GET",
          "flow": "flow_0.pcap",
          "host": "test.com",
          "time": "1764835117075898",
          "desc": "Request end time: Thu, 04 Dec 2025 07:58:37 GMT\nDownstream local address: 172.16.11.240:443\nDownstream remote address: 10.1.34.26:40418\nUpstream local address: 172.16.11.240:43232\nUpstream remote address: 10.1.2.4:443\nHTTP request: 'GET https://test.com/rpc-server'",
          "uri": "/rpc-server",
          "scheme": "https"
      }
  ]
}

Author

The OpenResty Inc. Team.

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