Skip to content
Snippets Groups Projects
Commit f54ae704 authored by David G. Quintas's avatar David G. Quintas
Browse files

Merge pull request #4762 from vjpai/server_port

Re-enable explicit specification of server port for qps worker
parents 7ff9f3fe 2c42bb1d
No related branches found
No related tags found
No related merge requests found
...@@ -165,6 +165,13 @@ static void QpsDriver() { ...@@ -165,6 +165,13 @@ static void QpsDriver() {
server_config.mutable_security_params()->CopyFrom(security); server_config.mutable_security_params()->CopyFrom(security);
} }
// Make sure that if we are performing a generic (bytebuf) test
// that we are also using async streaming
GPR_ASSERT(!client_config.payload_config().has_bytebuf_params() ||
(client_config.client_type() == ASYNC_CLIENT &&
client_config.rpc_type() == STREAMING &&
server_config.server_type() == ASYNC_SERVER));
const auto result = RunScenario( const auto result = RunScenario(
client_config, FLAGS_num_clients, server_config, FLAGS_num_servers, client_config, FLAGS_num_clients, server_config, FLAGS_num_servers,
FLAGS_warmup_seconds, FLAGS_benchmark_seconds, FLAGS_local_workers); FLAGS_warmup_seconds, FLAGS_benchmark_seconds, FLAGS_local_workers);
......
...@@ -51,11 +51,11 @@ ...@@ -51,11 +51,11 @@
#include <grpc/support/host_port.h> #include <grpc/support/host_port.h>
#include <grpc/support/log.h> #include <grpc/support/log.h>
#include "src/proto/grpc/testing/services.pb.h"
#include "test/core/util/grpc_profiler.h" #include "test/core/util/grpc_profiler.h"
#include "test/cpp/qps/client.h" #include "test/cpp/qps/client.h"
#include "test/cpp/qps/server.h" #include "test/cpp/qps/server.h"
#include "test/cpp/util/create_test_channel.h" #include "test/cpp/util/create_test_channel.h"
#include "src/proto/grpc/testing/services.pb.h"
namespace grpc { namespace grpc {
namespace testing { namespace testing {
...@@ -97,7 +97,8 @@ static std::unique_ptr<Server> CreateServer(const ServerConfig& config) { ...@@ -97,7 +97,8 @@ static std::unique_ptr<Server> CreateServer(const ServerConfig& config) {
class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service { class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service {
public: public:
explicit WorkerServiceImpl() : acquired_(false) {} explicit WorkerServiceImpl(int server_port)
: acquired_(false), server_port_(server_port) {}
Status RunClient(ServerContext* ctx, Status RunClient(ServerContext* ctx,
ServerReaderWriter<ClientStatus, ClientArgs>* stream) ServerReaderWriter<ClientStatus, ClientArgs>* stream)
...@@ -196,6 +197,9 @@ class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service { ...@@ -196,6 +197,9 @@ class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service {
if (!args.has_setup()) { if (!args.has_setup()) {
return Status(StatusCode::INVALID_ARGUMENT, ""); return Status(StatusCode::INVALID_ARGUMENT, "");
} }
if (server_port_ != 0) {
args.mutable_setup()->set_port(server_port_);
}
auto server = CreateServer(args.setup()); auto server = CreateServer(args.setup());
if (!server) { if (!server) {
return Status(StatusCode::INVALID_ARGUMENT, ""); return Status(StatusCode::INVALID_ARGUMENT, "");
...@@ -219,10 +223,11 @@ class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service { ...@@ -219,10 +223,11 @@ class WorkerServiceImpl GRPC_FINAL : public WorkerService::Service {
std::mutex mu_; std::mutex mu_;
bool acquired_; bool acquired_;
int server_port_;
}; };
QpsWorker::QpsWorker(int driver_port) { QpsWorker::QpsWorker(int driver_port, int server_port) {
impl_.reset(new WorkerServiceImpl()); impl_.reset(new WorkerServiceImpl(server_port));
char* server_address = NULL; char* server_address = NULL;
gpr_join_host_port(&server_address, "::", driver_port); gpr_join_host_port(&server_address, "::", driver_port);
......
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -46,7 +46,7 @@ class WorkerServiceImpl; ...@@ -46,7 +46,7 @@ class WorkerServiceImpl;
class QpsWorker { class QpsWorker {
public: public:
explicit QpsWorker(int driver_port); explicit QpsWorker(int driver_port, int server_port = 0);
~QpsWorker(); ~QpsWorker();
private: private:
......
/* /*
* *
* Copyright 2015, Google Inc. * Copyright 2015-2016, Google Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "test/cpp/util/test_config.h" #include "test/cpp/util/test_config.h"
DEFINE_int32(driver_port, 0, "Port for communication with driver"); DEFINE_int32(driver_port, 0, "Port for communication with driver");
DEFINE_int32(server_port, 0, "Port for operation as a server");
static bool got_sigint = false; static bool got_sigint = false;
...@@ -53,7 +54,7 @@ namespace grpc { ...@@ -53,7 +54,7 @@ namespace grpc {
namespace testing { namespace testing {
static void RunServer() { static void RunServer() {
QpsWorker worker(FLAGS_driver_port); QpsWorker worker(FLAGS_driver_port, FLAGS_server_port);
while (!got_sigint) { while (!got_sigint) {
gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment