thread_stress_test.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #include <cinttypes>
20 #include <mutex>
21 #include <thread>
22 
23 #include <gtest/gtest.h>
24 
25 #include <grpc/grpc.h>
26 #include <grpc/support/time.h>
27 #include <grpcpp/channel.h>
28 #include <grpcpp/client_context.h>
29 #include <grpcpp/create_channel.h>
31 #include <grpcpp/resource_quota.h>
32 #include <grpcpp/server.h>
33 #include <grpcpp/server_builder.h>
34 #include <grpcpp/server_context.h>
35 
36 #include "src/core/lib/gpr/env.h"
38 #include "src/proto/grpc/testing/duplicate/echo_duplicate.grpc.pb.h"
39 #include "src/proto/grpc/testing/echo.grpc.pb.h"
40 #include "test/core/util/port.h"
42 
43 using grpc::testing::EchoRequest;
44 using grpc::testing::EchoResponse;
45 
46 const int kNumThreads = 300; // Number of threads
47 const int kNumAsyncSendThreads = 2;
48 const int kNumAsyncReceiveThreads = 50;
49 const int kNumAsyncServerThreads = 50;
50 const int kNumRpcs = 1000; // Number of RPCs per thread
51 
52 namespace grpc {
53 namespace testing {
54 
55 class TestServiceImpl : public grpc::testing::EchoTestService::Service {
56  public:
58 
59  Status Echo(ServerContext* /*context*/, const EchoRequest* request,
60  EchoResponse* response) override {
61  response->set_message(request->message());
62  return Status::OK;
63  }
64 };
65 
66 template <class Service>
68  public:
70 #if TARGET_OS_IPHONE
71  // Workaround Apple CFStream bug
72  gpr_setenv("grpc_cfstream", "0");
73 #endif
74  }
75  virtual ~CommonStressTest() {}
76  virtual void SetUp() = 0;
77  virtual void TearDown() = 0;
78  virtual void ResetStub() = 0;
79  virtual bool AllowExhaustion() = 0;
80  grpc::testing::EchoTestService::Stub* GetStub() { return stub_.get(); }
81 
82  protected:
83  std::unique_ptr<grpc::testing::EchoTestService::Stub> stub_;
84  std::unique_ptr<Server> server_;
85 
86  virtual void SetUpStart(ServerBuilder* builder, Service* service) = 0;
88  builder->RegisterService(service);
89  builder->SetMaxMessageSize(
90  kMaxMessageSize_); // For testing max message size.
91  }
92  void SetUpEnd(ServerBuilder* builder) { server_ = builder->BuildAndStart(); }
93  void TearDownStart() { server_->Shutdown(); }
94  void TearDownEnd() {}
95 
96  private:
97  const int kMaxMessageSize_;
98 };
99 
100 template <class Service>
102  public:
103  void ResetStub() override {
104  std::shared_ptr<Channel> channel = grpc::CreateChannel(
106  this->stub_ = grpc::testing::EchoTestService::NewStub(channel);
107  }
108  bool AllowExhaustion() override { return false; }
109 
110  protected:
113  this->server_address_ << "localhost:" << port;
114  // Setup server
115  builder->AddListeningPort(server_address_.str(),
117  this->SetUpStartCommon(builder, service);
118  }
119 
120  private:
121  std::ostringstream server_address_;
122 };
123 
124 template <class Service, bool allow_resource_exhaustion>
125 class CommonStressTestInproc : public CommonStressTest<Service> {
126  public:
127  void ResetStub() override {
129  std::shared_ptr<Channel> channel = this->server_->InProcessChannel(args);
130  this->stub_ = grpc::testing::EchoTestService::NewStub(channel);
131  }
132  bool AllowExhaustion() override { return allow_resource_exhaustion; }
133 
134  protected:
136  this->SetUpStartCommon(builder, service);
137  }
138 };
139 
140 template <class BaseClass>
141 class CommonStressTestSyncServer : public BaseClass {
142  public:
143  void SetUp() override {
145  this->SetUpStart(&builder, &service_);
146  this->SetUpEnd(&builder);
147  }
148  void TearDown() override {
149  this->TearDownStart();
150  this->TearDownEnd();
151  }
152 
153  private:
155 };
156 
157 template <class BaseClass>
159  public:
160  void SetUp() override {
162  ResourceQuota quota;
163  this->SetUpStart(&builder, &service_);
164  quota.SetMaxThreads(4);
165  builder.SetResourceQuota(quota);
166  this->SetUpEnd(&builder);
167  }
168  void TearDown() override {
169  this->TearDownStart();
170  this->TearDownEnd();
171  }
172 
173  private:
175 };
176 
177 template <class BaseClass>
178 class CommonStressTestAsyncServer : public BaseClass {
179  public:
181  void SetUp() override {
182  shutting_down_ = false;
184  this->SetUpStart(&builder, &service_);
185  cq_ = builder.AddCompletionQueue();
186  this->SetUpEnd(&builder);
187  for (int i = 0; i < kNumAsyncServerThreads * 100; i++) {
188  RefreshContext(i);
189  }
190  for (int i = 0; i < kNumAsyncServerThreads; i++) {
192  this);
193  }
194  }
195  void TearDown() override {
196  {
198  this->TearDownStart();
199  shutting_down_ = true;
200  cq_->Shutdown();
201  }
202 
203  for (int i = 0; i < kNumAsyncServerThreads; i++) {
204  server_threads_[i].join();
205  }
206 
207  void* ignored_tag;
208  bool ignored_ok;
209  while (cq_->Next(&ignored_tag, &ignored_ok)) {
210  }
211  this->TearDownEnd();
212  }
213 
214  private:
215  void ProcessRpcs() {
216  void* tag;
217  bool ok;
218  while (cq_->Next(&tag, &ok)) {
219  if (ok) {
220  int i = static_cast<int>(reinterpret_cast<intptr_t>(tag));
221  switch (contexts_[i].state) {
222  case Context::READY: {
223  contexts_[i].state = Context::DONE;
224  EchoResponse send_response;
225  send_response.set_message(contexts_[i].recv_request.message());
226  contexts_[i].response_writer->Finish(send_response, Status::OK,
227  tag);
228  break;
229  }
230  case Context::DONE:
231  RefreshContext(i);
232  break;
233  }
234  }
235  }
236  }
237  void RefreshContext(int i) {
239  if (!shutting_down_) {
240  contexts_[i].state = Context::READY;
241  contexts_[i].srv_ctx.reset(new ServerContext);
242  contexts_[i].response_writer.reset(
244  contexts_[i].srv_ctx.get()));
245  service_.RequestEcho(contexts_[i].srv_ctx.get(),
246  &contexts_[i].recv_request,
247  contexts_[i].response_writer.get(), cq_.get(),
248  cq_.get(), reinterpret_cast<void*>(i));
249  }
250  }
251  struct Context {
252  std::unique_ptr<ServerContext> srv_ctx;
253  std::unique_ptr<grpc::ServerAsyncResponseWriter<EchoResponse>>
255  EchoRequest recv_request;
256  enum { READY, DONE } state;
257  };
258  std::vector<Context> contexts_;
259  grpc::testing::EchoTestService::AsyncService service_;
260  std::unique_ptr<ServerCompletionQueue> cq_;
263  std::vector<std::thread> server_threads_;
264 };
265 
266 template <class Common>
267 class End2endTest : public ::testing::Test {
268  protected:
270  void SetUp() override { common_.SetUp(); }
271  void TearDown() override { common_.TearDown(); }
272  void ResetStub() { common_.ResetStub(); }
273 
274  Common common_;
275 };
276 
277 static void SendRpc(grpc::testing::EchoTestService::Stub* stub, int num_rpcs,
278  bool allow_exhaustion, gpr_atm* errors) {
279  EchoRequest request;
280  EchoResponse response;
281  request.set_message("Hello");
282 
283  for (int i = 0; i < num_rpcs; ++i) {
285  Status s = stub->Echo(&context, request, &response);
286  EXPECT_TRUE(s.ok() || (allow_exhaustion &&
287  s.error_code() == StatusCode::RESOURCE_EXHAUSTED));
288  if (!s.ok()) {
289  if (!(allow_exhaustion &&
290  s.error_code() == StatusCode::RESOURCE_EXHAUSTED)) {
291  gpr_log(GPR_ERROR, "RPC error: %d: %s", s.error_code(),
292  s.error_message().c_str());
293  }
294  gpr_atm_no_barrier_fetch_add(errors, static_cast<gpr_atm>(1));
295  } else {
296  EXPECT_EQ(response.message(), request.message());
297  }
298  }
299 }
300 
302  CommonStressTestSyncServer<CommonStressTestInsecure<TestServiceImpl>>,
303  CommonStressTestSyncServer<CommonStressTestInproc<TestServiceImpl, false>>,
304  CommonStressTestSyncServerLowThreadCount<
305  CommonStressTestInproc<TestServiceImpl, true>>,
306  CommonStressTestAsyncServer<
307  CommonStressTestInsecure<grpc::testing::EchoTestService::AsyncService>>,
308  CommonStressTestAsyncServer<CommonStressTestInproc<
309  grpc::testing::EchoTestService::AsyncService, false>>>
311 TYPED_TEST_SUITE(End2endTest, CommonTypes);
312 TYPED_TEST(End2endTest, ThreadStress) {
313  this->common_.ResetStub();
314  std::vector<std::thread> threads;
315  gpr_atm errors;
316  gpr_atm_rel_store(&errors, static_cast<gpr_atm>(0));
317  threads.reserve(kNumThreads);
318  for (int i = 0; i < kNumThreads; ++i) {
319  threads.emplace_back(SendRpc, this->common_.GetStub(), kNumRpcs,
320  this->common_.AllowExhaustion(), &errors);
321  }
322  for (int i = 0; i < kNumThreads; ++i) {
323  threads[i].join();
324  }
325  uint64_t error_cnt = static_cast<uint64_t>(gpr_atm_no_barrier_load(&errors));
326  if (error_cnt != 0) {
327  gpr_log(GPR_INFO, "RPC error count: %" PRIu64, error_cnt);
328  }
329  // If this test allows resource exhaustion, expect that it actually sees some
330  if (this->common_.AllowExhaustion()) {
331  EXPECT_GT(error_cnt, static_cast<uint64_t>(0));
332  }
333 }
334 
335 template <class Common>
337  protected:
339 
340  void SetUp() override { common_.SetUp(); }
341  void TearDown() override {
342  void* ignored_tag;
343  bool ignored_ok;
344  while (cq_.Next(&ignored_tag, &ignored_ok)) {
345  }
346  common_.TearDown();
347  }
348 
349  void Wait() {
351  while (rpcs_outstanding_ != 0) {
352  cv_.Wait(&mu_);
353  }
354 
355  cq_.Shutdown();
356  }
357 
359  EchoResponse response;
362  std::unique_ptr<ClientAsyncResponseReader<EchoResponse>> response_reader;
363  };
364 
365  void AsyncSendRpc(int num_rpcs) {
366  for (int i = 0; i < num_rpcs; ++i) {
368  EchoRequest request;
369  request.set_message("Hello: " + std::to_string(i));
370  call->response_reader =
371  common_.GetStub()->AsyncEcho(&call->context, request, &cq_);
372  call->response_reader->Finish(&call->response, &call->status, call);
373 
376  }
377  }
378 
380  while (true) {
381  void* got_tag;
382  bool ok = false;
383  if (!cq_.Next(&got_tag, &ok)) break;
384  AsyncClientCall* call = static_cast<AsyncClientCall*>(got_tag);
385  if (!ok) {
386  gpr_log(GPR_DEBUG, "Error: %d", call->status.error_code());
387  }
388  delete call;
389 
390  bool notify;
391  {
394  notify = (rpcs_outstanding_ == 0);
395  }
396  if (notify) {
397  cv_.Signal();
398  }
399  }
400  }
401 
402  Common common_;
407 };
408 
411  this->common_.ResetStub();
412  std::vector<std::thread> send_threads, completion_threads;
413  for (int i = 0; i < kNumAsyncReceiveThreads; ++i) {
414  completion_threads.emplace_back(
415  &AsyncClientEnd2endTest_ThreadStress_Test<TypeParam>::AsyncCompleteRpc,
416  this);
417  }
418  for (int i = 0; i < kNumAsyncSendThreads; ++i) {
419  send_threads.emplace_back(
420  &AsyncClientEnd2endTest_ThreadStress_Test<TypeParam>::AsyncSendRpc,
421  this, kNumRpcs);
422  }
423  for (int i = 0; i < kNumAsyncSendThreads; ++i) {
424  send_threads[i].join();
425  }
426 
427  this->Wait();
428  for (int i = 0; i < kNumAsyncReceiveThreads; ++i) {
429  completion_threads[i].join();
430  }
431 }
432 
433 } // namespace testing
434 } // namespace grpc
435 
436 int main(int argc, char** argv) {
437  grpc::testing::TestEnvironment env(&argc, argv);
438  ::testing::InitGoogleTest(&argc, argv);
439  return RUN_ALL_TESTS();
440 }
grpc::testing::CommonStressTest::stub_
std::unique_ptr< grpc::testing::EchoTestService::Stub > stub_
Definition: thread_stress_test.cc:83
grpc::testing::CommonStressTest::TearDownEnd
void TearDownEnd()
Definition: thread_stress_test.cc:94
grpc::gpr_setenv
gpr_setenv("STS_CREDENTIALS", creds_file_name)
grpc::testing::AsyncClientEnd2endTest::cv_
grpc::internal::CondVar cv_
Definition: thread_stress_test.cc:405
GPR_INFO
#define GPR_INFO
Definition: include/grpc/impl/codegen/log.h:56
testing
Definition: aws_request_signer_test.cc:25
grpc::testing::AsyncClientEnd2endTest::mu_
grpc::internal::Mutex mu_
Definition: thread_stress_test.cc:404
grpc::testing::CommonStressTestInproc::ResetStub
void ResetStub() override
Definition: thread_stress_test.cc:127
grpc::testing::CommonTypes
::testing::Types< CommonStressTestSyncServer< CommonStressTestInsecure< TestServiceImpl > >, CommonStressTestSyncServer< CommonStressTestInproc< TestServiceImpl, false > >, CommonStressTestSyncServerLowThreadCount< CommonStressTestInproc< TestServiceImpl, true > >, CommonStressTestAsyncServer< CommonStressTestInsecure< grpc::testing::EchoTestService::AsyncService > >, CommonStressTestAsyncServer< CommonStressTestInproc< grpc::testing::EchoTestService::AsyncService, false > > > CommonTypes
Definition: thread_stress_test.cc:310
grpc::testing::CommonStressTestAsyncServer::service_
grpc::testing::EchoTestService::AsyncService service_
Definition: thread_stress_test.cc:259
grpc::testing::CommonStressTestAsyncServer::server_threads_
std::vector< std::thread > server_threads_
Definition: thread_stress_test.cc:263
gpr_atm_no_barrier_load
#define gpr_atm_no_barrier_load(p)
Definition: impl/codegen/atm_gcc_atomic.h:53
grpc::ServerContext
Definition: grpcpp/impl/codegen/server_context.h:566
port.h
generate.env
env
Definition: generate.py:37
grpc::testing::CommonStressTestAsyncServer::Context
Definition: thread_stress_test.cc:251
grpc::testing::CommonStressTestAsyncServer::TearDown
void TearDown() override
Definition: thread_stress_test.cc:195
grpc::internal::Mutex
Definition: include/grpcpp/impl/codegen/sync.h:59
grpc
Definition: grpcpp/alarm.h:33
grpc::testing::CommonStressTestSyncServer::SetUp
void SetUp() override
Definition: thread_stress_test.cc:143
grpc::testing::AsyncClientEnd2endTest::cq_
CompletionQueue cq_
Definition: thread_stress_test.cc:403
grpc::testing::CommonStressTestInproc::SetUpStart
void SetUpStart(ServerBuilder *builder, Service *service) override
Definition: thread_stress_test.cc:135
grpc::testing::AsyncClientEnd2endTest::AsyncClientCall::response
EchoResponse response
Definition: thread_stress_test.cc:359
benchmark.request
request
Definition: benchmark.py:77
grpc::testing::CommonStressTestAsyncServer::shutting_down_
bool shutting_down_
Definition: thread_stress_test.cc:261
EXPECT_GT
#define EXPECT_GT(val1, val2)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2036
grpc::testing::CommonStressTestAsyncServer
Definition: thread_stress_test.cc:178
grpc::testing::AsyncClientEnd2endTest::AsyncClientCall::status
Status status
Definition: thread_stress_test.cc:361
grpc::testing::AsyncClientEnd2endTest::AsyncClientCall::context
ClientContext context
Definition: thread_stress_test.cc:360
common_
size_t common_
Definition: bloaty/third_party/googletest/googletest/src/gtest.cc:1203
grpc::ResourceQuota
Definition: include/grpcpp/resource_quota.h:34
grpc::testing::CommonStressTest::CommonStressTest
CommonStressTest()
Definition: thread_stress_test.cc:69
grpc::testing::CommonStressTest::server_
std::unique_ptr< Server > server_
Definition: thread_stress_test.cc:84
grpc::testing::CommonStressTestInsecure::ResetStub
void ResetStub() override
Definition: thread_stress_test.cc:103
grpc::testing::AsyncClientEnd2endTest::rpcs_outstanding_
int rpcs_outstanding_
Definition: thread_stress_test.cc:406
grpc::testing::CommonStressTestAsyncServer::SetUp
void SetUp() override
Definition: thread_stress_test.cc:181
env.h
time.h
grpc::testing::End2endTest::SetUp
void SetUp() override
Definition: thread_stress_test.cc:270
grpc::testing::CommonStressTest::AllowExhaustion
virtual bool AllowExhaustion()=0
async_greeter_client.stub
stub
Definition: hellostreamingworld/async_greeter_client.py:26
grpc::testing::TestServiceImpl
TestMultipleServiceImpl< grpc::testing::EchoTestService::Service > TestServiceImpl
Definition: test_service_impl.h:498
grpc::testing::CommonStressTest::GetStub
grpc::testing::EchoTestService::Stub * GetStub()
Definition: thread_stress_test.cc:80
grpc::internal::MutexLock
Definition: include/grpcpp/impl/codegen/sync.h:86
grpc::testing::TestServiceImpl::Echo
Status Echo(ServerContext *, const EchoRequest *request, EchoResponse *response) override
Definition: thread_stress_test.cc:59
threads
static uv_thread_t * threads
Definition: threadpool.c:38
testing::Test
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:402
call
FilterStackCall * call
Definition: call.cc:750
grpc::testing::CommonStressTestInsecure
Definition: thread_stress_test.cc:101
grpc::Service
Desriptor of an RPC service and its various RPC methods.
Definition: grpcpp/impl/codegen/service_type.h:58
grpc::testing::AsyncClientEnd2endTest::TearDown
void TearDown() override
Definition: thread_stress_test.cc:341
grpc::testing::CommonStressTestInproc::AllowExhaustion
bool AllowExhaustion() override
Definition: thread_stress_test.cc:132
testing::internal::ProxyTypeList
Definition: googletest/googletest/include/gtest/internal/gtest-type-util.h:155
testing::Types
internal::ProxyTypeList< Ts... > Types
Definition: boringssl-with-bazel/src/third_party/googletest/include/gtest/internal/gtest-type-util.h:183
grpc::ServerBuilder::AddListeningPort
ServerBuilder & AddListeningPort(const std::string &addr_uri, std::shared_ptr< grpc::ServerCredentials > creds, int *selected_port=nullptr)
Definition: server_builder.cc:222
profile_analyzer.builder
builder
Definition: profile_analyzer.py:159
grpc.StatusCode.RESOURCE_EXHAUSTED
tuple RESOURCE_EXHAUSTED
Definition: src/python/grpcio/grpc/__init__.py:270
channel
wrapped_grpc_channel * channel
Definition: src/php/ext/grpc/call.h:33
asyncio_get_stats.args
args
Definition: asyncio_get_stats.py:40
grpc::testing::AsyncClientEnd2endTest::SetUp
void SetUp() override
Definition: thread_stress_test.cc:340
grpc::testing::CommonStressTestSyncServer
Definition: thread_stress_test.cc:141
sync.h
errors
const char * errors
Definition: bloaty/third_party/protobuf/src/google/protobuf/io/tokenizer_unittest.cc:841
grpc::internal::CondVar::Wait
void Wait(Mutex *mu)
Definition: include/grpcpp/impl/codegen/sync.h:135
grpc::ServerBuilder
A builder class for the creation and startup of grpc::Server instances.
Definition: grpcpp/server_builder.h:86
grpc::testing::CommonStressTestSyncServerLowThreadCount::SetUp
void SetUp() override
Definition: thread_stress_test.cc:160
grpc::testing::CommonStressTest
Definition: thread_stress_test.cc:67
grpc::testing::CommonStressTest::TearDown
virtual void TearDown()=0
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
grpc::testing::AsyncClientEnd2endTest::AsyncClientCall
Definition: thread_stress_test.cc:358
grpc::testing::CommonStressTestSyncServerLowThreadCount::service_
TestServiceImpl service_
Definition: thread_stress_test.cc:174
grpc.h
grpc::testing::AsyncClientEnd2endTest::AsyncSendRpc
void AsyncSendRpc(int num_rpcs)
Definition: thread_stress_test.cc:365
uint64_t
unsigned __int64 uint64_t
Definition: stdint-msvc2008.h:90
grpc::testing::CommonStressTestAsyncServer::Context::READY
@ READY
Definition: thread_stress_test.cc:256
grpc::ResourceQuota::SetMaxThreads
ResourceQuota & SetMaxThreads(int new_max_threads)
Definition: resource_quota_cc.cc:41
grpc::testing::CommonStressTest::SetUpStart
virtual void SetUpStart(ServerBuilder *builder, Service *service)=0
channel.h
gpr_atm_rel_store
#define gpr_atm_rel_store(p, value)
Definition: impl/codegen/atm_gcc_atomic.h:54
grpc::testing::AsyncClientEnd2endTest::common_
Common common_
Definition: thread_stress_test.cc:402
gpr_atm_no_barrier_fetch_add
#define gpr_atm_no_barrier_fetch_add(p, delta)
Definition: impl/codegen/atm_gcc_atomic.h:59
grpc::testing::CommonStressTestSyncServerLowThreadCount
Definition: thread_stress_test.cc:158
grpc::testing::CommonStressTestInsecure::server_address_
std::ostringstream server_address_
Definition: thread_stress_test.cc:121
intptr_t
_W64 signed int intptr_t
Definition: stdint-msvc2008.h:118
grpc::Status::OK
static const Status & OK
An OK pre-defined instance.
Definition: include/grpcpp/impl/codegen/status.h:113
grpc::testing::CommonStressTest::~CommonStressTest
virtual ~CommonStressTest()
Definition: thread_stress_test.cc:75
grpc::testing::AsyncClientEnd2endTest::AsyncClientEnd2endTest
AsyncClientEnd2endTest()
Definition: thread_stress_test.cc:338
kNumRpcs
const int kNumRpcs
Definition: thread_stress_test.cc:50
grpc::CreateChannel
std::shared_ptr< Channel > CreateChannel(const grpc::string &target, const std::shared_ptr< ChannelCredentials > &creds)
RUN_ALL_TESTS
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2471
GPR_ERROR
#define GPR_ERROR
Definition: include/grpc/impl/codegen/log.h:57
grpc_pick_unused_port_or_die
int grpc_pick_unused_port_or_die(void)
grpc::testing::CommonStressTest::SetUp
virtual void SetUp()=0
grpc::testing::CommonStressTest::ResetStub
virtual void ResetStub()=0
grpc::testing::AsyncClientEnd2endTest::AsyncClientCall::response_reader
std::unique_ptr< ClientAsyncResponseReader< EchoResponse > > response_reader
Definition: thread_stress_test.cc:362
main
int main(int argc, char **argv)
Definition: thread_stress_test.cc:436
grpc::testing::TestServiceImpl::TestServiceImpl
TestServiceImpl()
Definition: thread_stress_test.cc:57
grpc::testing::End2endTest::TearDown
void TearDown() override
Definition: thread_stress_test.cc:271
grpc::testing::tag
static void * tag(intptr_t t)
Definition: h2_ssl_cert_test.cc:263
grpc::testing::End2endTest::End2endTest
End2endTest()
Definition: thread_stress_test.cc:269
grpc::testing::End2endTest::ResetStub
void ResetStub()
Definition: thread_stress_test.cc:272
grpc::ClientContext
Definition: grpcpp/impl/codegen/client_context.h:195
tests.unit._exit_scenarios.port
port
Definition: _exit_scenarios.py:179
grpc::testing::CommonStressTestAsyncServer::CommonStressTestAsyncServer
CommonStressTestAsyncServer()
Definition: thread_stress_test.cc:180
test_config.h
grpc::testing::CommonStressTestInproc
Definition: thread_stress_test.cc:125
gpr_atm
intptr_t gpr_atm
Definition: impl/codegen/atm_gcc_atomic.h:32
grpc::testing::CommonStressTestAsyncServer::Context::srv_ctx
std::unique_ptr< ServerContext > srv_ctx
Definition: thread_stress_test.cc:252
grpc::testing::AsyncClientEnd2endTest::AsyncCompleteRpc
void AsyncCompleteRpc()
Definition: thread_stress_test.cc:379
grpc::ChannelArguments
Definition: grpcpp/support/channel_arguments.h:39
grpc::CompletionQueue::Next
bool Next(void **tag, bool *ok)
Definition: include/grpcpp/impl/codegen/completion_queue.h:179
client_context.h
testing::InitGoogleTest
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Definition: bloaty/third_party/googletest/googletest/src/gtest.cc:6106
grpc::testing::CommonStressTest::SetUpEnd
void SetUpEnd(ServerBuilder *builder)
Definition: thread_stress_test.cc:92
kNumAsyncServerThreads
const int kNumAsyncServerThreads
Definition: thread_stress_test.cc:49
grpc::testing::AsyncClientEnd2endTest::Wait
void Wait()
Definition: thread_stress_test.cc:349
kNumThreads
const int kNumThreads
Definition: thread_stress_test.cc:46
grpc::testing::CommonStressTest::TearDownStart
void TearDownStart()
Definition: thread_stress_test.cc:93
kNumAsyncSendThreads
const int kNumAsyncSendThreads
Definition: thread_stress_test.cc:47
server_context.h
asyncio_get_stats.response
response
Definition: asyncio_get_stats.py:28
grpc::testing::TestEnvironment
Definition: test/core/util/test_config.h:54
grpc::CompletionQueue::Shutdown
void Shutdown()
Definition: completion_queue_cc.cc:137
grpc::Status
Definition: include/grpcpp/impl/codegen/status.h:35
ok
bool ok
Definition: async_end2end_test.cc:197
state
Definition: bloaty/third_party/zlib/contrib/blast/blast.c:41
grpc::testing::TYPED_TEST
TYPED_TEST(End2endTest, ThreadStress)
Definition: thread_stress_test.cc:312
grpc::testing::EXPECT_EQ
EXPECT_EQ(options.token_exchange_service_uri, "https://foo/exchange")
grpc::testing::End2endTest::common_
Common common_
Definition: thread_stress_test.cc:274
grpc::testing::CommonStressTestAsyncServer::ProcessRpcs
void ProcessRpcs()
Definition: thread_stress_test.cc:215
kNumAsyncReceiveThreads
const int kNumAsyncReceiveThreads
Definition: thread_stress_test.cc:48
grpc::testing::AsyncClientEnd2endTest
Definition: thread_stress_test.cc:336
grpc::testing::CommonStressTestAsyncServer::contexts_
std::vector< Context > contexts_
Definition: thread_stress_test.cc:258
resource_quota.h
grpc::testing::CommonStressTestAsyncServer::Context::DONE
@ DONE
Definition: thread_stress_test.cc:256
grpc::InsecureServerCredentials
std::shared_ptr< ServerCredentials > InsecureServerCredentials()
Definition: insecure_server_credentials.cc:52
api_trace.h
grpc::internal::CondVar
Definition: include/grpcpp/impl/codegen/sync.h:124
grpc::testing::CommonStressTestSyncServerLowThreadCount::TearDown
void TearDown() override
Definition: thread_stress_test.cc:168
GPR_DEBUG
#define GPR_DEBUG
Definition: include/grpc/impl/codegen/log.h:55
context
grpc::ClientContext context
Definition: istio_echo_server_lib.cc:61
grpc::testing::CommonStressTest::kMaxMessageSize_
const int kMaxMessageSize_
Definition: thread_stress_test.cc:97
grpc::testing::EXPECT_TRUE
EXPECT_TRUE(grpc::experimental::StsCredentialsOptionsFromJson(minimum_valid_json, &options) .ok())
grpc::CompletionQueue
Definition: include/grpcpp/impl/codegen/completion_queue.h:104
grpc::testing::CommonStressTestAsyncServer::RefreshContext
void RefreshContext(int i)
Definition: thread_stress_test.cc:237
server.h
grpc::ServerAsyncResponseWriter
Definition: grpcpp/impl/codegen/async_unary_call.h:295
grpc::internal::CondVar::Signal
void Signal()
Definition: include/grpcpp/impl/codegen/sync.h:132
grpc::testing::CommonStressTest::SetUpStartCommon
void SetUpStartCommon(ServerBuilder *builder, Service *service)
Definition: thread_stress_test.cc:87
grpc::testing::CommonStressTestAsyncServer::Context::response_writer
std::unique_ptr< grpc::ServerAsyncResponseWriter< EchoResponse > > response_writer
Definition: thread_stress_test.cc:254
grpc::InsecureChannelCredentials
std::shared_ptr< ChannelCredentials > InsecureChannelCredentials()
Credentials for an unencrypted, unauthenticated channel.
Definition: cpp/client/insecure_credentials.cc:69
grpc::testing::CommonStressTestAsyncServer::Context::recv_request
EchoRequest recv_request
Definition: thread_stress_test.cc:255
service
__attribute__((deprecated("Please use GRPCProtoMethod."))) @interface ProtoMethod NSString * service
Definition: ProtoMethod.h:25
grpc::testing::CommonStressTestAsyncServer::Context::state
enum grpc::testing::CommonStressTestAsyncServer::Context::@59 state
grpc::testing::CommonStressTestInsecure::SetUpStart
void SetUpStart(ServerBuilder *builder, Service *service) override
Definition: thread_stress_test.cc:111
grpc::testing::TYPED_TEST_SUITE
TYPED_TEST_SUITE(End2endTest, CommonTypes)
to_string
static bool to_string(zval *from)
Definition: protobuf/php/ext/google/protobuf/convert.c:333
TestServiceImpl
Definition: interop_server.cc:139
grpc::testing::SendRpc
static void SendRpc(grpc::testing::EchoTestService::Stub *stub, int num_rpcs, bool allow_exhaustion, gpr_atm *errors)
Definition: thread_stress_test.cc:277
grpc::testing::CommonStressTestAsyncServer::mu_
grpc::internal::Mutex mu_
Definition: thread_stress_test.cc:262
grpc::testing::CommonStressTestInsecure::AllowExhaustion
bool AllowExhaustion() override
Definition: thread_stress_test.cc:108
grpc::testing::CommonStressTestSyncServer::service_
TestServiceImpl service_
Definition: thread_stress_test.cc:154
server_builder.h
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
create_channel.h
grpc::testing::CommonStressTestAsyncServer::cq_
std::unique_ptr< ServerCompletionQueue > cq_
Definition: thread_stress_test.cc:260
grpc::testing::CommonStressTestSyncServer::TearDown
void TearDown() override
Definition: thread_stress_test.cc:148


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:36