If we see that another thread is already busy trying to announce the
dropped counter, there's no point going there, so let's just skip all
that operation from sink_write() and avoid disturbing the other thread.
This results in a boost from 244 to 262k req/s.
size_t maxlen, const struct ist msg[], size_t nmsg)
{
ssize_t sent = 0;
+ uint dropped = HA_ATOMIC_LOAD(&sink->ctx.dropped);
- if (unlikely(HA_ATOMIC_LOAD(&sink->ctx.dropped) > 0)) {
+ if (unlikely(dropped > 0)) {
+ if (dropped & 1) // another thread on it.
+ goto fail;
sent = sink_announce_dropped(sink, hdr);
if (!sent) {