1
votes

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.

1
I guess you try to insert documents one-by-one (i.e. insertOne). Use insertMany or Bulk Operation Methods or similar API. Are you sure you got 15k/sec with the same method? I have made similar experience, see github.com/syslog-ng/syslog-ng/issues/3454Wernfried Domscheit

1 Answers

0
votes

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