Search code examples
mongodbsharding

MongoDB sharded cluster - problem w/per second


I have set a MongoDB Sharded Cluster with 2 shards (3 replicas set), 3 configSrv and 2 mongos, and my problem is when I make an insert query > it writes at only 1000 w/per second for a simple query indexed id + firstname.

That seems to be abnormally slow when looking at my server setup which is as follows :

  • Config server for each Shard is a cpu 24c/48t - 128g ram - ssd nvme 512go
  • Config server for each Mongos and for each ConfigSrv is a cpu 16c/32t - 256go ram - ssd nvme 512go
  • All server are running on a Ubuntu 20.04 with Mongodb 4.4

(In comparison when I have tested on a standalone MongoDB server, I could easily reach 25000 w/per second...)

Anyone can tell me why I cannot get more than 1000 w/per second ?

With Htop the cpu is only used between 2% and 7%, the ram is at 0.4%.

Problem is mongos, shard or configSrv ?

Thank you for advice.


Solution

  • If you set writeConcern: 0 and journaling: 0 it will be much faster...