Glossary
Backpressure
What a system does when messages arrive faster than they can be handled. Without it, buffers grow until memory runs out; with it, the fast side waits, drops or sheds load on purpose.
General definition
Backpressure is the feedback that travels against the direction of data flow. A producer pushes items into a pipe; when the consumer at the other end falls behind, the pipe fills and the producer must learn to stop pushing. If there is no such signal, the only outcomes are unbounded buffering (memory grows until the process dies) or silent loss. Backpressure makes the limit explicit: the pipeline runs at the speed of its slowest stage, and the producer decides what to do with the surplus.
The mechanism exists at every layer:
- TCP advertises a receive window; a sender may not have more unacknowledged bytes in flight than the receiver can hold, so a slow reader throttles the writer across the network
- WebSockets in the browser expose
bufferedAmount, the bytes queued but not yet sent; a client that keeps writing while it grows is ignoring backpressure. Server-side socket libraries expose the same idea through write return values and drain events - Streams such as Node.js streams and the Reactive Streams specification let the consumer request n items at a time, so demand flows upstream explicitly
- Queues apply bounds: a full message queue blocks the producer, rejects the message or drops the oldest, and absorbs bursts between the two sides
When slowing the producer is impossible, as with human users typing, the system chooses a degradation policy: buffer up to a bound, drop or sample (keep the latest presence update, discard the ten before it), coalesce (one notification for many events), shed load by rejecting new work, or apply rate limiting at the edge so the surplus never enters. Which one is right depends on whether the data is a fact that must arrive (a message) or a signal that only matters now (typing).
Chat fan-out is the classic case. One message in a room with ten thousand members becomes ten thousand deliveries, and the members include phones on poor networks that read slowly. The server keeps a per-connection send queue; when a client’s queue passes a limit the server stops reading for that client, closes the connection, or marks it for catch-up from the archive on reconnect. Measuring throughput per node under that pattern is what sizing a chat cluster means in practice.
Building this into your own app? The Ethora chat SDK covers iOS, Android, React and React Native, with push notifications and file sharing included.
In the Ethora ecosystem
Ethora’s real-time path runs on ejabberd, an Erlang XMPP server built around bounded per-session queues and traffic shapers that cap how fast a single connection can send and receive, so one busy room or one flooding client does not take the node down with it. Clients connect over WebSocket, and the SDKs catch up from the server-side message archive after a disconnect rather than depending on every stanza surviving a congested link. Signals that only matter now, such as typing indicators and presence, are handled separately from messages that must arrive.
The Node.js API layer sits behind rate limits on app and API tokens, so bulk operations from your own backend, for example provisioning users or exporting data, are paced instead of queued without limit. On a dedicated or self-hosted deployment the included Prometheus metrics and load-testing tools let you find each node’s real limits before production does.