Skip to content

Instantly share code, notes, and snippets.

@zmccoy
Created July 20, 2026 19:01
Show Gist options
  • Select an option

  • Save zmccoy/55b1a743193b27b64f8f0268279ec975 to your computer and use it in GitHub Desktop.

Select an option

Save zmccoy/55b1a743193b27b64f8f0268279ec975 to your computer and use it in GitHub Desktop.
CMS using FlowStats - INCRBY Benchmark
~ via 🆂 v3.8.2 via ❄️
❯ valkey-cli CMS.INITBYDIM sketchdim 1000 5
OK
~ via 🆂 v3.8.2 via ❄️
❯ valkey-cli CMS.INCRBY sketchdim hello 1
1) (integer) 1
~ via 🆂 v3.8.2 via ❄️
❯ valkey-benchmark -n 1000000 CMS.INCRBY sketchdim hello 1
====== CMS.INCRBY sketchdim hello 1 ======
1000000 requests completed in 7.98 seconds
50 parallel clients
54 bytes payload
keep alive: 1
host configuration "save": 3600 1 300 100 60 10000
host configuration "appendonly": no
multi-thread: no
Latency by percentile distribution:
0.000% <= 0.087 milliseconds (cumulative count 1)
50.000% <= 0.255 milliseconds (cumulative count 522890)
75.000% <= 0.303 milliseconds (cumulative count 784960)
87.500% <= 0.335 milliseconds (cumulative count 875308)
93.750% <= 0.391 milliseconds (cumulative count 938504)
96.875% <= 0.455 milliseconds (cumulative count 969494)
98.438% <= 0.511 milliseconds (cumulative count 984385)
99.219% <= 0.559 milliseconds (cumulative count 993228)
99.609% <= 0.599 milliseconds (cumulative count 996396)
99.805% <= 0.743 milliseconds (cumulative count 998078)
99.902% <= 1.095 milliseconds (cumulative count 999044)
99.951% <= 1.207 milliseconds (cumulative count 999551)
99.976% <= 1.351 milliseconds (cumulative count 999756)
99.988% <= 1.711 milliseconds (cumulative count 999878)
99.994% <= 2.287 milliseconds (cumulative count 999939)
99.997% <= 3.855 milliseconds (cumulative count 999970)
99.998% <= 6.391 milliseconds (cumulative count 999988)
99.999% <= 6.399 milliseconds (cumulative count 999994)
100.000% <= 6.415 milliseconds (cumulative count 999998)
100.000% <= 6.423 milliseconds (cumulative count 999999)
100.000% <= 6.431 milliseconds (cumulative count 1000000)
100.000% <= 6.431 milliseconds (cumulative count 1000000)
Cumulative distribution of latencies:
0.007% <= 0.103 milliseconds (cumulative count 68)
41.428% <= 0.207 milliseconds (cumulative count 414280)
78.496% <= 0.303 milliseconds (cumulative count 784960)
94.848% <= 0.407 milliseconds (cumulative count 948482)
98.250% <= 0.503 milliseconds (cumulative count 982501)
99.668% <= 0.607 milliseconds (cumulative count 996677)
99.789% <= 0.703 milliseconds (cumulative count 997886)
99.844% <= 0.807 milliseconds (cumulative count 998436)
99.873% <= 0.903 milliseconds (cumulative count 998731)
99.884% <= 1.007 milliseconds (cumulative count 998843)
99.907% <= 1.103 milliseconds (cumulative count 999072)
99.955% <= 1.207 milliseconds (cumulative count 999551)
99.973% <= 1.303 milliseconds (cumulative count 999729)
99.978% <= 1.407 milliseconds (cumulative count 999777)
99.981% <= 1.503 milliseconds (cumulative count 999811)
99.985% <= 1.607 milliseconds (cumulative count 999846)
99.988% <= 1.703 milliseconds (cumulative count 999876)
99.989% <= 1.807 milliseconds (cumulative count 999893)
99.992% <= 1.903 milliseconds (cumulative count 999915)
99.992% <= 2.007 milliseconds (cumulative count 999922)
99.993% <= 2.103 milliseconds (cumulative count 999929)
99.995% <= 3.103 milliseconds (cumulative count 999945)
99.997% <= 4.103 milliseconds (cumulative count 999971)
99.997% <= 6.103 milliseconds (cumulative count 999972)
100.000% <= 7.103 milliseconds (cumulative count 1000000)
Summary:
throughput summary: 125297.59 requests per second
latency summary (msec):
avg min p50 p95 p99 max
0.248 0.080 0.255 0.415 0.543 6.431
@zmccoy

zmccoy commented Jul 21, 2026

