westerndigitalcorporation / zenfs

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

A Question about Zone::Reset #253

Closed attack204 closed 1 year ago

attack204 commented 1 year ago

I asked a question about whether Zone::Reset will cause device io in issue#252 But I find that in ZenFS, a zone will be reset when used_capacity = 0, regardless of whether the capacity is 0. Should we wait until the capacity decreases to a certain threshold before resetting to avoid additional device io?

yhr commented 1 year ago

@attack204 : I think it could be a good idea to reset the write life time setting of the zone for non-empty zones in stead of resetting them(allowing them to be filled up by user data). Do I make sense?

attack204 commented 1 year ago

But consider this case: The zone size of WD ZN540 is 1GB, if the SST file size is 64MB, when there are several SST file allocated to a zone, e.g. 2 files with a total of 128MB and deleted, the zone will be reset with capacity = 896MB. I make an experiment to evaluate this. I create a 100GB SSD with each zone is 1GB and load 100GB data in random.

I find in total 2389 resets, about 260 resets are as follow.

Reset zone_id=5 capacity=863469568 used_capacity=0 HINT=5 level=1 

I think what you said is reasonable, but would it be more reasonable to add a threshold?

yhr commented 1 year ago

@attack204 : Why do you use 64MB sst file size? Aligning the file sizes with (1077MB) zone capacity costs ~10% of write amp but avoids this problem.

attack204 commented 1 year ago

OK, that's reasonable