Write Amplification – Application, DB, SSD
Application Write Amplification
It’s a single operation on the front-end – let’s say -> mark a task completed. This may translate to multiple things on the backend. It would
- change the status to completed
- based on the status completion – another task needs to be marked completed
- update a log table for maintaining history
So essentially, one operation causes multiple on the backend.
DB Write Amplification
A db row updation would case
- changing values into the table
- changing values into the index. Now there could be multiple indexes and all may or may not need to be updated depending on the scenario, what you are updating and which DB system you are using.
So essentially, one operation causes multiple on the backend.
SSD Write Amplification
SSDs work in a different way. We write to them pages which are stored in blocks.
As one can see the entire data is moved from one block to the other in garbage collection. The updates are bad for the SSD as it invalidates the pages and it needs to be written again. So with a structure like B+ tree where trees need to be balanced and nodes updated, it can cause several blocks to be written. This is why append logs came into the scenario as they are SSD friendly as they don’t update but just write new things.