summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2023-05-17 07:39:57 +0200
committerWilly Tarreau <w@1wt.eu>2023-05-17 08:10:40 +0200
commitb93758cec977334059b138e9fb75c25982dda53d (patch)
treeac2f9b8848ac119b1d9c0fb56ddcb6afccf80681
parentbf86d89ea60d63df469069339bb8542203c5578f (diff)
downloadhaproxy-b93758cec977334059b138e9fb75c25982dda53d.tar.gz
MINOR: checks: make sure spread-checks is used also at boot time
This makes use of spread-checks also for the startup of the check tasks. This provides a smoother load on startup for uneven configurations which tend to enable only *some* servers. Below is the connection distribution per second of the SSL checks of a config with 5k servers spread over 800 backends, with a check inter of 5 seconds: - default: 682 08:00:50 826 08:00:51 773 08:00:52 1016 08:00:53 885 08:00:54 889 08:00:55 825 08:00:56 773 08:00:57 1016 08:00:58 884 08:00:59 888 08:01:00 491 08:01:01 - with spread-checks 50: 437 08:01:19 866 08:01:20 777 08:01:21 1023 08:01:22 1118 08:01:23 923 08:01:24 641 08:01:25 859 08:01:26 962 08:01:27 860 08:01:28 929 08:01:29 909 08:01:30 866 08:01:31 849 08:01:32 114 08:01:33 - with spread-checks 50 + this patch: 680 08:01:55 922 08:01:56 962 08:01:57 899 08:01:58 819 08:01:59 843 08:02:00 916 08:02:01 896 08:02:02 886 08:02:03 846 08:02:04 903 08:02:05 894 08:02:06 178 08:02:07 The load is much smoother from the start, this can help initial health checks succeed when many target the same overloaded server for example. This could be backported as it should make border-line configs more reliable across reloads.
-rw-r--r--src/check.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/check.c b/src/check.c
index 309b99964..86cd5963c 100644
--- a/src/check.c
+++ b/src/check.c
@@ -1494,6 +1494,14 @@ int start_check_task(struct check *check, int mininter,
if (mininter < srv_getinter(check))
mininter = srv_getinter(check);
+ if (global.spread_checks > 0) {
+ int rnd;
+
+ rnd = srv_getinter(check) * global.spread_checks / 100;
+ rnd -= (int) (2 * rnd * (ha_random32() / 4294967295.0));
+ mininter += rnd;
+ }
+
if (global.max_spread_checks && mininter > global.max_spread_checks)
mininter = global.max_spread_checks;