bneradt commented on PR #13806: URL: https://github.com/apache/trafficserver/pull/13806#issuecomment-6218746110
@traeak, could we use “origin connections” in the title and opening paragraph? `HttpSessionManager` handles shared outbound server sessions for connections to both origin servers and parent proxies, so “parent connections” makes the scope sound narrower than it is. Suggested title: > Reduce contention in the shared origin connection pool Suggested description: --- With global and hybrid origin connection pools, the shared session pool mutex was held while migrating pooled connections between net threads and closing sessions. This put socket and TLS work inside a lock shared by the net threads, increasing contention when reusing origin connections. Limit the shared pool lock to session lookup, table updates, and detaching a connection for transfer. Attach migrated connections and close removed sessions after releasing the lock. This applies to pooled connections to origin servers and parent proxies. The change also fixes migration lifetime and event-registration races: - Make stopped `EventIO` objects safe to encounter while the owning thread finishes rescheduling a connection. - Remove old kqueue registrations during migration and undo a refresh that races with removal, preventing events from referring to a freed connection. - Detach the session from its old VC before handling an attach failure, avoiding a second close of a VC that may already have been freed. - Publish the completed socket/state transfer through an atomic `closed` flag before the owning thread reclaims the old VC. When `server_max_connections` triggers a purge, each net thread closes its own pooled connections outside the shared pool lock. The calling thread closes its sessions immediately if it can acquire the pool lock; other threads purge when they process their events. This can leave the connection count at the limit briefly and cause additional requests to fail compared with the previous synchronous purge. Removing sessions through the normal pool bookkeeping also fixes drift in `pooled_server_connections` after a purge. Add kqueue unit tests and `ATSReplayTest` coverage for cross-thread reuse with global and hybrid pools, plus a single-thread test that checks the request triggering a purge succeeds on retry. The replay tests also check that the pooled and current connection gauges return to zero. --- The existing performance measurements could stay below this description as a separate results paragraph. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