Copy link
Copy Markdown
Author

Using Rust-Count-Min-Sketch underneath:

❯ valkey-benchmark -n 1000000 CMS.QUERY sketchdim hello
                                                                                                                                                                                                                    CMS.QUERY sketchdim hello: rps=119336.0 (overall: 134462.0) avg_msec=0.252 (overall: 0.229) 100981 request                                                                                                          CMS.QUERY sketchdim hello: rps=122936.3 (overall: 131574.9) avg_msec=0.256 (overall: 0.236) 131838 request                                                                                                          CMS.QUERY sketchdim hello: rps=156516.0 (overall: 136555.1) avg_msec=0.191 (overall: 0.225) 170967 request                                                                                                          CMS.QUERY sketchdim hello: rps=149780.0 (overall: 138756.3) avg_msec=0.201 (overall: 0.221) 208412 request                                                                                                          CMS.QUERY sketchdim hello: rps=153612.0 (overall: 140876.1) avg_msec=0.190 (overall: 0.216) 246815 request                                                                                                          CMS.QUERY sketchdim hello: rps=152136.0 (overall: 142282.2) avg_msec=0.194 (overall: 0.213) 284849 request                                                                                                          CMS.QUERY sketchdim hello: rps=169808.0 (overall: 145337.9) avg_msec=0.172 (overall: 0.208) 327301 request                                                                                                          CMS.QUERY sketchdim hello: rps=163075.7 (overall: 147116.7) avg_msec=0.182 (overall: 0.205) 368233 request                                                                                                          CMS.QUERY sketchdim hello: rps=160196.0 (overall: 148304.4) avg_msec=0.185 (overall: 0.203) 408282 request                                                                                                          CMS.QUERY sketchdim hello: rps=137484.0 (overall: 147403.6) avg_msec=0.220 (overall: 0.204) 442653 request                                                                                                          CMS.QUERY sketchdim hello: rps=152236.0 (overall: 147775.0) avg_msec=0.196 (overall: 0.204) 480712 request                                                                                                          CMS.QUERY sketchdim hello: rps=167816.0 (overall: 149205.2) avg_msec=0.179 (overall: 0.202) 522666 request                                                                                                          CMS.QUERY sketchdim hello: rps=156984.0 (overall: 149723.4) avg_msec=0.191 (overall: 0.201) 561912 request                                                                                                          CMS.QUERY sketchdim hello: rps=151708.0 (overall: 149847.4) avg_msec=0.196 (overall: 0.201) 599839 request                                                                                                          CMS.QUERY sketchdim hello: rps=151757.0 (overall: 149960.0) avg_msec=0.197 (overall: 0.200) 637930 request                                                                                                          CMS.QUERY sketchdim hello: rps=166032.0 (overall: 150852.1) avg_msec=0.183 (overall: 0.199) 679438 request                                                                                                          CMS.QUERY sketchdim hello: rps=157316.0 (overall: 151192.0) avg_msec=0.187 (overall: 0.199) 718767 request                                                                                                          CMS.QUERY sketchdim hello: rps=160720.0 (overall: 151668.1) avg_msec=0.188 (overall: 0.198) 758947 request                                                                                                          CMS.QUERY sketchdim hello: rps=156504.0 (overall: 151898.2) avg_msec=0.195 (overall: 0.198) 798073 request                                                                                                          CMS.QUERY sketchdim hello: rps=157224.0 (overall: 152140.1) avg_msec=0.191 (overall: 0.198) 837379 request                                                                                                          CMS.QUERY sketchdim hello: rps=159581.7 (overall: 152464.6) avg_msec=0.188 (overall: 0.197) 877434 request                                                                                                          CMS.QUERY sketchdim hello: rps=159088.0 (overall: 152740.4) avg_msec=0.187 (overall: 0.197) 917206 request                                                                                                          CMS.QUERY sketchdim hello: rps=161904.0 (overall: 153106.6) avg_msec=0.186 (overall: 0.196) 957682 request                                                                                                          CMS.QUERY sketchdim hello: rps=159180.7 (overall: 153339.2) avg_msec=0.187 (overall: 0.196) 997318 request                                                                                                          ====== CMS.QUERY sketchdim hello ======
  1000000 requests completed in 6.52 seconds
  50 parallel clients
  45 bytes payload
  keep alive: 1
  host configuration "save": 3600 1 300 100 60 10000
  host configuration "appendonly": no
  multi-thread: no

Latency by percentile distribution:
0.000% <= 0.087 milliseconds (cumulative count 2)
50.000% <= 0.167 milliseconds (cumulative count 534831)
75.000% <= 0.247 milliseconds (cumulative count 764758)
87.500% <= 0.287 milliseconds (cumulative count 877579)
93.750% <= 0.327 milliseconds (cumulative count 942126)
96.875% <= 0.375 milliseconds (cumulative count 970394)
98.438% <= 0.431 milliseconds (cumulative count 985751)
99.219% <= 0.487 milliseconds (cumulative count 992821)
99.609% <= 0.535 milliseconds (cumulative count 996373)
99.805% <= 0.575 milliseconds (cumulative count 998127)
99.902% <= 0.711 milliseconds (cumulative count 999028)
99.951% <= 1.151 milliseconds (cumulative count 999523)
99.976% <= 1.399 milliseconds (cumulative count 999765)
99.988% <= 1.455 milliseconds (cumulative count 999892)
99.994% <= 1.535 milliseconds (cumulative count 999941)
99.997% <= 1.647 milliseconds (cumulative count 999973)
99.998% <= 1.687 milliseconds (cumulative count 999985)
99.999% <= 1.735 milliseconds (cumulative count 999993)
100.000% <= 1.791 milliseconds (cumulative count 999997)
100.000% <= 1.823 milliseconds (cumulative count 999999)
100.000% <= 1.839 milliseconds (cumulative count 1000000)
100.000% <= 1.839 milliseconds (cumulative count 1000000)

Cumulative distribution of latencies:
0.032% <= 0.103 milliseconds (cumulative count 319)
70.796% <= 0.207 milliseconds (cumulative count 707956)
91.151% <= 0.303 milliseconds (cumulative count 911509)
98.046% <= 0.407 milliseconds (cumulative count 980458)
99.412% <= 0.503 milliseconds (cumulative count 994116)
99.856% <= 0.607 milliseconds (cumulative count 998558)
99.898% <= 0.703 milliseconds (cumulative count 998982)
99.919% <= 0.807 milliseconds (cumulative count 999188)
99.921% <= 0.903 milliseconds (cumulative count 999205)
99.922% <= 1.007 milliseconds (cumulative count 999218)
99.933% <= 1.103 milliseconds (cumulative count 999325)
99.957% <= 1.207 milliseconds (cumulative count 999568)
99.972% <= 1.303 milliseconds (cumulative count 999720)
99.978% <= 1.407 milliseconds (cumulative count 999782)
99.993% <= 1.503 milliseconds (cumulative count 999934)
99.996% <= 1.607 milliseconds (cumulative count 999961)
99.999% <= 1.703 milliseconds (cumulative count 999989)
100.000% <= 1.807 milliseconds (cumulative count 999998)
100.000% <= 1.903 milliseconds (cumulative count 1000000)

Summary:
  throughput summary: 153303.70 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
        0.196     0.080     0.167     0.343     0.463     1.839

@zmccoy

zmccoy commented Jul 21, 2026

Copy link
Copy Markdown
Author

Rust-Count-Min-Sketch Implementation INCRBY


