Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Every client accept takes the connection tracker locks

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

メンテナーはふだん 2 日以内に返信

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cpp

調査の方向性

Start by reading ConnectionTracker::is_client_exempt(), ConnectionTracker::obtain_inbound(), Group::release(), and handle_max_client_connections() to trace the accept and close paths. The issue lists several possible changes but gives no measured lock cost or chosen behavior; first measure the contention and assess how skipping table lookups affects get_connection_tracker_info and the exempt connection counters.

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

説明

Network Performance

Every TCP client accept takes two locks in ConnectionTracker, whatever the configuration:

  1. The shared lock on the client exempt list (client_exempt_list_mutex), in ConnectionTracker::is_client_exempt(). The accept takes it even when proxy.config.http.per_client.connection.exempt_list is empty.
  2. For a client that is not in the exempt list, the exclusive mutex on the inbound table (_inbound_table._mutex), in ConnectionTracker::obtain_inbound(). The accept finds or creates a Group for the client address. When the last connection from that address closes, Group::release() takes the same mutex again to erase the Group.

The accept takes the second lock even when proxy.config.net.per_client.max_connections_in is 0, which means no limit. NetHandler::get_per_client_max_connections_in() maps 0 to INT32_MAX - 1, so the client_max > 0 check in handle_max_client_connections() always passes. This has been the case since #10688. #13737 kept the same locks for accepted connections. Connections that proxy.config.net.connections_throttle refuses now also take the shared lock, because the exempt-list lookup happens before the throttle check.

The inbound table mutex is one mutex for all accept threads. A client that opens one connection at a time takes it twice per connection and allocates a new Group each time.

Possible changes:

  • Skip the inbound table when max_connections_in is 0. The get_connection_tracker_info JSONRPC method reports the inbound table, so with no limit set, clients would no longer appear in its output.
  • Skip the exempt-list lock when the list is empty, or keep the list as an immutable snapshot that a reload or a plugin API edit replaces, so that readers take no lock.
  • Together with the first change, look up the exempt list only when the per-client limit is set or the connection count is at connections_throttle. proxy.process.net.per_client.connections_exempt_in and proxy.process.net.per_client.connections_exempt_currently_open would then count only the connections that a limit applied to.

The cost of these locks has not been measured.

主要言語
C++
スター
2k
フォーク
882
平均マージ
3日 19時間
マージ済み PR(30日)
113

環境構築

はじめの一歩

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

apache/trafficserver のほかの issue

apache/trafficserver の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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