Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate prepared statements #132

Merged
merged 10 commits into from
Aug 1, 2024
Merged

Conversation

marco6
Copy link
Collaborator

@marco6 marco6 commented Jul 16, 2024

This PR aims at reducing the boilerplate associated with preparing statements in a Dialect.

Copy link

github-actions bot commented Jul 16, 2024

Benchmark Result

goos: linux
goarch: amd64
pkg: github.com/canonical/k8s-dqlite/test
cpu: AMD EPYC 7763 64-Core Processor                
                    │     Before      │                 After                 │
                    │     sec/op      │    sec/op     vs base                 │
Compaction/sqlite-4    4.465m ± 12%     4.522m ± 24%        ~ (p=0.383 n=7)
Compaction/dqlite-4    6.138m ± 16%     5.983m ±  9%        ~ (p=1.000 n=7)
Create/sqlite-4        1.432m ±  9%     1.665m ± 23%        ~ (p=0.209 n=7)
Create/dqlite-4        1.606m ± 10%     1.519m ± 12%        ~ (p=0.318 n=7)
Delete/sqlite-4        1.902m ±  4%     1.512m ± 14%  -20.52% (p=0.001 n=7)
Delete/dqlite-4        1.648m ± 15%     1.396m ±  8%  -15.31% (p=0.038 n=7)
Get/sqlite-4           390.6µ ±  1%     286.8µ ±  2%  -26.59% (p=0.001 n=7)
Get/dqlite-4           507.4µ ±  5%     378.5µ ±  2%  -25.41% (p=0.001 n=7)
Lease/sqlite-4         106.6µ ±  1%     106.6µ ±  1%        ~ (p=0.805 n=7)
Lease/dqlite-4         108.2µ ±  4%     109.9µ ±  7%        ~ (p=0.456 n=7)
List/sqlite-4          7.686m ±  3%     8.164m ±  3%   +6.23% (p=0.001 n=7)
List/dqlite-4         43.540m ±   ∞ ¹   5.575m ±  4%  -87.20% (p=0.003 n=5+7)
Update/sqlite-4        1.640m ± 12%     1.482m ± 23%        ~ (p=0.383 n=7)
Update/dqlite-4        1.699m ±  4%     1.506m ±  9%  -11.39% (p=0.001 n=7)
geomean                1.540m           1.232m        -19.96%
¹ need >= 6 samples for confidence interval at level 0.95

                    │        Before        │                     After                      │
                    │ page-cache-misses/op │ page-cache-misses/op  vs base                  │
Compaction/sqlite-4           0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Compaction/dqlite-4           0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Create/sqlite-4               0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Create/dqlite-4               0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Delete/sqlite-4               0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Delete/dqlite-4               0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Get/sqlite-4                  0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Get/dqlite-4                  0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Lease/sqlite-4                0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Lease/dqlite-4                0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
List/sqlite-4                 0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
List/dqlite-4                 0.000 ±  ∞ ²             0.000 ± 0%       ~ (p=1.000 n=5+7) ¹
Update/sqlite-4               0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Update/dqlite-4               0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
geomean                                  ³                         +0.00%                 ³
¹ all samples are equal
² need >= 6 samples for confidence interval at level 0.95
³ summaries must be >0 to compute geomean

                    │        Before        │                     After                      │
                    │ page-cache-spills/op │ page-cache-spills/op  vs base                  │
Compaction/sqlite-4           0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Compaction/dqlite-4           0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Create/sqlite-4               0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Create/dqlite-4               0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Delete/sqlite-4               0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Delete/dqlite-4               0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Get/sqlite-4                  0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Get/dqlite-4                  0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Lease/sqlite-4                0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Lease/dqlite-4                0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
List/sqlite-4                 0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
List/dqlite-4                 0.000 ±  ∞ ²             0.000 ± 0%       ~ (p=1.000 n=5+7) ¹
Update/sqlite-4               0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Update/dqlite-4               0.000 ± 0%               0.000 ± 0%       ~ (p=1.000 n=7)   ¹
geomean                                  ³                         +0.00%                 ³
¹ all samples are equal
² need >= 6 samples for confidence interval at level 0.95
³ summaries must be >0 to compute geomean

                    │     Before     │                  After                   │
                    │ page-reads/op  │ page-reads/op  vs base                   │
