Support for setting keepAliveTimeout
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 72/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- docker, node.js
- Domain
- backend
Research direction
The relevant entry point is the HTTP/HTTPS server setup that creates httpServer and httpsServer; start by tracing how the Echo container reads runtime environment variables. Add a configurable keep-alive timeout for both servers, including the related headers-timeout behavior shown in the issue, and verify that the container still starts and accepts HTTP/S requests with and without the setting.
Written by the indexing model from the issue text.
Description
Hi,
I was making some tests with the Echo container, including ensuring connection pool logics / configuration.
Currently this is taking the default 5s Node keepAliveTimeout which will then start dropping connections. If we would be able to stablish the keepAliveTimeout we would be able to allow the consumer side to manage the connections.
I've hacked a solution as:
// How long an idle keep-alive connection is held before the server closes it.
// Node's default is 5s, so an upstream keep-alive pool in front of this server can never be observed intact.
// Raising it past the drain time lets the pool settle and leaves the reverse proxy in charge of trimming it.
const keepAliveTimeoutMs = parseInt(process.env.KEEPALIVE_TIMEOUT_MS, 10);
if (Number.isFinite(keepAliveTimeoutMs) && keepAliveTimeoutMs > 0) {
for (const server of [httpServer, httpsServer]) {
server.keepAliveTimeout = keepAliveTimeoutMs;
// headersTimeout bounds how long a started request may take to send its headers;
// keeping it above keepAliveTimeout stops Node from closing a pooled connection just as it is being reused.
server.headersTimeout = keepAliveTimeoutMs + 5000;
}
console.log(`Keep-alive timeout set to ${keepAliveTimeoutMs}ms (headers timeout ${keepAliveTimeoutMs + 5000}ms).`);
}
- Dominant language
- Shell
- Stars
- 792
- Forks
- 152
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 3
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mendhak/docker-http-https-echo
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
mendhak/docker-http-https-echo#86 · 3 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
mendhak/docker-http-https-echo#80 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
mendhak/docker-http-https-echo#60 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
mendhak/docker-http-https-echo#59 · 1 comment ·
All issues in mendhak/docker-http-https-echo
Similar issues
-
Issue-Enhancement Needs-Triage
Difficulty 1/5 Under an hour Newbie friendliness 86/100
PowerShell/PowerShell#28061 · 2 reactions ·
-
Feature Request: Add ability to load custom environment variables in linux-exec-server-installer.sh Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
microsoft/vscode-remote-release#11867 ·
-
AuTest Bug Tests
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/trafficserver#13714 ·
-
Update to NCCL 2.32 Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
conda-forge/nccl-feedstock#166 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
vllm-project/agentic-api#358 · 1 comment ·