A key-value store inspired by Bitcask.
FileDB is a Zig-implementation of Bitcask by Riak1 paper.
MAX_FILE_REACHED, the disk file is rotated and all the oldfiles are kept open for reading only.config.compactionInterval seconds, reads all the disk files and combines them into one file while updating the metadata hashtable.config.syncInterval. Sync also can be done on every request if config.alwaysFsync is True.Read about internals in-depth at FileDb.
init(allocator: std.mem.Allocator, options: ?config.Options) : Intialized FileDBdeinit(): Deinitalizes FileDBput(key:[]const u8, value: []const u8): Inserts a key-value pair in the database to be tracked.get(key:[]const u8): Retrieved a key-value pair from the database.delete(key: []const u8): Delete a key-value pair from the databaselist(allocator: std.mem.Allocator): Returns a list of keys stored in the database.sync(): Syncs the current open datafile on the diskstoreHashMap(): Creates the HINTS fileloadKeyDir(): Loads the hashmap from the HINTS fileAlong with the library, a Redis-compatible client is available.
127.0.0.1:6379> RING
(error) ERR unknown command
127.0.0.1:6379> PING
PONG
127.0.0.1:6379> get abcd
(nil)
127.0.0.1:6379> set abcd def
OK
127.0.0.1:6379> get abcd
"def"
redis-benchmark -p 6379 -t set -n 10000 -r 100000000
Summary:
throughput summary: 13736.26 requests per second
latency summary (msec):
avg min p50 p95 p99 max
3.615 0.088 3.455 6.831 8.831 14.919
redis-benchmark -p 6379 -t set -n 200000 -r 100000000
Summary:
throughput summary: 14375.04 requests per second
latency summary (msec):
avg min p50 p95 p99 max
3.452 0.072 3.087 6.767 10.647 114.303
redis-benchmark -p 6379 -t get -n 100000 -r 100000000
Summary:
throughput summary: 44286.98 requests per second
latency summary (msec):
avg min p50 p95 p99 max
0.573 0.088 0.519 0.967 1.447 7.495
redis-benchmark -p 6379 -t get -n 1000000 -r 1000000000 --threads 10
Summary:
throughput summary: 104876.77 requests per second
latency summary (msec):
avg min p50 p95 p99 max
0.405 0.032 0.375 0.831 1.295 26.047
23 commits
Zig
100.0%
A key-value store inspired by Bitcask.
FileDB is a Zig-implementation of Bitcask by Riak1 paper.
MAX_FILE_REACHED, the disk file is rotated and all the oldfiles are kept open for reading only.config.compactionInterval seconds, reads all the disk files and combines them into one file while updating the metadata hashtable.config.syncInterval. Sync also can be done on every request if config.alwaysFsync is True.Read about internals in-depth at FileDb.
init(allocator: std.mem.Allocator, options: ?config.Options) : Intialized FileDBdeinit(): Deinitalizes FileDBput(key:[]const u8, value: []const u8): Inserts a key-value pair in the database to be tracked.get(key:[]const u8): Retrieved a key-value pair from the database.delete(key: []const u8): Delete a key-value pair from the databaselist(allocator: std.mem.Allocator): Returns a list of keys stored in the database.sync(): Syncs the current open datafile on the diskstoreHashMap(): Creates the HINTS fileloadKeyDir(): Loads the hashmap from the HINTS fileAlong with the library, a Redis-compatible client is available.
127.0.0.1:6379> RING
(error) ERR unknown command
127.0.0.1:6379> PING
PONG
127.0.0.1:6379> get abcd
(nil)
127.0.0.1:6379> set abcd def
OK
127.0.0.1:6379> get abcd
"def"
redis-benchmark -p 6379 -t set -n 10000 -r 100000000
Summary:
throughput summary: 13736.26 requests per second
latency summary (msec):
avg min p50 p95 p99 max
3.615 0.088 3.455 6.831 8.831 14.919
redis-benchmark -p 6379 -t set -n 200000 -r 100000000
Summary:
throughput summary: 14375.04 requests per second
latency summary (msec):
avg min p50 p95 p99 max
3.452 0.072 3.087 6.767 10.647 114.303
redis-benchmark -p 6379 -t get -n 100000 -r 100000000
Summary:
throughput summary: 44286.98 requests per second
latency summary (msec):
avg min p50 p95 p99 max
0.573 0.088 0.519 0.967 1.447 7.495
redis-benchmark -p 6379 -t get -n 1000000 -r 1000000000 --threads 10
Summary:
throughput summary: 104876.77 requests per second
latency summary (msec):
avg min p50 p95 p99 max
0.405 0.032 0.375 0.831 1.295 26.047
23 commits
Zig
100.0%