4 ms·
Sure, but with the above, there's 1 mutex to read the channel, not 1 per backend. And a single thread reading the channel. Plus you know that if the backend
by kitd 7y ago
Sure, but with the above, there's 1 mutex to read the channel,
not 1 per backend. And a single thread reading the channel.
Plus you know that if the backend is on the channel, you know it's ready to accept, and you don't need the alive flag with synchronized access.
- biggestdecision 7y ago> there's 1 mutex to read the channel, not 1 per backend Fewer mutexes isn't necessarily an advantage, there will be far higher contention on that single mutex. Channel writes also require a lock.
- kitd 7y agoOne to read, and a single reader thread. That's no contention. One to write, that's used for writing only, not both read/write as in the published design. Edit: it's a variation on the following, but for ReverseProxies, not worker goroutines http://marcio.io/2015/07/handling-1-million-requests-per-minute-with-golang/ http://marcio.io/2015/07/handling-1-million-requests-per-min...