apache / apache/shenyu

[BUG] HTTP keepAlive defaults to false — connection pool is effectively bypassed

Open Beginner friendly
#6,574 1 comment 0 reactions 0 assignees View on GitHub
plugin: http-client priority: high type: performance
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

## Description
`keepAlive` defaults to `false`. `HttpClient.keepAlive(false)` sends `Connection: close` on every outbound request, so connections are never reused. The comment says it was set to fix a Reactor Netty `Connection reset by peer` bug (reactor-netty#388, from 2019, long fixed in modern versions).

## Location
```
shenyu-plugin-httpclient/.../config/HttpClientProperties.java:117 (private boolean keepAlive; default false)
HttpClientFactory.java:142 (httpClient.keepAlive(properties.isKeepAlive()))
```

## Impact
Every proxied request opens a new TCP connection (and new TLS handshake if HTTPS). At 10K RPS = 10K connections/sec churn, adding ~1ms TCP + ~50-100ms TLS latency per request, increasing kernel overhead (TIME_WAIT, conntrack). Makes the connection pool useless.

## Suggested fix
Default `keepAlive = true`. If the RST issue resurfaces for specific upstreams, make it per-route config, not a global default.

## Related existing issue(s)
None. Distinct from FD leaks — this is a default-config latency/throughput problem.

_Identified during the 2026-08-02 audit; full list in [`docs/issue-candidates-2026-08-02.md`](docs/issue-candidates-2026-08-02.md)._

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with shenyu-plugin-httpclient/.../config/HttpClientProperties.java:117 and trace the setting into HttpClientFactory.java:142. Confirm how the default affects the outbound Connection header and pooled connections. Done means the default is true and the relevant HTTP client behavior remains covered by the project's existing checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend, performance
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.