What is MongoDB's fsync for?
mongodb, mongodb-query
Solution
Per Mongo documentation:
The primary use of `fsync` is to flush and lock the database for backups.
also
The `fsync` operation blocks all other write operations while its running.
The blocking appears to be the reason.
Problem
I've been using MongoDB for some time, and saw that `fsync` waits for data to be flushed to disk. Ok, so i thought it was the solution for safety of the data. It worked well by takes long, longer than SQL alternative. Then I saw that I can put the `syncdelay` to `0`, then speed came back, but I thought how it would be in the future with many many concurrent requests. So I removed `fsync` option from the updates and inserts and removed the `syncdelay` configuration option. To test if the data was being written I quickly checked Rockmongo after I made an update and the data was actually there, super fast! So really, what is `fsync` for if it makes the writes slow and without it the writes happen, and fast anyway?