Compaction/sqlite-4    112.3 ±  3%       112.3 ±  8%          ~ (p=0.731 n=7)
Compaction/dqlite-4    122.3 ±  3%       118.7 ±  2%     -2.94% (p=0.004 n=7)
Create/sqlite-4        21.19 ±  1%       20.93 ±  3%          ~ (p=0.068 n=7)
Create/dqlite-4        18.18 ±  4%       20.97 ±  3%    +15.35% (p=0.001 n=7)
Delete/sqlite-4        25.19 ± 12%       25.16 ±  4%          ~ (p=0.932 n=7)
Delete/dqlite-4        20.83 ±  2%       24.64 ±  1%    +18.29% (p=0.001 n=7)
Get/sqlite-4           11.99 ±  0%       11.99 ±  0%          ~ (p=1.000 n=7)
Get/dqlite-4           11.99 ±  0%       11.99 ±  0%          ~ (p=0.192 n=7)
Lease/sqlite-4        1.200m ±  6%      1.200m ± 33%          ~ (p=0.171 n=7)
Lease/dqlite-4        809.3µ ± 48%     1039.0µ ± 23%          ~ (p=0.767 n=7)
List/sqlite-4          276.0 ±  3%       296.0 ±  4%     +7.25% (p=0.001 n=7)
List/dqlite-4          34.03 ±   ∞ ¹    393.00 ±  5%  +1054.86% (p=0.003 n=5+7)
Update/sqlite-4        24.51 ±  3%       24.43 ±  5%          ~ (p=1.000 n=7)
Update/dqlite-4        20.81 ±  2%       24.70 ±  3%    +18.69% (p=0.001 n=7)
geomean                7.522             9.455          +25.70%
¹ need >= 6 samples for confidence interval at level 0.95

                    │     Before     │                  After                   │
                    │ page-writes/op │ page-writes/op  vs base                  │
Compaction/sqlite-4     11.25 ± 0%         11.22 ± 0%       ~ (p=0.263 n=7)
Compaction/dqlite-4     8.239 ± 1%         8.839 ± 4%  +7.28% (p=0.001 n=7)
Create/sqlite-4         5.105 ± 0%         5.092 ± 1%       ~ (p=0.136 n=7)
Create/dqlite-4         4.120 ± 0%         4.121 ± 1%       ~ (p=0.432 n=7)
Delete/sqlite-4         5.306 ± 1%         5.307 ± 0%       ~ (p=0.456 n=7)
Delete/dqlite-4         4.317 ± 1%         4.314 ± 1%       ~ (p=0.926 n=7)
Get/sqlite-4            0.000 ± 0%         0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Get/dqlite-4            0.000 ± 0%         0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Lease/sqlite-4          0.000 ± 0%         0.000 ± 0%       ~ (p=1.000 n=7)   ¹
Lease/dqlite-4          0.000 ± 0%         0.000 ± 0%       ~ (p=1.000 n=7)   ¹
List/sqlite-4           0.000 ± 0%         0.000 ± 0%       ~ (p=1.000 n=7)   ¹
List/dqlite-4           0.000 ±  ∞ ²       0.000 ± 0%       ~ (p=1.000 n=5+7) ¹
Update/sqlite-4         5.120 ± 1%         5.126 ± 0%  +0.12% (p=0.049 n=7)
Update/dqlite-4         4.135 ± 1%         4.154 ± 1%       ~ (p=0.439 n=7)
geomean                            ³                   +0.51%                 ³
¹ all samples are equal
² need >= 6 samples for confidence interval at level 0.95
³ summaries must be >0 to compute geomean

                    │     Before      │                   After                    │
                    │ sec-reading/op  │ sec-reading/op  vs base                    │
