bazelbuild / bazel-bench Goto Github PK
View Code? Open in Web Editor NEWBenchmarking tool for bazel
License: Apache License 2.0
Benchmarking tool for bazel
License: Apache License 2.0
Description of the problem / feature request:
It's easy to miss a non-zero exit status in the long build log. It should also be visible in the results summary in the end.
If not all runs have the same status, you may even consider excluding measurements from non-zero exit code runs.
Feature requests: what underlying problem are you trying to solve with this feature?
Make it easy to detect errors / flakiness.
Incompatible flag --incompatible_no_implicit_file_export will be enabled by default in a future Bazel release [1], thus breaking Bazel Bench.
The flag is documented here: bazelbuild/bazel#10225
Please check the following CI builds for build and test results:
Never heard of incompatible flags before? We have documentation that explains everything.
If you don't want to receive any future issues for Bazel Bench or if you have any questions,
please file an issue in https://github.com/bazelbuild/continuous-integration
Important: Please do NOT modify the issue title since that might break our tools.
[1] The target release hasn't been determined yet. Our tool will update the issue title once the flag flip has been scheduled.
Hi
I have followed the installation instructions, and tried to do some test benchmarking. But it fails with the following error:
https://gist.github.com/snazhmudinov/fe4b9140135eb3d9c1b42bb9b808a51d
Command I'm trying to run:
bazel run :benchmark \
-- \
--project_source=https://github.com/bazelbuild/rules_cc.git \
--data_directory=/tmp/bazel-bench-data \
--verbose \
-- build //:all
I have bazelisk, python/python3, git installed. I have also installed all the 3rd party requirements (according to installation guides).
I'm on macbook air: 1.6 GHz Dual-Core Intel Core i5, MacOS 12.6,
Description of the problem / feature request:
Config-file interface would allow us more flexibility in our benchmarks: we'd be able to benchmark the same version of bazel, but with different conditions (e.g. flags, depot cl, ...).
Use case: As a Bazel developer, I'd like to benchmark the effect of my new flag on Bazel performance before submitting the change.
Description of the problem / feature request:
We should fail the whole script if any individual run fails. Measurements from failed runs aren't very meaningful.
Description of the problem / feature request:
This is a follow-up of #39. We'd like to exclude failed runs (exit code != 0) from the final numbers displayed in the summary tables.
Feature requests: what underlying problem are you trying to solve with this feature?
Failed runs aren't very meaningful in terms of performance benchmarking.
Description of the problem / feature request:
We'd like the option to collect the JSON profiles of our bazel runs with bazel-bench.
Feature requests: what underlying problem are you trying to solve with this feature?
To get a more in-depth perspective of the build performance.
Description of the problem / feature request:
In bazel-bench-nightly, we currently only separate fetched bazel binaries by commits. This becomes a problem when the same VM is used for 2 different containers of 2 different platforms, as the directory where we store the binaries is shared.
This problem can be resolved by further namespacing the binaries by platforms.
Incompatible flag --incompatible_no_implicit_file_export will break Bazel Bench once Bazel 1.2.1 is released.
Please see the following CI builds for more information:
Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration
Important: Please do NOT modify the issue title since that might break our tools.
Description of the problem / feature request:
The build event protocol exposes a bunch of good metrics about the invocation such as number of packages loaded, targets configured, actions created and executed.
It would be nice to be able to track them with bazel-bench.
Feature requests: what underlying problem are you trying to solve with this feature?
Get insights into project growth.
suggested by @zhengwei143
Not all metrics are times, memory is MB.
Description of the problem / feature request:
https://buildkite.com/bazel-trusted/bazel-bench-nightly/builds/12
The previous day had no commit, so there shouldn't have been any fetching of binaries at all. Instead, the pipeline attempted to fetch a bazel binary with commit=''
. This is potentially due to a bug in parsing git log
.
Description of the problem / feature request:
Improve the table alignment in the stdout output.
Description of the problem / feature request:
The list of artifacts at the end of the report is pretty long. It'd be nice to be able to collapse it.
Description of the problem / feature request:
bazel-bench did not run on all specified bazel commits.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Ran the following command:
bazel run :benchmark -- --bazel_commits ffad58728d850b465a070d25b037ea1bced0f91f,4782b8872c3bef8df56f3714ffd005dd3dcc95f7 --bazel_source /usr/local/google/home/twerth/bazel-up --collect_memory --data_directory /tmp/bazel-g1_2 --project_commits ffad58728d850b465a070d25b037ea1bced0f91f --project_source /usr/local/google/home/twerth/bazel-up --runs 20 --collect_json_profile -- build --compilation_mode=opt //src:bazel
Note that I am using the same local repository as bazel and project source - is that causing any problems?
From the logs:
INFO: Running command line: bazel-out/k8-py2-fastbuild/bin/benchmark --bazel_commits ffad58728d850b465a070d25b037ea1bced0f91f,4782b8872c3bef8df56f3714ffd005dd3dcc95f7 --bazel_source /usr/local/google/home/twerth/bazel-up --collect_memory --data_directory /tmp/bazel-g1_2 --project_commits ffad58728d850b465a070d25b037ea1bced0f91f --project_source /usr/local/google/home/twerth/bazel-up --runs 20 --collect_json_profile -- build '--compilation_mode=opt' //src:bazel
...
I0619 07:56:51.347815 139708403218240 logger.py:33] Preparing bazelbuild/bazel repository.
I0619 07:56:51.347987 139708403218240 logger.py:33] Path /tmp/.bazel-bench/bazel exists. Updating...
I0619 07:56:51.811319 139708403218240 logger.py:33] Preparing /usr/local/google/home/twerth/bazel-up clone.
I0619 07:56:51.811598 139708403218240 logger.py:33] Path /tmp/.bazel-bench/project-clones/cbf1f465934e5495d5024f0a2bd99ea5 exists. Updating...
I0619 07:56:52.261014 139708403218240 logger.py:33] Binary exists at /tmp/.bazel-bench/bazel-bin/ffad58728d850b465a070d25b037ea1bced0f91f/bazel, reusing...
I0619 07:56:52.328670 139708403218240 logger.py:33] Pre-fetching external dependencies & exporting build event json to /tmp/.bazel-bench/out/build_env.json...
So it is already missing in the preparation phase.
Traceback (most recent call last):
File "/home/benjamin/.cache/bazel/_bazel_benjamin/87896217ed058d0cf7ddf603fa041dc4/execroot/__main__/bazel-out/k8-fastbuild/bin/benchmark.runfiles/__main__/benchmark.py", line 695, in <module>
app.run(main)
File "/home/benjamin/.cache/bazel/_bazel_benjamin/87896217ed058d0cf7ddf603fa041dc4/execroot/__main__/bazel-out/k8-fastbuild/bin/benchmark.runfiles/third_party_pypi__absl_py_0_9_0/absl/app.py", line 299, in run
_run_main(main, args)
File "/home/benjamin/.cache/bazel/_bazel_benjamin/87896217ed058d0cf7ddf603fa041dc4/execroot/__main__/bazel-out/k8-fastbuild/bin/benchmark.runfiles/third_party_pypi__absl_py_0_9_0/absl/app.py", line 250, in _run_main
sys.exit(main(argv))
File "/home/benjamin/.cache/bazel/_bazel_benjamin/87896217ed058d0cf7ddf603fa041dc4/execroot/__main__/bazel-out/k8-fastbuild/bin/benchmark.runfiles/__main__/benchmark.py", line 634, in main
results, args = _run_benchmark(
File "/home/benjamin/.cache/bazel/_bazel_benjamin/87896217ed058d0cf7ddf603fa041dc4/execroot/__main__/bazel-out/k8-fastbuild/bin/benchmark.runfiles/__main__/benchmark.py", line 322, in _run_benchmark
_single_run(bazel_bin_path, command, options, targets, startup_options,
File "/home/benjamin/.cache/bazel/_bazel_benjamin/87896217ed058d0cf7ddf603fa041dc4/execroot/__main__/bazel-out/k8-fastbuild/bin/benchmark.runfiles/__main__/benchmark.py", line 266, in _single_run
measurements['memory'],
KeyError: 'memory'
Description of the problem / feature request:
This is specific to the benchmarking pipeline on BazelCI.
Right now we only specify the platform to run benchmarking on. We should be able to replicate CI's tasks' environments, which include not only the platform but also things like ENV vars, build flags, ...
Example:
https://github.com/bazelbuild/bazel/blob/master/.bazelci/postsubmit.yml#L116
Description of the problem / feature request:
Currently, the json_profile_merger logic simply takes time spans from the profiles and collates them for analysis.
It would be nice if we could categorise this data based on whether the action was executed locally, executed remotely, cached locally, cached remotely.
Visually it can be quite clear through chrome://tracing
whether an action is using the remote cache as it has a span below with "Downloading Outputs", but this isn't considered when collecting this data as the spans are only related via the CPU executed.
Feature requests: what underlying problem are you trying to solve with this feature?
I would like to be able to produce reports on execution time of executed actions from daily CI builds. This is currently not possible as cached actions are grouped in and are quite fast.
Description of the problem / feature request:
Support for Python 2 is ending in 2020: https://pythonclock.org/. We currently have some targets that only works on python2. These need to be changed to support python3.
Platform: Ubuntu, MacOS
Logs:
FAILED: //utils:bazel_test (Summary)
FAILED: //utils:values_test (Summary)
FAILED: //:benchmark_test (Summary)
Steps:
git clone https://github.com/bazelbuild/bazel-bench.git
git reset 63b12c00145c30ccf3a230d62d30103654649c80 --hard
export USE_BAZEL_VERSION=2ddacab80af1dca3c04e74809827c47ec4bc8498
bazel test //...
CC Greenteam @fweikert
Platform: Macos. Windows
Logs:
ERROR: �[0mAn error occurred during the fetch of repository 'third_party':
Error: 'struct' value has no field or method 'to_json'
ERROR: �[0m/Users/buildkite/builds/bk-imacpro-20/bazel-org-repo-root/bazel-bench/WORKSPACE:23:12: fetching pip_repository rule //external:third_party: Traceback (most recent call last):
Error: 'struct' value has no field or method 'to_json'
ERROR: �[0mSkipping '//...': error loading package under directory '': no such package '@@third_party//': 'struct' value has no field or method 'to_json'
ERROR: �[0merror loading package under directory '': no such package '@@third_party//': 'struct' value has no field or method 'to_json'
Culprit:
Steps:
git clone https://github.com/bazelbuild/bazel-bench
git reset d1c5d8815f1069a5a278023e4c4344ab7c823b33 --hard
export USE_BAZEL_VERSION=b100e4f1631da2d7c78621c040e88b7644985cd8
bazel build //...
CC Greenteam @SalmaSamy
Platform : MacOS
Logs:
(03:12:28) ERROR: An error occurred during the fetch of repository 'third_party':
Traceback (most recent call last):
File "/private/var/tmp/_bazel_buildkite/4e9cc81b0b6cd04f715b7270e313d439/external/rules_python/python/pip_install/pip_repository.bzl", line 235, column 63, in _pip_repository_impl
environment = _create_repository_execution_environment(rctx),
File "/private/var/tmp/_bazel_buildkite/4e9cc81b0b6cd04f715b7270e313d439/external/rules_python/python/pip_install/pip_repository.bzl", line 158, column 37, in _create_repository_execution_environment
_maybe_set_xcode_location_cflags(rctx, env)
File "/private/var/tmp/_bazel_buildkite/4e9cc81b0b6cd04f715b7270e313d439/external/rules_python/python/pip_install/pip_repository.bzl", line 83, column 26, in _maybe_set_xcode_location_cflags
rctx.path(Label("@{}//:WORKSPACE".format(rctx.attr.python_interpreter_target.workspace_name))).dirname,
Error in path: Not a regular file: /private/var/tmp/_bazel_buildkite/4e9cc81b0b6cd04f715b7270e313d439/external/python3_10_x86_64-apple-darwin/WORKSPACE
Steps:
git clone https://github.com/bazelbuild/bazel-bench.git
git reset 656fdf243022f3cbadf2f7ce161a401212add6e6 --hard
export USE_BAZEL_VERSION=104a711ae1772be62b6034506d51c5fee486b589
bazel build //...
CC Greenteam @comius
Description of the problem / feature request:
We no longer do benchmarking on ubuntu1604
on BazelCI, so it shouldn't be included in this project's CI environments.
Bazel 0.27 turns on --incompatible_use_python_toolchains
. According to a recent downstream CI run with the flag flip, this project fails, probably because the flag flip causes it to use the correct Python version (as requested by the target) instead of whatever the system python
version is. You can likely fix this by adding python_version = "PY2"
to your Python 2 targets.
Description of the problem / feature request:
Currently bazel-bench isn't able to benchmark incremental builds due to the following reasons:
--warm_up=n
runs prior to the benchmark --runs=n
--shutdown
and --clean
to allow us to toggle whether or not to run blaze shutdown / clean
(currently runs both by default).--patch_file
.Feature requests: what underlying problem are you trying to solve with this feature?
Allows users to benchmark the incremental case, by:
--warm_up
runs to warm up the blaze cache.shutdown
or clean
in between runs so that we run with a warm blaze cache.Description of the problem / feature request:
The current report requires scrolling and is more tailored for viewing on personal devices. We'd like to have a dashboard-friendly display where no scrolling is required.
Incompatible flag --incompatible_load_python_rules_from_bzl will break Bazel Bench once Bazel 1.2.1 is released.
Please see the following CI builds for more information:
Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration
Important: Please do NOT modify the issue title since that might break our tools.
Description of the problem / feature request:
This is to help the users of the reports to understand the report easier. We can add something like https://getbootstrap.com/docs/4.1/components/tooltips/.
Description of the problem / feature request:
As there's a timeout limit, it's not practical to run benchmarking at every commit (also we need to maintain the number of runs per commit to achieve statistical significance). We need an option to benchmark every X commit in the commit list.
Description of the problem / feature request:
We should add some e2e tests. Something like what Bazel has https://github.com/bazelbuild/bazel/tree/master/src/test/shell
Feature requests: what underlying problem are you trying to solve with this feature?
To make sure the tool works properly end-to-end.
Description of the problem / feature request:
Add --sandbox_tmpfs_path=/tmp
to the default bazel arguments on Linux.
Building bazel itself (from clean) without this flag breaks in ~15% of the cases.
With the flag, it doesn't fail once in 50 clean builds.
Any other information, logs, or outputs that you want to share?
This is just a workaround until bazelbuild/bazel#3236 is fixed.
Description of the problem / feature request:
Trying to run the example benchmark from README
, and it gives me the error:
ERROR: /Users/sherozn/.bazel-bench/project-clones/3915c08828952724cf3dcead4c416118/tools/build_rules/java_rules_skylark.bzl:59:39: invalid escape sequence: \.. Use '\\' to insert '\'.
ERROR: /Users/sherozn/.bazel-bench/project-clones/3915c08828952724cf3dcead4c416118/src/BUILD:140:11: error loading package 'src/java_tools/buildjar/java/com/google/devtools/build/buildjar/jarhelper': compilation of module 'tools/build_rules/java_rules_skylark.bzl' failed and referenced by '//src:embedded_tools_jdk_minimal_srcs'
ERROR: Analysis of target '//src:bazel' failed; build aborted:
INFO: Elapsed time: 0.051s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (4 packages loaded, 0 targets configured)
currently loading: src/java_tools/buildjar/java/com/google/devtools/build/buildjar/jarhelper ... (2 packages)
Fetching repository @local_config_cc_toolchains; starting
Fetching repository @local_jdk; starting
Traceback (most recent call last):
File "/private/var/tmp/_bazel_sherozn/4e4b6bfdaf070146b8f266fb0b3ab2cc/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/benchmark.runfiles/__main__/benchmark.py", line 698, in <module>
app.run(main)
File "/private/var/tmp/_bazel_sherozn/4e4b6bfdaf070146b8f266fb0b3ab2cc/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/benchmark.runfiles/third_party/pypi__absl_py/site-packages/absl/app.py", line 308, in run
_run_main(main, args)
File "/private/var/tmp/_bazel_sherozn/4e4b6bfdaf070146b8f266fb0b3ab2cc/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/benchmark.runfiles/third_party/pypi__absl_py/site-packages/absl/app.py", line 254, in _run_main
sys.exit(main(argv))
File "/private/var/tmp/_bazel_sherozn/4e4b6bfdaf070146b8f266fb0b3ab2cc/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/benchmark.runfiles/__main__/benchmark.py", line 621, in main
bazel_bin_path = _build_bazel_binary(unit['bazel_commit'],
File "/private/var/tmp/_bazel_sherozn/4e4b6bfdaf070146b8f266fb0b3ab2cc/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/benchmark.runfiles/__main__/benchmark.py", line 175, in _build_bazel_binary
_exec_command(['bazel', 'build', '//src:bazel'], cwd=repo.working_dir)
File "/private/var/tmp/_bazel_sherozn/4e4b6bfdaf070146b8f266fb0b3ab2cc/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/benchmark.runfiles/__main__/benchmark.py", line 61, in _exec_command
return subprocess.run(
File "/private/var/tmp/_bazel_sherozn/4e4b6bfdaf070146b8f266fb0b3ab2cc/external/python3_10_aarch64-apple-darwin/lib/python3.10/subprocess.py", line 524, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['bazel', 'build', '//src:bazel']' returned non-zero exit status 1.
Command I'm trying to execute from the terminal:
bazel run :benchmark \
-- \
--project_source=https://github.com/bazelbuild/rules_cc.git \
--data_directory=/tmp/bazel-bench-data \
--verbose \
-- build //:all
I am using this:
global_options:
project_commit: 10eddc3d5394d2483b0568c6f88f6954fc380158
runs: 5
collect_profile: True
project_source: /usr/local/google/home/twerth/bazel
bazel_binary: /usr/bin/bazel-real
units:
- command: build --jobs=100 //src:bazel
- command: build --jobs=600 //src:bazel
prints:
RESULTS:
Bazel commit: /usr/bin/bazel-real, Project commit: 10eddc3d5394d2483b0568c6f88f6954fc380158, Project source: /usr/local/google/home/twerth/bazel
metric mean median stddev pval
wall: 111.753s 111.931s 0.622s
cpu: 124.410s 124.550s 3.667s
system: 52.578s 52.810s 0.885s
memory: 95.600MB 96.000MB 0.490MB
which is only the result of the second run.
Description of the problem / feature request:
For example: https://github.com/bazelbuild/bazel/blob/master/.bazelci/postsubmit.yml#L119
ubuntu1804_javabase9:
platform: ubuntu1804_nojava
name: ":java: OpenJDK 9 Javabase"
shell_commands:
- sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^#
android_ndk_repository/android_ndk_repository/' WORKSPACE
- rm -f WORKSPACE.bak
build_flags:
- "--javabase=@openjdk9_linux_archive//:runtime"
...
ubuntu1804_javabase10:
platform: ubuntu1804_nojava
name: ":java: OpenJDK 10 Javabase"
shell_commands:
- sed -i.bak -e 's/^# android_sdk_repository/android_sdk_repository/' -e 's/^#
android_ndk_repository/android_ndk_repository/' WORKSPACE
- rm -f WORKSPACE.bak
build_flags:
- "--javabase=@openjdk10_linux_archive//:runtime"
The same ubuntu1804_nojava
platform can have many tasks based on it, each with a different set of shell_commands
and build_flags
.
It's useful to perform benchmarking on each of these different environments.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.