net/http: ServeMux excess locking #28785
In #25383, a lock contention regression was brought up in
A sample CL that fixes this regression is https://go-review.googlesource.com/c/go/+/149377 and shows promising speedups on the benchmarks:
However, this change depends on using CompareAndSwap, which is only available for
Thus, there are a few ways forward that I can think of, but need a decision from the Go team:
I feel rather helpless with regards to options 1 and 2. I have suggested both, but have received differing reasons for why they aren't acceptable from different Go team members. I'd rather the Go team just pick one of the 4 options above, because the requirements for changing Go are opaque from my POV.
The text was updated successfully, but these errors were encountered:
You're not going to find disagreement on the team there.
You seem to have a real-world use case for it, so do what I said on the CL: implement both (with unsafe, which we won't accept, which we also agree on), and with atomic.Value CAS, and show that atomic.Value with CAS is the way to get the same performance without using unsafe.
But it's not a priority for us to investigate this ourselves so if you want to pursue this, please do.