Compaction/sqlite-4   751.7µ ±  50%      673.2µ ±  16%         ~ (p=0.535 n=7)
Compaction/dqlite-4   200.0µ ±  26%      507.8µ ±  37%  +153.90% (p=0.001 n=7)
Create/sqlite-4       94.60µ ±  10%      96.10µ ± 106%         ~ (p=0.710 n=7)
Create/dqlite-4       43.30µ ±   8%      53.40µ ±  22%   +23.33% (p=0.011 n=7)
Delete/sqlite-4       168.8µ ± 661%      139.4µ ± 120%         ~ (p=0.318 n=7)
Delete/dqlite-4       47.60µ ±  37%      60.20µ ±  31%         ~ (p=0.209 n=7)
Get/sqlite-4          89.00µ ±   6%      86.60µ ±   5%         ~ (p=0.154 n=7)
Get/dqlite-4          37.80µ ±  20%      38.80µ ±  13%         ~ (p=0.648 n=7)
Lease/sqlite-4         0.000 ±    ?       0.000 ±   0%         ~ (p=1.000 n=7)
Lease/dqlite-4         0.000 ±    ?       0.000 ±    ?         ~ (p=1.000 n=7)
List/sqlite-4         6.989m ±   3%      7.509m ±   3%    +7.44% (p=0.001 n=7)
List/dqlite-4         450.0µ ±    ∞ ¹   4237.0µ ±   4%  +841.56% (p=0.003 n=5+7)
Update/sqlite-4       162.0µ ±  15%      163.5µ ±  21%         ~ (p=0.383 n=7)
Update/dqlite-4       81.90µ ±  42%      98.30µ ±  34%   +20.02% (p=0.026 n=7)
geomean                             ²                    +29.28%                 ²
¹ need >= 6 samples for confidence interval at level 0.95
² summaries must be >0 to compute geomean

                    │     Before     │                   After                   │
                    │ sec-writing/op │ sec-writing/op  vs base                   │
Compaction/sqlite-4   3.335m ± 14%       3.382m ± 32%        ~ (p=0.456 n=7)
Compaction/dqlite-4   50.00µ ± 55%       86.00µ ± 29%  +72.00% (p=0.017 n=7)
Create/sqlite-4       972.4µ ± 15%      1270.0µ ± 28%        ~ (p=0.097 n=7)
Create/dqlite-4       22.90µ ± 20%       18.60µ ± 77%        ~ (p=0.558 n=7)
Delete/sqlite-4       1.380m ± 12%       1.128m ± 19%  -18.26% (p=0.001 n=7)
Delete/dqlite-4       19.50µ ± 28%       21.00µ ± 38%        ~ (p=0.596 n=7)
Get/sqlite-4           0.000 ±  0%        0.000 ±  0%        ~ (p=1.000 n=7)   ¹
Get/dqlite-4           0.000 ±  0%        0.000 ±  0%        ~ (p=1.000 n=7)   ¹
Lease/sqlite-4         0.000 ±  0%        0.000 ±  0%        ~ (p=1.000 n=7)   ¹
Lease/dqlite-4         0.000 ±  0%        0.000 ±  0%        ~ (p=1.000 n=7)   ¹
List/sqlite-4          0.000 ±  0%        0.000 ±  0%        ~ (p=1.000 n=7)   ¹
List/dqlite-4          0.000 ±   ∞ ²      0.000 ±  0%        ~ (p=1.000 n=5+7) ¹
Update/sqlite-4       1.107m ± 20%       1.060m ± 31%        ~ (p=0.805 n=7)
Update/dqlite-4       20.10µ ± 42%       22.30µ ± 39%        ~ (p=0.209 n=7)
geomean                            ³                    +3.99%                 ³
¹ all samples are equal
² need >= 6 samples for confidence interval at level 0.95
³ summaries must be >0 to compute geomean

                    │     Before     │                   After                    │
                    │      B/op      │      B/op        vs base                   │
