-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
40 changed files
with
8,928 additions
and
2,415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
Benchmark | ||
========= | ||
Utilities for benchmarking grpcbox. The used protocol is compatible with the one defined in [grpc](https://github.com/grpc/grpc/blob/master/src/proto/grpc/testing/benchmark_service.proto) and for example the Go benchmark client and server can be used against grpcbox. | ||
|
||
Grpcbox benchmark server | ||
------------------------ | ||
To run the grpcbox benchmark server: | ||
|
||
``` | ||
$ rebar3 as benchmark shell | ||
``` | ||
|
||
Server options can be changed in `benchmark/config/sys.config` | ||
|
||
Grpcbox benchmark client | ||
------------------------ | ||
The benchmark client is implemented as a Common Test. First set test parameters in `benchmark/config/test.config`. The available parameters are described in the file. Also the chatterbox client options can be set. After setting test parameters and starting a server to test against, run the grpcbox benchmark client: | ||
|
||
``` | ||
$ rebar3 as benchmark ct --verbose | ||
``` | ||
|
||
The --verbose option needs to be set for the measurements to be printed out. | ||
|
||
Go benchmark client and server | ||
------------------------------ | ||
Grpcbox benchmark is compatible with the Go benchmark client and server. | ||
|
||
To build the Go client and server: | ||
|
||
``` | ||
$ go build -o $GOPATH/bin/go-grpc-benchmark-client <path-to-grpc-go>/benchmark/client | ||
$ go build -o $GOPATH/bin/go-grpc-benchmark-server <path-to-grpc-go>/benchmark/server | ||
``` | ||
|
||
Example of running the Go benchmark server: | ||
|
||
``` | ||
$ go-grpc-benchmark-server -port 8080 -test_name mytest | ||
``` | ||
|
||
Example of running the Go benchmark client: | ||
|
||
``` | ||
$ go-grpc-benchmark-client -port 8080 -test_name mytest -d 10 -w 1 -r 100 -c 1 -rpc_type unary -req 1 -resp 1 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[ | ||
{grpcbox, [%% {client, #{channels => [{default_channel, [{http, "localhost", 8080, []}], #{}}]}}, | ||
{servers, | ||
[#{grpc_opts => #{service_protos => [benchmark_service_pb], | ||
services => #{'grpc.testing.BenchmarkService' => grpc_testing_benchmark_service}, | ||
client_cert_dir => "test/grpcbox_SUITE_data/certificates/"}, | ||
|
||
transport_opts => #{ssl => false, | ||
keyfile => "test/grpcbox_SUITE_data/certificates/server1.key", | ||
certfile => "test/grpcbox_SUITE_data/certificates/server1.pem", | ||
cacertfile => "test/grpcbox_SUITE_data/certificates/ca.pem"}, | ||
|
||
listen_opts => #{port => 8080, | ||
ip => {0,0,0,0}}, | ||
|
||
pool_opts => #{size => 10}, | ||
|
||
server_opts => #{server_header_table_size => 4096, | ||
server_enable_push => 1, | ||
server_max_concurrent_streams => unlimited, | ||
server_initial_window_size => 100000000, | ||
server_max_frame_size => 16384, | ||
server_max_header_list_size => unlimited}}]}]}, | ||
|
||
{opencensus, [{sampler, {oc_sampler_always, []}}, | ||
{reporters, [{oc_reporter_stdout, []}]}, | ||
|
||
{stat, [{exporters, [{oc_stat_exporter_stdout, []}]}]}]}, | ||
|
||
{kernel, | ||
[ | ||
{logger, | ||
[ | ||
{handler, default, logger_std_h, | ||
#{filters => [{progress, {fun logger_filters:progress/2, stop}}], | ||
formatter => {logger_formatter, #{single_line => true}}}}]}]} | ||
]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
%% Test options | ||
{server_addr, "localhost"}. %% Server address to connect to | ||
{server_port, 8080}. %% Server port to connect to | ||
{num_rpc, 100}. %% The number of concurrent RPCs on each connection | ||
{num_conn, 1}. %% The number of parallel connections | ||
{warmup_dur, 1}. %% Warm-up duration in seconds | ||
{duration, 10}. %% Benchmark duration in seconds | ||
{rq_size, 1}. %% Request message size in bytes | ||
{rsp_size, 1}. %% Response message size in bytes | ||
{rpc_type, unary}. %% RPC type, unary or streaming | ||
|
||
%% Client options | ||
{chatterbox, | ||
[ | ||
{client_header_table_size,4096}, | ||
{client_enable_push,1}, | ||
{client_max_concurrent_streams,unlimited}, | ||
{client_initial_window_size,100000000}, | ||
{client_max_frame_size,16384}, | ||
{client_max_header_list_size,unlimited}, | ||
{client_flow_control,auto} | ||
] | ||
}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2015 gRPC authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// An integration test service that covers all the method signature permutations | ||
// of unary/streaming requests/responses. | ||
syntax = "proto3"; | ||
|
||
import "interop/proto/messages.proto"; | ||
|
||
package grpc.testing; | ||
|
||
service BenchmarkService { | ||
// One request followed by one response. | ||
// The server returns the client payload as-is. | ||
rpc UnaryCall(SimpleRequest) returns (SimpleResponse); | ||
|
||
// Repeated sequence of one request followed by one response. | ||
// Should be called streaming ping-pong | ||
// The server returns the client payload as-is on each response | ||
rpc StreamingCall(stream SimpleRequest) returns (stream SimpleResponse); | ||
|
||
// Single-sided unbounded streaming from client to server | ||
// The server returns the client payload as-is once the client does WritesDone | ||
rpc StreamingFromClient(stream SimpleRequest) returns (SimpleResponse); | ||
|
||
// Single-sided unbounded streaming from server to client | ||
// The server repeatedly returns the client payload as-is | ||
rpc StreamingFromServer(SimpleRequest) returns (stream SimpleResponse); | ||
|
||
// Two-sided unbounded streaming between server to client | ||
// Both sides send the content of their own choice to the other | ||
rpc StreamingBothWays(stream SimpleRequest) returns (stream SimpleResponse); | ||
} |
Oops, something went wrong.