carlos / platform Public

copy: apply Luna pass 2 to the backhaul_shed threshold and README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 34b8677edd79ee8eb9d7e40da53ae456bd82c44e parent 83b6a65
2 files changed, +22 −29
  • README.md +17 −19
  • internal/alerting/ruletext.go +5 −10
diff --git a/README.md b/README.md
index d0306276e..da971e4ee 100644
--- a/README.md
+++ b/README.md
@@ -1100,16 +1100,15 @@ forwards it to the box that does. This is the backhaul. Every forwarded
request crosses the network twice, so each sending box limits how many it has
open toward any one destination box at a time. It keeps two separate limits:
-<!-- adjusted after Luna pass 1: the defaults (128 and 512) and the last
-two sentences of the second item. -->
- `CARLOS_BACKHAUL_MAX_INFLIGHT`: ordinary requests, 128 per destination box
by default.
- `CARLOS_BACKHAUL_MAX_STREAMS`: WebSockets and other upgraded connections,
- 512 per destination box by default. A socket keeps its place until it
- closes, so sockets have a limit of their own and never use up the room
- ordinary requests need. A request to open a socket counts as an ordinary
- request until the destination box accepts it. If the socket limit is
- reached at that moment, it gets `503` with `Retry-After: 2`.
+ 512 per destination box by default. Once the destination box accepts the
+ upgrade, the socket keeps its place until it closes, using the socket pool
+ rather than ordinary-request capacity. The request to open it counts
+ against ordinary-request capacity until acceptance. If the socket pool is
+ full when the destination accepts it, the request gets `503` with
+ `Retry-After: 2`.
Set either one in the sending box's `/etc/carlos/host.env`, or as a
`/carlos/<deployment>/<region>/` or `/shared/` parameter on a box launched by
@@ -1117,19 +1116,18 @@ its region's group. Restart `carlos-edge` after changing `host.env`. A value
that is not a positive whole number is logged and the default is used.
Neither limit can be turned off.
-<!-- adjusted after Luna pass 1: the share sentence (a quarter of a lowered
-limit), and the rule's sentence (refusals at a limit only, three quiet
-minutes) with the one after it. -->
When either limit is reached, the sending box returns `503` with
`Retry-After: 2`, and its journal has a line that starts `backhaul to <box>`
-and names the destination box. While `CARLOS_RATE_LIMIT` is `enforce`, one
-visitor address may also hold at most 8 ordinary requests, or 64 sockets,
-once that limit is half used, or a quarter of the limit if that is fewer. More
-than that gets `429`. The `backhaul_shed` rule is a warning in the console's
-alert engine. The box does not page for it. It fires when a box refuses more
-than 10 forwarded requests in a minute because a limit was reached, and
-clears after three minutes with none (see [Fleet alerts](#fleet-alerts)).
-Refusals of a visitor over its share do not count toward it.
+and names the destination box. While `CARLOS_RATE_LIMIT` is `enforce`, once
+the relevant backhaul pool is at least half full, one visitor address may
+hold at most 8 ordinary requests in the request pool or 64 sockets in the
+stream pool. If one quarter of that pool's limit is lower, the lower value
+applies. Requests over the share get `429`. The `backhaul_shed` rule is a
+warning in the console's alert engine. The box does not page for it. It
+fires when a box refuses more than 10 forwarded requests in a minute because
+a limit was reached, and clears after three minutes with none (see
+[Fleet alerts](#fleet-alerts)). Requests refused because a visitor exceeded
+its share do not count toward it.
Server-sent events and long polls are ordinary requests here: they hold a
place under `CARLOS_BACKHAUL_MAX_INFLIGHT` for as long as they stay open.
@@ -1263,7 +1261,7 @@ with no usable connector appear as notes on that job, not as failures.
| `lag`, mail relay lag | box | warning | 900 seconds, fixed |
| `geoip`, location database | box | warning | fixed |
| `engine_silent` | the console box's agent | incident | no beat for 10 minutes, fixed (`CARLOS_ALERT_ENGINE_BEAT`) |
-| `backhaul_shed`, forwarded requests refused | box | warning (console only) | more than 10 refused at a limit in a minute, clears after three minutes with none, fixed (see [Forwarding between boxes](#forwarding-between-boxes)) <!-- adjusted after Luna pass 1: refused at a limit; three minutes --> |
+| `backhaul_shed`, forwarded requests refused | box | warning (console only) | more than 10 refused at a limit in a minute, clears after three minutes with none, fixed (see [Forwarding between boxes](#forwarding-between-boxes)) |
| `box_silent` | console | incident | no heartbeat for 15 minutes, editable from 5 to 1440 |
| `service_down` | console | incident | a platform service the fleet summary reports down |
| `cert_expiring` | console | warning | a served host's certificate expires within 14 days, editable from 1 to 60 |
diff --git a/internal/alerting/ruletext.go b/internal/alerting/ruletext.go
index b87829af8..e4c614d5e 100644
--- a/internal/alerting/ruletext.go
+++ b/internal/alerting/ruletext.go
@@ -96,14 +96,12 @@ var BoxRuleText = map[string]RuleText{
// The backhaul_shed rule's words (#1535), every one in this block: a box
// refused requests it was forwarding to the box that hosts their app (the
// backhaul) because its limit toward that box was reached. The console's
-// messages and Rules page read the rest of them from here too. Luna pass 1
-// applied; the lines marked "adjusted after Luna pass 1" changed after it.
+// messages and Rules page read the rest of them from here too. Approved by
+// Luna passes 1 and 2.
const (
BackhaulShedTitle = "Forwarded requests refused"
BackhaulShedHowLong = "Forwarded requests are being refused while the limit is reached. This is a warning in the console's alert engine. The box does not page for it."
- // adjusted after Luna pass 1: Luna's backticks around the journal
- // prefix, host.env and the parameter paths are quotes or plain text
- // here, because an alert message is plain text.
+ // Plain text and quotes, no backticks: an alert message is plain text.
BackhaulShedWhatToDo = "Read the box's journal for \"backhaul to\" lines. They show which destination box was limiting traffic and why. If traffic needs more room, raise the relevant limit in host.env, or set it as a /carlos/<deployment>/<region>/ or /shared/ parameter on a box launched by its region's group."
// BackhaulShedWhat and BackhaulShedWhatNone open a message; %s is
// the box.
@@ -113,11 +111,8 @@ const (
// lines. The numbers are metrics.DefaultRules()'s BackhaulShedCount
// and BackhaulShedQuiet. Only refusals at a limit count, not a
// visitor's fair-share refusals.
- // adjusted after Luna pass 1: says the refusals are at the limit.
- BackhaulShedWhen = "A box refuses more than 10 forwarded requests in a minute because its limit for the destination box is reached."
- // adjusted after Luna pass 1: refusals at the limit; clears after
- // three minutes, not one.
- BackhaulShedThreshold = "Fixed at more than 10 forwarded requests refused at the limit in a minute. Clears after three minutes with none. Not configurable."
+ BackhaulShedWhen = "A box refuses more than 10 forwarded requests in a minute because its limit for the destination box is reached."
+ BackhaulShedThreshold = "Fixed at more than 10 forwarded requests refused because a limit was reached in one minute. Clears after three minutes with none. Not configurable."
// BackhaulShedValue is the last reading; %d is the count.
BackhaulShedValue = "%d forwarded requests refused in a minute"
)