]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Feature] proxy: enable token bucket load balancing by default
authorVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 3 Feb 2026 11:52:18 +0000 (11:52 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 3 Feb 2026 11:52:18 +0000 (11:52 +0000)
Add token_bucket configuration to the default upstream in worker-proxy.inc
with sensible defaults (max_tokens=10000, scale=1024, base_cost=10).

conf/worker-proxy.inc

index 7f6723854b5d0183fd0e39bed879932137846e4d..f19b396fb10cde9c1e17b16e3f2feab0df672afe 100644 (file)
@@ -25,6 +25,15 @@ timeout = 60s;
 upstream "local" {
   default = yes;
   hosts = "localhost";
+
+  # Token bucket load balancing: distributes load based on message size
+  # and current backend utilization (useful with multiple backends)
+  token_bucket {
+    max_tokens = 10000;  # Maximum token capacity per backend
+    scale = 1024;        # Bytes per token (1KB = 1 token)
+    min_tokens = 1;      # Minimum tokens required for selection
+    base_cost = 10;      # Base cost per request regardless of size
+  }
 }
 
 count = 1; # Do not spawn too many processes of this type