Journaling

Mongo uses a write ahead log called the Journal. By default, journaling is on, on 64-bit distributions since version 2.2. This is very likely what you want. If you use an mmapv1, you can change the journal flush interval. I've not found a need to do this yet, but under some use cases it might be a performance or durability gain for you.

When Mongo acknowledges a write to an application, the data may not have made it yet to disk. With journaling on, an acknowledgment of a journaled write means data made it to disk. With journaling off, you would have to wait for the in-memory data to be flushed to disk, which takes much longer than the journal.

確認mongo的資料有存進硬碟

Turning journaling off is putting your data at risk. An application expects that a write accepted by Mongo is persisted to disk and will survive reboot. Without journaling, the risk window is wider. Now some scenarios can tolerate data loss. Most don't. I keep journaling on. Not only that, I set it in the config file even though on is the default. This protects me in case future versions has it off by default, or some bug or something, and I miss the release notes. Explicit is good.

results matching ""

    No results matching ""