CrewLink-server icon indicating copy to clipboard operation
CrewLink-server copied to clipboard

WIP: Horizontal Scaling

Open AlexMog opened this issue 4 years ago • 3 comments

Hello,
I've just seen this tweet from Ottomated.
Scaling vertically a server can work for a limited number of users, but it's not the best way to scale nodes, that's why I've started this PR, I'm working on vertical scaling for CrewLink Server with modular ways to implement messaging and caching.
I've replicated noop scaling (which replicated the current server for local use) and cluster-based node servers.

Currently implemented caches:

  • Local (noop)
  • Redis

Currently implemented messaging system:

  • Local (noop)
  • RabbitMQ

This PR is still in WIP status, because I'll also like to rewrite completely the index.ts to provide a better, modular-through-config and cleanest MVC model for this part of the code.
Theoretically, it can support an infinite amount of users, depending on the number of nodes you are able to provide to your cluster.

WIP part: Everything should work correctly, I've just didn't tested it very well, that's why I've added the WIP tag, I'll test it more with real world usage to validate all this PR.

Have fun !

AlexMog avatar Dec 25 '20 20:12 AlexMog

Tested with 50k clients spamming Signal messages each 100ms on 3 servers (standard HA, 3 rabbitMQ, 3 redis (1 sentinel 2 workers), 3 crewlink servers) with 2 cores each (3 GHz each), works like a charm !

AlexMog avatar Jan 09 '21 23:01 AlexMog

How would this perform with a TURN server?

ottomated avatar Jan 10 '21 01:01 ottomated

That's a good question, haven't tested it at all, just tested the Websocket messaging system. I think it would depend on the TURN implementation used https://github.com/coturn/coturn seems to have a good implementation for horizontal scaling behing a loadbalencer tho

(btw, I have a kubernetes cluster available (3x6 workers (8c16t x 4.5GHz) if you want me to host the CrewLink server with horizontal scaling if you want to test it)

AlexMog avatar Jan 10 '21 02:01 AlexMog