Skip to content

perf: enhance tokens block memory usage - #486

Open
cheb0 wants to merge 4 commits into
mainfrom
0-enhance-token-block-memory
Open

perf: enhance tokens block memory usage#486
cheb0 wants to merge 4 commits into
mainfrom
0-enhance-token-block-memory

Conversation

@cheb0

@cheb0 cheb0 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Description

Measurements

Memory

Memory reduction (prod fraction):

message:*foobar*
25335032 => 20584912 bytes

message:*87466437*
71844952 => 58236912

Query perf

V5 fractions
For V5 fractions (current version) we have same cold perf - unpack is unchanged, same hot perf for contains wildcard but a little slowdown for wildcards like suffix since GetToken is now includes version check and it's a bit more expensive. Please see the code of Block and contains function.

Query env Total cold, ms   hot, ms   cold (branch), ms   hot (branch), ms   cold diff hot diff
message:*eldorado* prod 0 94.3 ±4.58 12.21 ±0.39 96.36 ±3.91 12.02 ±0.07 2.2% -1.6%
request:*010462589104432* prod 0 118.86 ±7.32 17.63 ±0.68 115.34 ±6.02 16.99 ±0.38 -3% -3.6%
request:*201928699403000 prod 0 120.61 ±5.22 15.01 ±0.17 122.53 ±5.83 15.91 ±0.09 1.6% 6%

V6 fractions

For V6 (new format) we have slightly better cold perf - unpack is more cheap. For hot queries it's also slightly faster for contains wildcards since getting a token is a bit more cheap. Same for arbitrary wildcards - slightly more expensive GetToken, I suppose.

Query env Total cold, ms   hot, ms   cold (branch), ms   hot (branch), ms   cold diff hot diff
message:*eldorado* prod 0 94.3 ±4.58 12.21 ±0.39 91.97 ±2.31 10.71 ±0.47 -2.5% -12.3%
request:*010462589104432* prod 0 118.86 ±7.32 17.63 ±0.68 107.5 ±5.58 16.11 ±0.33 -9.6% -8.6%
request:*201928699403000 prod 0 120.61 ±5.22 15.01 ±0.17 110.44 ±6.19 15.64 ±0.20 -8.4% 4.2%

  • I have read and followed all requirements in CONTRIBUTING.md;
  • I used LLM/AI assistance to make this pull request;

@codecov-commenter

codecov-commenter commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 63.93443% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.01%. Comparing base (6372ee9) to head (2468d53).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
frac/sealed/token/block_loader.go 60.00% 18 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #486      +/-   ##
==========================================
- Coverage   71.12%   71.01%   -0.11%     
==========================================
  Files         232      232              
  Lines       18404    18544     +140     
==========================================
+ Hits        13089    13169      +80     
- Misses       4337     4391      +54     
- Partials      978      984       +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dkharms

dkharms commented Aug 6, 2026

Copy link
Copy Markdown
Member

@seqbenchbot start search-regular main 'k8s_pod:-eu-' --duration 5m

@seqbenchbot

seqbenchbot commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Nice, @dkharms <(-^,^-)=b!

Started benchmark 58d2faa3.

Show details
  • scenario search-regular;
  • against main;
  • running for 5m0s;

I'll post the statistics here once it finishes.
To end it early, run @seqbenchbot stop 58d2faa3.

Here is a list of helpful links:

  • Take a look at Grafana dashboard;
  • Live-tailing logs are also available;

Have a great time!

@seqbenchbot

Copy link
Copy Markdown
Collaborator

Nice, @dkharms <(-^,^-)=b!

Benchmark 58d2faa3 (scenario search-regular) has finished.
I've prepared a summary for you. Click on Show summary button to see it:

Show summary
Query Type mean (ms) stddev (ms) p(50) (ms) p(95) (ms) p(99) (ms) iterations total
k8s_pod:*-eu-*
hot 11.80 0.74 12.17 17.54 18.20 2992 1437046

Compare it against another run with @seqbenchbot compare 58d2faa3 <other-id>.

@dkharms

dkharms commented Aug 6, 2026

Copy link
Copy Markdown
Member

@seqbenchbot start search-regular 0-enhance-token-block-memory 'k8s_pod:-eu-' --duration 5m

@seqbenchbot

seqbenchbot commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Nice, @dkharms <(-^,^-)=b!

Started benchmark 43c61a79.

Show details
  • scenario search-regular;
  • against 0-enhance-token-block-memory;
  • running for 5m0s;

I'll post the statistics here once it finishes.
To end it early, run @seqbenchbot stop 43c61a79.

Here is a list of helpful links:

  • Take a look at Grafana dashboard;
  • Live-tailing logs are also available;

Have a great time!

@seqbenchbot

Copy link
Copy Markdown
Collaborator

Nice, @dkharms <(-^,^-)=b!

Benchmark 43c61a79 (scenario search-regular) has finished.
I've prepared a summary for you. Click on Show summary button to see it:

Show summary
Query Type mean (ms) stddev (ms) p(50) (ms) p(95) (ms) p(99) (ms) iterations total
k8s_pod:*-eu-*
hot 12.15 2.71 10.95 16.47 17.00 2992 1437020

Compare it against another run with @seqbenchbot compare 43c61a79 <other-id>.

@dkharms dkharms added the performance Features or improvements that positively affect seq-db performance label Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Features or improvements that positively affect seq-db performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants