12 Comments
User's avatar
Daniel Moka's avatar

Saurabh friend is delivering high quality content as always! 💪

Saurabh Dashora's avatar

Thank you Daniel!

Akos Komuves's avatar

First time hearing this term, thanks for writing this up Saurabh! Aren't these systems prone to data loss - specifically during the memtable part where the data is stored in memory? Also, do you know if MongoDB also uses the LSM Tree approach, or is this more like your Redis and similar stuff?

Saurabh Dashora's avatar

Thanks Akos!

The WAL file takes care of the data loss.

As far as MongoDB is concerned, their storage engine WiredTiger uses B-Tree by default. But there is also an option to go with LSM Tree.

Akos Komuves's avatar

Thanks, Saurabh, for the clarifications! 🙌

Ashwani Yadav's avatar

hi Akos, data loss is mitigated by first writing the record to WAL file and then to the memtable.

Even if the server restarts abruptly, LSM tree memtable can recover the records unwritten to SStable from WAL file.

Akos Komuves's avatar

Oh so they are written into a file for the first time as well! Thanks!

Ashwani Yadav's avatar

yes, since its written in append only mode in WAL, its generally faster

Franco Fernando's avatar

I finally had the time to read your article, Saurabh. I loved it. A simple explanation of a not easy topic 👏

Saurabh Dashora's avatar

Thank you Fernando!

Raul Junco's avatar

Superb explanation, @saurabh!