[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/proto_http.c b/src/proto_http.c
index 9044d5d..f717bdf 100644
--- a/src/proto_http.c
+++ b/src/proto_http.c
@@ -3848,6 +3848,9 @@
case DATA_ST_PX_BE:
/* print the backend */
if (px->cap & PR_CAP_BE) {
+ if (px->map_state & PR_MAP_RECALC)
+ recalc_server_map(px);
+
chunk_printf(&msg, sizeof(trash),
/* name */
"<tr align=center class=\"backend\"><td>Backend</td>"