Functions | Variables
stress_test.cc File Reference
#include <memory>
#include <string>
#include <thread>
#include <utility>
#include <vector>
#include "absl/flags/flag.h"
#include <grpc/support/log.h>
#include <grpc/support/time.h>
#include <grpcpp/create_channel.h>
#include <grpcpp/grpcpp.h>
#include "src/proto/grpc/testing/metrics.grpc.pb.h"
#include "src/proto/grpc/testing/metrics.pb.h"
#include "test/cpp/interop/interop_client.h"
#include "test/cpp/interop/stress_interop_client.h"
#include "test/cpp/util/create_test_channel.h"
#include "test/cpp/util/metrics_server.h"
#include "test/cpp/util/test_config.h"
Include dependency graph for stress_test.cc:

Go to the source code of this file.

Functions

 ABSL_FLAG (bool, do_not_abort_on_transient_failures, true, "If set to 'true', abort() is not called in case of transient " "failures like temporary connection failures.")
 
 ABSL_FLAG (bool, use_alts, false, "Whether to use alts. Enable alts will disable tls.")
 
 ABSL_FLAG (bool, use_test_ca, false, "False to use SSL roots for google")
 
 ABSL_FLAG (bool, use_tls, false, "Whether to use tls.")
 
 ABSL_FLAG (int32_t, log_level, GPR_LOG_SEVERITY_INFO, "Severity level of messages that should be logged. Any messages " "greater than or equal to the level set here will be logged. " "The choices are: 0 (GPR_LOG_SEVERITY_DEBUG), 1 " "(GPR_LOG_SEVERITY_INFO) and 2 (GPR_LOG_SEVERITY_ERROR)")
 
 ABSL_FLAG (int32_t, metrics_port, 8081, "The metrics server port.")
 
 ABSL_FLAG (int32_t, num_channels_per_server, 1, "Number of channels for each server")
 
 ABSL_FLAG (int32_t, num_stubs_per_channel, 1, "Number of stubs per each channels to server. This number also " "indicates the max number of parallel RPC calls on each channel " "at any given time.")
 
 ABSL_FLAG (int32_t, sleep_duration_ms, 0, "The duration (in millisec) between two" " consecutive test calls (per server) issued by the server.")
 
 ABSL_FLAG (int32_t, test_duration_secs, -1, "The length of time (in seconds) to run" " the test. Enter -1 if the test should run continuously until" " forcefully terminated.")
 
 ABSL_FLAG (std::string, server_addresses, "localhost:8080", "The list of server addresses. The format is: \n" " \"<name_1>:<port_1>,<name_2>:<port_1>...<name_N>:<port_N>\"\n" " Note: <name> can be servername or IP address.")
 
 ABSL_FLAG (std::string, server_host_override, "", "Override the server host which is sent in HTTP header")
 
 ABSL_FLAG (std::string, test_cases, "", "List of test cases to call along with the" " relative weights in the following format:\n" " \"<testcase_1:w_1>,<testcase_2:w_2>...<testcase_n:w_n>\"\n" " The following testcases are currently supported:\n" " empty_unary\n" " large_unary\n" " large_compressed_unary\n" " client_streaming\n" " server_streaming\n" " server_compressed_streaming\n" " slow_consumer\n" " half_duplex\n" " ping_pong\n" " cancel_after_begin\n" " cancel_after_first_response\n" " timeout_on_sleeping_server\n" " empty_stream\n" " status_code_and_message\n" " custom_metadata\n" " Example: \"empty_unary:20,large_unary:10,empty_stream:70\"\n" " The above will execute 'empty_unary', 20% of the time," " 'large_unary', 10% of the time and 'empty_stream' the remaining" " 70% of the time")
 
TestCaseType GetTestTypeFromName (const std::string &test_name)
 
void gpr_default_log (gpr_log_func_args *args)
 
void LogParameterInfo (const std::vector< std::string > &addresses, const std::vector< std::pair< TestCaseType, int >> &tests)
 
int main (int argc, char **argv)
 
bool ParseCommaDelimitedString (const std::string &comma_delimited_str, std::vector< std::string > &tokens)
 
bool ParseTestCasesString (const std::string &test_cases, std::vector< std::pair< TestCaseType, int >> &tests)
 
void TestLogFunction (gpr_log_func_args *args)
 

Variables

static int log_level = GPR_LOG_SEVERITY_DEBUG
 

Function Documentation

◆ ABSL_FLAG() [1/13]

ABSL_FLAG ( bool  ,
do_not_abort_on_transient_failures  ,
true  ,
"If set to 'true ,
abort() is not called in case of transient " "failures like temporary connection failures."   
)

◆ ABSL_FLAG() [2/13]

