diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/cpp/qps/client.h | 32 | ||||
-rw-r--r-- | test/cpp/qps/client_async.cc | 36 | ||||
-rw-r--r-- | test/cpp/qps/client_sync.cc | 13 | ||||
-rw-r--r-- | test/cpp/qps/histogram.h | 4 | ||||
-rw-r--r-- | test/cpp/qps/qps_driver.cc | 37 | ||||
-rw-r--r-- | test/cpp/qps/report.cc | 94 | ||||
-rw-r--r-- | test/cpp/qps/report.h | 57 | ||||
-rw-r--r-- | test/cpp/qps/server_async.cc | 20 | ||||
-rw-r--r-- | test/cpp/qps/smoke_test.cc | 149 | ||||
-rwxr-xr-x | test/cpp/qps/smoke_test.sh | 28 |
10 files changed, 389 insertions, 81 deletions
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index 08b338c747..2dc5b3860f 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -104,7 +104,7 @@ class Client { void EndThreads() { threads_.clear(); } - virtual void ThreadFunc(Histogram* histogram, size_t thread_idx) = 0; + virtual bool ThreadFunc(Histogram* histogram, size_t thread_idx) = 0; private: class Thread { @@ -113,20 +113,24 @@ class Client { : done_(false), new_(nullptr), impl_([this, idx, client]() { - for (;;) { - // run the loop body - client->ThreadFunc(&histogram_, idx); - // lock, see if we're done - std::lock_guard<std::mutex> g(mu_); - if (done_) {return;} - // check if we're marking, swap out the histogram if so - if (new_) { - new_->Swap(&histogram_); - new_ = nullptr; - cv_.notify_one(); + for (;;) { + // run the loop body + bool thread_still_ok = client->ThreadFunc(&histogram_, idx); + // lock, see if we're done + std::lock_guard<std::mutex> g(mu_); + if (!thread_still_ok) { + gpr_log(GPR_ERROR, "Finishing client thread due to RPC error"); + done_ = true; + } + if (done_) {return;} + // check if we're marking, swap out the histogram if so + if (new_) { + new_->Swap(&histogram_); + new_ = nullptr; + cv_.notify_one(); + } } - } - }) {} + }) {} ~Thread() { { diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index c01d840178..0a6d9beeca 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -137,13 +137,7 @@ class AsyncUnaryClient GRPC_FINAL : public Client { cli_cqs_.emplace_back(new CompletionQueue); } - auto payload_size = config.payload_size(); - auto check_done = [payload_size](grpc::Status s, SimpleResponse* response) { - GPR_ASSERT(s.IsOk() && (response->payload().type() == - grpc::testing::PayloadType::COMPRESSABLE) && - (response->payload().body().length() == - static_cast<size_t>(payload_size))); - }; + auto check_done = [](grpc::Status s, SimpleResponse* response) {}; int t = 0; for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) { @@ -179,10 +173,14 @@ class AsyncUnaryClient GRPC_FINAL : public Client { } } - void ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { + bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { void* got_tag; bool ok; - cli_cqs_[thread_idx]->Next(&got_tag, &ok); + switch (cli_cqs_[thread_idx]->AsyncNext(&got_tag, &ok, std::chrono::system_clock::now() + std::chrono::seconds(1))) { + case CompletionQueue::SHUTDOWN: return false; + case CompletionQueue::TIMEOUT: return true; + case CompletionQueue::GOT_EVENT: break; + } ClientRpcContext* ctx = ClientRpcContext::detag(got_tag); if (ctx->RunNextState(ok, histogram) == false) { @@ -191,6 +189,8 @@ class AsyncUnaryClient GRPC_FINAL : public Client { ctx->StartNewClone(); delete ctx; } + + return true; } std::vector<std::unique_ptr<CompletionQueue>> cli_cqs_; @@ -270,13 +270,7 @@ class AsyncStreamingClient GRPC_FINAL : public Client { cli_cqs_.emplace_back(new CompletionQueue); } - auto payload_size = config.payload_size(); - auto check_done = [payload_size](grpc::Status s, SimpleResponse *response) { - GPR_ASSERT(s.IsOk() && (response->payload().type() == - grpc::testing::PayloadType::COMPRESSABLE) && - (response->payload().body().length() == - static_cast<size_t>(payload_size))); - }; + auto check_done = [](grpc::Status s, SimpleResponse* response) {}; int t = 0; for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) { @@ -313,10 +307,14 @@ class AsyncStreamingClient GRPC_FINAL : public Client { } } - void ThreadFunc(Histogram *histogram, size_t thread_idx) GRPC_OVERRIDE { + bool ThreadFunc(Histogram *histogram, size_t thread_idx) GRPC_OVERRIDE { void *got_tag; bool ok; - cli_cqs_[thread_idx]->Next(&got_tag, &ok); + switch (cli_cqs_[thread_idx]->AsyncNext(&got_tag, &ok, std::chrono::system_clock::now() + std::chrono::seconds(1))) { + case CompletionQueue::SHUTDOWN: return false; + case CompletionQueue::TIMEOUT: return true; + case CompletionQueue::GOT_EVENT: break; + } ClientRpcContext *ctx = ClientRpcContext::detag(got_tag); if (ctx->RunNextState(ok, histogram) == false) { @@ -325,6 +323,8 @@ class AsyncStreamingClient GRPC_FINAL : public Client { ctx->StartNewClone(); delete ctx; } + + return true; } std::vector<std::unique_ptr<CompletionQueue>> cli_cqs_; diff --git a/test/cpp/qps/client_sync.cc b/test/cpp/qps/client_sync.cc index 947618121b..aea5a0fb27 100644 --- a/test/cpp/qps/client_sync.cc +++ b/test/cpp/qps/client_sync.cc @@ -83,13 +83,14 @@ class SynchronousUnaryClient GRPC_FINAL : public SynchronousClient { SynchronousClient(config) {StartThreads(num_threads_);} ~SynchronousUnaryClient() {} - void ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { + bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { auto* stub = channels_[thread_idx % channels_.size()].get_stub(); double start = Timer::Now(); grpc::ClientContext context; grpc::Status s = stub->UnaryCall(&context, request_, &responses_[thread_idx]); histogram->Add((Timer::Now() - start) * 1e9); + return s.IsOk(); } }; @@ -111,11 +112,13 @@ class SynchronousStreamingClient GRPC_FINAL : public SynchronousClient { } } - void ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { + bool ThreadFunc(Histogram* histogram, size_t thread_idx) GRPC_OVERRIDE { double start = Timer::Now(); - EXPECT_TRUE(stream_->Write(request_)); - EXPECT_TRUE(stream_->Read(&responses_[thread_idx])); - histogram->Add((Timer::Now() - start) * 1e9); + if (stream_->Write(request_) && stream_->Read(&responses_[thread_idx])) { + histogram->Add((Timer::Now() - start) * 1e9); + return true; + } + return false; } private: grpc::ClientContext context_; diff --git a/test/cpp/qps/histogram.h b/test/cpp/qps/histogram.h index eb17821cdc..0547b7283a 100644 --- a/test/cpp/qps/histogram.h +++ b/test/cpp/qps/histogram.h @@ -50,10 +50,10 @@ class Histogram { void Merge(Histogram* h) { gpr_histogram_merge(impl_, h->impl_); } void Add(double value) { gpr_histogram_add(impl_, value); } - double Percentile(double pctile) { + double Percentile(double pctile) const { return gpr_histogram_percentile(impl_, pctile); } - double Count() { return gpr_histogram_count(impl_); } + double Count() const { return gpr_histogram_count(impl_); } void Swap(Histogram* other) { std::swap(impl_, other->impl_); } void FillProto(HistogramData* p) { size_t n; diff --git a/test/cpp/qps/qps_driver.cc b/test/cpp/qps/qps_driver.cc index f42d538b16..220f826118 100644 --- a/test/cpp/qps/qps_driver.cc +++ b/test/cpp/qps/qps_driver.cc @@ -35,7 +35,7 @@ #include <grpc/support/log.h> #include "test/cpp/qps/driver.h" -#include "test/cpp/qps/stats.h" +#include "test/cpp/qps/report.h" DEFINE_int32(num_clients, 1, "Number of client binaries"); DEFINE_int32(num_servers, 1, "Number of server binaries"); @@ -65,7 +65,6 @@ using grpc::testing::ClientType; using grpc::testing::ServerType; using grpc::testing::RpcType; using grpc::testing::ResourceUsage; -using grpc::testing::sum; // In some distros, gflags is in the namespace google, and in some others, // in gflags. This hack is enabling us to find both. @@ -105,37 +104,9 @@ int main(int argc, char** argv) { server_config, FLAGS_num_servers, FLAGS_warmup_seconds, FLAGS_benchmark_seconds); - gpr_log(GPR_INFO, "QPS: %.1f", - result.latencies.Count() / - average(result.client_resources, - [](ResourceUsage u) { return u.wall_time; })); - - gpr_log(GPR_INFO, "Latencies (50/95/99/99.9%%-ile): %.1f/%.1f/%.1f/%.1f us", - result.latencies.Percentile(50) / 1000, - result.latencies.Percentile(95) / 1000, - result.latencies.Percentile(99) / 1000, - result.latencies.Percentile(99.9) / 1000); - - gpr_log(GPR_INFO, "Server system time: %.2f%%", - 100.0 * sum(result.server_resources, - [](ResourceUsage u) { return u.system_time; }) / - sum(result.server_resources, - [](ResourceUsage u) { return u.wall_time; })); - gpr_log(GPR_INFO, "Server user time: %.2f%%", - 100.0 * sum(result.server_resources, - [](ResourceUsage u) { return u.user_time; }) / - sum(result.server_resources, - [](ResourceUsage u) { return u.wall_time; })); - gpr_log(GPR_INFO, "Client system time: %.2f%%", - 100.0 * sum(result.client_resources, - [](ResourceUsage u) { return u.system_time; }) / - sum(result.client_resources, - [](ResourceUsage u) { return u.wall_time; })); - gpr_log(GPR_INFO, "Client user time: %.2f%%", - 100.0 * sum(result.client_resources, - [](ResourceUsage u) { return u.user_time; }) / - sum(result.client_resources, - [](ResourceUsage u) { return u.wall_time; })); + ReportQPSPerCore(result, server_config); + ReportLatency(result); + ReportTimes(result); grpc_shutdown(); return 0; diff --git a/test/cpp/qps/report.cc b/test/cpp/qps/report.cc new file mode 100644 index 0000000000..29d88da344 --- /dev/null +++ b/test/cpp/qps/report.cc @@ -0,0 +1,94 @@ +/* + * + * 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 "test/cpp/qps/report.h" + +#include <grpc/support/log.h> +#include "test/cpp/qps/stats.h" + +namespace grpc { +namespace testing { + +// QPS: XXX +void ReportQPS(const ScenarioResult& result) { + gpr_log(GPR_INFO, "QPS: %.1f", + result.latencies.Count() / + average(result.client_resources, + [](ResourceUsage u) { return u.wall_time; })); +} + +// QPS: XXX (YYY/server core) +void ReportQPSPerCore(const ScenarioResult& result, const ServerConfig& server_config) { + auto qps = + result.latencies.Count() / + average(result.client_resources, + [](ResourceUsage u) { return u.wall_time; }); + + gpr_log(GPR_INFO, "QPS: %.1f (%.1f/server core)", qps, qps/server_config.threads()); +} + +// Latency (50/90/95/99/99.9%-ile): AA/BB/CC/DD/EE us +void ReportLatency(const ScenarioResult& result) { + gpr_log(GPR_INFO, "Latencies (50/90/95/99/99.9%%-ile): %.1f/%.1f/%.1f/%.1f/%.1f us", + result.latencies.Percentile(50) / 1000, + result.latencies.Percentile(90) / 1000, + result.latencies.Percentile(95) / 1000, + result.latencies.Percentile(99) / 1000, + result.latencies.Percentile(99.9) / 1000); +} + +void ReportTimes(const ScenarioResult& result) { + gpr_log(GPR_INFO, "Server system time: %.2f%%", + 100.0 * sum(result.server_resources, + [](ResourceUsage u) { return u.system_time; }) / + sum(result.server_resources, + [](ResourceUsage u) { return u.wall_time; })); + gpr_log(GPR_INFO, "Server user time: %.2f%%", + 100.0 * sum(result.server_resources, + [](ResourceUsage u) { return u.user_time; }) / + sum(result.server_resources, + [](ResourceUsage u) { return u.wall_time; })); + gpr_log(GPR_INFO, "Client system time: %.2f%%", + 100.0 * sum(result.client_resources, + [](ResourceUsage u) { return u.system_time; }) / + sum(result.client_resources, + [](ResourceUsage u) { return u.wall_time; })); + gpr_log(GPR_INFO, "Client user time: %.2f%%", + 100.0 * sum(result.client_resources, + [](ResourceUsage u) { return u.user_time; }) / + sum(result.client_resources, + [](ResourceUsage u) { return u.wall_time; })); +} + +} // namespace testing +} // namespace grpc diff --git a/test/cpp/qps/report.h b/test/cpp/qps/report.h new file mode 100644 index 0000000000..343e426ca4 --- /dev/null +++ b/test/cpp/qps/report.h @@ -0,0 +1,57 @@ +/* + * + * 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. + * + */ + +#ifndef TEST_QPS_REPORT_H +#define TEST_QPS_REPORT_H + +#include "test/cpp/qps/driver.h" + +namespace grpc { +namespace testing { + +// QPS: XXX +void ReportQPS(const ScenarioResult& result); +// QPS: XXX (YYY/server core) +void ReportQPSPerCore(const ScenarioResult& result, const ServerConfig& config); +// Latency (50/90/95/99/99.9%-ile): AA/BB/CC/DD/EE us +void ReportLatency(const ScenarioResult& result); +// Server system time: XX% +// Server user time: XX% +// Client system time: XX% +// Client user time: XX% +void ReportTimes(const ScenarioResult& result); + +} // namespace testing +} // namespace grpc + +#endif diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 2e366a8d72..b19c443c82 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -97,15 +97,15 @@ class AsyncQpsServerTest : public Server { bool ok; void* got_tag; while (srv_cq_.Next(&got_tag, &ok)) { - ServerRpcContext* ctx = detag(got_tag); - // The tag is a pointer to an RPC context to invoke - if (ctx->RunNextState(ok) == false) { - // this RPC context is done, so refresh it + ServerRpcContext* ctx = detag(got_tag); + // The tag is a pointer to an RPC context to invoke + if (ctx->RunNextState(ok) == false) { + // this RPC context is done, so refresh it std::lock_guard<std::mutex> g(shutdown_mutex_); if (!shutdown_) { ctx->Reset(); } - } + } } return; })); @@ -175,8 +175,9 @@ class AsyncQpsServerTest : public Server { private: bool finisher(bool) { return false; } bool invoker(bool ok) { - if (!ok) - return false; + if (!ok) { + return false; + } ResponseType response; @@ -230,8 +231,9 @@ class AsyncQpsServerTest : public Server { private: bool request_done(bool ok) { - if (!ok) - return false; + if (!ok) { + return false; + } stream_.Read(&req_, AsyncQpsServerTest::tag(this)); next_state_ = &ServerRpcContextStreamingImpl::read_done; return true; diff --git a/test/cpp/qps/smoke_test.cc b/test/cpp/qps/smoke_test.cc new file mode 100644 index 0000000000..c9d321f133 --- /dev/null +++ b/test/cpp/qps/smoke_test.cc @@ -0,0 +1,149 @@ +/* + * + * 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 <grpc/support/log.h> + +#include "test/cpp/qps/driver.h" +#include "test/cpp/qps/report.h" + +namespace grpc { +namespace testing { + +static const int WARMUP = 5; +static const int BENCHMARK = 10; + +static void RunSynchronousUnaryPingPong() { + gpr_log(GPR_INFO, "Running Synchronous Unary Ping Pong"); + + ClientConfig client_config; + client_config.set_client_type(SYNCHRONOUS_CLIENT); + client_config.set_enable_ssl(false); + client_config.set_outstanding_rpcs_per_channel(1); + client_config.set_client_channels(1); + client_config.set_payload_size(1); + client_config.set_rpc_type(UNARY); + + ServerConfig server_config; + server_config.set_server_type(SYNCHRONOUS_SERVER); + server_config.set_enable_ssl(false); + server_config.set_threads(1); + + auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK); + + ReportQPS(result); + ReportLatency(result); +} + +static void RunSynchronousStreamingPingPong() { + gpr_log(GPR_INFO, "Running Synchronous Streaming Ping Pong"); + + ClientConfig client_config; + client_config.set_client_type(SYNCHRONOUS_CLIENT); + client_config.set_enable_ssl(false); + client_config.set_outstanding_rpcs_per_channel(1); + client_config.set_client_channels(1); + client_config.set_payload_size(1); + client_config.set_rpc_type(STREAMING); + + ServerConfig server_config; + server_config.set_server_type(SYNCHRONOUS_SERVER); + server_config.set_enable_ssl(false); + server_config.set_threads(1); + + auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK); + + ReportQPS(result); + ReportLatency(result); +} + +static void RunAsyncUnaryPingPong() { + gpr_log(GPR_INFO, "Running Async Unary Ping Pong"); + + ClientConfig client_config; + client_config.set_client_type(ASYNC_CLIENT); + client_config.set_enable_ssl(false); + client_config.set_outstanding_rpcs_per_channel(1); + client_config.set_client_channels(1); + client_config.set_payload_size(1); + client_config.set_async_client_threads(1); + client_config.set_rpc_type(UNARY); + + ServerConfig server_config; + server_config.set_server_type(ASYNC_SERVER); + server_config.set_enable_ssl(false); + server_config.set_threads(1); + + auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK); + + ReportQPS(result); + ReportLatency(result); +} + +static void RunQPS() { + gpr_log(GPR_INFO, "Running QPS test"); + + ClientConfig client_config; + client_config.set_client_type(ASYNC_CLIENT); + client_config.set_enable_ssl(false); + client_config.set_outstanding_rpcs_per_channel(1000); + client_config.set_client_channels(8); + client_config.set_payload_size(1); + client_config.set_async_client_threads(8); + client_config.set_rpc_type(UNARY); + + ServerConfig server_config; + server_config.set_server_type(ASYNC_SERVER); + server_config.set_enable_ssl(false); + server_config.set_threads(4); + + auto result = RunScenario(client_config, 1, server_config, 1, WARMUP, BENCHMARK); + + ReportQPSPerCore(result, server_config); + ReportLatency(result); +} + +} // namespace testing +} // namespace grpc + +int main(int argc, char** argv) { + grpc_init(); + + using namespace grpc::testing; + RunSynchronousStreamingPingPong(); + RunSynchronousUnaryPingPong(); + RunAsyncUnaryPingPong(); + RunQPS(); + + grpc_shutdown(); + return 0; +} diff --git a/test/cpp/qps/smoke_test.sh b/test/cpp/qps/smoke_test.sh new file mode 100755 index 0000000000..ba7f0a4f27 --- /dev/null +++ b/test/cpp/qps/smoke_test.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# performs a single qps run with one client and one server + +set -ex + +cd $(dirname $0)/../../.. + +killall qps_worker || true + +config=opt + +NUMCPUS=`python2.7 -c 'import multiprocessing; print multiprocessing.cpu_count()'` + +make CONFIG=$config qps_worker qps_smoke_test -j$NUMCPUS + +bins/$config/qps_worker -driver_port 10000 -server_port 10001 & +PID1=$! +bins/$config/qps_worker -driver_port 10010 -server_port 10011 & +PID2=$! + +export QPS_WORKERS="localhost:10000,localhost:10010" + +bins/$config/qps_smoke_test $* + +kill -2 $PID1 $PID2 +wait + |