diff --git a/Taskfile.yml b/Taskfile.yml index b7cf494..92e06cf 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -31,18 +31,18 @@ tasks: - '{{.BAR}} --stack pool/bench/pool-8cpu.txt -n "Pool (8 CPUs)" --id pool-8cpu -d "Same matrix at GOMAXPROCS 8" -o {{.DATA}}/pool-8cpu.json' - '{{.BAR}} --stack pool/bench/pool-4cpu.txt -n "Pool (4 CPUs)" --id pool-4cpu -d "Same matrix at GOMAXPROCS 4" -o {{.DATA}}/pool-4cpu.json' - >- - {{.BAR}} redis/bench/redis.txt -n "Redis (Persistent)" --id redis-persistent + {{.BAR}} --stack redis/bench/redis.txt -n "Redis (Persistent)" --id redis-persistent -d "One consumer process: VarMQ persistent queue vs Asynq, rmq, taskq, gocraft/work; plus enqueue-only and pickup latency" -f '^(Benchmark)?(Durable/[^/]+C1|Enqueue/Enqueue|Latency/[^/]+)/[^/]+/{{.SUBJECTS}}$' --better p50-ms:low,p99-ms:low,max-ms:low -o {{.DATA}}/redis-persistent.json - >- - {{.BAR}} redis/bench/redis.txt -n "Redis (Distributed)" --id redis-distributed + {{.BAR}} --stack redis/bench/redis.txt -n "Redis (Distributed)" --id redis-distributed -d "Four consumer processes: VarMQ distributed queue vs Asynq, rmq, taskq, gocraft/work" -f '^(Benchmark)?Durable/[^/]+C4/' -o {{.DATA}}/redis-distributed.json - >- - {{.BAR}} sqlite/bench/sqlite.txt -n "Sqlite (Persistent)" --id sqlite-persistent + {{.BAR}} --stack sqlite/bench/sqlite.txt -n "Sqlite (Persistent)" --id sqlite-persistent -d "sqliteq through a VarMQ worker: one queue, drain, priority, ten queues; WAL checkpoint 1000 vs 10000 pages" --better walMB:low -o {{.DATA}}/sqlite-persistent.json - jq -se 'all(.data | length > 0)' {{.JSONS}} diff --git a/sqlite/README.md b/sqlite/README.md index 129c8fe..9d4f7ca 100644 --- a/sqlite/README.md +++ b/sqlite/README.md @@ -70,14 +70,16 @@ WAL size. | Scenario | Layout | ckpt1000 | ckpt10000 | walMB 1000 / 10000 | |----------|--------|---------:|----------:|-------------------:| -| `Mixed1Q` | SingleFile | 6,351 | 10,236 | 4.2 / 41.2 | -| `Drain1Q` | SingleFile | 14,020 | 19,169 | 4.1 / 41.2 | -| `DrainPrio` | SingleFile | 12,320 | 24,036 | 4.1 / 41.2 | -| `Mixed10Q` | Folder | 21,058 | 69,482 | 4.1 / 39.8 | -| `Mixed10Q` | SingleFile | 5,255 | 11,578 | 4.2 / 41.3 | +| `Mixed1Q` | SingleFile | 6,579 | 9,640 | 4.2 / 41.2 | +| `Drain1Q` | SingleFile | 12,397 | 17,577 | 4.2 / 41.2 | +| `DrainPrio` | SingleFile | 11,027 | 16,918 | 4.2 / 41.2 | +| `Mixed10Q` | SingleFile | 4,290 | 8,678 | 4.2 / 41.3 | +| `Mixed10Q` | Folder | 22,675 | 34,935 | 4.1 / 39.4 | -A 10,000-page checkpoint runs 1.4 to 3.3x faster than the 1,000-page default +A 10,000-page checkpoint runs 1.4 to 2.0x faster than the 1,000-page default and holds a WAL about ten times larger (41 MB against 4 MB at this payload). -Ten queues in separate files run 4 to 6x faster than the same ten in one -file, which fits SQLite allowing one writer per database file. The machine -and disk change these numbers a lot, so compare runs on the same machine only. +Ten queues in separate files run 4 to 5x faster than the same ten in one +file, which fits SQLite allowing one writer per database file. Two runs an +hour apart on the same machine differed by up to 2x on the ckpt10000 rows, so +read the ratios, not the absolute numbers, and compare runs on the same machine +only. diff --git a/sqlite/bench/sqlite.txt b/sqlite/bench/sqlite.txt index 8f96b01..98985ad 100644 --- a/sqlite/bench/sqlite.txt +++ b/sqlite/bench/sqlite.txt @@ -2,15 +2,15 @@ goos: linux goarch: amd64 pkg: github.com/goptics/benchmarks/sqlite cpu: 13th Gen Intel(R) Core(TM) i7-13700 -BenchmarkSQLite/Mixed1Q/SingleFile/ckpt1000-24 2 3149068829 ns/op 6351 jobs/s 4.153 walMB -BenchmarkSQLite/Mixed1Q/SingleFile/ckpt10000-24 2 1953916054 ns/op 10236 jobs/s 41.22 walMB -BenchmarkSQLite/Drain1Q/SingleFile/ckpt1000-24 2 1426568010 ns/op 14020 jobs/s 4.145 walMB -BenchmarkSQLite/Drain1Q/SingleFile/ckpt10000-24 2 1043378285 ns/op 19169 jobs/s 41.22 walMB -BenchmarkSQLite/DrainPrio/SingleFile/ckpt1000-24 2 811688704 ns/op 12320 jobs/s 4.149 walMB -BenchmarkSQLite/DrainPrio/SingleFile/ckpt10000-24 2 416049300 ns/op 24036 jobs/s 41.22 walMB -BenchmarkSQLite/Mixed10Q/Folder/ckpt1000-24 2 949778238 ns/op 21058 jobs/s 4.132 walMB -BenchmarkSQLite/Mixed10Q/Folder/ckpt10000-24 2 287843161 ns/op 69482 jobs/s 39.75 walMB -BenchmarkSQLite/Mixed10Q/SingleFile/ckpt1000-24 2 3805894852 ns/op 5255 jobs/s 4.244 walMB -BenchmarkSQLite/Mixed10Q/SingleFile/ckpt10000-24 2 1727460905 ns/op 11578 jobs/s 41.29 walMB +BenchmarkSQLite/Mixed1Q/SingleFile/ckpt1000-24 2 3039747602 ns/op 6579 jobs/s 4.161 walMB +BenchmarkSQLite/Mixed1Q/SingleFile/ckpt10000-24 2 2074583028 ns/op 9640 jobs/s 41.22 walMB +BenchmarkSQLite/Drain1Q/SingleFile/ckpt1000-24 2 1613315062 ns/op 12397 jobs/s 4.157 walMB +BenchmarkSQLite/Drain1Q/SingleFile/ckpt10000-24 2 1137877831 ns/op 17577 jobs/s 41.22 walMB +BenchmarkSQLite/DrainPrio/SingleFile/ckpt1000-24 2 906832514 ns/op 11027 jobs/s 4.153 walMB +BenchmarkSQLite/DrainPrio/SingleFile/ckpt10000-24 2 591091365 ns/op 16918 jobs/s 41.21 walMB +BenchmarkSQLite/Mixed10Q/SingleFile/ckpt1000-24 2 4662094013 ns/op 4290 jobs/s 4.231 walMB +BenchmarkSQLite/Mixed10Q/SingleFile/ckpt10000-24 2 2304644819 ns/op 8678 jobs/s 41.31 walMB +BenchmarkSQLite/Mixed10Q/Folder/ckpt1000-24 2 882018262 ns/op 22675 jobs/s 4.145 walMB +BenchmarkSQLite/Mixed10Q/Folder/ckpt10000-24 2 572491534 ns/op 34935 jobs/s 39.43 walMB PASS -ok github.com/goptics/benchmarks/sqlite 59.913s +ok github.com/goptics/benchmarks/sqlite 66.554s diff --git a/sqlite/harness_test.go b/sqlite/harness_test.go index cba19da..89acf6c 100644 --- a/sqlite/harness_test.go +++ b/sqlite/harness_test.go @@ -32,7 +32,9 @@ var scenarios = []scenario{ {name: "Mixed1Q", queues: 1, producers: 4, total: 20000, layouts: []layout{singleFile}}, {name: "Drain1Q", queues: 1, producers: 4, total: 20000, drain: true, layouts: []layout{singleFile}}, {name: "DrainPrio", queues: 1, producers: 4, total: 10000, drain: true, priority: true, layouts: []layout{singleFile}}, - {name: "Mixed10Q", queues: 10, producers: 1, total: 20000, layouts: []layout{folder, singleFile}}, + // SingleFile first: vizb orders chart series by the first layout seen in + // the whole file, and the one-queue scenarios only have SingleFile. + {name: "Mixed10Q", queues: 10, producers: 1, total: 20000, layouts: []layout{singleFile, folder}}, } // benchRoot is where the benchmark databases live. They must be on a real disk: