Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Every client accept takes the connection tracker locks

Đang mở
#13,890 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
42/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp
Lĩnh vực
backend, performance

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
C++
Star
2k
Fork
882
Merge trung bình
3 ngày 19 giờ
Pull request đã merge (30 ngày)
113

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của apache/trafficserver

Tất cả issue của apache/trafficserver

Issue tương tự

Thêm issue về C++

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.