I was testing MongoDb write performance and noticed the following behaviour: when I increase the number of concurrent writers, the average time needed to write a document increases as well and ultimately I reach the peak when the number of inserted documents per second doesn't grow at all.
The interesting thing is, there is plenty of CPU still left, the disk utilisation is fine and the IOPS limit is not hit either. What's even more interesting is that if I start two mongod processes on the same node and alternate between inserting in them (based on GUID hash), the throughput increases in comparison to one mongod process.
I performed the simplest possible insert of a small 60 bytes document and a bigger one of ~1kb with the write concern majority and journaled set to true. The described behaviour was observed on several local Win machines and on Azure Linux VM with dedicated SSD mounted. MongoDb versions tested were 4.0 and 4.2. There is no sharding nor replication set up, it's a single standalone mongod on all environments.
I'd appreciate and advice as to what would cause such perf degradation even though neither CPU nor disk limits are reached.