trafficserver
trafficserver copied to clipboard
Http2Stream may not be used across threads
The code below implies Http2Stream's event handler can be called from multiple threads, but I'm not sure if it really happens. https://github.com/apache/trafficserver/blob/aa1d73b07fdb43f7e77f1fb72630f91a7086c366/proxy/http2/Http2Stream.cc#L143-L149
@masaori335 says switching threads is necessary for global server session pool, but we have UnixNetVConnection::migrateToCurrentThread and I think it ensures a server session is always on the same thread as the client session.
If Http2Stream is used always on the same thread we should be able to remove the logic, and it would improve performance.
Right, the switch threads should not happen. Could maybe change this check to an assert. The switching logic was added earlier as we were debugging some threading problems.
The migration from the global pool should only happen for Http1.x. And that migration should be done before the session is assigned to the state machine
Talked at the weekly meeting, we should start by logging (or stats) to see how often the thread jumping occurs and why. If we observe nothing, we can just get rid of the code with confidence.
I added a metric for thread switching count and monitored it on production, and the switching didn't happen at all. I'm pretty sure we can get rid of the code.
This issue has been automatically marked as stale because it has not had recent activity. Marking it stale to flag it for further consideration by the community.