12 Comments
User's avatar
Daniel Moka's avatar

Saurabh friend is delivering high quality content as always! 💪

Expand full comment
Saurabh Dashora's avatar

Thank you Daniel!

Expand full comment
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?

Expand full comment
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.

Expand full comment
Akos Komuves's avatar

Thanks, Saurabh, for the clarifications! 🙌

Expand full comment
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.

Expand full comment
Akos Komuves's avatar

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

Expand full comment
Ashwani Yadav's avatar

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

Expand full comment
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 👏

Expand full comment
Saurabh Dashora's avatar

Thank you Fernando!

Expand full comment
Raul Junco's avatar

Superb explanation, @saurabh!

Expand full comment
Saurabh Dashora's avatar

Thank you Raul!

Expand full comment