mendhak / mendhak/docker-http-https-echo

Support for setting keepAliveTimeout

オープン
#103 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Shell
スター
792
フォーク
152
平均マージ
3日 18時間
マージ済み PR(30日)
3

説明

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).`);
}

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

関連するエントリポイントは、httpServer と httpsServer を作成する HTTP/HTTPS サーバーのセットアップです。まず、Echo コンテナが実行時環境変数をどのように読み取るかを追跡してください。両方のサーバーに設定可能な keep-alive タイムアウトを追加し、issue に示されている関連する headers-timeout の動作も含めてください。また、その設定の有無にかかわらず、コンテナが引き続き起動し、HTTP/S リクエストを受け付けることを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
docker, node.js
領域
backend
issue の種類
機能追加
難易度
3/5
見積もり時間
1〜2日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
72/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。