Stateful WebSocket scale-in without drain

warningstateful-websocket-scale-in-without-drain

Scaling a gateway down kills every live WebSocket on the removed instance at once. Without a drain step those clients all reconnect together.

Severity
warning
Selects
every node of kind realtime-gateway
Components in scope
20
What it checks

It looks at every node of kind realtime-gateway, and fires when:

  • — all of these hold:
  • — the node's `autoscaling` is true
  • — the node's `drainOnScaleIn` is false
Message
Realtime gateway '{{node.id}}' autoscales but does not drain connections on scale-in. Every scale-down becomes a reconnect storm.

{{node.id}} style paths are filled in from the node, the edge or the design the finding is about.

Applies to · 20 components
Tripped by · 10

Reference designs whose broken twin names this rule in its header. The gate reads the same header, and fails when a rule no design trips.

Source
# yaml-language-server: $schema=../schema/rule.schema.json
# Autoscaling down a gateway that holds live WebSockets kills every connection on the
# removed instance at once. Without a drain step the clients all reconnect together.
# Tripped by: designs/slack-messaging.broken.yaml
schemaVersion: "1"
type: "rule"
id: "stateful-websocket-scale-in-without-drain"
severity: "warning"
select:
  node:
    kind: "realtime-gateway"
when:
  all:
    - prop: "autoscaling"
      equals: true
    - prop: "drainOnScaleIn"
      equals: false
message: "Realtime gateway '{{node.id}}' autoscales but does not drain connections on scale-in. Every scale-down becomes a reconnect storm."

The same page as markdown, for an agent: /catalogue/rules/stateful-websocket-scale-in-without-drain.md