Through iostat
I could find spikes in disk writes once per minute. I think these spikes are caused by fsync
, since MongoDB by default flush data to disk every 60 seconds.
I could also find out that coinciding with the spikes slow queries are appearing in the slow query log.
There is an option called storage.syncPeriodSecs, but according to the docs:
Do not set this value on production systems. In almost every situation, you should use the default setting.
Executing fsync more often could reduce the spikes, so I would like to know the risks of changing this value in production.
I would appreciate any thoughts.
Details:
MongoDB version: 3.2.16
Storage engine: WiredTiger
Slow queries during the spike: A couple of them, of around 1second. Not stalling the server
Deployment: Sharded cluster. Replica sets with two members (primary + secondary)
Specs: CPU 8 cores, Memory 64GB, SSD disk