Skip to content

Commit 9d83f98

Browse files
committed
feat(sqlite): add cold read benchmarks and simplify optimizations
1 parent 85e870b commit 9d83f98

106 files changed

Lines changed: 25213 additions & 1227 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agent/benchmarks/sqlite-realworld-smoke/disabled-full-latest/results.json

Lines changed: 1050 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
SQLite real-world benchmark
2+
3+
Server SQLite time only. Setup time, sleep delay, wake/cold-start time, and client RTT are not included.
4+
5+
| workload | category | size | server_ms | get_pages | fetched_pages | cache_hits | cache_misses | rows/ops | pages |
6+
| --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
7+
| small-rowid-point | canary | 0.25 MiB | 255.3 | 20 | 244 | 0 | 20 | 50 | 166 |
8+
| small-schema-read | canary | 0.25 MiB | 5.3 | 4 | 4 | 0 | 4 | 128 | 166 |
9+
| small-range-scan | canary | 0.25 MiB | 880.8 | 133 | 2051 | 0 | 133 | 128 | 166 |
10+
| rowid-range-forward | read | 2.00 MiB | 10817.3 | 1035 | 17179 | 0 | 1035 | 1024 | 1231 |
11+
| rowid-range-backward | read | 2.00 MiB | 4523.6 | 1035 | 1035 | 0 | 1035 | 1024 | 1231 |
12+
| secondary-index-covering-range | read | 2.00 MiB | 21.3 | 11 | 11 | 0 | 11 | 1024 | 1063 |
13+
| secondary-index-scattered-table | read | 2.00 MiB | 7778.9 | 1038 | 3241 | 0 | 1038 | 1024 | 1063 |
14+
| aggregate-status | read | 2.00 MiB | 14175.7 | 1037 | 16733 | 0 | 1037 | 1024 | 1231 |
15+
| aggregate-time-bucket | read | 2.00 MiB | 10989.9 | 1030 | 17172 | 0 | 1030 | 1024 | 1231 |
16+
| aggregate-tenant-time-range | read | 1.00 MiB | 226.4 | 39 | 111 | 0 | 39 | 16 | 623 |
17+
| feed-order-by-limit | read | 1.00 MiB | 2656.3 | 519 | 519 | 0 | 519 | 512 | 623 |
18+
| feed-pagination-adjacent | read | 1.00 MiB | 263.4 | 106 | 106 | 0 | 106 | 100 | 623 |
19+
| join-order-items | read | 2.00 MiB | 80.9 | 32 | 38 | 0 | 32 | 2048 | 1231 |
20+
| random-point-lookups | read | 2.00 MiB | 7718.5 | 1011 | 3304 | 0 | 1011 | 1000 | 1231 |
21+
| hot-index-cold-table | read | 2.00 MiB | 41.3 | 16 | 26 | 0 | 16 | 8 | 1063 |
22+
| ledger-without-rowid-range | read | 2.00 MiB | 458.6 | 94 | 176 | 0 | 94 | 564 | 176 |
23+
| write-batch-after-wake | write | 1.00 MiB | 402.4 | 15 | 17 | 0 | 15 | 1000 | 1642 |
24+
| update-hot-partition | write | 1.00 MiB | 6902.0 | 516 | 8498 | 0 | 516 | 64 | 623 |
25+
| delete-churn-range-read | write | 1.00 MiB | 7040.2 | 526 | 8398 | 0 | 526 | 448 | 623 |
26+
| migration-create-indexes-large | migration | 2.00 MiB | 14959.5 | 1030 | 17230 | 0 | 1030 | | 1059 |
27+
| migration-create-indexes-skewed-large | migration | 2.00 MiB | 32741.9 | 2054 | 34577 | 0 | 2054 | | 1055 |
28+
| migration-table-rebuild-large | migration | 2.00 MiB | 30746.7 | 2057 | 34767 | 0 | 2057 | | 2070 |
29+
| migration-add-column-large | migration | 2.00 MiB | 4.2 | 3 | 3 | 0 | 3 | | 1044 |
30+
| migration-ddl-small | canary | 0.00 MiB | 22.8 | 3 | 3 | 0 | 3 | | 19 |
Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
{
2+
"schemaVersion": 1,
3+
"startedAt": "2026-04-29T10:18:23.224Z",
4+
"finishedAt": "2026-04-29T10:19:02.894Z",
5+
"config": {
6+
"endpoint": "http://127.0.0.1:7520",
7+
"profile": "smoke",
8+
"selectedWorkloads": [
9+
"rowid-range-forward",
10+
"secondary-index-scattered-table",
11+
"random-point-lookups",
12+
"migration-add-column-large"
13+
],
14+
"sizes": {
15+
"smallBytes": 262144,
16+
"mediumBytes": 1048576,
17+
"cacheFitBytes": 1048576,
18+
"cacheOverflowBytes": 2097152,
19+
"largeBytes": 2097152,
20+
"rowBytes": 2048
21+
},
22+
"metricsToken": "dev-metrics",
23+
"wakeDelayMs": 1000,
24+
"postSetupWaitMs": 0,
25+
"startLocalEnvoy": true,
26+
"disableStorageCompaction": false,
27+
"sqliteOptimizationsDisabled": true,
28+
"sqliteOptimizationEnv": {
29+
"RIVETKIT_SQLITE_OPT_READ_AHEAD": "false",
30+
"RIVETKIT_SQLITE_OPT_CACHE_HIT_PREDICTOR_TRAINING": "false",
31+
"RIVETKIT_SQLITE_OPT_RECENT_PAGE_HINTS": "false",
32+
"RIVETKIT_SQLITE_OPT_ADAPTIVE_READ_AHEAD": "false",
33+
"RIVETKIT_SQLITE_OPT_PRELOAD_HINT_FLUSH": "false",
34+
"RIVETKIT_SQLITE_OPT_STARTUP_PRELOAD_FIRST_PAGES": "false",
35+
"RIVETKIT_SQLITE_OPT_PRELOAD_HINTS_ON_OPEN": "false",
36+
"RIVETKIT_SQLITE_OPT_PRELOAD_HINT_HOT_PAGES": "false",
37+
"RIVETKIT_SQLITE_OPT_PRELOAD_HINT_EARLY_PAGES": "false",
38+
"RIVETKIT_SQLITE_OPT_PRELOAD_HINT_SCAN_RANGES": "false",
39+
"RIVETKIT_SQLITE_OPT_DEDUP_GET_PAGES_META": "false",
40+
"RIVETKIT_SQLITE_OPT_CACHE_GET_PAGES_VALIDATION": "false",
41+
"RIVETKIT_SQLITE_OPT_RANGE_READS": "false",
42+
"RIVETKIT_SQLITE_OPT_BATCH_CHUNK_READS": "false",
43+
"RIVETKIT_SQLITE_OPT_DECODED_LTX_CACHE": "false",
44+
"RIVETKIT_SQLITE_OPT_VFS_CACHE_FETCHED_PAGES": "false",
45+
"RIVETKIT_SQLITE_OPT_VFS_CACHE_PREFETCHED_PAGES": "false",
46+
"RIVETKIT_SQLITE_OPT_VFS_CACHE_STARTUP_PRELOADED_PAGES": "false",
47+
"RIVETKIT_SQLITE_OPT_VFS_SCAN_RESISTANT_CACHE": "false",
48+
"RIVETKIT_SQLITE_OPT_STARTUP_PRELOAD_MAX_BYTES": "0",
49+
"RIVETKIT_SQLITE_OPT_STARTUP_PRELOAD_FIRST_PAGE_COUNT": "0",
50+
"RIVETKIT_SQLITE_OPT_VFS_PAGE_CACHE_CAPACITY_PAGES": "1",
51+
"RIVETKIT_SQLITE_OPT_VFS_PROTECTED_CACHE_PAGES": "0"
52+
},
53+
"cacheSizing": {
54+
"sqlitePageSizeBytes": 4096,
55+
"startupPreloadMaxBytes": 0,
56+
"vfsPageCacheCapacityPages": 1,
57+
"vfsPageCacheCapacityBytes": 4096,
58+
"largeBytesExceedsConfiguredVfsCache": true
59+
}
60+
},
61+
"cacheConfigProbe": {
62+
"sqliteCacheSizePragma": -2000,
63+
"sqlitePageSize": 4096,
64+
"pageCount": 16
65+
},
66+
"results": [
67+
{
68+
"workload": "rowid-range-forward",
69+
"description": "Large append-like INTEGER PRIMARY KEY forward range scan.",
70+
"category": "read",
71+
"sizeClass": "large",
72+
"targetBytes": 2097152,
73+
"actorKey": [
74+
"sqlite-realworld-bench",
75+
"sqlite-realworld-1777457901653-7c6244b2",
76+
"rowid-range-forward"
77+
],
78+
"actorId": "9qhpr92yuo3cyli6hwbsfvj2kjcl00",
79+
"setup": {
80+
"rows": 1024,
81+
"targetBytes": 2097152,
82+
"rowBytes": 2048,
83+
"setupMs": 614.354797,
84+
"pageCount": 1230
85+
},
86+
"main": {
87+
"ms": 14946.551086000001,
88+
"workload": "rowid-range-forward",
89+
"rows": 1024,
90+
"bytes": 2097152,
91+
"pageCount": 1231
92+
},
93+
"vfsMetrics": {
94+
"resolvePagesTotal": 1032,
95+
"resolvePagesRequestedTotal": 1032,
96+
"resolvePagesCacheHitsTotal": -3,
97+
"resolvePagesCacheMissesTotal": 1035,
98+
"getPagesTotal": 1035,
99+
"pagesFetchedTotal": 17179,
100+
"prefetchPagesTotal": 16144,
101+
"bytesFetchedTotal": 70365184,
102+
"prefetchBytesTotal": 66125824,
103+
"getPagesDurationSecondsSum": 14.822318194999998,
104+
"getPagesDurationSecondsCount": 1035
105+
}
106+
},
107+
{
108+
"workload": "secondary-index-scattered-table",
109+
"description": "Large secondary-index range that visits table rows in scattered rowid order.",
110+
"category": "read",
111+
"sizeClass": "large",
112+
"targetBytes": 2097152,
113+
"actorKey": [
114+
"sqlite-realworld-bench",
115+
"sqlite-realworld-1777457901653-7c6244b2",
116+
"secondary-index-scattered-table"
117+
],
118+
"actorId": "dpzhx6td3elrkg4w33bpnshfh9dl00",
119+
"setup": {
120+
"rows": 1024,
121+
"targetBytes": 2097152,
122+
"rowBytes": 2048,
123+
"setupMs": 461.5752219999995,
124+
"pageCount": 1062
125+
},
126+
"main": {
127+
"ms": 8251.848477,
128+
"workload": "secondary-index-scattered-table",
129+
"rows": 1024,
130+
"bytes": 2097152,
131+
"pageCount": 1063
132+
},
133+
"vfsMetrics": {
134+
"resolvePagesTotal": 1035,
135+
"resolvePagesRequestedTotal": 1035,
136+
"resolvePagesCacheHitsTotal": -3,
137+
"resolvePagesCacheMissesTotal": 1038,
138+
"getPagesTotal": 1038,
139+
"pagesFetchedTotal": 3514,
140+
"prefetchPagesTotal": 2476,
141+
"bytesFetchedTotal": 14393344,
142+
"prefetchBytesTotal": 10141696,
143+
"getPagesDurationSecondsSum": 8.176378407,
144+
"getPagesDurationSecondsCount": 1038
145+
}
146+
},
147+
{
148+
"workload": "random-point-lookups",
149+
"description": "Deterministic random primary-key point lookups across a large table.",
150+
"category": "read",
151+
"sizeClass": "large",
152+
"targetBytes": 2097152,
153+
"actorKey": [
154+
"sqlite-realworld-bench",
155+
"sqlite-realworld-1777457901653-7c6244b2",
156+
"random-point-lookups"
157+
],
158+
"actorId": "dh1qdiyzkl40znrz5wr8zuevkkcl00",
159+
"setup": {
160+
"rows": 1024,
161+
"targetBytes": 2097152,
162+
"rowBytes": 2048,
163+
"setupMs": 582.4261729999998,
164+
"pageCount": 1230
165+
},
166+
"main": {
167+
"ms": 8725.889302,
168+
"workload": "random-point-lookups",
169+
"ops": 1000,
170+
"bytes": 2048000,
171+
"pageCount": 1231
172+
},
173+
"vfsMetrics": {
174+
"resolvePagesTotal": 1008,
175+
"resolvePagesRequestedTotal": 1008,
176+
"resolvePagesCacheHitsTotal": -3,
177+
"resolvePagesCacheMissesTotal": 1011,
178+
"getPagesTotal": 1011,
179+
"pagesFetchedTotal": 3208,
180+
"prefetchPagesTotal": 2197,
181+
"bytesFetchedTotal": 13139968,
182+
"prefetchBytesTotal": 8998912,
183+
"getPagesDurationSecondsSum": 8.084016886,
184+
"getPagesDurationSecondsCount": 1011
185+
}
186+
},
187+
{
188+
"workload": "migration-add-column-large",
189+
"description": "Large-table ADD COLUMN migration that should avoid row rewrite.",
190+
"category": "migration",
191+
"sizeClass": "large",
192+
"targetBytes": 2097152,
193+
"actorKey": [
194+
"sqlite-realworld-bench",
195+
"sqlite-realworld-1777457901653-7c6244b2",
196+
"migration-add-column-large"
197+
],
198+
"actorId": "hsw0n9x0nf0tvc6hbmfkm19xnmcl00",
199+
"setup": {
200+
"rows": 1024,
201+
"targetBytes": 2097152,
202+
"rowBytes": 2048,
203+
"setupMs": 388.5069980000044,
204+
"pageCount": 1043
205+
},
206+
"main": {
207+
"ms": 2.7332150000002002,
208+
"workload": "migration-add-column-large",
209+
"alters": 1,
210+
"rewritesRows": false,
211+
"pageCount": 1044
212+
},
213+
"vfsMetrics": {
214+
"resolvePagesTotal": 0,
215+
"resolvePagesRequestedTotal": 0,
216+
"resolvePagesCacheHitsTotal": -3,
217+
"resolvePagesCacheMissesTotal": 3,
218+
"getPagesTotal": 3,
219+
"pagesFetchedTotal": 3,
220+
"prefetchPagesTotal": 0,
221+
"bytesFetchedTotal": 12288,
222+
"prefetchBytesTotal": 0,
223+
"getPagesDurationSecondsSum": 0.024192735,
224+
"getPagesDurationSecondsCount": 3
225+
}
226+
}
227+
]
228+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
SQLite real-world benchmark
2+
3+
Server SQLite time only. Setup time, sleep delay, wake/cold-start time, and client RTT are not included.
4+
5+
| workload | category | size | server_ms | get_pages | fetched_pages | cache_hits | cache_misses | rows/ops | pages |
6+
| --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
7+
| rowid-range-forward | read | 2.00 MiB | 14946.6 | 1035 | 17179 | -3 | 1035 | 1024 | 1231 |
8+
| secondary-index-scattered-table | read | 2.00 MiB | 8251.8 | 1038 | 3514 | -3 | 1038 | 1024 | 1063 |
9+
| random-point-lookups | read | 2.00 MiB | 8725.9 | 1011 | 3208 | -3 | 1011 | 1000 | 1231 |
10+
| migration-add-column-large | migration | 2.00 MiB | 2.7 | 3 | 3 | -3 | 3 | | 1044 |
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"schemaVersion": 1,
3+
"startedAt": "2026-04-29T10:09:16.917Z",
4+
"finishedAt": "2026-04-29T10:09:18.608Z",
5+
"config": {
6+
"endpoint": "http://127.0.0.1:6420",
7+
"profile": "smoke",
8+
"selectedWorkloads": [
9+
"feed-pagination-adjacent"
10+
],
11+
"sizes": {
12+
"smallBytes": 262144,
13+
"mediumBytes": 1048576,
14+
"cacheFitBytes": 1048576,
15+
"cacheOverflowBytes": 2097152,
16+
"largeBytes": 2097152,
17+
"rowBytes": 2048
18+
},
19+
"metricsToken": "dev-metrics",
20+
"wakeDelayMs": 1000,
21+
"postSetupWaitMs": 0,
22+
"startLocalEnvoy": true,
23+
"disableStorageCompaction": false,
24+
"cacheSizing": {
25+
"sqlitePageSizeBytes": 4096,
26+
"startupPreloadMaxBytes": 1048576,
27+
"vfsPageCacheCapacityPages": 50000,
28+
"vfsPageCacheCapacityBytes": 204800000,
29+
"standardLargeBytesExceedsDefaultVfsCache": false
30+
}
31+
},
32+
"cacheConfigProbe": {
33+
"sqliteCacheSizePragma": -2000,
34+
"sqlitePageSize": 4096,
35+
"pageCount": 16
36+
},
37+
"results": [
38+
{
39+
"workload": "feed-pagination-adjacent",
40+
"description": "Adjacent cursor pagination over an indexed recent-feed query.",
41+
"category": "read",
42+
"sizeClass": "medium",
43+
"targetBytes": 1048576,
44+
"actorKey": [
45+
"sqlite-realworld-bench",
46+
"sqlite-realworld-1777457355366-7b780a8f",
47+
"feed-pagination-adjacent"
48+
],
49+
"actorId": "th4hd4y4xocgt7ha3f94wxy7fubl00",
50+
"setup": {
51+
"rows": 512,
52+
"targetBytes": 1048576,
53+
"rowBytes": 2048,
54+
"setupMs": 302.266161,
55+
"pageCount": 622
56+
},
57+
"main": {
58+
"ms": 47.609035000000404,
59+
"workload": "feed-pagination-adjacent",
60+
"firstPageRows": 100,
61+
"rows": 100,
62+
"pageCount": 623
63+
},
64+
"vfsMetrics": {
65+
"resolvePagesTotal": 103,
66+
"resolvePagesRequestedTotal": 103,
67+
"resolvePagesCacheHitsTotal": 96,
68+
"resolvePagesCacheMissesTotal": 7,
69+
"getPagesTotal": 7,
70+
"pagesFetchedTotal": 135,
71+
"prefetchPagesTotal": 128,
72+
"bytesFetchedTotal": 552960,
73+
"prefetchBytesTotal": 524288,
74+
"getPagesDurationSecondsSum": 0.044485068,
75+
"getPagesDurationSecondsCount": 7
76+
}
77+
}
78+
]
79+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SQLite real-world benchmark
2+
3+
Server SQLite time only. Setup time, sleep delay, wake/cold-start time, and client RTT are not included.
4+
5+
| workload | category | size | server_ms | get_pages | fetched_pages | cache_hits | cache_misses | rows/ops | pages |
6+
| --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
7+
| feed-pagination-adjacent | read | 1.00 MiB | 47.6 | 7 | 135 | 96 | 7 | 100 | 623 |

0 commit comments

Comments
 (0)