Compaction/sqlite-4   77.13Ki ± 7%       76.56Ki ± 12%          ~ (p=0.902 n=7)
Compaction/dqlite-4   57.60Ki ± 4%      113.91Ki ± 29%    +97.75% (p=0.001 n=7)
Create/sqlite-4       23.81Ki ± 0%       23.95Ki ±  0%     +0.57% (p=0.001 n=7)
Create/dqlite-4       21.56Ki ± 0%       21.93Ki ±  0%     +1.71% (p=0.001 n=7)
Delete/sqlite-4       26.58Ki ± 9%       26.65Ki ±  3%          ~ (p=0.091 n=7)
Delete/dqlite-4       23.28Ki ± 0%       23.70Ki ±  0%     +1.81% (p=0.001 n=7)
Get/sqlite-4          21.17Ki ± 0%       21.31Ki ±  0%     +0.65% (p=0.001 n=7)
Get/dqlite-4          19.15Ki ± 0%       19.38Ki ±  0%     +1.16% (p=0.001 n=7)
Lease/sqlite-4        12.33Ki ± 0%       12.33Ki ±  0%          ~ (p=1.000 n=7)
Lease/dqlite-4        12.33Ki ± 0%       12.33Ki ±  0%          ~ (p=0.869 n=7)
List/sqlite-4         1.014Mi ± 3%       1.095Mi ±  3%     +7.98% (p=0.001 n=7)
List/dqlite-4         76.99Ki ±  ∞ ¹   1020.82Ki ±  4%  +1225.95% (p=0.003 n=5+7)
Update/sqlite-4       26.09Ki ± 0%       26.19Ki ±  0%     +0.39% (p=0.001 n=7)
Update/dqlite-4       23.10Ki ± 0%       23.44Ki ±  0%     +1.47% (p=0.001 n=7)
geomean               35.03Ki            44.71Ki          +27.63%
¹ need >= 6 samples for confidence interval at level 0.95

                    │     Before     │                   After                    │
                    │   allocs/op    │   allocs/op    vs base                     │
Compaction/sqlite-4   3.405k ±  7%      3.382k ± 12%          ~ (p=0.871 n=7)
Compaction/dqlite-4   1.587k ±  4%      3.745k ± 34%   +135.98% (p=0.001 n=7)
Create/sqlite-4        535.0 ±  0%       532.0 ±  1%     -0.56% (p=0.001 n=7)
Create/dqlite-4        397.0 ±  0%       406.0 ±  0%     +2.27% (p=0.001 n=7)
Delete/sqlite-4        636.0 ± 16%       634.0 ±  6%          ~ (p=0.420 n=7)
Delete/dqlite-4        422.0 ±  0%       433.0 ±  0%     +2.61% (p=0.001 n=7)
Get/sqlite-4           504.0 ±  0%       505.0 ±  0%     +0.20% (p=0.001 n=7)
Get/dqlite-4           359.0 ±  0%       366.0 ±  0%     +1.95% (p=0.001 n=7)
Lease/sqlite-4         224.0 ±  0%       224.0 ±  0%          ~ (p=1.000 n=7)   ¹
Lease/dqlite-4         224.0 ±  0%       224.0 ±  0%          ~ (p=1.000 n=7)   ¹
List/sqlite-4         42.40k ±  3%      45.50k ±  4%     +7.30% (p=0.001 n=7)
List/dqlite-4         1.704k ±   ∞ ²   25.310k ±  5%  +1385.33% (p=0.003 n=5+7)
Update/sqlite-4        612.0 ±  0%       610.0 ±  0%     -0.33% (p=0.002 n=7)
Update/dqlite-4        418.0 ±  0%       427.0 ±  0%     +2.15% (p=0.001 n=7)
geomean                809.3            1.054k          +30.24%
¹ all samples are equal
² need >= 6 samples for confidence interval at level 0.95

                    │         After         │
                    │ network-bytes-read/op │
Compaction/dqlite-4           28.45Ki ± 41%
Create/dqlite-4                 423.3 ±  0%
Delete/dqlite-4                 616.4 ±  0%
Get/dqlite-4                    494.0 ±  0%
Lease/dqlite-4                0.03809 ± 19%
List/dqlite-4                 152.5Ki ±  6%
Update/dqlite-4                 564.5 ±  0%
geomean                         535.4

                    │          After           │
                    │ network-bytes-written/op │
