|
|
|
|
|
by gkalin59
27 days ago
|
|
The problem with singleflight is that when a goroutine that grabs it first happens to be a slow request, it slows down entire group. What's worse is if it returns error, rest of group share the fate. That sometimes shows in bursts of cancellations on one of goroutines timing out. Better would be if it was semaphoreflight e.g. allow up to N concurrent requests to proceed to amortize this. Another issue is there's per group lock that can generate meaningful contention just to check the result. |
|