westerndigitalcorporation / zenfs

Licence: other
ZenFS is a storage backend for RocksDB that enables support for ZNS SSDs and SMR HDDs.

Programming Languages

C++
36643 projects - #6 most used programming language
python
139335 projects - #7 most used programming language
shell
77523 projects
Roff
2310 projects
Makefile
30231 projects

Projects that are alternatives of or similar to zenfs

FEMU
FEMU: Accurate, Scalable and Extensible NVMe SSD Emulator (FAST'18)
Stars: ✭ 213 (+238.1%)
Mutual labels:  ssd, zns, nvme
pynvme
builds your own tests.
Stars: ✭ 139 (+120.63%)
Mutual labels:  ssd, nvme
ToolBin
All the great tools we have for the field.
Stars: ✭ 91 (+44.44%)
Mutual labels:  ssd, nvme
SSD Demo Android
基于 mxnet, 实现 ssd demo for android
Stars: ✭ 14 (-77.78%)
Mutual labels:  ssd
netarbiter
Multi-site Network Emulation, Kubeadm-installed Kubernetes, NVMe over Fabrics
Stars: ✭ 18 (-71.43%)
Mutual labels:  nvme
CNN-Series-Getting-Started-and-PyTorch-Implementation
我的笔记和Demo,包含分类,检测、分割、知识蒸馏。
Stars: ✭ 49 (-22.22%)
Mutual labels:  ssd
sedcli
sedcli and libsed library for NVMe Self-Encrypting Drives (SEDs) management
Stars: ✭ 22 (-65.08%)
Mutual labels:  nvme
People-Counting-in-Real-Time
People Counting in Real-Time with an IP camera.
Stars: ✭ 233 (+269.84%)
Mutual labels:  ssd
SSD-Tensorflow2.0
A Tensorflow2.0 implementation of Single Shot Detector
Stars: ✭ 25 (-60.32%)
Mutual labels:  ssd
disktrim
Windows application to send TRIM / UNMAP / DISCARD to SSD. Similar to blkdiscard.
Stars: ✭ 17 (-73.02%)
Mutual labels:  ssd
Fourier-Analysis-Digital-Images
Fourier analysis applications for image matching.
Stars: ✭ 18 (-71.43%)
Mutual labels:  ssd
shd
Show pretty HDD/SSD list
Stars: ✭ 37 (-41.27%)
Mutual labels:  ssd
SSD Keras
Single Shot MultiBox Detector(SSD)目标检测算法
Stars: ✭ 44 (-30.16%)
Mutual labels:  ssd
CacheLib
Pluggable in-process caching engine to build and scale high performance services
Stars: ✭ 637 (+911.11%)
Mutual labels:  ssd
resolution
A library to resolve blockchain domain names.
Stars: ✭ 190 (+201.59%)
Mutual labels:  zns
objdet web
Image object detection demo(YOLO,SSD,etc.) running as a Flask web server.
Stars: ✭ 52 (-17.46%)
Mutual labels:  ssd
gsmartcontrol
GSmartControl - Hard disk drive and SSD health inspection tool
Stars: ✭ 183 (+190.48%)
Mutual labels:  ssd
coral-pi-rest-server
Perform inferencing of tensorflow-lite models on an RPi with acceleration from Coral USB stick
Stars: ✭ 49 (-22.22%)
Mutual labels:  ssd
SSD-Pruning-and-quantization
Pruning and quantization for SSD. Model compression.
Stars: ✭ 19 (-69.84%)
Mutual labels:  ssd
ssd detectors
SSD-based object and text detection with Keras, SSD, DSOD, TextBoxes, SegLink, TextBoxes++, CRNN
Stars: ✭ 295 (+368.25%)
Mutual labels:  ssd

ZenFS: RocksDB Storage Backend for ZNS SSDs and SMR HDDs

ZenFS is a file system plugin that utilizes RockDB's FileSystem interface to place files into zones on a raw zoned block device. By separating files into zones and utilizing write life time hints to co-locate data of similar life times the system write amplification is greatly reduced compared to conventional block devices. ZenFS ensures that there is no background garbage collection in the file system or on the disk, improving performance in terms of throughput, tail latencies and disk endurance.

Community

For help or questions about zenfs usage (e.g. "how do I do X?") see below, on join us on Matrix, or on Slack.

To report a bug, file a documentation issue, or submit a feature request, please open a GitHub issue.

For release announcements and other discussions, please subscribe to this repository or join us on Matrix or Slack.

Dependencies

ZenFS depends on libzbd and Linux kernel 5.4 or later to perform zone management operations. To use ZenFS on SSDs with Zoned Namespaces, Linux kernel 5.9 or later is required. ZenFS works with RocksDB version v6.19.3 or later.

Getting started

Build

Download, build and install libzbd. See the libzbd README for instructions.

Download rocksdb 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

Configure the IO Scheduler for the zoned block device

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

Creating a ZenFS file system

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>

ZenFS on-disk file formats

ZenFS Version 1.0.0 and earlier uses version 1 of the on-disk format. ZenFS Version 2.0.0 introduces breaking on-disk-format changes (inline extents, support for zones larged than 4GB).

To migrate between different versions of the on-disk file format, use the zenfs backup/restore commands.

# Backup the disk contents to the host file system using the version of zenfs that was used to store the current database
./plugin/zenfs/util/zenfs backup --path=<path to store backup> --zbd=<zoned block device>

# Switch to the new version of ZenFS you want to use (e.g 1.0.2 -> 2.0.0), rebuild and create a new file system
# Remove the current aux folder if needed.
./plugin/zenfs/util/zenfs mkfs --force --zbd=<zoned block device> --aux_path=<path to store LOG and LOCK files>

# Restore the database files to the new version of the file system
./plugin/zenfs/util/zenfs restore --path=<path to backup> --zbd=<zoned block device>

Testing with db_bench

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 by specifying 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

Performance testing

If you want to use db_bench for testing zenfs performance, there is a a convenience script that runs the 'long' and 'quick' performance test sets with a good set of parameters for the drive.

cd tests; ./zenfs_base_performance.sh <zoned block device name>

Crashtesting

To run the crashtesting scripts, Python3 is required. Crashtesting is done through the modified db_crashtest.py (original db_crashtest.py). It kills the DB at a random point in time (blackbox) or at predefined places in the RocksDB code (whitebox) and checks for recovery. For further reading visit the RocksDB wiki. However the goal for ZenFS crashtesting is to cover a specified set of parameters rather than randomized continuous testing.

The convenience script can be used to run all crashtest sets defined in tests/crashtest.

cd tests; ./zenfs_base_crashtest.sh <zoned block device name>

ZenFS Internals

Architecture overview

zenfs stack

ZenFS implements the FileSystem API, and stores all data files on to a raw zoned block device. Log and lock files are stored on the default file system under a configurable directory. Zone management is done through libzbd and ZenFS io is done through normal pread/pwrite calls.

File system implementation

Files are mapped into into a set of extents:

  • Extents are block-aligned, continuous 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

Reclaim

ZenFS is exceptionally lazy at current state of implementation and does not do any garbage collection whatsoever. As files gets deleted, the used capacity zone counters drops and when it reaches zero, a zone can be reset and reused.

Metadata

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)

Contribution Guide

ZenFS uses clang-format with Google code style. You may run the following commands before submitting a PR.

clang-format-11 -n -Werror --style=file fs/* util/zenfs.cc # Check for style issues
clang-format-11 -i --style=file fs/* util/zenfs.cc         # Auto-fix the style issues
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].