Optimize consistency and state handling
Description
This optimizes how BuildStream handles states, and reduces the number of calls that are necessary to detect whether something is cached or not.
Changes proposed in this merge request:
- add a
is_resolved
on sources to determine whether the source is resolved or not. Default implementation isself.get_ref() is not None
- add a
is_cached()
on sources to determine whether the source has a local copy of its data - Remove
get_consistency()
onSource
, which only allows coarse-grained state tracking and is not needed by 1 and 2. - separate 'in source cache' and 'cached by plugin' logic in
Element
Fixes
Fix #1126 (closed)
BREAKING BEHAVIORS
This optimization ensures that we do not call the check for a plugin of whether its sources are cached or not.
This means that if sources are in the internal source cache, we don't call the validate_cache
part of the plugin anymore, which means that warnings will not be shown/will not error the build as soon as the source is in the source cache.
Since this is a breaking behavior it will need to be synchronized with
Benchmarks
Using the dummy debian project
- Finished in: 84 mins, 32 secs
- Number of builders: [4, 8, 12, 24]
- Target files: base-files/base-files.bst
- Number of runs: 4
- Number of warmups: 2
- Python versions: py37
action | python_version | commit | median time (secs) | mean time (secs) ± std |
---|---|---|---|---|
build - 12 | py37 | bschubert/optimize-consistency - 8b8b7e52 | 81.445 | 81.20 ± 0.74 |
py37 | master - 51263e21 | 84.735 | 84.74 ± 0.22 | |
build - 24 | py37 | bschubert/optimize-consistency - 8b8b7e52 | 81.35 | 81.28 ± 0.35 |
py37 | master - 51263e21 | 84.975 | 85.04 ± 0.47 | |
build - 4 | py37 | bschubert/optimize-consistency - 8b8b7e52 | 88.775 | 88.84 ± 0.26 |
py37 | master - 51263e21 | 92.18 | 92.07 ± 0.76 | |
build - 8 | py37 | bschubert/optimize-consistency - 8b8b7e52 | 81.725 | 81.86 ± 0.48 |
py37 | master - 51263e21 | 84.985 | 84.84 ± 0.48 | |
show | py37 | bschubert/optimize-consistency - 8b8b7e52 | 4.84 | 4.84 ± 0.03 |
py37 | master - 51263e21 | 4.89 | 4.90 ± 0.04 | |
show - cached | py37 | bschubert/optimize-consistency - 8b8b7e52 | 7.525 | 7.53 ± 0.32 |
py37 | master - 51263e21 | 7.93 | 8.00 ± 0.16 | |
show - sources fetched | py37 | bschubert/optimize-consistency - 8b8b7e52 | 7.135 | 7.08 ± 0.23 |
py37 | master - 51263e21 | 4.87 | 4.87 ± 0.05 | |
source fetch | py37 | bschubert/optimize-consistency - 8b8b7e52 | 41.695 | 41.68 ± 0.27 |
py37 | master - 51263e21 | 48.055 | 47.92 ± 0.33 |
There were 4 runs of each command.
Using a real internal project
action | commit | real | user | sys |
---|---|---|---|---|
bst show - nothing cached | master | 1m28 | 1m47 | 0m17 |
1m34 | 1m53 | 0m18 | ||
1m32 | 1m50 | 0m17 | ||
optimize-consistency | 0m11 | 0m10 | 0m01 | |
0m11 | 0m10 | 0m01 | ||
0m11 | 0m10 | 0m03 | ||
bst --fetchers 32 source fetch | master | 5m01 | 24m4 | 11m35 |
5m05 | 23m55 | 11m34 | ||
5m04 | 24m6 | 11m31 | ||
optimize-consistency | 4m11 | 24m33 | 11m2 | |
4m05 | 23m44 | 10m40 | ||
4m16 | 24m53 | 11m11 | ||
bst show - sources cached | master | 1m24 | 0m31 | 0m55 |
1m21 | 0m31 | 0m53 | ||
1m24 | 0m32 | 0m56 | ||
optimize-consistency | 0m17 | 0m13 | 0m03 | |
0m16 | 0m13 | 0m03 | ||
0m18 | 0m14 | 0m03 | ||
bst build | NOT COMPUTED, TOO LONG | X | X | X |
bst show - all cached | master | 1m58 | 0m38 | 1m32 |
1m54 | 0m37 | 1m20 | ||
1m56 | 0m38 | 1m21 | ||
optimize-consistency | 0m26s | 0m16s | 0m06 | |
0m19 | 0m15 | 0m04 | ||
0m19 | 0m15 | 0m04 |
Edited by Benjamin Schubert
Merge request reports
Activity
Please register or sign in to reply