[MEDIUM] improve behaviour with large number of servers per proxy
When a very large number of servers is configured (thousands),
shutting down many of them at once could lead to large number
of calls to recalc_server_map() which already takes some time.
This would result in an O(N^3) computation time, leading to
noticeable pauses on slow embedded CPUs on test platforms.
Instead, mark the map as dirty and recalc it only when needed.
diff --git a/src/backend.c b/src/backend.c
index 8abaf1c..da8b8ac 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -90,6 +90,7 @@
tot = 1; /* the first server is enough */
} else {
px->srv_map_sz = 0;
+ px->map_state &= ~PR_MAP_RECALC;
return;
}
@@ -130,6 +131,7 @@
best->wscore -= tot;
}
px->srv_map_sz = tot;
+ px->map_state &= ~PR_MAP_RECALC;
}