ABSL_FLAG ( bool  ,
use_alts  ,
false  ,
"Whether to use alts. Enable alts will disable tls."   
)

◆ ABSL_FLAG() [3/13]

ABSL_FLAG ( bool  ,
use_test_ca  ,
false  ,
"False to use SSL roots for google"   
)

◆ ABSL_FLAG() [4/13]

ABSL_FLAG ( bool  ,
use_tls  ,
false  ,
"Whether to use tls."   
)

◆ ABSL_FLAG() [5/13]

ABSL_FLAG ( int32_t  ,
log_level  ,
GPR_LOG_SEVERITY_INFO  ,
"Severity level of messages that should be logged. Any messages " "greater than or equal to the level set here will be logged. " "The choices are: 0   GPR_LOG_SEVERITY_DEBUG,
1 " "(GPR_LOG_SEVERITY_INFO) and 2(GPR_LOG_SEVERITY_ERROR)"   
)

◆ ABSL_FLAG() [6/13]

ABSL_FLAG ( int32_t  ,
metrics_port  ,
8081  ,
"The metrics server port."   
)

◆ ABSL_FLAG() [7/13]

ABSL_FLAG ( int32_t  ,
num_channels_per_server  ,
,
"Number of channels for each server  
)

◆ ABSL_FLAG() [8/13]

ABSL_FLAG ( int32_t  ,
num_stubs_per_channel  ,
,
"Number of stubs per each channels to server. This number also " "indicates the max number of parallel RPC calls on each channel " "at any given time."   
)

◆ ABSL_FLAG() [9/13]

ABSL_FLAG ( int32_t  ,
sleep_duration_ms  ,
,
"The duration (in millisec) between two" " consecutive test calls (per server) issued by the server."   
)

◆ ABSL_FLAG() [10/13]

ABSL_FLAG ( int32_t  ,
test_duration_secs  ,
1,
"The length of time (in seconds) to run" " the test. Enter -1 if the test should run continuously until" " forcefully terminated."   
)

◆ ABSL_FLAG() [11/13]

ABSL_FLAG ( std::string  ,
server_addresses  ,
"localhost:8080"  ,
"The list of server addresses. The format is: \n" " \"<name_1>:<port_1>  ,
< name_2 >:< port_1 >...< name_N >:< port_N >\"\n" " Note: <name> can be servername or IP address."   
)

◆ ABSL_FLAG() [12/13]

ABSL_FLAG ( std::string  ,
server_host_override  ,
""  ,
"Override the server host which is sent in HTTP header  
)

◆ ABSL_FLAG() [13/13]

ABSL_FLAG ( std::string  ,
test_cases  ,
""  ,
"List of test cases to call along with the" " relative weights in the following format:\n" " \"<testcase_1:w_1>  ,
< testcase_2:w_2 >...< testcase_n:w_n >\"\n" " The following testcases are currently supported:\n" " empty_unary\n" " large_unary\n" " large_compressed_unary\n" " client_streaming\n" " server_streaming\n" " server_compressed_streaming\n" " slow_consumer\n" " half_duplex\n" " ping_pong\n" " cancel_after_begin\n" " cancel_after_first_response\n" " timeout_on_sleeping_server\n" " empty_stream\n" " status_code_and_message\n" " custom_metadata\n" " Example: \"empty_unary:20  ,
large_unary:10  ,
empty_stream:70\"\n" " The above will execute 'empty_unary'  ,
20% of the  time,
" " 'large_unary'  ,
10% of the time and 'empty_stream' the remaining" " 70% of the time"   
)

◆ GetTestTypeFromName()

TestCaseType GetTestTypeFromName ( const std::string &  test_name)

Definition at line 134 of file stress_test.cc.

◆ gpr_default_log()

void gpr_default_log ( gpr_log_func_args args)

◆ LogParameterInfo()

void LogParameterInfo ( const std::vector< std::string > &  addresses,
const std::vector< std::pair< TestCaseType, int >> &  tests 
)

Definition at line 198 of file stress_test.cc.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 230 of file stress_test.cc.

◆ ParseCommaDelimitedString()

bool ParseCommaDelimitedString ( const std::string &  comma_delimited_str,
std::vector< std::string > &  tokens 
)

Definition at line 148 of file stress_test.cc.

◆ ParseTestCasesString()

bool ParseTestCasesString ( const std::string &  test_cases,
std::vector< std::pair< TestCaseType, int >> &  tests 
)

Definition at line 166 of file stress_test.cc.

◆ TestLogFunction()

void TestLogFunction ( gpr_log_func_args args)

Definition at line 128 of file stress_test.cc.

Variable Documentation

◆ log_level

int log_level = GPR_LOG_SEVERITY_DEBUG
static

Definition at line 124 of file stress_test.cc.



grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:32