carlos / platform Public

README: document backhaul limits and the backhaul_shed rule

Refs #1535
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev df3435a548dbaa41b46ce1c55a5b3a8507344d3a parent 4e082fd
1 file changed, +30 −0
  • README.md +30 −0

CI cancelled — superseded by a newer push — run details

CI log
=== gate ===
go: downloading go1.26.10 (linux/arm64)
go version go1.26.10 linux/arm64
opentofu: arm64, tofu 1.13.9, aws 6.73.0, archive 2.8.1
  tofu: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/tofu_1.13.9_linux_arm64.tar.gz
  tofu: downloaded, digest verified
  aws: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/terraform-provider-aws_6.73.0_linux_arm64.zip
  aws: downloaded, digest verified
  archive: downloading https://carlos-ci-mirror-640012953448.s3.eu-west-1.amazonaws.com/opentofu/terraform-provider-archive_2.8.1_linux_arm64.zip
  archive: downloaded, digest verified
  installed in /tmp/carlos-opentofu-B6sf3Z
.amadan/test-gate.sh
go: downloading github.com/aws/aws-sdk-go-v2 v1.44.0
go: downloading github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.68.0
go: downloading github.com/aws/aws-sdk-go-v2/service/costexplorer v1.67.5
go: downloading github.com/aws/aws-sdk-go-v2/service/s3 v1.105.0
go: downloading github.com/aws/smithy-go v1.28.1
go: downloading golang.org/x/crypto/x509roots/fallback v0.0.0-20260209214922-2f26647a795e
go: downloading golang.org/x/net v0.62.0
go: downloading modernc.org/sqlite v1.55.0
go: downloading github.com/prometheus/client_golang v1.17.0
go: downloading github.com/aws/aws-sdk-go-v2/service/sns v1.43.0
go: downloading github.com/aws/aws-sdk-go-v2/service/acm v1.45.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ec2 v1.324.0
go: downloading github.com/aws/aws-sdk-go-v2/service/iam v1.58.2
go: downloading github.com/aws/aws-sdk-go-v2/service/resourcegroupstaggingapi v1.37.0
go: downloading github.com/aws/aws-sdk-go-v2/service/route53 v1.64.1
go: downloading golang.org/x/crypto v0.58.0
go: downloading golang.org/x/sys v0.49.0
go: downloading github.com/pion/logging v0.2.4
go: downloading github.com/pion/stun/v3 v3.1.5
go: downloading github.com/pion/turn/v4 v4.1.4
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading github.com/aws/aws-sdk-go-v2/service/sesv2 v1.66.6
go: downloading google.golang.org/protobuf v1.36.10
go: downloading github.com/pion/dtls/v3 v3.1.4
go: downloading github.com/pion/transport/v4 v4.0.2
go: downloading github.com/klauspost/compress v1.20.2
go: downloading golang.org/x/text v0.43.0
go: downloading github.com/wlynxg/anet v0.0.5
go: downloading github.com/pion/randutil v0.1.0
go: downloading modernc.org/sqlite v1.55.0
go: downloading github.com/aws/aws-sdk-go-v2/service/ecs v1.91.0
go: downloading github.com/klauspost/compress v1.20.2
go: downloading github.com/pierrec/lz4/v4 v4.1.22
go: downloading modernc.org/libc v1.74.1
go: downloading modernc.org/libc v1.74.1
go: downloading modernc.org/mathutil v1.7.1
go: downloading github.com/google/uuid v1.6.0

amadan: job cancelled — a newer push superseded it
diff --git a/README.md b/README.md
index 6398b418c..17ee95106 100644
--- a/README.md
+++ b/README.md
@@ -1093,6 +1093,35 @@ A fully-private deployment (`STATUS_PUBLIC` unset) whose console is down has
no page at all — the `aws s3 cp` fallback above is the entire story there;
nothing papers over it.
+## Forwarding between boxes
+
+When a request reaches a box that does not host its app, that box's edge
+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:
+
+- `CARLOS_BACKHAUL_MAX_INFLIGHT`: ordinary requests, 256 per destination box
+ by default.
+- `CARLOS_BACKHAUL_MAX_STREAMS`: WebSockets and other upgraded connections,
+ 1024 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.
+
+Set either one in the sending box's `/etc/carlos/host.env` and restart
+`carlos-edge`. A value that is not a positive whole number is logged and the
+default is used. Neither limit can be turned off.
+
+At either limit the sending box answers `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. More
+than that gets `429`. The `backhaul_shed` rule fires when a box refuses more
+than 10 forwarded requests in a minute, and clears after a minute with none
+(see [Fleet alerts](#fleet-alerts)).
+
+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.
+
## Host & process monitoring
Operator-grade monitoring layered on top of fleet status: real CPU, memory,
@@ -1222,6 +1251,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 | more than 10 in a minute, clears after a minute 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 |