π Overview
Currently, the storage engine only performs whole-file deduplication. This means that if two large files differ by even a single byte, both files are stored independently, resulting in significant storage waste β especially for mutable large files such as:
This feature proposes implementing block-level deduplication using the FastCDC content-defined chunking algorithm in Rust.
Instead of hashing entire files, files will be split into variable-sized chunks using rolling hash boundaries. Identical chunks across files will be stored only once, dramatically improving storage efficiency.
π― Goals
Implement FastCDC-based content-defined chunking
Enable block-level deduplication
Reduce redundant storage for large mutable files
Improve backup and snapshot efficiency
Maintain high throughput with minimal memory overhead
π‘ Why FastCDC?
Traditional fixed-size chunking performs poorly when bytes are inserted or removed because chunk boundaries shift.
FastCDC solves this using:
Rolling hash fingerprinting
Content-defined chunk boundaries
Adaptive normalization
High-speed chunking performance
This approach is used in enterprise-grade storage and backup systems such as:
ZFS
BorgBackup
Restic
VDO
Dropbox backend systems
π Proposed Architecture
Current Flow
File β SHA256(file) β Store Entire File
Proposed Flow
File
β
FastCDC Chunking
β
Chunk Hashing (SHA256/BLAKE3)
β
Chunk Index Lookup
β
Store Only Unique Chunks
β
Metadata Manifest Creation
π§ Core Components
1. FastCDC Chunker
Implement content-defined chunking with:
Rolling hash window
Min/avg/max chunk sizes
Boundary detection masks
Suggested defaults:
MIN_CHUNK_SIZE = 16KB
AVG_CHUNK_SIZE = 64KB
MAX_CHUNK_SIZE = 256KB
2. Chunk Hashing
Each chunk should be hashed independently using:
Example:
hash(chunk_bytes) -> ChunkID
3. Chunk Store
Store chunks separately:
/chunks/
ab/cd/hash.chunk
Avoid storing duplicate chunks.
4. Manifest Metadata
Each uploaded file should maintain a manifest:
{
"file_name": "vm-image.qcow2",
"chunks": [
"hash1",
"hash2",
"hash3"
]
}
This enables reconstruction during restore/download.
5. Reconstruction Pipeline
During retrieval:
Read manifest
Stream chunks in order
Rebuild original file
β‘ Performance Considerations
Memory Efficiency
Parallelism
Potential future optimization:
Chunk Cache
Optional LRU cache for hot chunks.
π§ͺ Edge Cases
π Expected Impact
Metric | Current | After FastCDC
-- | -- | --
Deduplication Granularity | Whole File | Block Level
VM Backup Efficiency | Poor | Excellent
Incremental Backup Size | Large | Minimal
Storage Savings | Low | High
Upload Redundancy | High | Reduced
Expected improvements:
π Suggested Rust Crates
fastcdc
blake3
rayon
tokio
bytes
Example:
[dependencies]
fastcdc = "3"
blake3 = "1"
rayon = "1"
tokio = { version = "1", features = ["full"] }
π Suggested File Structure
src/
βββ chunking/
β βββ fastcdc.rs
β βββ boundaries.rs
β
βββ storage/
β βββ chunk_store.rs
β βββ manifest.rs
β
βββ hashing/
β βββ blake3.rs
β
βββ restore/
β βββ reconstruct.rs
β
Acceptance Criteria
Files are chunked using FastCDC
Duplicate chunks are stored only once
Chunk manifests are generated correctly
Files can be reconstructed losslessly
Streaming uploads supported
Benchmarks added
Unit + integration tests added
Documentation updated
π§ͺ Benchmark Ideas
Test against:
Measure:
Chunking throughput
Deduplication ratio
Restore speed
Memory usage
π References
π· Labels
enhancement
NSoC'26 and GSSoC'26
π Overview
Currently, the storage engine only performs whole-file deduplication. This means that if two large files differ by even a single byte, both files are stored independently, resulting in significant storage waste β especially for mutable large files such as:
Virtual Machine Images (
.vmdk,.qcow2)Database snapshots
Incremental backups
Container layers
Large binary archives
This feature proposes implementing block-level deduplication using the FastCDC content-defined chunking algorithm in Rust.
Instead of hashing entire files, files will be split into variable-sized chunks using rolling hash boundaries. Identical chunks across files will be stored only once, dramatically improving storage efficiency.
π― Goals
Implement FastCDC-based content-defined chunking
Enable block-level deduplication
Reduce redundant storage for large mutable files
Improve backup and snapshot efficiency
Maintain high throughput with minimal memory overhead
π‘ Why FastCDC?
Traditional fixed-size chunking performs poorly when bytes are inserted or removed because chunk boundaries shift.
FastCDC solves this using:
Rolling hash fingerprinting
Content-defined chunk boundaries
Adaptive normalization
High-speed chunking performance
This approach is used in enterprise-grade storage and backup systems such as:
ZFS
BorgBackup
Restic
VDO
Dropbox backend systems
π Proposed Architecture
Current Flow
Proposed Flow
π§ Core Components
1. FastCDC Chunker
Implement content-defined chunking with:
Rolling hash window
Min/avg/max chunk sizes
Boundary detection masks
Suggested defaults:
2. Chunk Hashing
Each chunk should be hashed independently using:
BLAKE3(preferred for performance)or
SHA256Example:
3. Chunk Store
Store chunks separately:
Avoid storing duplicate chunks.
4. Manifest Metadata
Each uploaded file should maintain a manifest:
This enables reconstruction during restore/download.
5. Reconstruction Pipeline
During retrieval:
Read manifest
Stream chunks in order
Rebuild original file
β‘ Performance Considerations
Memory Efficiency
Use streaming I/O
Avoid loading full files into memory
Parallelism
Potential future optimization:
Parallel chunk hashing with Rayon
Async chunk persistence
Chunk Cache
Optional LRU cache for hot chunks.
π§ͺ Edge Cases
Very small files
Highly compressed/encrypted files
Chunk boundary drift
Corrupted chunk manifests
Concurrent uploads
π Expected Impact
Metric | Current | After FastCDC -- | -- | -- Deduplication Granularity | Whole File | Block Level VM Backup Efficiency | Poor | Excellent Incremental Backup Size | Large | Minimal Storage Savings | Low | High Upload Redundancy | High | ReducedExpected improvements:
50β90% storage savings for mutable large files
Faster incremental backups
Reduced network transfer
π Suggested Rust Crates
fastcdcblake3rayontokiobytesExample:
π Suggested File Structure
β Acceptance Criteria
Files are chunked using FastCDC
Duplicate chunks are stored only once
Chunk manifests are generated correctly
Files can be reconstructed losslessly
Streaming uploads supported
Benchmarks added
Unit + integration tests added
Documentation updated
π§ͺ Benchmark Ideas
Test against:
VM disk images
SQLite/Postgres snapshots
Incremental backups
Large binary datasets
Measure:
Chunking throughput
Deduplication ratio
Restore speed
Memory usage
π References
FastCDC Paper:
βFastCDC: A Fast and Efficient Content-Defined Chunking Approach for Data Deduplicationβ
Reference Crates:
fastcdcresticborgbackupπ· Labels