Introduction
As enterprises migrate core business functions to containerized microservices, they encounter a significant storage challenge. While microservices are theoretically "stateless," real-world applications frequently require persistent data storage, file sharing across containers, and the ability to handle diverse workloads—ranging from massive multi-gigabyte logs to millions of tiny metadata-heavy files.
Existing distributed file systems (DFS) often struggle with these requirements. Systems like HDFS excel at large file processing but falter under small file workloads. Conversely, specialized systems like Haystack are optimized for small files but lack general-purpose flexibility. Furthermore, many DFS solutions rely on hashing or subtree partitioning for metadata distribution, which triggers disruptive "rebalancing storms" when scaling out.
CFS (Chubao File System) is a distributed file system purpose-built to address these limitations within massive, dynamic container platforms like those at JD.com.
System Architecture
CFS is structured around three primary components: a metadata subsystem, a data subsystem, and a centralized resource manager. This design explicitly decouples metadata from data to allow for independent scaling and optimization.
The Metadata Subsystem maintains all file metadata in the memory of "Meta Nodes," avoiding expensive disk I/O for directory lookups and file "stats." The Data Subsystem manages the actual file content on "Data Nodes." The Resource Manager oversees the cluster, managing node health and volume allocation.
A key innovation in CFS is its utilization-based placement strategy. Instead of using consistent hashing, CFS places metadata and data on nodes based on their current resource availability (memory and disk usage). This approach allows the system to scale out by simply adding new nodes without requiring massive data migrations or rebalancing.
Hybrid Storage Engine
To handle the "storage paradox" of diverse file sizes, CFS employs a hybrid storage engine within its Data Partitions.
For large files, CFS uses "extents"—contiguous chunks of data. For small files, the system aggregates multiple files into single extents to minimize metadata overhead and improve I/O efficiency. To manage deletions without a complex custom garbage collector, CFS utilizes the Linux fallocate() "punch hole" interface to delete files asynchronously.
Performance and Evaluation
The system was evaluated against Ceph (v12.2.11) using industry-standard benchmarks including mdtest for metadata concurrency and fio for large-file I/O.
Key Results
- Metadata Throughput: CFS achieved a 3x average performance boost over Ceph for common metadata operations. Directory listing (
DirStat) was notably 8.6x faster, largely due to the in-memory metadata design and the use ofbatchInodeGetoperations to reduce network round-trips. - Scalability: CFS demonstrated superior performance stability under high concurrency. While Ceph’s performance often degraded as more clients were added due to metadata server pressure, CFS scaled linearly.
- Small and Large File I/O: CFS significantly outperformed Ceph in both reading and writing small files (under 128 KB) by avoiding the overhead of frequent resource manager requests. For large files (40 GB), CFS maintained higher IOPS than Ceph once concurrent processes exceeded 16.
Conclusion and Future Work
CFS demonstrates that decoupling metadata from data and relaxing certain POSIX semantics can yield massive performance gains for containerized workloads. By keeping metadata in memory and using utilization-based placement, CFS eliminates the scaling tax associated with traditional DFS rebalancing.
Future development focuses on reducing the performance overhead of the FUSE-based client by moving toward a native kernel-space implementation. Additionally, the team plans to leverage emerging hardware technologies like RDMA and NVMe to further minimize latency in large-scale deployments.
Summary updated