MilletDB is a concurrent in-memory key-value store in Java with:
- sharded storage
- Caffeine-backed bounded cache
- TTL support
- binary snapshots
- Netty TCP server
- REST metrics/health endpoints
NettyServer: text command protocol over TCP (SET,GET,DEL,EXPIRE,PING,STATS)ShardedKVStore: hash-based sharding layerConcurrentKVStore: per-shard Caffeine cache + TTL metadataSnapshotManager: periodic binary snapshots with atomic file replacementStatsController:/healthand/stats
The following reliability/performance issues were addressed:
- Removed TTL side-map + per-key lock contention in
ConcurrentKVStore. - Unified value + expiration metadata into one record to reduce race windows.
- Added snapshot coordination gates for consistent capture/restore behavior under concurrent operations.
- Snapshot files are now written through temp file + atomic move.
- Migrated naming and usage fully to Netty (
NioServeralias removed). - Enforced entry size limits (
max key bytes,max value bytes) inShardedKVStore. - Replaced benchmark docs with measured output and reproducible commands.
Prerequisites:
- Java 17+ (tested on Java 25)
- Maven 3.9+
Build:
./mvnw clean packageStart:
./mvnw spring-boot:runDefault ports:
- TCP (Netty):
8080 - HTTP (Spring):
8081
src/main/resources/application.properties:
milletdb.tcp.enabled=truemilletdb.tcp.port=8080milletdb.tcp.workerThreads=20
For tests, TCP autostart is disabled via src/test/resources/application.properties.
SET key value
GET key
DEL key
EXPIRE key ttlMillis
PING
STATS
GET /healthGET /stats
Measured benchmark results and exact commands are in BENCHMARK.md.
Raw run outputs:
target/benchmarks/throughput-jmh.txttarget/benchmarks/latency-jmh.txttarget/benchmarks/netty-load.txt
Run all tests:
./mvnw clean testsrc/main/java/com/pavan/milletdb/
kvstore/
server/
snapshot/
metrics/
src/test/java/com/pavan/milletdb/