Skip to content

Commit c4dfd8b

Browse files
committed
docs(webapp): correct TRIGGER_MOLLIFIER_DRAINER_ENABLED comment
The old comment claimed multiple drainer replicas would "race for the same buffer entries." That's wrong — `popAndMarkDraining` is an atomic ZPOPMIN + status flip in a single Lua call, so only one replica can win any given entry. Multi-replica drainers are correct, just inefficient (polling load and per-process concurrency multiply by N). Rewrite the comment to give the real reasons a deployment might split the drainer onto a dedicated worker. No behaviour change.
1 parent 345926f commit c4dfd8b

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

apps/webapp/app/env.server.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,13 +1058,16 @@ const EnvironmentSchema = z
10581058
// Separate switch for the drainer (consumer side) so it can be split
10591059
// off onto a dedicated worker service. Unset → inherits
10601060
// TRIGGER_MOLLIFIER_ENABLED, so single-container self-hosters don't have to
1061-
// flip two switches. In multi-replica deployments, set this to "0"
1062-
// explicitly on every replica except the one dedicated drainer
1063-
// service — otherwise every replica's polling loop races for the
1064-
// same buffer entries. `TRIGGER_MOLLIFIER_ENABLED` is still the master kill
1065-
// switch; setting this to "1" while `TRIGGER_MOLLIFIER_ENABLED` is "0" is a
1066-
// no-op because the gate-side singleton refuses to construct a
1067-
// buffer when the system is off.
1061+
// flip two switches. Multi-replica drainers are correct — `popAndMarkDraining`
1062+
// is an atomic ZPOPMIN + status flip in one Lua call, so only one replica
1063+
// can win any given entry — but inefficient: polling load (SMEMBERS +
1064+
// per-env scans) multiplies by N, and `TRIGGER_MOLLIFIER_DRAIN_CONCURRENCY`
1065+
// is per-process so engine load also multiplies. Splitting the drainer
1066+
// onto a dedicated worker keeps that traffic off the request-serving
1067+
// replicas. `TRIGGER_MOLLIFIER_ENABLED` is still the master kill switch;
1068+
// setting this to "1" while `TRIGGER_MOLLIFIER_ENABLED` is "0" is a
1069+
// no-op because the gate-side singleton refuses to construct a buffer
1070+
// when the system is off.
10681071
TRIGGER_MOLLIFIER_DRAINER_ENABLED: z.string().default(process.env.TRIGGER_MOLLIFIER_ENABLED ?? "0"),
10691072
TRIGGER_MOLLIFIER_SHADOW_MODE: z.string().default("0"),
10701073
TRIGGER_MOLLIFIER_REDIS_HOST: z

0 commit comments

Comments
 (0)