denoland / denokv

A self-hosted backend for Deno KV
https://deno.com/kv
MIT License
500 stars 24 forks source link

feat: multi-thread reads and batched writes #56

Closed losfair closed 10 months ago

losfair commented 10 months ago

Write batching and read multi-threading improves throughput by 5-18x, depending on workload type.

Benchmark with:

denokv --sqlite-path denokv-test.sqlite serve --access-token public-token --num-workers 8 --atomic-write-batch-timeout-ms 50
deno run -A --unstable ./scripts/benchmark.ts --path http://127.0.0.1:4512 --read-concurrency 128 --write-concurrency 64 --size 10000 --consistency-check-interval 10

Before:

Inserted 10000 entries in 18661ms
NewRds:     1831/s, NewWrs:      472/s, NewCfs:        7/s,

After:

Inserted 10000 entries in 1317ms
NewRds:    34573/s, NewWrs:     2285/s, NewCfs:       38/s
littledivy commented 10 months ago

Great improvements, nice work.