Compaction/dqlite-4              1.121Ki ±  2%
Create/dqlite-4                    231.5 ±  1%
Delete/dqlite-4                    245.8 ±  0%
Get/dqlite-4                       80.51 ±  0%
Lease/dqlite-4                   0.08400 ± 57%
List/dqlite-4                      65.17 ±  0%
Update/dqlite-4                    263.2 ±  0%
geomean                            69.17
Current status
goos: linux
goarch: amd64
pkg: github.com/canonical/k8s-dqlite/test
cpu: AMD EPYC 7763 64-Core Processor                
                    │    After     │
                    │    sec/op    │
Compaction/sqlite-4   4.522m ± 24%
Compaction/dqlite-4   5.983m ±  9%
Create/sqlite-4       1.665m ± 23%
Create/dqlite-4       1.519m ± 12%
Delete/sqlite-4       1.512m ± 14%
Delete/dqlite-4       1.396m ±  8%
Get/sqlite-4          286.8µ ±  2%
Get/dqlite-4          378.5µ ±  2%
Lease/sqlite-4        106.6µ ±  1%
Lease/dqlite-4        109.9µ ±  7%
List/sqlite-4         8.164m ±  3%
List/dqlite-4         5.575m ±  4%
Update/sqlite-4       1.482m ± 23%
Update/dqlite-4       1.506m ±  9%
geomean               1.232m

                    │        After         │
                    │ page-cache-misses/op │
Compaction/sqlite-4           0.000 ± 0%
Compaction/dqlite-4           0.000 ± 0%
Create/sqlite-4               0.000 ± 0%
Create/dqlite-4               0.000 ± 0%
Delete/sqlite-4               0.000 ± 0%
Delete/dqlite-4               0.000 ± 0%
Get/sqlite-4                  0.000 ± 0%
Get/dqlite-4                  0.000 ± 0%
Lease/sqlite-4                0.000 ± 0%
Lease/dqlite-4                0.000 ± 0%
List/sqlite-4                 0.000 ± 0%
List/dqlite-4                 0.000 ± 0%
Update/sqlite-4               0.000 ± 0%
Update/dqlite-4               0.000 ± 0%
geomean                                  ¹
¹ summaries must be >0 to compute geomean

                    │        After         │
                    │ page-cache-spills/op │
Compaction/sqlite-4           0.000 ± 0%
Compaction/dqlite-4           0.000 ± 0%
Create/sqlite-4               0.000 ± 0%
Create/dqlite-4               0.000 ± 0%
Delete/sqlite-4               0.000 ± 0%
Delete/dqlite-4               0.000 ± 0%
Get/sqlite-4                  0.000 ± 0%
Get/dqlite-4                  0.000 ± 0%
Lease/sqlite-4                0.000 ± 0%
Lease/dqlite-4                0.000 ± 0%
List/sqlite-4                 0.000 ± 0%
List/dqlite-4                 0.000 ± 0%
Update/sqlite-4               0.000 ± 0%
Update/dqlite-4               0.000 ± 0%
geomean                                  ¹
¹ summaries must be >0 to compute geomean

                    │     After     │
                    │ page-reads/op │
Compaction/sqlite-4     112.3 ±  8%
Compaction/dqlite-4     118.7 ±  2%
Create/sqlite-4         20.93 ±  3%
Create/dqlite-4         20.97 ±  3%
Delete/sqlite-4         25.16 ±  4%
Delete/dqlite-4         24.64 ±  1%
Get/sqlite-4            11.99 ±  0%
Get/dqlite-4            11.99 ±  0%
Lease/sqlite-4         1.200m ± 33%
Lease/dqlite-4         1.039m ± 23%
List/sqlite-4           296.0 ±  4%
List/dqlite-4           393.0 ±  5%
Update/sqlite-4         24.43 ±  5%
Update/dqlite-4         24.70 ±  3%
geomean                 9.455

                    │     After      │
                    │ page-writes/op │
