- Notifications
You must be signed in to change notification settings - Fork6
RocksDB plugin for zoned block device support
License
GPL-2.0, Apache-2.0 licenses found
Licenses found
bzbd/zenfs
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
ZenFS is a file system plugin that utilizes RockDB's FileSystem interface toplace files into zones on a raw zoned block device. By separating files intozones and utilizing write life time hints to co-locate data of similar lifetimes the system write amplification is greatly reduced compared toconventional block devices. ZenFS ensures that there is no backgroundgarbage collection in the file system or on the disk, improving performancein terms of throughput, tail latencies and disk endurance.
ZenFS depends on libzbdand Linux kernel 5.4 or later to perform zone management operations. To useZenFS on SSDs with Zoned Namespaces kernel 5.9 or later is required.
Download, build and install libzbd. See the libzbd READMEfor instructions.
Download rockksdb and the zenfs projects:
$ git clone https://github.com/facebook/rocksdb.git$ cd rocksdb$ git clone https://github.com/westerndigitalcorporation/zenfs plugin/zenfs
Build and install rocksdb with zenfs enabled:
$ DEBUG_LEVEL=0 ROCKSDB_PLUGINS=zenfs make -j48 db_bench install
Build the zenfs utility:
$ pushd$ cd plugin/zenfs/util$ make$ popd
The IO scheduler must be set to deadline to avoid writes from being reordered.This must be done every time the zoned name space is enumerated (e.g at boot).
echo deadline > /sys/class/block/<zoned block device>/queue/scheduler
Before ZenFS can be used in RocksDB, the file system metadata and superblock must be set up.This is done with the zenfs utility, using the mkfs command:
./plugin/zenfs/util/zenfs mkfs --zbd=<zoned block device> --aux_path=<path to store LOG and LOCK files>
To instruct db_bench to use zenfs on a specific zoned block device, the --fs_uri parameter is used.The device name may be used by specifying--fs_uri=zenfs://dev:<zoned block device name>
or byspecifying a unique identifier for the created file system by specifying--fs_uri=zenfs://uuid:<UUID>
.UUIDs can be listed using./plugin/zenfs/util/zenfs ls-uuid
./db_bench --fs_uri=zenfs://dev:<zoned block device name> --benchmarks=fillrandom --use_direct_io_for_flush_and_compaction
ZenFS implements the FileSystem API, and stores all data files on to a rawzoned block device. Log and lock files are stored on the default file systemunder a configurable directory. Zone management is done through libzbd andZenFS io is done through normal pread/pwrite calls.
Files are mapped into into a set of extents:
- Extents are block-aligned, continious regions on the block device
- Extents do not span across zones
- A zone may contain more than one extent
- Extents from different files may share zones
ZenFS is exceptionally lazy at current state of implementation and doesnot do any garbage collection whatsoever. As files gets deleted, the usedcapacity zone counters drops and when it reaches zero, a zone can be resetand reused.
Metadata is stored in a rolling log in the first zones of the block device.
Each valid meta data zone contains:
- A superblock with the current sequence number and global file system metadata
- At least one snapshot of all files in the file system
- Incremental file system updates (new files, new extents, deletes, renames etc)
ZenFS uses clang-format with Google code style. You may run the following commandsbefore submitting a PR.
clang-format-11 -n -Werror --style=file fs/*# Check for style issuesclang-format-11 -i --style=file fs/*# Auto-fix the style issues
About
RocksDB plugin for zoned block device support
Resources
License
GPL-2.0, Apache-2.0 licenses found
Licenses found
Code of conduct
Stars
Watchers
Forks
Packages0
Languages
- C++84.9%
- Shell11.1%
- Python3.7%
- Makefile0.3%