What is a chat server?
It is a server built around long-lived connections. Unlike a web page, which is requested and done, a chat client stays connected for hours so the server can push new messages the moment they arrive. The server tracks who is online, which rooms or channels each user belongs to, and which messages each device has already received. When a message comes in, it saves it, works out the recipients and sends it down each of their open connections. Offline users get it when they reconnect, often with a mobile push notification in between.
Which protocols do chat servers use?
| Protocol | Model | Example software |
|---|---|---|
| WebSocket | Custom messages over one TCP connection | Rocket.Chat, Mattermost, custom apps with Socket.IO |
| XMPP | Open, federated XML messaging standard | ejabberd, Prosody, Openfire |
| Matrix | Federated rooms with synchronized history | Synapse, Conduit-style servers |
| IRC | Plain-text channels, very lightweight | InspIRCd, Ergo |
| MQTT | Publish and subscribe, tiny messages | Mosquitto, EMQX (often for devices) |
What does a chat server spend resources on?
Open connections, message fan-out and history. Each open connection costs some memory: a few kilobytes in a well-tuned Erlang or Go server, tens of kilobytes or more in heavier stacks. Fan-out multiplies work: one message to a channel of 2,000 users means 2,000 sends. History grows forever unless you set retention, and search across it is often the hungriest feature. Files and images are usually the biggest share of storage and outgoing traffic.
How far does one box scale for chat?
More than most teams expect. ejabberd and similar servers are known to hold hundreds of thousands of idle connections on one well-tuned box; team chat platforms with search and integrations typically serve thousands of active users per machine. Practical starting points:
- A company of a few hundred people on Mattermost or Rocket.Chat: E2 or S1 is plenty.
- A community of several thousand active users with search and file sharing: S5 with 128 GB DDR4 for the database and search index.
- A large public service or a federated Matrix server with big rooms: S14 or D4 with many cores.
What needs tuning for many connections?
Raise the open file limit, because every connection is a file descriptor. In a systemd unit add LimitNOFILE=200000; check the current value with cat /proc/$(pgrep -o beam.smp)/limits or the process of your server. Keep a reverse proxy configured for WebSockets with long timeouts, for example proxy_read_timeout 1h; in nginx, so idle connections are not cut every minute. Use heartbeats so dead connections are noticed and cleaned up. These steps are the same whether the chat engine is written in Erlang, Go or Node.js.
Where should a chat server live?
Close to the bulk of users, because typing indicators and message delivery feel sluggish when every round trip is long. For a team spread across the US, Chicago sits near the middle; for Europe, Amsterdam; for Asia, Singapore. Chat traffic itself is small, a few hundred bytes per message, so the monthly outgoing allowance is mostly used by images, files and voice notes, not by text. Latency explains what distance does to response times.
Self-hosted chat or a hosted service?
Self-hosting on your own machine means data stays on hardware you control, there is no per-user fee, retention follows your rules, and you can integrate with internal systems freely. The work is yours: updates, backups, push notification setup for mobile apps and moderation tools. For voice and video calls, many chat platforms add a separate media server, such as an SFU for group calls and a TURN server for clients behind strict firewalls; VoIP and PBX servers covers the voice side. Back up both the database and the uploaded files to a second machine (Backup server).
Machines for Self-Hosted Chat
| Server | Processor | Cores / threads | Memory | Storage | Network | Per month | Smallest order |
|---|---|---|---|---|---|---|---|
| E2 | Intel Xeon E3-1270 v3 | 4 / 8 | 32 GB DDR3 | 1x 480 GB SSD | 2x 1 Gbps | $38.32 | $114.96 (3 months) |
| S1 | Intel Xeon E-2276G | 6 / 12 | 64 GB DDR4 | 1x 1 TB NVMe | 2x 10 Gbps | $53.32 | $53.32 (1 month) |
| S5 | Intel Xeon E-2276G | 6 / 12 | 128 GB DDR4 | 2x 1 TB NVMe | 2x 10 Gbps | $88.72 | $88.72 (1 month) |
| S14 | AMD EPYC 4565P | 16 / 32 | 192 GB DDR5 | 2x 4 TB NVMe | 2x 25 Gbps | $317.89 | $317.89 (1 month) |
| D4 | 2x Intel Xeon Gold 6326 | 32 / 64 | 128 GB DDR4 | 2x 1 TB NVMe | 2x 25 Gbps | $275.41 | $275.41 (1 month) |
Keep Reading
VoIP and PBX servers
Asterisk or FreeSWITCH on a public IPv4 with no NAT in the way, sized by concurrent calls and codecs.
OpenLatency
Why distance sets the floor for ping time, how to estimate round trips between our six cities and how to choose a location.
OpenBackup server
A machine whose job is to receive, keep and restore copies of other systems, and how to size one on budget bare metal.
OpenAPI server
A server that answers program-to-program requests over HTTP or gRPC, and the CPU, memory and latency factors that shape one.
OpenFAQ
Quick Answers
Clients keep a connection open, usually a WebSocket, so the server can push each message as soon as it arrives.
From a few kilobytes in efficient servers such as ejabberd to tens of kilobytes in heavier stacks, plus whatever the app keeps per user.
Open file limits, memory per connection, message fan-out in large rooms and the database behind history and search.
Text is tiny. Images, files and voice notes account for most of the outgoing traffic.
Yes, many platforms include or integrate a media server. Group video adds CPU and outgoing traffic, so size for it.