realtime
Let a managed edge hold the socket
- When
- You need millions of long-lived client connections but don't want to own draining, sticky routing, and fleet scaling.
- AWS
- API Gateway WebSocket API with $connect/$disconnect Lambdas; push later with @connections POST.
- Trade-off
- Per-message + per-connection-minute cost and a 128 KB frame limit, in exchange for deleting socket-fleet operations.
notification-fanout
Decouple fan-out behind pub/sub + queues
- When
- One event must reach many consumers and the producer must not feel the fan-out or the slowest consumer.
- AWS
- SNS topic fanning out to per-shard SQS queues, drained by Lambda workers; DLQ for poison messages.
- Trade-off
- At-least-once delivery (consumers must dedupe) and per-message SQS cost, in exchange for buffering, retries, and zero servers.
notification-fanout
Shard the hot partition
- When
- A few topics have orders-of-magnitude more subscribers than the rest, creating a hot key on lookup and delivery.
- AWS
- Append a shard suffix to the DynamoDB partition key (TOPIC#id#shard) and run one delivery worker per shard.
- Trade-off
- Delivery code must scatter-gather across shards; more workers and queries for the few topics that need it.
messaging
Let delivery prune the registry
- When
- A connection registry drifts as clients disconnect uncleanly, leaving dead entries that waste pushes.
- AWS
- On a 410 Gone from @connections POST, delete that connection from DynamoDB inline; TTL sweeps the rest.
- Trade-off
- A little extra write traffic on the delivery path, in exchange for a registry that needs no separate reaper.