12 Comments

Saurabh friend is delivering high quality content as always! 💪

Expand full comment
author

Thank you Daniel!

Expand full comment
Jun 9Liked by Saurabh Dashora

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
author

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

Thanks, Saurabh, for the clarifications! 🙌

Expand full comment
Jun 9·edited Jun 9Liked by Saurabh Dashora

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
Jun 9Liked by Saurabh Dashora

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

Expand full comment

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

Expand full comment

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

Expand full comment
author

Thank you Fernando!

Expand full comment

Superb explanation, @saurabh!

Expand full comment
author

Thank you Raul!

Expand full comment