Skip to content

Commit

Permalink
[benchmark] Add an opinionated macro for gRPC benchmark targets (grpc…
Browse files Browse the repository at this point in the history
…#37012)

As we've learned what configuration is needed for our benchmarks the settings have been growing more and more bespoke for each binary. Try to consolidate that into some useful defaults.

Also ensure we always `linkstatic=1`. `cc_binary` defaults to this, so it's reasonable to assume that's the performance our customers see. It also deeply impacts performance for small microbenchmarks, and so enabling it gives us more apples:apples, and saves chasing things that don't matter.

Closes grpc#37012

COPYBARA_INTEGRATE_REVIEW=grpc#37012 from ctiller:benchmark-bin b84cab5
PiperOrigin-RevId: 645483183
  • Loading branch information
ctiller authored and copybara-github committed Jun 21, 2024
1 parent 34a0318 commit 83ee2cd
Show file tree
Hide file tree
Showing 13 changed files with 175 additions and 269 deletions.
135 changes: 70 additions & 65 deletions CMakeLists.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions build_autogenerated.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 2 additions & 10 deletions test/core/call/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//test/core/call/yodel:grpc_yodel_test.bzl", "grpc_yodel_simple_test")
load("//test/cpp/microbenchmarks:grpc_benchmark_config.bzl", "grpc_benchmark_args")
load("//test/cpp/microbenchmarks:grpc_benchmark_config.bzl", "grpc_cc_benchmark")

grpc_package(name = "test/core/call")

Expand Down Expand Up @@ -79,17 +79,9 @@ grpc_cc_library(
],
)

grpc_cc_test(
grpc_cc_benchmark(
name = "bm_client_call",
size = "small",
srcs = ["bm_client_call.cc"],
args = grpc_benchmark_args(),
external_deps = ["benchmark"],
tags = [
"no_mac",
"no_windows",
],
uses_polling = False,
deps = [
"//:grpc",
"//src/core:default_event_engine",
Expand Down
12 changes: 2 additions & 10 deletions test/core/client_channel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

load("//bazel:grpc_build_system.bzl", "grpc_cc_test", "grpc_package")
load("//test/core/call/yodel:grpc_yodel_test.bzl", "grpc_yodel_simple_test")
load("//test/cpp/microbenchmarks:grpc_benchmark_config.bzl", "grpc_benchmark_args")
load("//test/cpp/microbenchmarks:grpc_benchmark_config.bzl", "grpc_cc_benchmark")

grpc_package(name = "test/core/client_channel")

Expand Down Expand Up @@ -118,17 +118,9 @@ grpc_cc_test(
],
)

grpc_cc_test(
grpc_cc_benchmark(
name = "bm_client_channel",
size = "small",
srcs = ["bm_client_channel.cc"],
args = grpc_benchmark_args(),
external_deps = ["benchmark"],
tags = [
"no_mac",
"no_windows",
],
uses_polling = False,
deps = [
"//:grpc",
"//src/core:default_event_engine",
Expand Down
10 changes: 2 additions & 8 deletions test/core/event_engine/posix/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//test/cpp/microbenchmarks:grpc_benchmark_config.bzl", "grpc_cc_benchmark")

licenses(["notice"])

Expand Down Expand Up @@ -109,20 +110,13 @@ grpc_cc_test(
],
)

grpc_cc_test(
grpc_cc_benchmark(
name = "lock_free_event_test",
srcs = ["lock_free_event_test.cc"],
external_deps = [
"benchmark",
"gtest",
],
language = "C++",
tags = [
"no_mac",
"no_windows",
],
uses_event_engine = True,
uses_polling = False,
deps = [
"//src/core:posix_event_engine",
"//src/core:posix_event_engine_closure",
Expand Down
9 changes: 2 additions & 7 deletions test/core/experiments/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//test/cpp/microbenchmarks:grpc_benchmark_config.bzl", "grpc_cc_benchmark")

grpc_package(name = "test/core/experiments")

Expand All @@ -31,16 +32,10 @@ grpc_cc_library(
],
)

grpc_cc_test(
grpc_cc_benchmark(
name = "bm_experiments",
srcs = ["bm_experiments.cc"],
external_deps = [
"benchmark",
"absl/container:btree",
],
deps = [
"//:grpc++",
"//src/core:channel_args",
"//src/core:experiments",
"//test/core/test_util:grpc_test_util",
],
Expand Down
8 changes: 2 additions & 6 deletions test/core/filters/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

load("//bazel:grpc_build_system.bzl", "grpc_cc_library", "grpc_cc_test", "grpc_package")
load("//test/cpp/microbenchmarks:grpc_benchmark_config.bzl", "grpc_benchmark_args")
load("//test/cpp/microbenchmarks:grpc_benchmark_config.bzl", "grpc_cc_benchmark")

licenses(["notice"])

Expand Down Expand Up @@ -120,13 +120,9 @@ grpc_cc_test(
],
)

grpc_cc_test(
grpc_cc_benchmark(
name = "bm_http_client_filter",
size = "small",
srcs = ["bm_http_client_filter.cc"],
args = grpc_benchmark_args(),
external_deps = ["benchmark"],
uses_polling = False,
deps = [
"//:grpc",
"//src/core:default_event_engine",
Expand Down
10 changes: 2 additions & 8 deletions test/core/load_balancing/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ load(
"grpc_cc_test",
"grpc_package",
)
load("//test/cpp/microbenchmarks:grpc_benchmark_config.bzl", "grpc_cc_benchmark")

grpc_package(name = "test/core/load_balancing")

Expand Down Expand Up @@ -194,21 +195,14 @@ grpc_cc_test(
],
)

grpc_cc_test(
grpc_cc_benchmark(
name = "static_stride_scheduler_benchmark",
srcs = ["static_stride_scheduler_benchmark.cc"],
external_deps = [
"absl/algorithm:container",
"absl/log:check",
"benchmark",
],
language = "C++",
tags = [
"no_mac",
"no_windows",
],
uses_event_engine = False,
uses_polling = False,
deps = [
"//src/core:no_destruct",
"//src/core:static_stride_scheduler",
Expand Down
Loading

0 comments on commit 83ee2cd

Please sign in to comment.