Compaction/sqlite-4     11.22 ± 0%
Compaction/dqlite-4     8.839 ± 4%
Create/sqlite-4         5.092 ± 1%
Create/dqlite-4         4.121 ± 1%
Delete/sqlite-4         5.307 ± 0%
Delete/dqlite-4         4.314 ± 1%
Get/sqlite-4            0.000 ± 0%
Get/dqlite-4            0.000 ± 0%
Lease/sqlite-4          0.000 ± 0%
Lease/dqlite-4          0.000 ± 0%
List/sqlite-4           0.000 ± 0%
List/dqlite-4           0.000 ± 0%
Update/sqlite-4         5.126 ± 0%
Update/dqlite-4         4.154 ± 1%
geomean                            ¹
¹ summaries must be >0 to compute geomean

                    │      After      │
                    │ sec-reading/op  │
Compaction/sqlite-4   673.2µ ±  16%
Compaction/dqlite-4   507.8µ ±  37%
Create/sqlite-4       96.10µ ± 106%
Create/dqlite-4       53.40µ ±  22%
Delete/sqlite-4       139.4µ ± 120%
Delete/dqlite-4       60.20µ ±  31%
Get/sqlite-4          86.60µ ±   5%
Get/dqlite-4          38.80µ ±  13%
Lease/sqlite-4         0.000 ±   0%
Lease/dqlite-4         0.000 ±    ?
List/sqlite-4         7.509m ±   3%
List/dqlite-4         4.237m ±   4%
Update/sqlite-4       163.5µ ±  21%
Update/dqlite-4       98.30µ ±  34%
geomean                             ¹
¹ summaries must be >0 to compute geomean

                    │     After      │
                    │ sec-writing/op │
Compaction/sqlite-4   3.382m ± 32%
Compaction/dqlite-4   86.00µ ± 29%
Create/sqlite-4       1.270m ± 28%
Create/dqlite-4       18.60µ ± 77%
Delete/sqlite-4       1.128m ± 19%
Delete/dqlite-4       21.00µ ± 38%
Get/sqlite-4           0.000 ±  0%
Get/dqlite-4           0.000 ±  0%
Lease/sqlite-4         0.000 ±  0%
Lease/dqlite-4         0.000 ±  0%
List/sqlite-4          0.000 ±  0%
List/dqlite-4          0.000 ±  0%
Update/sqlite-4       1.060m ± 31%
Update/dqlite-4       22.30µ ± 39%
geomean                            ¹
¹ summaries must be >0 to compute geomean

                    │     After      │
                    │      B/op      │
Compaction/sqlite-4    76.56Ki ± 12%
Compaction/dqlite-4    113.9Ki ± 29%
Create/sqlite-4        23.95Ki ±  0%
Create/dqlite-4        21.93Ki ±  0%
Delete/sqlite-4        26.65Ki ±  3%
Delete/dqlite-4        23.70Ki ±  0%
Get/sqlite-4           21.31Ki ±  0%
Get/dqlite-4           19.38Ki ±  0%
Lease/sqlite-4         12.33Ki ±  0%
Lease/dqlite-4         12.33Ki ±  0%
List/sqlite-4          1.095Mi ±  3%
List/dqlite-4         1020.8Ki ±  4%
Update/sqlite-4        26.19Ki ±  0%
Update/dqlite-4        23.44Ki ±  0%
geomean                44.71Ki

                    │    After     │
                    │  allocs/op   │
Compaction/sqlite-4   3.382k ± 12%
Compaction/dqlite-4   3.745k ± 34%
Create/sqlite-4        532.0 ±  1%
Create/dqlite-4        406.0 ±  0%
Delete/sqlite-4        634.0 ±  6%
Delete/dqlite-4        433.0 ±  0%
Get/sqlite-4           505.0 ±  0%
Get/dqlite-4           366.0 ±  0%
Lease/sqlite-4         224.0 ±  0%
Lease/dqlite-4         224.0 ±  0%
List/sqlite-4         45.50k ±  4%
List/dqlite-4         25.31k ±  5%
Update/sqlite-4        610.0 ±  0%
Update/dqlite-4        427.0 ±  0%
geomean               1.054k

                    │         After         │
                    │ network-bytes-read/op │
