EngFlow / bazel_invocation_analyzer

A tool that automatically analyzes a Bazel build's profile and offers suggestions on how to make it faster.
https://analyzer.engflow.com
Apache License 2.0
90 stars 10 forks source link

[SuggestionProvider] Suggest investigating remote cache misses #126

Closed saraadams closed 11 months ago

saraadams commented 11 months ago

If remote caching is used and there are remote cache misses, suggest investigating the misses with a link to Bazel documentation.

Contributes to #90

saraadams commented 11 months ago

Example output:

Suggestion: "Investigate remote cache misses"
The following actions with cache misses took the longest to execute:
    - Action: "Copying directory external/npm/_/node_modules/date-fns [for tool]"
        Action duration: 52s
    - Action: "Copying directory external/npm/_/node_modules/date-fns"
        Action duration: 51s
    - Action: "Copying directory external/npm/_/node_modules/rxjs"
        Action duration: 46s
    - Action: "Copying directory external/npm/_/node_modules/@material-ui/core [for tool]"
        Action duration: 42s
    - Action: "Copying directory external/npm/_/node_modules/@material-ui/core"
        Action duration: 41s
Check https://bazel.build/remote/cache-remote#troubleshooting-cache-hits to learn more about how to debug remote cache misses. Increasing the cache hit rate can significantly speed up builds.
Caveats
- Only the first 5 of 6125 cache misses are listed. Try running this tool with --verbose to get more data.
laszlocsomor commented 11 months ago

Could you rebase on main and force-push please?

saraadams commented 11 months ago

Rebased and addressed TODOs. PTAL.

saraadams commented 11 months ago

Example output with target name caveat:

Suggestion: "Investigate remote cache misses"
The following actions with cache misses took the longest to execute:
[...]
Check https://bazel.build/remote/cache-remote#troubleshooting-cache-hits to learn more about how to debug remote cache misses. Increasing the cache hit rate can significantly speed up builds.
Caveats
- The profile does not include which target each action was processed for, although that data can help with investigating remote cache misses. It is added to the profile by using the Bazel flag `--experimental_profile_include_target_label`. Also see https://bazel.build/reference/command-line-reference#flag--experimental_profile_include_target_label