3 ms·
Okay, fair enough. I thought my previous test was parallel as well, but I was mistaken. Here's one for 64 parallel writes: https://gist.github.com/markuswusten
by markusw 4y ago
Okay, fair enough. I thought my previous test was parallel as well, but I was mistaken.
Here's one for 64 parallel writes: https://gist.github.com/markuswustenberg/f35ab7e191137dca5f7ec112bfc887be https://gist.github.com/markuswustenberg/f35ab7e191137dca5f7...
$ make benchmark
go test -bench=.
goos: darwin
goarch: arm64
pkg: sqlite
BenchmarkWriteBlogPost/write_blog_post_without_WAL-8 100 16317415 ns/op
BenchmarkWriteBlogPost/write_blog_post_with_WAL-8 1196 1198679 ns/op
BenchmarkWriteBlogPost/write_blog_post_with_WAL_and_Go_mutex-8 58455 17461 ns/op
PASS
ok sqlite 4.557s
1e9/1198679 = 834 writes per second is still far from crash and burn territory when using just WAL mode.
Of course, it gets more interesting when there are also concurrent readers, as people are trying out elsewhere in the discussion. But the point still stands: it can handle way, waaaay better than "fives of authors" in a not-at-all scary way.
- marktangotango 4y agoYou should duplicate this test against postgres inserts. I did the same thing for sqlite; in go using a mutex on inserts, and sqlite still out performs postgres on inserts (on the same machine).