Skip to content

Conversation

@bzp2010
Copy link
Collaborator

@bzp2010 bzp2010 commented Nov 3, 2025

Description

Move the connection pool to the global dimension to ensure connections are properly reused.

Currently, the connection pool is created when creating instances of the backend implementation class, which was sufficient for the one-time CLI mode.
However, in ADC server mode, this caused a new connection pool to be created for every sync request, and kept old connections and prevented reuse. This was a completely unintended state and must be fixed.

This PR moves connection pool creation to the top layer and passes it to each backend instance, preventing backend instances from maintaining their own connection pools.
Additionally, it replaces the use of Node.js's native HTTPAgent and HTTPSAgent with the agentkeepalive library. Some helper functions within this library will assist us in maintaining idle connections at relatively low levels by closing excess connections.

As a trade-off, the ADC server mode temporarily loses the ability to use mTLS and validate server certificates. This is because HTTPSAgent is statically configured, which prevents us from defining specific TLS configurations for particular requests. Since its primary use case, the APISIX Ingress Controller, does not support mTLS-based Admin APIs, this is not currently an issue.
We will address this issue in a future pull request. For example, we will establish dedicated connection pools for each host instead of maintaining all connections in a single pool.

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible

@bzp2010 bzp2010 added test/api7 Trigger the API7 test on the PR test/apisix-standalone Trigger the APISIX standalone test on the PR labels Nov 3, 2025
@bzp2010 bzp2010 marked this pull request as ready for review November 3, 2025 03:42
@bzp2010 bzp2010 merged commit fd8d112 into main Nov 3, 2025
26 of 27 checks passed
@bzp2010 bzp2010 deleted the bzp/feat-agentkeepalive branch November 3, 2025 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test/api7 Trigger the API7 test on the PR test/apisix-standalone Trigger the APISIX standalone test on the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants