Daniel
Daniel

Reputation: 181

How to disable mongod journal pre-allocation

Is there a way to prevent mongod from pre-allocating these 100 MB files in journal folder?

WiredTigerPreplog.0000000001 WiredTigerPreplog.0000000002

I want journaling to be enabled.

Upvotes: 2

Views: 595

Answers (2)

devkev
devkev

Reputation: 25

I often need to run test instances of mongod, and these preallocated WiredTiger journal (log) files just waste 200MB each time.

They can disabled by adding this parameter to your mongod command line:

--wiredTigerEngineConfigString 'log=(prealloc=false)'

Or this to your mongod.conf file:

storage:
    wiredTiger:
        engineConfig:
            configString: log=(prealloc=false)

Of course this should never be done in production, and only when testing things that are unrelated to journalling. Journal file preallocation is a deliberate performance feature, which is almost always a win in the real world (and so is why it defaults to true).

Upvotes: 1

Mani
Mani

Reputation: 1549

Find below some notes from MongoDB Documentation for Journaling

WiredTiger will pre-allocate journal files.

Preallocation Lag

MongoDB may preallocate journal files if the mongod process determines that it is more efficient to preallocate journal files than create new journal files as needed.

The preallocation can be avoided using only for MMapv1 storage engine using --noprealloc option when starting the mongod. But this is not applicable for wiredtiger storage engine.

few more references

Meaning of WiredTigerPreplog files

Upvotes: 0

Related Questions