Closed royguo closed 2 years ago
Garbage collection adds a lot of code complexity, so I've actively avoided implementing it. I'm trying to keep zenfs super-simple. Do you have any (estimated?) numbers on decreased space amplification in a real-world use case?
@yhr Now since you are going to implement a new background reset/finish worker, I believe it will be much easier for you to also add a GC ratio in that background worker, :P.
We can simply add a garbage ratio in the background reset/finish worker, then if we find out a zone has only x% valid data, we move it into another zone & reset the previous one). This process could be co-designed with the new background allocator.
@royguo : Yes, exactly! once #36 is done, lets revisit this.
Currently, ZenFS doesn't re-use the existing zone unless all of its data is deleted by RocksDB.
Sometimes we may run into such case:
ZenFS
is not going to re-claim those zones, thus space is wasted, and serving ability is restrictedWe propose to add a new GC worker thread that does this:
Since this GC worker only used as a backup plan to avoid the worst cases, so there should be no harm to the ZenFS's performance first principle.