Roadmap Reveal 🗺 What's next for Rocket.Chat, Sep 22

How to spread mongodb load across few servers?


We use mongodb version 4.0.24 in PSA mode - one Primary server, one Secondary server and one mongo-arbiter docker container.
Recent version of Rocket.Chat (we are on 3.14.0 now) consuming more CPU resources of mongodb server (and RocketChat application too, but it’s some next thing).

We have both Primary and Secondary mongo servers with 12 CPU and 64Gb of RAM, and I guess it’s not enough for CPU.
But now we have problem with virtual infrastructure (NUMA and all stuff) and can’t add more and more CPUs to DB servers.
Virtual Infrastructure administrator advised us to create more small servers and spread load among them. That is a good idea, but how can I do it.

As I understand - in mongodb all writes operations are always on one single Primary node. Or there is other options that support by Rocket.Chat?

My goal is to spread that high load among few middle size servers. How can I do that?

Server Setup Information

  • Version of Rocket.Chat Server: 3.14.0
  • Operating System: CentOS
  • Deployment Method: docker
  • Number of Running Instances: 25
  • DB Replicaset Oplog: Enabled
  • NodeJS Version: 12.22.1
  • MongoDB Version: 4.0.24
  • Proxy: nginx+HAProxy
  • Firewalls involved: Yes, but all critical is opened

Any additional Information

That question is not solved actually, but for a moment it’s not so critical for us due to migration to native OpLog with USE_NATIVE_OPLOG=true which have much less load on mongodb.

But in future I still want to get back to change streams technology.

1 Like