skip to content

On MongoDB 9.0, can you turn off WiredTiger journaling to speed up writes, and what do storage.journal.commitIntervalMs and storage.syncPeriodSecs actually trade away?

level: middleimportance: should knowfreq 33%

answer

  1. removed, not merely discouraged
  2. version 6.1
  3. one knob moves the loss window
  4. the other moves replay and disk
  5. zero is not an off switch

basics

~20 s

No: journaling has been always on since MongoDB 6.1, and its off switches were removed. commitIntervalMs trades a wider loss window against fewer syncs; syncPeriodSecs trades more journal to keep and replay against less frequent checkpoints.

solid answer

~50 s

You cannot. Since MongoDB 6.1 journaling is always on, and `storage.journal.enabled`, `--journal` and `--nojournal` no longer exist, so 9.0 and 8.0 behave the same. What remains are two intervals. `storage.journal.commitIntervalMs` defaults to 100 and accepts 1 to 500: raising it means fewer syncs but a wider window of writes lost in a crash, while lowering it does the reverse at a cost in disk performance. `storage.syncPeriodSecs` defaults to 60 and has no effect on journal sync frequency: raising it spaces checkpoints out, at the price of more journal to retain and replay. Setting it to 0 skips checkpoints, and the journal eventually consumes all available disk. The docs and the source both say not to set it in production. A `w: 1` write with no `j` does not wait for the sync anyway, so these rarely buy the speed people hope for.

code

yaml · 4 lines
yaml
storage:
  journal:
    commitIntervalMs: 100
  syncPeriodSecs: 60

go deeper

for a junior

Recall that journaling cannot be switched off on current MongoDB, and that the two defaults are 100 milliseconds for the journal and 60 seconds for checkpoints.

for a middle

State what moves when each interval changes: the commit interval moves the loss window, while the checkpoint delay moves replay work and retained journal, and has no effect on journal syncs.

for a senior

Push back on tuning without a measurement. Explain why 0 for the checkpoint delay fills the disk, and why a w: 1 client with no j never waited for the journal sync.

for a principal

Decide that these stay at their defaults across the estate unless a recorded measurement says otherwise, because each change quietly moves a data-loss or recovery boundary that others rely on.

## The short answer on 9.0 Journaling cannot be turned off. **Since MongoDB 6.1** it is always enabled, and the manual records the removal of `storage.journal.enabled` along with the `--journal` and `--nojournal` command-line options. At r9.0.4 the storage options file registers `storage.journal.commitIntervalMs` and no enabling option at all. Teams on 8.0 are in the same position, so this is not a 9.0 change. Older advice about `--nojournal` is therefore out of date. The configuration without a journal that the manual describes is the Enterprise **in-memory storage engine**, which keeps its data in memory and has no separate journal, because it has nothing durable to recover. That is a different engine with different promises, not a speed setting for WiredTiger. ## Why it would not help much anyway The wish to disable the journal rests on a mistaken picture of the write path: - A standalone write with `w: 1` and no `j` is acknowledged after it is applied in memory, so that client does not wait for the journal sync at all. - A write that asks for `j: true`, or implies it, does wait, and that wait is exactly the durability the application asked for. It is a matter of write concern, not storage configuration. - On a replica set member, replicated collections are not journaled in the first place. The journal protects the oplog and most of the `local` database. The journal still costs something: buffer copying, compression, and sync I/O competing with other work. However, it is rarely the cost that a client is measuring. ## The two remaining settings | | `storage.journal.commitIntervalMs` | `storage.syncPeriodSecs` | |---|---|---| | Controls | Maximum time between journal syncs | Delay before the next checkpoint | | Default | 100 ms | 60 seconds | | Accepted values | 1 to 500, both included | 0 to 3600, both included | | Raising it gives | Fewer syncs | Less frequent checkpoints | | Raising it costs | A wider window of lost writes | More journal to keep and replay | | Runtime alias | `journalCommitInterval` | `syncdelay` | Both defaults are set in `StorageGlobalParams` in the source, and both can be changed at runtime through `setParameter`. ## What `commitIntervalMs` trades This setting defines the **loss window** for writes that did not ask for journal acknowledgement. By default, the most you can lose is the last 100 ms plus the time it takes to perform the journal writes. - Lowering it increases durability at the expense of disk performance, as the manual says. - Raising it to the 500 ms ceiling means fewer syncs but up to about five times the exposure. - It does not delay `j: true` writes, because those force an immediate sync. - There is no value of 0: the validator requires at least 1. ## What `syncPeriodSecs` trades The manual is blunt: **do not set this value on production systems**, and the source comment says the same. People reach for it for one of these reasons, and the honest response differs for each: - *Checkpoints look expensive.* Spacing them out does not remove the work, because more changed pages can pile up for the next one. - *Recovery should be faster.* A shorter interval reduces replay, but more frequent checkpoints cost more I/O all the time, to speed up a rare event. - *Durability should improve.* It cannot. The setting has no effect on how often the journal is synced. Setting it to **0** is the trap. The source comment says checkpointing is then skipped, and the manual adds the consequence: the journal eventually consumes all available disk space. Log files can only be removed once a checkpoint completes, and a server without enough room for its journal files crashes. ## What to do instead When someone proposes these changes to make writes faster, redirect the conversation: 1. Measure what the client is waiting for, starting with the write concern it uses. 2. Check whether the disk is the bottleneck, using the `wiredTiger.log` section of `serverStatus` for journal statistics. 3. Leave both intervals at their defaults unless a measurement points at them, and write down why if you change one. A reviewer who sees either setting in a `mongod.conf` should ask for that reason, since each one quietly moves a recovery or data-loss boundary for everyone using the server.

  • What should you do when a mongod.conf inherited from an old deployment contains storage.journal.enabled: false?
    Remove the line before upgrading. The option was removed in 6.1 and at 9.0 it is not a registered option, so it cannot disable anything. Then check whether anyone believed the setting mattered, since their loss and recovery assumptions were built on it.
  • Does lowering storage.journal.commitIntervalMs remove the risk of losing an acknowledged w: 1 write?
    No, it only narrows it. Even at the minimum of 1 ms, a write acknowledged in memory can still be lost before the sync, and the journal write itself takes time. Lower values also cost disk performance. Removing the risk for specific writes is what asking for journal acknowledgement is for.

  • On a standalone you can still disable journaling with --nojournal.
  • Setting storage.journal.commitIntervalMs to 0 turns the journal off.
  • Setting storage.syncPeriodSecs to 0 disables checkpoints with no side effects.
  • Raising storage.syncPeriodSecs makes journal syncs less frequent.
  • Lowering storage.syncPeriodSecs is the way to make acknowledged writes more durable.

Assumes MongoDB 9.0; journaling has been always on since 6.1, so 8.0 behaves the same way.