Rocket.Chat's Community Open Call 🎤 Jan 19th, 2022 Join us!

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

Does anybody knows is mongodb sharding is supported with Rocket.Chat?


I opened a ticket to support. The answer on 19 Oct 2020 05:17 PM was:

Rocket.Chat still doesn’t support shard clusters. It’s on our developers pipeline and we might have some news about this in the next updates.


1 Like

Hello, @scrat and thanks a lot for sharing that information!

Can you open another support ticket? Maybe shared mongodb cluster already supported. Your previous request was almost year ago, so something might changed.

Sure! Although in that case it would appear in the version changelog.

I will let you know when I hear back.

1 Like