Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: multi-thread reads and batched writes #56

Merged
merged 13 commits into from
Dec 20, 2023

Conversation

losfair
Copy link
Member

@losfair losfair commented Dec 17, 2023

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

deno.lock Outdated Show resolved Hide resolved
scripts/benchmark.ts Show resolved Hide resolved
Cargo.lock Outdated Show resolved Hide resolved
@littledivy
Copy link
Member

Great improvements, nice work.

Copy link
Member

@lucacasonato lucacasonato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if workers[0] was explicitly write_worker and the workers[1..] was read_workers. The rest LGTM!

@losfair losfair merged commit 43628b4 into denoland:main Dec 20, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants