Skip to content

Commit

Permalink
[test] Allow set request/response size in interop soak test
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanli-ml committed Aug 8, 2023
1 parent bfe4dbf commit ca1677f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 2 additions & 0 deletions test/cpp/interop/interop_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ const std::vector<int> response_stream_sizes = {31415, 9, 2653, 58979};
const int kNumResponseMessages = 2000;
const int kResponseMessageSize = 1030;
const int kReceiveDelayMilliSeconds = 20;
const int kLargeRequestSize = 271828;
const int kLargeResponseSize = 314159;

void NoopChecks(const InteropClientContextInspector& /*inspector*/,
const SimpleRequest* /*request*/,
Expand Down
11 changes: 4 additions & 7 deletions test/cpp/interop/interop_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ class InteropClient {
int64_t max_acceptable_per_iteration_latency_ms,
int32_t soak_min_time_ms_between_rpcs,
int32_t overall_timeout_seconds,
int32_t request_size = kLargeRequestSize,
int32_t response_size = kLargeResponseSize);
int32_t request_size,
int32_t response_size);
bool DoRpcSoakTest(const std::string& server_uri, int32_t soak_iterations,
int32_t max_failures,
int64_t max_acceptable_per_iteration_latency_ms,
int32_t soak_min_time_ms_between_rpcs,
int32_t overall_timeout_seconds,
int32_t request_size = kLargeRequestSize,
int32_t response_size = kLargeResponseSize);
int32_t request_size,
int32_t response_size);
bool DoLongLivedChannelTest(int32_t soak_iterations,
int32_t iteration_interval);

Expand Down Expand Up @@ -168,9 +168,6 @@ class InteropClient {
bool do_not_abort_on_transient_failures_;
// Load Orca metrics captured by the custom LB policy.
LoadReportTracker load_report_tracker_;

static constexpr int kLargeRequestSize = 271828;
static constexpr int kLargeResponseSize = 314159;
};

} // namespace testing
Expand Down
11 changes: 9 additions & 2 deletions test/cpp/interop/xds_federation_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ ABSL_FLAG(
ABSL_FLAG(int32_t, soak_min_time_ms_between_rpcs, 0,
"The minimum time in milliseconds between consecutive RPCs in a soak "
"test (rpc_soak or channel_soak), useful for limiting QPS");
ABSL_FLAG(int32_t, soak_request_size, 271828, "The request size in a soak RPC");
ABSL_FLAG(int32_t, soak_response_size, 314159,
"The response size in a soak RPC");
ABSL_FLAG(std::string, test_case, "rpc_soak",
"Configure different test cases. Valid options are: "
"rpc_soak: sends --soak_iterations large_unary RPCs; "
Expand Down Expand Up @@ -99,14 +102,18 @@ int main(int argc, char** argv) {
absl::GetFlag(FLAGS_soak_max_failures),
absl::GetFlag(FLAGS_soak_per_iteration_max_acceptable_latency_ms),
absl::GetFlag(FLAGS_soak_min_time_ms_between_rpcs),
absl::GetFlag(FLAGS_soak_overall_timeout_seconds));
absl::GetFlag(FLAGS_soak_overall_timeout_seconds),
absl::GetFlag(FLAGS_soak_request_size),
absl::GetFlag(FLAGS_soak_response_size));
} else if (test_case == "channel_soak") {
client.DoChannelSoakTest(
uris[i], absl::GetFlag(FLAGS_soak_iterations),
absl::GetFlag(FLAGS_soak_max_failures),
absl::GetFlag(FLAGS_soak_per_iteration_max_acceptable_latency_ms),
absl::GetFlag(FLAGS_soak_min_time_ms_between_rpcs),
absl::GetFlag(FLAGS_soak_overall_timeout_seconds));
absl::GetFlag(FLAGS_soak_overall_timeout_seconds),
absl::GetFlag(FLAGS_soak_request_size),
absl::GetFlag(FLAGS_soak_response_size));
} else {
gpr_log(GPR_ERROR,
"Invalid test case, must be either rpc_soak or channel_soak");
Expand Down

0 comments on commit ca1677f

Please sign in to comment.