► Resources Insight
It's not just a memory/storage issue. The chat system has dual-binding between the client's (multiple) view and the data model (server). This basically means the client(s) and server stay in sync when either changes. This is typically attained by keeping a connection open between the server/client (long-poll). The plural client is important:
User sends a message to server:
Server response to all connected chatters:
As the number of users grow, the more often messages get sent. Not only that, but the server requires more people to update. The strain rate (with all factors considered) is unfortunately curved.
The web server should be responsible for web page generation, not real time chat. Discord is built to be a real time chat system, and separating concerns is the best way to properly stay sane while developing anything.
User sends a message to server:
Chatter#1
Chatter#2 ----+
Chatter#3 |
Chatter#4 |
Chatter#5 +---> Server
Chatter#6
Chatter#7
Chatter#8
Chatter#9
Server response to all connected chatters:
Chatter#1 <----+
Chatter#2 <----|
Chatter#3 <----|
Chatter#4 <----|
Chatter#5 <----+--- Server
Chatter#6 <----|
Chatter#7 <----|
Chatter#8 <----|
Chatter#9 <----+
As the number of users grow, the more often messages get sent. Not only that, but the server requires more people to update. The strain rate (with all factors considered) is unfortunately curved.
The web server should be responsible for web page generation, not real time chat. Discord is built to be a real time chat system, and separating concerns is the best way to properly stay sane while developing anything.