Repository navigation
test(engine) #5519: isolate what a tag-heavy TimeSeries schema pays on ingest - #5520
Conversation
…n ingest calculateRowSize() reserves 2 + MAX_STRING_BYTES = 258 bytes of stride for every STRING column, while writeStringValue() stores the row packed. Only the stride assumes the maximum, and the stride is what positions the row in the page, so on the TSBS cpu-only shape (10 tags + 3 DOUBLE) a 2612-byte stride carries ~110 bytes of data: 25 rows per 64 KB page, 4% fill. The benchmark separates that from the row encoding with three arms that differ in one variable each. Twenty times more string bytes per row at the same stride costs nothing; the same tag content in one column, at one ninth of the stride, is 9x faster. A batch moves 23x more page and WAL bytes than it stores. Adds TimeSeriesBucket.getRowSize() so the stride can be reported exactly rather than derived from getMaxSamplesPerPage(). Tagged benchmark and named *Benchmark, so mvn-test.yml excludes it and benchmark-tests.yml picks it up. Default batch is 20k rows because a wide-stride arm writes rows/25 pages of 64 KB; -Darcadedb.tagStrideBenchmark.rows=50000 reproduces the batch size quoted on the issue.
|
Tick the box to add this pull request to the merge queue (same as
|
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| CodeStyle | 1 minor |
🟢 Metrics 30 complexity
Metric Results Complexity 30
🟢 Coverage 0.00% diff coverage · -6.32% coverage variation
Metric Results Coverage variation ✅ -6.32% coverage variation Diff coverage ✅ 0.00% diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (c906c6b) 146708 108811 74.17% Head commit (e711b43) 178701 (+31993) 121254 (+12443) 67.85% (-6.32%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#5520) 1 0 0.00% Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Review: #5520 - TimeSeries tag-stride benchmarkReviewed the production change ( Production change - good
Correctness spot-checks - all hold
Minor points (non-blocking)
Nothing blocking - the production change is safe and the test is a solid, reproducible artifact for the #5519/#5474 numbers. |
The reported traffic and the amplification assertion multiplied by a hardcoded 64 KB while rows/page came from the bucket, so running with a non-default arcadedb.bucketDefaultPageSize made the two silently disagree. Both sides now read getPageSize(), which was already public on PaginatedComponent.
|
Thanks - point 1 was a real defect and is fixed in e711b43. 1. Hardcoded page size. You are right that the two sides could disagree. 2. Timing assertions. Accepted as a known trade-off. Worth being explicit about which assertions carry which weight: the two 3. 4. Disk footprint. Your ~600 MB at the 20k default is right. The javadoc only quotes the 1 GB figure for the 50k override, so nothing to correct there. Re-ran after the change: 29.9 / 25.5 / 4.3 ms across the three arms, ratios unchanged. |
|
Review: PR 5520 - TimeSeries tag-stride benchmark Thanks for the very thorough write-up. I verified the change against the codebase and it looks solid. Summary: a 10-line no-behaviour accessor plus a self-contained, correctly-tagged benchmark. Approve with a few minor notes. What is good
Minor notes (non-blocking)
Test coverage Nice, reproducible artifact backing issues 5519/5474. LGTM. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5520 +/- ##
============================================
+ Coverage 65.31% 65.70% +0.39%
+ Complexity 1114 1112 -2
============================================
Files 1748 1748
Lines 146708 146709 +1
Branches 31358 31358
============================================
+ Hits 95817 96394 +577
+ Misses 37940 37369 -571
+ Partials 12951 12946 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…n ingest (#5520) * test(engine) #5519: isolate what a tag-heavy TimeSeries schema pays on ingest calculateRowSize() reserves 2 + MAX_STRING_BYTES = 258 bytes of stride for every STRING column, while writeStringValue() stores the row packed. Only the stride assumes the maximum, and the stride is what positions the row in the page, so on the TSBS cpu-only shape (10 tags + 3 DOUBLE) a 2612-byte stride carries ~110 bytes of data: 25 rows per 64 KB page, 4% fill. The benchmark separates that from the row encoding with three arms that differ in one variable each. Twenty times more string bytes per row at the same stride costs nothing; the same tag content in one column, at one ninth of the stride, is 9x faster. A batch moves 23x more page and WAL bytes than it stores. Adds TimeSeriesBucket.getRowSize() so the stride can be reported exactly rather than derived from getMaxSamplesPerPage(). Tagged benchmark and named *Benchmark, so mvn-test.yml excludes it and benchmark-tests.yml picks it up. Default batch is 20k rows because a wide-stride arm writes rows/25 pages of 64 KB; -Darcadedb.tagStrideBenchmark.rows=50000 reproduces the batch size quoted on the issue. * test(engine) #5519: derive page traffic from the bucket page size The reported traffic and the amplification assertion multiplied by a hardcoded 64 KB while rows/page came from the bucket, so running with a non-default arcadedb.bucketDefaultPageSize made the two silently disagree. Both sides now read getPageSize(), which was already public on PaginatedComponent. (cherry picked from commit 2d5b0fe)
Backs the numbers quoted on #5519 and on #5474 with a benchmark that can be re-run.
What it measures
TimeSeriesBucket.calculateRowSize()reserves2 + MAX_STRING_BYTES= 258 bytes of row stride for every STRING column, whilewriteStringValue()stores the row packed. Only the stride assumes the maximum, and the stride is what positions the row inside the page. On the TSBS cpu-only shape (10 STRING tags + 3 DOUBLE) that is a 2612-byte stride carrying ~110 bytes of data: 25 rows per 64 KB page, 4% fill.The benchmark separates that cost from the row encoding with three arms that each differ in exactly one variable:
WideStrideWideStrideBigValuesNarrowStrideOutput at the default size:
Encoding twenty times more string data costs nothing. Changing only the stride is 9x. A batch moves 23x more page and WAL bytes than it stores, which also costs the page cache and compaction.
Note the
WideStrideBigValuesamplification of 1x: 200-char tags nearly fill the 258 reserved bytes. The reservation is only waste when tag values are short, which is every real tag set.Notes on the method
nanoTime, median of 3 batches.*Benchmark.javaand taggedbenchmark, somvn-test.ymlexcludes it two ways andbenchmark-tests.ymlpicks it up.rows / 25pages of 64 KB, so 50k costs roughly 1 GB undertarget/across the three arms.-Darcadedb.tagStrideBenchmark.rows=50000reproduces the published batch size.Production change
One addition,
TimeSeriesBucket.getRowSize(), so the stride can be reported exactly rather than derived fromgetMaxSamplesPerPage(). It sits next to that existing public accessor and changes no behaviour.Verification
mvn -pl engine test -Dtest=TimeSeriesTagStrideBenchmark -Dgroups=benchmarkpassescom.arcadedb.engine.timeseries.**tests pass with the accessor addedWhen the tag dictionary proposed in #5519 lands,
WideStrideshould converge towardsNarrowStrideand the assertions in this test are expected to change.