Commit graph

3 commits

Author SHA1 Message Date
d18eaf060d [#957] treesvc: Implement pairing heap
With a large number of objects in a flat tree, sorting the nodes
dominates the latency of the operation. This scales nonlinearly
as O(n log n). Pairing heap has O(1) insert, and O(log n) extractMin,
which allows us to have O(n + log n) = O(n) latency on the first
operation, albeit with a slight increase in total running time.
On a real cluster with 2m objects, the latency decreased from 25s to
15s.

```
goos: linux
goarch: amd64
pkg: git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree
cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
                        │     cache     │               noparent               │
                        │    sec/op     │    sec/op     vs base                │
GetSubTree/latency-8      2349.9µ ± 19%   572.1µ ± 17%  -75.65% (p=0.000 n=10)
GetSubTree/total_time-8    70.62m ±  8%   86.02m ±  3%  +21.81% (p=0.000 n=10)
geomean                    12.88m         7.015m        -45.54%

                        │    cache     │               noparent               │
                        │     B/op     │     B/op      vs base                │
GetSubTree/latency-8      43.87Mi ± 0%   32.81Mi ± 0%  -25.22% (p=0.000 n=10)
GetSubTree/total_time-8   43.87Mi ± 0%   32.81Mi ± 0%  -25.22% (p=0.000 n=10)
geomean                   43.87Mi        32.81Mi       -25.22%

                        │    cache    │              noparent               │
                        │  allocs/op  │  allocs/op   vs base                │
GetSubTree/latency-8      400.0k ± 0%   500.0k ± 0%  +24.99% (p=0.000 n=10)
GetSubTree/total_time-8   400.0k ± 0%   500.0k ± 0%  +24.99% (p=0.000 n=10)
geomean                   400.0k        500.0k       +24.99%
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-02-06 14:14:49 +03:00
77bdadde14 [#957] treesvc/heap: Cache FileName attribute
```
goos: linux
goarch: amd64
pkg: git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree
cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
                        │     new      │                cache                 │
                        │    sec/op    │    sec/op     vs base                │
GetSubTree/latency-8      4.059m ± 20%   2.350m ± 19%  -42.11% (p=0.000 n=10)
GetSubTree/total_time-8   78.82m ±  4%   70.62m ±  8%  -10.39% (p=0.001 n=10)
geomean                   17.89m         12.88m        -27.98%

                        │     new      │                cache                 │
                        │     B/op     │     B/op      vs base                │
GetSubTree/latency-8      32.81Mi ± 0%   43.87Mi ± 0%  +33.72% (p=0.000 n=10)
GetSubTree/total_time-8   32.81Mi ± 0%   43.87Mi ± 0%  +33.73% (p=0.000 n=10)
geomean                   32.81Mi        43.87Mi       +33.72%

                        │     new     │               cache                │
                        │  allocs/op  │  allocs/op   vs base               │
GetSubTree/latency-8      400.0k ± 0%   400.0k ± 0%  +0.01% (p=0.000 n=10)
GetSubTree/total_time-8   400.0k ± 0%   400.0k ± 0%  +0.01% (p=0.000 n=10)
geomean                   400.0k        400.0k       +0.01%
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-02-06 10:15:28 +03:00
3601feab81 [#957] treesvc: Abstract out Heap interface for listing
```
goos: linux
goarch: amd64
pkg: git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree
cpu: 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz
                        │     old      │                 new                  │
                        │    sec/op    │    sec/op     vs base                │
GetSubTree/latency-8      3.542m ± 12%   4.059m ± 20%  +14.59% (p=0.005 n=10)
GetSubTree/total_time-8   73.19m ±  9%   78.82m ±  4%   +7.69% (p=0.043 n=10)
geomean                   16.10m         17.89m        +11.09%

                        │     old      │                 new                  │
                        │     B/op     │     B/op      vs base                │
GetSubTree/latency-8      28.23Mi ± 0%   32.81Mi ± 0%  +16.22% (p=0.000 n=10)
GetSubTree/total_time-8   28.23Mi ± 0%   32.81Mi ± 0%  +16.22% (p=0.000 n=10)
geomean                   28.23Mi        32.81Mi       +16.22%

                        │     old     │                new                 │
                        │  allocs/op  │  allocs/op   vs base               │
GetSubTree/latency-8      400.0k ± 0%   400.0k ± 0%  +0.00% (p=0.000 n=10)
GetSubTree/total_time-8   400.0k ± 0%   400.0k ± 0%  +0.00% (p=0.000 n=10)
geomean                   400.0k        400.0k       +0.00%
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-02-06 10:14:35 +03:00