Address some review comments about signal and restoring qps_test_with_poll

Make payloads respect the new defaults
pull/3905/head
vjpai 9 years ago
parent 1f6f02a6f4
commit fba20c987d
  1. 6
      test/cpp/qps/async_streaming_ping_pong_test.cc
  2. 6
      test/cpp/qps/async_unary_ping_pong_test.cc
  3. 26
      test/cpp/qps/client.h
  4. 2
      test/cpp/qps/qps_driver.cc
  5. 6
      test/cpp/qps/qps_openloop_test.cc
  6. 6
      test/cpp/qps/qps_test.cc
  7. 85
      test/cpp/qps/qps_test_with_poll.cc
  8. 4
      test/cpp/qps/qps_worker.cc
  9. 6
      test/cpp/qps/secure_sync_unary_ping_pong_test.cc
  10. 4
      test/cpp/qps/server.h
  11. 2
      test/cpp/qps/server_async.cc
  12. 2
      test/cpp/qps/server_sync.cc
  13. 6
      test/cpp/qps/sync_streaming_ping_pong_test.cc
  14. 6
      test/cpp/qps/sync_unary_ping_pong_test.cc

@ -35,8 +35,6 @@
#include <grpc/support/log.h>
#include <signal.h>
#include "test/cpp/qps/driver.h"
#include "test/cpp/qps/report.h"
#include "test/cpp/util/benchmark_config.h"
@ -54,9 +52,6 @@ static void RunAsyncStreamingPingPong() {
client_config.set_client_type(ASYNC_CLIENT);
client_config.set_outstanding_rpcs_per_channel(1);
client_config.set_client_channels(1);
client_config.mutable_payload_config()
->mutable_simple_params()
->set_resp_size(1);
client_config.set_async_client_threads(1);
client_config.set_rpc_type(STREAMING);
client_config.mutable_load_params()->mutable_closed_loop();
@ -78,7 +73,6 @@ static void RunAsyncStreamingPingPong() {
int main(int argc, char** argv) {
grpc::testing::InitBenchmark(&argc, &argv, true);
signal(SIGPIPE, SIG_IGN);
grpc::testing::RunAsyncStreamingPingPong();
return 0;
}

@ -35,8 +35,6 @@
#include <grpc/support/log.h>
#include <signal.h>
#include "test/cpp/qps/driver.h"
#include "test/cpp/qps/report.h"
#include "test/cpp/util/benchmark_config.h"
@ -54,9 +52,6 @@ static void RunAsyncUnaryPingPong() {
client_config.set_client_type(ASYNC_CLIENT);
client_config.set_outstanding_rpcs_per_channel(1);
client_config.set_client_channels(1);
client_config.mutable_payload_config()
->mutable_simple_params()
->set_resp_size(1);
client_config.set_async_client_threads(1);
client_config.set_rpc_type(UNARY);
client_config.mutable_load_params()->mutable_closed_loop();
@ -76,7 +71,6 @@ static void RunAsyncUnaryPingPong() {
int main(int argc, char** argv) {
grpc::testing::InitBenchmark(&argc, &argv, true);
signal(SIGPIPE, SIG_IGN);
grpc::testing::RunAsyncUnaryPingPong();
return 0;

@ -90,7 +90,11 @@ class Client {
} else if (config.payload_config().has_complex_params()) {
GPR_ASSERT(false); // not yet implemented
} else {
GPR_ASSERT(false); // badly configured
// default should be simple proto without payloads
request_.set_response_type(grpc::testing::PayloadType::COMPRESSABLE);
request_.set_response_size(0);
request_.mutable_payload()->set_type(
grpc::testing::PayloadType::COMPRESSABLE);
}
}
virtual ~Client() {}
@ -176,23 +180,29 @@ class Client {
const auto& load = config.load_params();
std::unique_ptr<RandomDist> random_dist;
if (load.has_poisson()) {
switch (load.load_case()) {
case LoadParams::kClosedLoop:
// Closed-loop doesn't use random dist at all
break;
case LoadParams::kPoisson:
random_dist.reset(
new ExpDist(load.poisson().offered_load() / num_threads));
} else if (load.has_uniform()) {
break;
case LoadParams::kUniform:
random_dist.reset(
new UniformDist(load.uniform().interarrival_lo() * num_threads,
load.uniform().interarrival_hi() * num_threads));
} else if (load.has_determ()) {
break;
case LoadParams::kDeterm:
random_dist.reset(
new DetDist(num_threads / load.determ().offered_load()));
} else if (load.has_pareto()) {
break;
case LoadParams::kPareto:
random_dist.reset(
new ParetoDist(load.pareto().interarrival_base() * num_threads,
load.pareto().alpha()));
} else if (load.has_closed_loop()) {
// Closed-loop doesn't use random dist at all
} else { // invalid load type
break;
default:
GPR_ASSERT(false);
}

@ -33,7 +33,6 @@
#include <memory>
#include <set>
#include <signal.h>
#include <gflags/gflags.h>
#include <grpc/support/log.h>
@ -167,7 +166,6 @@ static void QpsDriver() {
int main(int argc, char** argv) {
grpc::testing::InitBenchmark(&argc, &argv, true);
signal(SIGPIPE, SIG_IGN);
grpc::testing::QpsDriver();
return 0;

@ -31,8 +31,6 @@
*
*/
#include <signal.h>
#include <set>
#include <grpc/support/log.h>
@ -54,9 +52,6 @@ static void RunQPS() {
client_config.set_client_type(ASYNC_CLIENT);
client_config.set_outstanding_rpcs_per_channel(1000);
client_config.set_client_channels(8);
client_config.mutable_payload_config()
->mutable_simple_params()
->set_resp_size(1);
client_config.set_async_client_threads(8);
client_config.set_rpc_type(UNARY);
client_config.mutable_load_params()->mutable_poisson()->set_offered_load(
@ -79,7 +74,6 @@ static void RunQPS() {
int main(int argc, char** argv) {
grpc::testing::InitBenchmark(&argc, &argv, true);
signal(SIGPIPE, SIG_IGN);
grpc::testing::RunQPS();
return 0;

@ -31,8 +31,6 @@
*
*/
#include <signal.h>
#include <set>
#include <grpc/support/log.h>
@ -54,9 +52,6 @@ static void RunQPS() {
client_config.set_client_type(ASYNC_CLIENT);
client_config.set_outstanding_rpcs_per_channel(1000);
client_config.set_client_channels(8);
client_config.mutable_payload_config()
->mutable_simple_params()
->set_resp_size(1);
client_config.set_async_client_threads(8);
client_config.set_rpc_type(UNARY);
client_config.mutable_load_params()->mutable_closed_loop();
@ -78,7 +73,6 @@ static void RunQPS() {
int main(int argc, char** argv) {
grpc::testing::InitBenchmark(&argc, &argv, true);
signal(SIGPIPE, SIG_IGN);
grpc::testing::RunQPS();
return 0;

@ -0,0 +1,85 @@
/*
*
* Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <set>
#include <grpc/support/log.h>
#include "test/cpp/qps/driver.h"
#include "test/cpp/qps/report.h"
#include "test/cpp/util/benchmark_config.h"
extern "C" {
#include "src/core/iomgr/pollset_posix.h"
}
namespace grpc {
namespace testing {
static const int WARMUP = 5;
static const int BENCHMARK = 5;
static void RunQPS() {
gpr_log(GPR_INFO, "Running QPS test");
ClientConfig client_config;
client_config.set_client_type(ASYNC_CLIENT);
client_config.set_outstanding_rpcs_per_channel(1000);
client_config.set_client_channels(8);
client_config.set_async_client_threads(8);
client_config.set_rpc_type(UNARY);
client_config.mutable_load_params()->mutable_closed_loop();
ServerConfig server_config;
server_config.set_server_type(ASYNC_SERVER);
server_config.set_async_server_threads(4);
const auto result =
RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK, -2);
GetReporter()->ReportQPSPerCore(*result);
GetReporter()->ReportLatency(*result);
}
} // namespace testing
} // namespace grpc
int main(int argc, char** argv) {
grpc::testing::InitBenchmark(&argc, &argv, true);
grpc_platform_become_multipoller = grpc_poll_become_multipoller;
grpc::testing::RunQPS();
return 0;
}

@ -199,8 +199,8 @@ class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service {
return Status(StatusCode::INVALID_ARGUMENT, "");
}
ServerStatus status;
status.set_port(server->Port());
status.set_cores(server->Cores());
status.set_port(server->port());
status.set_cores(server->cores());
if (!stream->Write(status)) {
return Status(StatusCode::UNKNOWN, "");
}

@ -31,8 +31,6 @@
*
*/
#include <signal.h>
#include <set>
#include <grpc/support/log.h>
@ -54,9 +52,6 @@ static void RunSynchronousUnaryPingPong() {
client_config.set_client_type(SYNC_CLIENT);
client_config.set_outstanding_rpcs_per_channel(1);
client_config.set_client_channels(1);
client_config.mutable_payload_config()
->mutable_simple_params()
->set_resp_size(1);
client_config.set_rpc_type(UNARY);
client_config.mutable_load_params()->mutable_closed_loop();
@ -83,7 +78,6 @@ static void RunSynchronousUnaryPingPong() {
int main(int argc, char** argv) {
grpc::testing::InitBenchmark(&argc, &argv, true);
signal(SIGPIPE, SIG_IGN);
grpc::testing::RunSynchronousUnaryPingPong();
return 0;

@ -86,8 +86,8 @@ class Server {
return true;
}
int Port() const { return port_; }
int Cores() const { return gpr_cpu_num_cores(); }
int port() const { return port_; }
int cores() const { return gpr_cpu_num_cores(); }
static std::shared_ptr<ServerCredentials> CreateServerCredentials(
const ServerConfig& config) {
if (config.has_security_params()) {

@ -60,7 +60,7 @@ class AsyncQpsServerTest : public Server {
explicit AsyncQpsServerTest(const ServerConfig &config) : Server(config) {
char *server_address = NULL;
gpr_join_host_port(&server_address, "::", Port());
gpr_join_host_port(&server_address, "::", port());
ServerBuilder builder;
builder.AddListeningPort(server_address,

@ -89,7 +89,7 @@ class SynchronousServer GRPC_FINAL : public grpc::testing::Server {
char* server_address = NULL;
gpr_join_host_port(&server_address, "::", Port());
gpr_join_host_port(&server_address, "::", port());
builder.AddListeningPort(server_address,
Server::CreateServerCredentials(config));
gpr_free(server_address);

@ -31,8 +31,6 @@
*
*/
#include <signal.h>
#include <set>
#include <grpc/support/log.h>
@ -54,9 +52,6 @@ static void RunSynchronousStreamingPingPong() {
client_config.set_client_type(SYNC_CLIENT);
client_config.set_outstanding_rpcs_per_channel(1);
client_config.set_client_channels(1);
client_config.mutable_payload_config()
->mutable_simple_params()
->set_resp_size(1);
client_config.set_rpc_type(STREAMING);
client_config.mutable_load_params()->mutable_closed_loop();
@ -75,7 +70,6 @@ static void RunSynchronousStreamingPingPong() {
int main(int argc, char** argv) {
grpc::testing::InitBenchmark(&argc, &argv, true);
signal(SIGPIPE, SIG_IGN);
grpc::testing::RunSynchronousStreamingPingPong();
return 0;

@ -31,8 +31,6 @@
*
*/
#include <signal.h>
#include <set>
#include <grpc/support/log.h>
@ -54,9 +52,6 @@ static void RunSynchronousUnaryPingPong() {
client_config.set_client_type(SYNC_CLIENT);
client_config.set_outstanding_rpcs_per_channel(1);
client_config.set_client_channels(1);
client_config.mutable_payload_config()
->mutable_simple_params()
->set_resp_size(1);
client_config.set_rpc_type(UNARY);
client_config.mutable_load_params()->mutable_closed_loop();
@ -76,7 +71,6 @@ static void RunSynchronousUnaryPingPong() {
int main(int argc, char** argv) {
grpc::testing::InitBenchmark(&argc, &argv, true);
signal(SIGPIPE, SIG_IGN);
grpc::testing::RunSynchronousUnaryPingPong();
return 0;

Loading…
Cancel
Save