Compaction/dqlite-4           28.45Ki ± 41%
Create/dqlite-4                 423.3 ±  0%
Delete/dqlite-4                 616.4 ±  0%
Get/dqlite-4                    494.0 ±  0%
Lease/dqlite-4                0.03809 ± 19%
List/dqlite-4                 152.5Ki ±  6%
Update/dqlite-4                 564.5 ±  0%
geomean                         535.4

                    │          After           │
                    │ network-bytes-written/op │
Compaction/dqlite-4              1.121Ki ±  2%
Create/dqlite-4                    231.5 ±  1%
Delete/dqlite-4                    245.8 ±  0%
Get/dqlite-4                       80.51 ±  0%
Lease/dqlite-4                   0.08400 ± 57%
List/dqlite-4                      65.17 ±  0%
Update/dqlite-4                    263.2 ±  0%
geomean                            69.17

@marco6 marco6 force-pushed the marco6/simplify-prepared-statements branch from 1fe16a7 to 1b510f5 Compare July 16, 2024 09:57
@marco6
Copy link
Collaborator Author

marco6 commented Jul 17, 2024

Depends on canonical/go-dqlite#308 .

@marco6 marco6 mentioned this pull request Jul 22, 2024
@marco6 marco6 force-pushed the marco6/simplify-prepared-statements branch from 8e28dcc to 8d08ddc Compare July 24, 2024 06:39
@marco6
Copy link
Collaborator Author

marco6 commented Jul 24, 2024

Marking as ready since dqlite released the fix.

@marco6 marco6 marked this pull request as ready for review July 24, 2024 07:04
@marco6 marco6 requested a review from a team as a code owner July 24, 2024 07:04
@marco6 marco6 requested a review from bschimke95 July 24, 2024 07:04
Copy link
Contributor

@bschimke95 bschimke95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@marco6
Copy link
Collaborator Author

marco6 commented Jul 26, 2024

On my machine this change makes the benchmarks unstable because of canonical/dqlite#675 .

Copy link
Member

@TheSignPainter98 TheSignPainter98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work Marco, here are a few things I think we should consider before merging

pkg/kine/drivers/generic/generic.go Show resolved Hide resolved
pkg/kine/drivers/generic/generic.go Outdated Show resolved Hide resolved
pkg/kine/drivers/generic/generic.go Outdated Show resolved Hide resolved
pkg/kine/drivers/generic/generic.go Outdated Show resolved Hide resolved
pkg/kine/drivers/generic/generic.go Show resolved Hide resolved
pkg/kine/prepared/db.go Outdated Show resolved Hide resolved
pkg/kine/prepared/db.go Outdated Show resolved Hide resolved
pkg/kine/prepared/db.go Outdated Show resolved Hide resolved
pkg/kine/prepared/db.go Outdated Show resolved Hide resolved
pkg/kine/prepared/db.go Outdated Show resolved Hide resolved
Copy link
Member

@TheSignPainter98 TheSignPainter98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nearly there I think, just a couple of trivials

pkg/kine/drivers/generic/generic.go Outdated Show resolved Hide resolved
pkg/kine/drivers/generic/generic.go Outdated Show resolved Hide resolved
pkg/kine/logstructured/sqllog/sql.go Show resolved Hide resolved
Copy link
Member

@TheSignPainter98 TheSignPainter98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent, thank you for the improvements!

@marco6 marco6 merged commit b3721ee into master Aug 1, 2024
7 checks passed
@marco6 marco6 deleted the marco6/simplify-prepared-statements branch August 1, 2024 12:39
@marco6 marco6 restored the marco6/simplify-prepared-statements branch August 1, 2024 12:48
@marco6 marco6 deleted the marco6/simplify-prepared-statements branch August 1, 2024 12:48
louiseschmidtgen pushed a commit that referenced this pull request Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants