westerndigitalcorporation / zenfs

ZenFS is a storage backend for RocksDB that enables support for ZNS SSDs and SMR HDDs.
GNU General Public License v2.0
243 stars 88 forks source link

[Feature Request] Need an background GC worker to faster space reclaim #13

Closed royguo closed 2 years ago

royguo commented 3 years ago

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:

We 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.

yhr commented 3 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?

royguo commented 3 years ago

@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.

yhr commented 3 years ago

@royguo : Yes, exactly! once #36 is done, lets revisit this.