Write amplification is a critical parameter of SSD
SSD has to do some extra data migration when users want to write some data, due to GC. In other words, there will be extra writing, which leads to more actual data being written into flash memory of SSD compared with user data. Thus, there is a critical parameter of SSD, WA(Write Amplification):
WA = actual data/user data
As for empty disk(without triggering GC), WA is generally 1, which means data written by user is equal to actual data written in SSD(ignore the writing of internal data, mapping table writing for example). The minimum WA is 1 before Sand Force controller coming out. However, WA can be smaller than 1 with help of SandForce controller carrying real-time data compression, which makes real-time compression of data before writing them into flash memory. For example, when user writes 8KB data which is compressed to 4KB, WA is 0.5 without garbage collection.
How does WA being calculated after GC trigger? Choose Block 0 of each Die to make garbage collection, the former GC for instance:
There are 12 blocks of valid data among total 36 blocks. It is necessary to write back after doing garbage collection.
There are 24 blocks of data left for user data. Actually, in order to write 24 blocks of user data, SSD writes 12 blocks of original valid data adding 24 blocks of user data, which is 36 blocks of data in total. According to WA definition: WA= 36/24 = 1.5.
The larger WA is, the more extra data will be written in flash memory. On one hand, there will be a abrasion of flash memroy reducing SSD lifetime, on the other hand, extra data will take underlying flash memory bandwidth, which affects SSD performance. As a result, SSD design aims at making WA as small as possible. There are many ways to decrease WA, such as compression(which depends on master control), sequential write(garbage collection, but sequential write is stochastic which depends on user workload) and increasing OP(which can be controlled).
Why increasing OP can decline WA? The definision of OP ratio is: OP ratio = (flash memory space - user space)/user space.
Using the former SSD space as an example, SSD capacity can be cut divided into 180 blocks. When OP is 36 blocks the total SSD space is divided into 216 blocks, so the OP ratio is 36/180 = 20%. When 180 blocks of user data are averagely divided to 216 blocks, the valid data of each block is 180/216 = 0.83. Valid data of a flash memory block is 0.83*9 = 7.5, which means there are 7.5 green blocks and 1.5 red blocks on each flash memory block. In order to write 1.5 user data, 9 blocks of data(7.5 original valid data add up with 1.5 user data) is needed, when WA is 9/1.5 = 6.
If the whole SSD flash memory has a fixed space, 216 blocks, SSD capacity will be 144 blocks when OP is changed into 72 blocks(taking place of user space as OP accounting for 50%). 144 blocks of user data is averagely assigned to 216 blocks, so valid data of each block is 144/216 = 0.67. Valid data on a flash memory block is 0.67*9 = 6, which means there are 6 green blocks and 3 red blocks on each flash memory block. In order to write 3 blocks of user data, 9 blocks of data is needed(3 blocks of original valid data adding up with 3 blocks of user data), whose WA is 9/3 = 3.
Apparently , the larger OP is , the smaller WA is. Understandably, the larger OP is, the less valid data will be on each flash memory block, so there will be more garbage leading to less data to be rewritten. Meanwhile, full disk performance of SSD is better due to less rewritten data to GC.
Certainly, the situation above is the worst one(garbage data is averagely assigned to each flash memory block). Actually, garbage data isn’t always averagely assigned to each flash memory block while some blocks have much garbage and others have less garbage. GC will choose the block with most garbage, so WA is smaller than the calculated value in fact.
The relationship of OP and WA as well as SSD write resistant degree is as follow:
Figure 1-1 Influence of WA and write resistant degree from OP
Conclusion:
The smaller WA is, the less flash memory wastage will be, which supports more user data with a longer life spans. The larger OP is, the smaller WA is, which means SSD performance will be better.
Major factors which influences WA:
OP: the larger OP is, the smaller WA is;
Pattern of user data: apparently, if user data is sequntially written in, GC will work easier(a perfect condition is that whole flash memory block has invalid data which only needs data migration rather than wiping) with a small WA;
GC startegy: the WA will be increased when source flash memory block being chosen doesn’t have least valid data(having most garbage data); in addition, it helps to decrease WA that controling free flash memory blocks made by GC in background;
Wear Leveling: data migration is needed in order to balance erasing times of each flash memory blocks;
Read disturb and Data Retention handling: data migration enlarges WA;
Master control: controler with compression and without compression have different impacts on WA;
Trim: Trim has a large impact on WA.