Hacker News new | past | comments | ask | show | jobs | submit login

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.




> 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.


One 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-min...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: