Flush Dirty bytes

Hi Team ,

Thinking if we can manually flush “dirty bytes” from cache to disk .If yes , how can we do it ?
Help me in sharing documents link / commands.


There’s a lock side effect if you use fsync. Not sure if you want that.

This is the very first step before a disk snapshot based backup can be made.

Hi @Prince_Das,

As @Kobe_W mentioned there is a way to do it using fsync but may I ask why you want to do that. Are you facing any issues related to it.


No , i am not facing any issue , was thinking like in oracle if we want we can flush “dirty buffer” , without any issue ,… thought Mongodb might be having similar type of feature where we can flush those dirty bytes.

but not in regularly , Only if it reaches near to “bytes currently in the cache” . We can us those command …For temp. purpose.
@Kobe_W fsync would help but it can acquire locks .

Thanks both for the help.


Hi @Prince_Das,

In MongoDB, you don’t need to manually flush dirty bytes. The system takes care of automatically flushing them to disk once dirty contents in the WiredTiger cache reach 5%. It will flush them more aggressively once this number reaches 20% of the configured cache size. You can customize these numbers if you need more control, but unless you’re experiencing issues that can be conclusively traced to this setting, I would not recommend changing these values.

To read more, please refer to the WiredTiger: Cache and eviction tuning documentation.


This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.