peers / peerjs-server

Server for PeerJS
https://peerjs.com
MIT License
4.26k stars 1.08k forks source link

unsuitable for large / distributed application? #257

Open Awendel opened 2 years ago

Awendel commented 2 years ago

As far as I can tell, all state around connections is handled in memory and exchanged with Clients through the websocket protocol.

Now suppose I have a rather large applications with a load balancer and let's say 20 Servers behind it that the LB routes to.

Wouldn't there be the problem that when opening a Websocket, clients wouldn't "find" each other if they're not connected to the exact machine / websocket connection and hence connections wouldn't be possible?

The only way around it seems to add a centralised database, such as Redis, Memcached or Mongo to share state between Servers?

If that is the case, it would maybe be a good idea to add a disclaimer in the README that it's not suited for distributed / load balanced applications.

Givemeurcookies commented 2 years ago

Shouldn't be hard to add DB support. Redis is probably the simplest and most fitting.

Though, it's worth to mention that having an open Websocket use very little bandwidth and server resources so you would need to have a significant amount of connections to need a load balancer.

rushglen commented 2 years ago

It would be interesting to hear if someone has load tested a peerjs-server, then we might be aware of it's limitations.