❯ valkey-benchmark -n 1000000 CMS.INCRBY sketchdim hello 1
CMS.INCRBY sketchdim hello 1: rps=130416.0 (overall: 130416.0) avg_msec=0.248 (overall: 0.248) 32604 reque                                                                                                          CMS.INCRBY sketchdim hello 1: rps=121964.1 (overall: 126181.6) avg_msec=0.255 (overall: 0.252) 63217 reque                                                                                                          CMS.INCRBY sketchdim hello 1: rps=129340.0 (overall: 127233.0) avg_msec=0.227 (overall: 0.243) 95552 reque                                                                                                          CMS.INCRBY sketchdim hello 1: rps=145900.0 (overall: 131895.1) avg_msec=0.211 (overall: 0.234) 132027 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=155652.0 (overall: 136642.7) avg_msec=0.198 (overall: 0.226) 170940 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=142320.0 (overall: 137588.3) avg_msec=0.227 (overall: 0.226) 206520 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=159692.0 (overall: 140744.1) avg_msec=0.196 (overall: 0.221) 246443 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=153348.0 (overall: 142318.8) avg_msec=0.209 (overall: 0.220) 284780 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=146669.3 (overall: 142803.7) avg_msec=0.206 (overall: 0.218) 321594 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=148260.0 (overall: 143348.9) avg_msec=0.215 (overall: 0.218) 358659 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=141244.0 (overall: 143157.7) avg_msec=0.221 (overall: 0.218) 393970 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=124984.0 (overall: 141644.2) avg_msec=0.249 (overall: 0.220) 425216 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=141244.0 (overall: 141613.5) avg_msec=0.225 (overall: 0.221) 460527 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=147310.8 (overall: 142021.7) avg_msec=0.207 (overall: 0.220) 497502 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=156172.0 (overall: 142964.3) avg_msec=0.200 (overall: 0.218) 536545 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=147268.0 (overall: 143233.1) avg_msec=0.215 (overall: 0.218) 573362 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=148716.0 (overall: 143555.4) avg_msec=0.204 (overall: 0.217) 610541 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=159664.0 (overall: 144449.7) avg_msec=0.192 (overall: 0.216) 650457 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=137916.3 (overall: 144104.8) avg_msec=0.223 (overall: 0.216) 685074 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=129392.0 (overall: 143369.7) avg_msec=0.252 (overall: 0.218) 717422 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=152800.0 (overall: 143818.4) avg_msec=0.198 (overall: 0.217) 755622 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=146148.0 (overall: 143924.2) avg_msec=0.210 (overall: 0.216) 792159 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=155984.0 (overall: 144448.2) avg_msec=0.193 (overall: 0.215) 831155 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=142418.3 (overall: 144363.4) avg_msec=0.218 (overall: 0.215) 866902 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=148668.0 (overall: 144535.4) avg_msec=0.214 (overall: 0.215) 904069 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=152076.0 (overall: 144825.2) avg_msec=0.204 (overall: 0.215) 942088 requ                                                                                                          CMS.INCRBY sketchdim hello 1: rps=151196.0 (overall: 145061.0) avg_msec=0.200 (overall: 0.214) 979887 requ                                                                                                          ====== CMS.INCRBY sketchdim hello 1 ======
  1000000 requests completed in 6.90 seconds
  50 parallel clients
  54 bytes payload
  keep alive: 1
  host configuration "save": 3600 1 300 100 60 10000
  host configuration "appendonly": no
  multi-thread: no

Latency by percentile distribution:
0.000% <= 0.087 milliseconds (cumulative count 1)
50.000% <= 0.183 milliseconds (cumulative count 535125)
75.000% <= 0.271 milliseconds (cumulative count 763323)
87.500% <= 0.311 milliseconds (cumulative count 882313)
93.750% <= 0.359 milliseconds (cumulative count 939686)
96.875% <= 0.423 milliseconds (cumulative count 970092)
98.438% <= 0.487 milliseconds (cumulative count 985521)
99.219% <= 0.527 milliseconds (cumulative count 992355)
99.609% <= 0.559 milliseconds (cumulative count 996253)
99.805% <= 0.591 milliseconds (cumulative count 998108)
99.902% <= 0.711 milliseconds (cumulative count 999040)
99.951% <= 1.071 milliseconds (cumulative count 999540)
99.976% <= 1.135 milliseconds (cumulative count 999783)
99.988% <= 1.167 milliseconds (cumulative count 999885)
99.994% <= 1.231 milliseconds (cumulative count 999940)
99.997% <= 1.351 milliseconds (cumulative count 999970)
99.998% <= 1.439 milliseconds (cumulative count 999985)
99.999% <= 1.535 milliseconds (cumulative count 999995)
100.000% <= 1.559 milliseconds (cumulative count 999997)
100.000% <= 1.591 milliseconds (cumulative count 999999)
100.000% <= 1.607 milliseconds (cumulative count 1000000)
100.000% <= 1.607 milliseconds (cumulative count 1000000)

Cumulative distribution of latencies:
0.012% <= 0.103 milliseconds (cumulative count 122)
62.833% <= 0.207 milliseconds (cumulative count 628329)
86.463% <= 0.303 milliseconds (cumulative count 864632)
96.442% <= 0.407 milliseconds (cumulative count 964415)
98.844% <= 0.503 milliseconds (cumulative count 988436)
99.847% <= 0.607 milliseconds (cumulative count 998467)
99.901% <= 0.703 milliseconds (cumulative count 999013)
99.920% <= 0.807 milliseconds (cumulative count 999197)
99.924% <= 0.903 milliseconds (cumulative count 999238)
99.933% <= 1.007 milliseconds (cumulative count 999333)
99.969% <= 1.103 milliseconds (cumulative count 999691)
99.992% <= 1.207 milliseconds (cumulative count 999923)
99.996% <= 1.303 milliseconds (cumulative count 999965)
99.998% <= 1.407 milliseconds (cumulative count 999980)
99.999% <= 1.503 milliseconds (cumulative count 999989)
100.000% <= 1.607 milliseconds (cumulative count 1000000)

Summary:
  throughput summary: 144906.53 requests per second
  latency summary (msec):
          avg       min       p50       p95       p99       max
        0.214     0.080     0.183     0.383     0.519     1.607

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment