Write-Behind Log — WBL

One of my most popular blogs to date is also my first blog on Write-Ahead Logs. But as with everything in technology, we evolve the existing solutions to become better.

WBL — Write-Behind Log

Write-behind logging (WBL) is a logging technique used in database management systems (DBMS) to improve performance. It differs from write-ahead logging (WAL) in that it does not write the log records to persistent storage immediately after they are generated. Instead, the log records are buffered in memory and written to persistent storage in the background. This allows the DBMS to continue processing transactions without waiting for the log records to be written.

But wait, if log records are buffered in memory, wouldn’t that be an issue? That was the entire problem statement for using WAL!

WBL is made possible by advancements in hardware, such as non-volatile memory (NVM). NVM is a type of memory that retains its data even when power is lost. This means that the log records can be buffered in NVM and written to persistent storage later, without the risk of losing data.

How does Write-Behind Logging work

  1. A user updates record/s in a database.
  2. The changes are buffered in memory. The changes are not written to the log until the transaction commits.
  3. The transaction commits. On commit, the database writes the changes to a log in the NVM.

--

--

Pratik Pandey - https://pratikpandey.substack.com
Pratik Pandey - https://pratikpandey.substack.com

Written by Pratik Pandey - https://pratikpandey.substack.com

Senior Engineer with experience in designing and architecting large scale distributed systems.

Responses (1)