Hi @Duc_Bui_Minh and welcome in the MongoDB community !
I did a little test.
First, I started a for loop and inserted 10K docs in my
test.col collection. I did this at 22:40 and some seconds. Then took a screenshot at 22:41:09.
As you can see in this first screenshot, the
WiredTigerLog.0000000003 has been update a few seconds ago but the collection and index files have not been changed even if I’m actively writing to MDB at this moment in time.
After a few seconds, my write was done and nothing changed. It was similar to the image above.
Then, after 30 seconds, I’m guessing MongoDB reached a checkpoint and I took the following snapshot:
My understanding is that MongoDB flushed its WiredTiger journal and its content went into the collection and indexes files (my collection has 2 indexes,
As you can see, MongoDB’s journal size didn’t really change because of the pre-allocation. Also my current MongoDB is running with snappy’s compression algo so the file sizes are affected by this too.
So yes, from what I see, MongoDB is flushing its journal every 60 seconds or 2GB.
It’s also in the documentation.
So to answer your question, I think you are confused because of the pre-allocation. Your journal file is probably empty after 60sec if you stopped writing to MongoDB.
You can probably double check this by monitoring the file size like I did with
watch -n 0.1 ls -l or something similar.