From 86a5b2fbc77bf01cdcc4715cbfe1204d947d05a7 Mon Sep 17 00:00:00 2001 From: John Sully Date: Wed, 7 Apr 2021 15:49:58 +0000 Subject: [PATCH] Reduce connection latency for cluster clients Former-commit-id: f1acee99bdaee4faf9e18cdf4734d51a73e78a41 --- src/networking.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/networking.cpp b/src/networking.cpp index 82b731e19..ab0a335e4 100644 --- a/src/networking.cpp +++ b/src/networking.cpp @@ -1259,7 +1259,9 @@ void acceptOnThread(connection *conn, int flags, char *cip) } else { - ielTarget = chooseBestThreadForAccept(); + // Cluster connections are more transient, so its not worth the cost to balance + // we can trust that SO_REUSEPORT is doing its job of distributing connections + ielTarget = g_pserver->cluster_enabled ? ielCur : chooseBestThreadForAccept(); } rgacceptsInFlight[ielTarget].fetch_add(1, std::memory_order_relaxed);