From 793a9937262f2b34f2c14f4531891dc0d9103e51 Mon Sep 17 00:00:00 2001 From: irabbani Date: Mon, 24 Nov 2025 23:36:05 +0000 Subject: [PATCH] [core] Removing unused boilerplate grpc benchmarks Signed-off-by: irabbani --- src/ray/rpc/tests/grpc_bench/BUILD.bazel | 33 ------- src/ray/rpc/tests/grpc_bench/Dockerfile | 6 -- src/ray/rpc/tests/grpc_bench/README | 27 ------ src/ray/rpc/tests/grpc_bench/grpc_bench.cc | 91 ------------------- src/ray/rpc/tests/grpc_bench/helloworld.proto | 85 ----------------- 5 files changed, 242 deletions(-) delete mode 100644 src/ray/rpc/tests/grpc_bench/BUILD.bazel delete mode 100644 src/ray/rpc/tests/grpc_bench/Dockerfile delete mode 100644 src/ray/rpc/tests/grpc_bench/README delete mode 100644 src/ray/rpc/tests/grpc_bench/grpc_bench.cc delete mode 100644 src/ray/rpc/tests/grpc_bench/helloworld.proto diff --git a/src/ray/rpc/tests/grpc_bench/BUILD.bazel b/src/ray/rpc/tests/grpc_bench/BUILD.bazel deleted file mode 100644 index 4594e3873c5f..000000000000 --- a/src/ray/rpc/tests/grpc_bench/BUILD.bazel +++ /dev/null @@ -1,33 +0,0 @@ -load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library") -load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_proto_library") -load("@rules_proto//proto:defs.bzl", "proto_library") -load("//bazel:ray.bzl", "COPTS") - -proto_library( - name = "helloworld_proto_lib", - srcs = ["helloworld.proto"], -) - -cc_proto_library( - name = "helloworld_proto_lib_cc", - deps = [":helloworld_proto_lib"], -) - -cc_grpc_library( - name = "helloworld_cc_lib", - srcs = [":helloworld_proto_lib"], - grpc_only = True, - deps = [":helloworld_proto_lib_cc"], -) - -cc_binary( - name = "grpc_bench", - srcs = ["grpc_bench.cc"], - copts = COPTS, - deps = [ - ":helloworld_cc_lib", - "//src/ray/common:asio", - "//src/ray/rpc:grpc_server", - "//src/ray/rpc/authentication:authentication_token", - ], -) diff --git a/src/ray/rpc/tests/grpc_bench/Dockerfile b/src/ray/rpc/tests/grpc_bench/Dockerfile deleted file mode 100644 index 5e6d45f70812..000000000000 --- a/src/ray/rpc/tests/grpc_bench/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM ubuntu:22.04 -RUN apt-get update -y && apt-get install -y libjemalloc-dev - -COPY grpc_bench / - -ENTRYPOINT LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2 /grpc_bench diff --git a/src/ray/rpc/tests/grpc_bench/README b/src/ray/rpc/tests/grpc_bench/README deleted file mode 100644 index c81ae1558f05..000000000000 --- a/src/ray/rpc/tests/grpc_bench/README +++ /dev/null @@ -1,27 +0,0 @@ -This package is used to benchmark gRPC's performance and overhead. - -To run the test, the instruction need to be followed in this: - https://github.com/Tradias/grpc_bench - -To run the test, a docker image need to be built and follow the instruction in grpc_bench to add new tests. - ------------------------------------------------------------------------------------------------------------------------------------------ -| name | req/s | avg. latency | 90 % in | 95 % in | 99 % in | avg. cpu | avg. memory | ------------------------------------------------------------------------------------------------------------------------------------------ -| cpp_asio_grpc_callback | 48457 | 29.15 ms | 85.87 ms | 102.29 ms | 191.88 ms | 103.25% | 33.65 MiB | -| cpp_asio_grpc_coroutine | 48444 | 29.36 ms | 85.30 ms | 101.51 ms | 189.95 ms | 108.58% | 32.94 MiB | -| cpp_asio_grpc_unifex | 48313 | 29.22 ms | 84.43 ms | 98.52 ms | 185.01 ms | 100.04% | 32.45 MiB | -| cpp_asio_grpc_io_context_coro | 47965 | 30.20 ms | 85.61 ms | 101.98 ms | 193.66 ms | 86.79% | 31.84 MiB | -| cpp_ray_grpc | 45345 | 36.19 ms | 86.13 ms | 96.02 ms | 117.74 ms | 165.24% | 82.62 MiB | ------------------------------------------------------------------------------------------------------------------------------------------ -Benchmark Execution Parameters: -2a9be17 Tue, 18 Oct 2022 21:36:12 +0200 Dennis Hezel cpp: Update to grpc 1.50.0 -- GRPC_BENCHMARK_DURATION=20s -- GRPC_BENCHMARK_WARMUP=5s -- GRPC_SERVER_CPUS=4 -- GRPC_SERVER_RAM=512m -- GRPC_CLIENT_CONNECTIONS=50 -- GRPC_CLIENT_CONCURRENCY=2000 -- GRPC_CLIENT_QPS=0 -- GRPC_CLIENT_CPUS=4 -- GRPC_REQUEST_SCENARIO=complex_proto diff --git a/src/ray/rpc/tests/grpc_bench/grpc_bench.cc b/src/ray/rpc/tests/grpc_bench/grpc_bench.cc deleted file mode 100644 index 81dd9477f948..000000000000 --- a/src/ray/rpc/tests/grpc_bench/grpc_bench.cc +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2022 The Ray Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include -#include -#include -#include - -#include "ray/common/asio/instrumented_io_context.h" -#include "ray/rpc/authentication/authentication_token.h" -#include "ray/rpc/grpc_server.h" -#include "src/ray/rpc/test/grpc_bench/helloworld.grpc.pb.h" -#include "src/ray/rpc/test/grpc_bench/helloworld.pb.h" - -using namespace ray; // NOLINT -using namespace ray::rpc; // NOLINT -using namespace helloworld; // NOLINT - -class ServerCallFactory; - -class GreeterHandler { - public: - virtual void HandleSayHello(SayHelloRequest request, - SayHelloReply *reply, - SendReplyCallback send_reply_callback) = 0; - virtual ~GreeterHandler() {} -}; - -class GreeterServiceHandler : public GreeterHandler { - public: - void HandleSayHello(SayHelloRequest request, - SayHelloReply *reply, - SendReplyCallback send_reply_callback) override { - *reply->mutable_response() = std::move(*request.mutable_request()); - send_reply_callback(Status::OK(), nullptr, nullptr); - } -}; - -class GreeterGrpcService : public GrpcService { - public: - GreeterGrpcService(instrumented_io_context &main_service, - GreeterServiceHandler &service_handler) - : GrpcService(main_service), service_handler_(service_handler) {} - - protected: - grpc::Service &GetGrpcService() override { return service_; } - - void InitServerCallFactories( - const std::unique_ptr &cq, - std::vector> *server_call_factories, - const ClusterID &cluster_id, - const std::optional &auth_token) override { - RPC_SERVICE_HANDLER_CUSTOM_AUTH_SERVER_METRICS_DISABLED( - Greeter, SayHello, -1, ClusterIdAuthType::NO_AUTH); - } - - /// The grpc async service object. - Greeter::AsyncService service_; - - /// The service handler that actually handles the requests. - GreeterServiceHandler &service_handler_; -}; - -int main() { - const auto env = std::getenv("GRPC_SERVER_CPUS"); - const auto parallelism = env ? std::atoi(env) : std::thread::hardware_concurrency(); - - GrpcServer server("grpc_bench", 50051, false, ClusterID::Nil(), parallelism); - instrumented_io_context main_service; - std::thread t([&main_service] { - boost::asio::executor_work_guard work( - main_service.get_executor()); - main_service.run(); - }); - GreeterServiceHandler handler; - server.RegisterService(std::make_unique(main_service, handler)); - server.Run(); - t.join(); - return 0; -} diff --git a/src/ray/rpc/tests/grpc_bench/helloworld.proto b/src/ray/rpc/tests/grpc_bench/helloworld.proto deleted file mode 100644 index e9928c37acc9..000000000000 --- a/src/ray/rpc/tests/grpc_bench/helloworld.proto +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright The Ray Authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// Copyright 2015 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// This proto file is copied from -// https://github.com/Tradias/grpc_bench/blob/master/scenarios/complex_proto/helloworld.proto -// but some fileds got updated to make it work with ray gRPC framework. - -syntax = "proto3"; - -option go_package = "proto/helloworld"; -option java_multiple_files = true; -option java_package = "io.grpc.examples.helloworld"; -option java_outer_classname = "HelloWorldProto"; -option objc_class_prefix = "HLW"; - -package helloworld; - -// The greeting service definition. -service Greeter { - // Sends a greeting - rpc SayHello(SayHelloRequest) returns (SayHelloReply) {} -} - -// The actual message exchanged by the client and the server. -// NOTE: When creating a custom scenario plese edit only this message. -message Hello { - string name = 1; - double d = 2; - float f = 3; - bool b = 4; - int32 n = 5; - int64 l = 6; - oneof choice { - string c1 = 7; - bool c2 = 8; - } - message Pet { - enum Color { - BLACK = 0; - WHITE = 1; - BLUE = 2; - RED = 3; - YELLOW = 4; - GREEN = 5; - } - string name = 1; - Color color = 2; - } - repeated Pet pets = 9; -} - -// The request message from the client. -message SayHelloRequest { - Hello request = 1; -} - -// The response message from the server. -message SayHelloReply { - Hello response = 1; -}