Merge pull request #660 from menghanl/benchmark_client
Benchmark worker
This commit is contained in:
@ -37,8 +37,8 @@ Package benchmark implements the building blocks to setup end-to-end gRPC benchm
|
||||
package benchmark
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"net"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
@ -74,7 +74,7 @@ func (s *testServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *testServer) StreamingCall(stream testpb.TestService_StreamingCallServer) error {
|
||||
func (s *testServer) StreamingCall(stream testpb.BenchmarkService_StreamingCallServer) error {
|
||||
for {
|
||||
in, err := stream.Recv()
|
||||
if err == io.EOF {
|
||||
@ -92,16 +92,70 @@ func (s *testServer) StreamingCall(stream testpb.TestService_StreamingCallServer
|
||||
}
|
||||
}
|
||||
|
||||
// StartServer starts a gRPC server serving a benchmark service on the given
|
||||
// address, which may be something like "localhost:0". It returns its listen
|
||||
// address and a function to stop the server.
|
||||
func StartServer(addr string) (string, func()) {
|
||||
lis, err := net.Listen("tcp", addr)
|
||||
// byteBufServer is a gRPC server that sends and receives byte buffer.
|
||||
// The purpose is to benchmark the gRPC performance without protobuf serialization/deserialization overhead.
|
||||
type byteBufServer struct {
|
||||
respSize int32
|
||||
}
|
||||
|
||||
// UnaryCall is an empty function and is not used for benchmark.
|
||||
// If bytebuf UnaryCall benchmark is needed later, the function body needs to be updated.
|
||||
func (s *byteBufServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) {
|
||||
return &testpb.SimpleResponse{}, nil
|
||||
}
|
||||
|
||||
func (s *byteBufServer) StreamingCall(stream testpb.BenchmarkService_StreamingCallServer) error {
|
||||
for {
|
||||
var in []byte
|
||||
err := stream.(grpc.ServerStream).RecvMsg(&in)
|
||||
if err == io.EOF {
|
||||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
out := make([]byte, s.respSize)
|
||||
if err := stream.(grpc.ServerStream).SendMsg(&out); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ServerInfo contains the information to create a gRPC benchmark server.
|
||||
type ServerInfo struct {
|
||||
// Addr is the address of the server.
|
||||
Addr string
|
||||
|
||||
// Type is the type of the server.
|
||||
// It should be "protobuf" or "bytebuf".
|
||||
Type string
|
||||
|
||||
// Metadata is an optional configuration.
|
||||
// For "protobuf", it's ignored.
|
||||
// For "bytebuf", it should be an int representing response size.
|
||||
Metadata interface{}
|
||||
}
|
||||
|
||||
// StartServer starts a gRPC server serving a benchmark service according to info.
|
||||
// It returns its listen address and a function to stop the server.
|
||||
func StartServer(info ServerInfo, opts ...grpc.ServerOption) (string, func()) {
|
||||
lis, err := net.Listen("tcp", info.Addr)
|
||||
if err != nil {
|
||||
grpclog.Fatalf("Failed to listen: %v", err)
|
||||
}
|
||||
s := grpc.NewServer(grpc.MaxConcurrentStreams(math.MaxUint32))
|
||||
testpb.RegisterTestServiceServer(s, &testServer{})
|
||||
s := grpc.NewServer(opts...)
|
||||
switch info.Type {
|
||||
case "protobuf":
|
||||
testpb.RegisterBenchmarkServiceServer(s, &testServer{})
|
||||
case "bytebuf":
|
||||
respSize, ok := info.Metadata.(int32)
|
||||
if !ok {
|
||||
grpclog.Fatalf("failed to StartServer, invalid metadata: %v, for Type: %v", info.Metadata, info.Type)
|
||||
}
|
||||
testpb.RegisterBenchmarkServiceServer(s, &byteBufServer{respSize: respSize})
|
||||
default:
|
||||
grpclog.Fatalf("failed to StartServer, unknown Type: %v", info.Type)
|
||||
}
|
||||
go s.Serve(lis)
|
||||
return lis.Addr().String(), func() {
|
||||
s.Stop()
|
||||
@ -109,7 +163,7 @@ func StartServer(addr string) (string, func()) {
|
||||
}
|
||||
|
||||
// DoUnaryCall performs an unary RPC with given stub and request and response sizes.
|
||||
func DoUnaryCall(tc testpb.TestServiceClient, reqSize, respSize int) {
|
||||
func DoUnaryCall(tc testpb.BenchmarkServiceClient, reqSize, respSize int) error {
|
||||
pl := newPayload(testpb.PayloadType_COMPRESSABLE, reqSize)
|
||||
req := &testpb.SimpleRequest{
|
||||
ResponseType: pl.Type,
|
||||
@ -117,12 +171,13 @@ func DoUnaryCall(tc testpb.TestServiceClient, reqSize, respSize int) {
|
||||
Payload: pl,
|
||||
}
|
||||
if _, err := tc.UnaryCall(context.Background(), req); err != nil {
|
||||
grpclog.Fatal("/TestService/UnaryCall RPC failed: ", err)
|
||||
return fmt.Errorf("/BenchmarkService/UnaryCall(_, _) = _, %v, want _, <nil>", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DoStreamingRoundTrip performs a round trip for a single streaming rpc.
|
||||
func DoStreamingRoundTrip(tc testpb.TestServiceClient, stream testpb.TestService_StreamingCallClient, reqSize, respSize int) {
|
||||
func DoStreamingRoundTrip(stream testpb.BenchmarkService_StreamingCallClient, reqSize, respSize int) error {
|
||||
pl := newPayload(testpb.PayloadType_COMPRESSABLE, reqSize)
|
||||
req := &testpb.SimpleRequest{
|
||||
ResponseType: pl.Type,
|
||||
@ -130,16 +185,38 @@ func DoStreamingRoundTrip(tc testpb.TestServiceClient, stream testpb.TestService
|
||||
Payload: pl,
|
||||
}
|
||||
if err := stream.Send(req); err != nil {
|
||||
grpclog.Fatalf("StreamingCall(_).Send: %v", err)
|
||||
return fmt.Errorf("/BenchmarkService/StreamingCall.Send(_) = %v, want <nil>", err)
|
||||
}
|
||||
if _, err := stream.Recv(); err != nil {
|
||||
grpclog.Fatalf("StreamingCall(_).Recv: %v", err)
|
||||
// EOF is a valid error here.
|
||||
if err == io.EOF {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("/BenchmarkService/StreamingCall.Recv(_) = %v, want <nil>", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DoByteBufStreamingRoundTrip performs a round trip for a single streaming rpc, using a custom codec for byte buffer.
|
||||
func DoByteBufStreamingRoundTrip(stream testpb.BenchmarkService_StreamingCallClient, reqSize, respSize int) error {
|
||||
out := make([]byte, reqSize)
|
||||
if err := stream.(grpc.ClientStream).SendMsg(&out); err != nil {
|
||||
return fmt.Errorf("/BenchmarkService/StreamingCall.(ClientStream).SendMsg(_) = %v, want <nil>", err)
|
||||
}
|
||||
var in []byte
|
||||
if err := stream.(grpc.ClientStream).RecvMsg(&in); err != nil {
|
||||
// EOF is a valid error here.
|
||||
if err == io.EOF {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("/BenchmarkService/StreamingCall.(ClientStream).RecvMsg(_) = %v, want <nil>", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewClientConn creates a gRPC client connection to addr.
|
||||
func NewClientConn(addr string) *grpc.ClientConn {
|
||||
conn, err := grpc.Dial(addr, grpc.WithInsecure())
|
||||
func NewClientConn(addr string, opts ...grpc.DialOption) *grpc.ClientConn {
|
||||
conn, err := grpc.Dial(addr, opts...)
|
||||
if err != nil {
|
||||
grpclog.Fatalf("NewClientConn(%q) failed to create a ClientConn %v", addr, err)
|
||||
}
|
||||
|
@ -10,15 +10,16 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
testpb "google.golang.org/grpc/benchmark/grpc_testing"
|
||||
"google.golang.org/grpc/benchmark/stats"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
)
|
||||
|
||||
func runUnary(b *testing.B, maxConcurrentCalls int) {
|
||||
s := stats.AddStats(b, 38)
|
||||
b.StopTimer()
|
||||
target, stopper := StartServer("localhost:0")
|
||||
target, stopper := StartServer(ServerInfo{Addr: "localhost:0", Type: "protobuf"})
|
||||
defer stopper()
|
||||
conn := NewClientConn(target)
|
||||
tc := testpb.NewTestServiceClient(conn)
|
||||
conn := NewClientConn(target, grpc.WithInsecure())
|
||||
tc := testpb.NewBenchmarkServiceClient(conn)
|
||||
|
||||
// Warm up connection.
|
||||
for i := 0; i < 10; i++ {
|
||||
@ -58,10 +59,10 @@ func runUnary(b *testing.B, maxConcurrentCalls int) {
|
||||
func runStream(b *testing.B, maxConcurrentCalls int) {
|
||||
s := stats.AddStats(b, 38)
|
||||
b.StopTimer()
|
||||
target, stopper := StartServer("localhost:0")
|
||||
target, stopper := StartServer(ServerInfo{Addr: "localhost:0", Type: "protobuf"})
|
||||
defer stopper()
|
||||
conn := NewClientConn(target)
|
||||
tc := testpb.NewTestServiceClient(conn)
|
||||
conn := NewClientConn(target, grpc.WithInsecure())
|
||||
tc := testpb.NewBenchmarkServiceClient(conn)
|
||||
|
||||
// Warm up connection.
|
||||
stream, err := tc.StreamingCall(context.Background())
|
||||
@ -69,7 +70,7 @@ func runStream(b *testing.B, maxConcurrentCalls int) {
|
||||
b.Fatalf("%v.StreamingCall(_) = _, %v", tc, err)
|
||||
}
|
||||
for i := 0; i < 10; i++ {
|
||||
streamCaller(tc, stream)
|
||||
streamCaller(stream)
|
||||
}
|
||||
|
||||
ch := make(chan int, maxConcurrentCalls*4)
|
||||
@ -88,7 +89,7 @@ func runStream(b *testing.B, maxConcurrentCalls int) {
|
||||
}
|
||||
for range ch {
|
||||
start := time.Now()
|
||||
streamCaller(tc, stream)
|
||||
streamCaller(stream)
|
||||
elapse := time.Since(start)
|
||||
mu.Lock()
|
||||
s.Add(elapse)
|
||||
@ -106,12 +107,16 @@ func runStream(b *testing.B, maxConcurrentCalls int) {
|
||||
wg.Wait()
|
||||
conn.Close()
|
||||
}
|
||||
func unaryCaller(client testpb.TestServiceClient) {
|
||||
DoUnaryCall(client, 1, 1)
|
||||
func unaryCaller(client testpb.BenchmarkServiceClient) {
|
||||
if err := DoUnaryCall(client, 1, 1); err != nil {
|
||||
grpclog.Fatalf("DoUnaryCall failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func streamCaller(client testpb.TestServiceClient, stream testpb.TestService_StreamingCallClient) {
|
||||
DoStreamingRoundTrip(client, stream, 1, 1)
|
||||
func streamCaller(stream testpb.BenchmarkService_StreamingCallClient) {
|
||||
if err := DoStreamingRoundTrip(stream, 1, 1); err != nil {
|
||||
grpclog.Fatalf("DoStreamingRoundTrip failed: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkClientStreamc1(b *testing.B) {
|
||||
|
@ -28,18 +28,18 @@ var (
|
||||
1 : streaming call.`)
|
||||
)
|
||||
|
||||
func unaryCaller(client testpb.TestServiceClient) {
|
||||
func unaryCaller(client testpb.BenchmarkServiceClient) {
|
||||
benchmark.DoUnaryCall(client, 1, 1)
|
||||
}
|
||||
|
||||
func streamCaller(client testpb.TestServiceClient, stream testpb.TestService_StreamingCallClient) {
|
||||
benchmark.DoStreamingRoundTrip(client, stream, 1, 1)
|
||||
func streamCaller(stream testpb.BenchmarkService_StreamingCallClient) {
|
||||
benchmark.DoStreamingRoundTrip(stream, 1, 1)
|
||||
}
|
||||
|
||||
func buildConnection() (s *stats.Stats, conn *grpc.ClientConn, tc testpb.TestServiceClient) {
|
||||
func buildConnection() (s *stats.Stats, conn *grpc.ClientConn, tc testpb.BenchmarkServiceClient) {
|
||||
s = stats.NewStats(256)
|
||||
conn = benchmark.NewClientConn(*server)
|
||||
tc = testpb.NewTestServiceClient(conn)
|
||||
tc = testpb.NewBenchmarkServiceClient(conn)
|
||||
return s, conn, tc
|
||||
}
|
||||
|
||||
@ -107,11 +107,11 @@ func closeLoopStream() {
|
||||
}
|
||||
// Do some warm up.
|
||||
for i := 0; i < 100; i++ {
|
||||
streamCaller(tc, stream)
|
||||
streamCaller(stream)
|
||||
}
|
||||
for range ch {
|
||||
start := time.Now()
|
||||
streamCaller(tc, stream)
|
||||
streamCaller(stream)
|
||||
elapse := time.Since(start)
|
||||
mu.Lock()
|
||||
s.Add(elapse)
|
||||
|
973
benchmark/grpc_testing/control.pb.go
Normal file
973
benchmark/grpc_testing/control.pb.go
Normal file
@ -0,0 +1,973 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: control.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package grpc_testing is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
control.proto
|
||||
messages.proto
|
||||
payloads.proto
|
||||
services.proto
|
||||
stats.proto
|
||||
|
||||
It has these top-level messages:
|
||||
PoissonParams
|
||||
UniformParams
|
||||
DeterministicParams
|
||||
ParetoParams
|
||||
ClosedLoopParams
|
||||
LoadParams
|
||||
SecurityParams
|
||||
ClientConfig
|
||||
ClientStatus
|
||||
Mark
|
||||
ClientArgs
|
||||
ServerConfig
|
||||
ServerArgs
|
||||
ServerStatus
|
||||
CoreRequest
|
||||
CoreResponse
|
||||
Void
|
||||
Scenario
|
||||
Scenarios
|
||||
Payload
|
||||
EchoStatus
|
||||
SimpleRequest
|
||||
SimpleResponse
|
||||
StreamingInputCallRequest
|
||||
StreamingInputCallResponse
|
||||
ResponseParameters
|
||||
StreamingOutputCallRequest
|
||||
StreamingOutputCallResponse
|
||||
ReconnectParams
|
||||
ReconnectInfo
|
||||
ByteBufferParams
|
||||
SimpleProtoParams
|
||||
ComplexProtoParams
|
||||
PayloadConfig
|
||||
ServerStats
|
||||
HistogramParams
|
||||
HistogramData
|
||||
ClientStats
|
||||
*/
|
||||
package grpc_testing
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
const _ = proto.ProtoPackageIsVersion1
|
||||
|
||||
type ClientType int32
|
||||
|
||||
const (
|
||||
ClientType_SYNC_CLIENT ClientType = 0
|
||||
ClientType_ASYNC_CLIENT ClientType = 1
|
||||
)
|
||||
|
||||
var ClientType_name = map[int32]string{
|
||||
0: "SYNC_CLIENT",
|
||||
1: "ASYNC_CLIENT",
|
||||
}
|
||||
var ClientType_value = map[string]int32{
|
||||
"SYNC_CLIENT": 0,
|
||||
"ASYNC_CLIENT": 1,
|
||||
}
|
||||
|
||||
func (x ClientType) String() string {
|
||||
return proto.EnumName(ClientType_name, int32(x))
|
||||
}
|
||||
func (ClientType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
type ServerType int32
|
||||
|
||||
const (
|
||||
ServerType_SYNC_SERVER ServerType = 0
|
||||
ServerType_ASYNC_SERVER ServerType = 1
|
||||
ServerType_ASYNC_GENERIC_SERVER ServerType = 2
|
||||
)
|
||||
|
||||
var ServerType_name = map[int32]string{
|
||||
0: "SYNC_SERVER",
|
||||
1: "ASYNC_SERVER",
|
||||
2: "ASYNC_GENERIC_SERVER",
|
||||
}
|
||||
var ServerType_value = map[string]int32{
|
||||
"SYNC_SERVER": 0,
|
||||
"ASYNC_SERVER": 1,
|
||||
"ASYNC_GENERIC_SERVER": 2,
|
||||
}
|
||||
|
||||
func (x ServerType) String() string {
|
||||
return proto.EnumName(ServerType_name, int32(x))
|
||||
}
|
||||
func (ServerType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
type RpcType int32
|
||||
|
||||
const (
|
||||
RpcType_UNARY RpcType = 0
|
||||
RpcType_STREAMING RpcType = 1
|
||||
)
|
||||
|
||||
var RpcType_name = map[int32]string{
|
||||
0: "UNARY",
|
||||
1: "STREAMING",
|
||||
}
|
||||
var RpcType_value = map[string]int32{
|
||||
"UNARY": 0,
|
||||
"STREAMING": 1,
|
||||
}
|
||||
|
||||
func (x RpcType) String() string {
|
||||
return proto.EnumName(RpcType_name, int32(x))
|
||||
}
|
||||
func (RpcType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
|
||||
// Parameters of poisson process distribution, which is a good representation
|
||||
// of activity coming in from independent identical stationary sources.
|
||||
type PoissonParams struct {
|
||||
// The rate of arrivals (a.k.a. lambda parameter of the exp distribution).
|
||||
OfferedLoad float64 `protobuf:"fixed64,1,opt,name=offered_load,json=offeredLoad" json:"offered_load,omitempty"`
|
||||
}
|
||||
|
||||
func (m *PoissonParams) Reset() { *m = PoissonParams{} }
|
||||
func (m *PoissonParams) String() string { return proto.CompactTextString(m) }
|
||||
func (*PoissonParams) ProtoMessage() {}
|
||||
func (*PoissonParams) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
type UniformParams struct {
|
||||
InterarrivalLo float64 `protobuf:"fixed64,1,opt,name=interarrival_lo,json=interarrivalLo" json:"interarrival_lo,omitempty"`
|
||||
InterarrivalHi float64 `protobuf:"fixed64,2,opt,name=interarrival_hi,json=interarrivalHi" json:"interarrival_hi,omitempty"`
|
||||
}
|
||||
|
||||
func (m *UniformParams) Reset() { *m = UniformParams{} }
|
||||
func (m *UniformParams) String() string { return proto.CompactTextString(m) }
|
||||
func (*UniformParams) ProtoMessage() {}
|
||||
func (*UniformParams) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
type DeterministicParams struct {
|
||||
OfferedLoad float64 `protobuf:"fixed64,1,opt,name=offered_load,json=offeredLoad" json:"offered_load,omitempty"`
|
||||
}
|
||||
|
||||
func (m *DeterministicParams) Reset() { *m = DeterministicParams{} }
|
||||
func (m *DeterministicParams) String() string { return proto.CompactTextString(m) }
|
||||
func (*DeterministicParams) ProtoMessage() {}
|
||||
func (*DeterministicParams) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
|
||||
type ParetoParams struct {
|
||||
InterarrivalBase float64 `protobuf:"fixed64,1,opt,name=interarrival_base,json=interarrivalBase" json:"interarrival_base,omitempty"`
|
||||
Alpha float64 `protobuf:"fixed64,2,opt,name=alpha" json:"alpha,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ParetoParams) Reset() { *m = ParetoParams{} }
|
||||
func (m *ParetoParams) String() string { return proto.CompactTextString(m) }
|
||||
func (*ParetoParams) ProtoMessage() {}
|
||||
func (*ParetoParams) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
|
||||
|
||||
// Once an RPC finishes, immediately start a new one.
|
||||
// No configuration parameters needed.
|
||||
type ClosedLoopParams struct {
|
||||
}
|
||||
|
||||
func (m *ClosedLoopParams) Reset() { *m = ClosedLoopParams{} }
|
||||
func (m *ClosedLoopParams) String() string { return proto.CompactTextString(m) }
|
||||
func (*ClosedLoopParams) ProtoMessage() {}
|
||||
func (*ClosedLoopParams) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
|
||||
|
||||
type LoadParams struct {
|
||||
// Types that are valid to be assigned to Load:
|
||||
// *LoadParams_ClosedLoop
|
||||
// *LoadParams_Poisson
|
||||
// *LoadParams_Uniform
|
||||
// *LoadParams_Determ
|
||||
// *LoadParams_Pareto
|
||||
Load isLoadParams_Load `protobuf_oneof:"load"`
|
||||
}
|
||||
|
||||
func (m *LoadParams) Reset() { *m = LoadParams{} }
|
||||
func (m *LoadParams) String() string { return proto.CompactTextString(m) }
|
||||
func (*LoadParams) ProtoMessage() {}
|
||||
func (*LoadParams) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
|
||||
|
||||
type isLoadParams_Load interface {
|
||||
isLoadParams_Load()
|
||||
}
|
||||
|
||||
type LoadParams_ClosedLoop struct {
|
||||
ClosedLoop *ClosedLoopParams `protobuf:"bytes,1,opt,name=closed_loop,json=closedLoop,oneof"`
|
||||
}
|
||||
type LoadParams_Poisson struct {
|
||||
Poisson *PoissonParams `protobuf:"bytes,2,opt,name=poisson,oneof"`
|
||||
}
|
||||
type LoadParams_Uniform struct {
|
||||
Uniform *UniformParams `protobuf:"bytes,3,opt,name=uniform,oneof"`
|
||||
}
|
||||
type LoadParams_Determ struct {
|
||||
Determ *DeterministicParams `protobuf:"bytes,4,opt,name=determ,oneof"`
|
||||
}
|
||||
type LoadParams_Pareto struct {
|
||||
Pareto *ParetoParams `protobuf:"bytes,5,opt,name=pareto,oneof"`
|
||||
}
|
||||
|
||||
func (*LoadParams_ClosedLoop) isLoadParams_Load() {}
|
||||
func (*LoadParams_Poisson) isLoadParams_Load() {}
|
||||
func (*LoadParams_Uniform) isLoadParams_Load() {}
|
||||
func (*LoadParams_Determ) isLoadParams_Load() {}
|
||||
func (*LoadParams_Pareto) isLoadParams_Load() {}
|
||||
|
||||
func (m *LoadParams) GetLoad() isLoadParams_Load {
|
||||
if m != nil {
|
||||
return m.Load
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LoadParams) GetClosedLoop() *ClosedLoopParams {
|
||||
if x, ok := m.GetLoad().(*LoadParams_ClosedLoop); ok {
|
||||
return x.ClosedLoop
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LoadParams) GetPoisson() *PoissonParams {
|
||||
if x, ok := m.GetLoad().(*LoadParams_Poisson); ok {
|
||||
return x.Poisson
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LoadParams) GetUniform() *UniformParams {
|
||||
if x, ok := m.GetLoad().(*LoadParams_Uniform); ok {
|
||||
return x.Uniform
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LoadParams) GetDeterm() *DeterministicParams {
|
||||
if x, ok := m.GetLoad().(*LoadParams_Determ); ok {
|
||||
return x.Determ
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LoadParams) GetPareto() *ParetoParams {
|
||||
if x, ok := m.GetLoad().(*LoadParams_Pareto); ok {
|
||||
return x.Pareto
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*LoadParams) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
|
||||
return _LoadParams_OneofMarshaler, _LoadParams_OneofUnmarshaler, _LoadParams_OneofSizer, []interface{}{
|
||||
(*LoadParams_ClosedLoop)(nil),
|
||||
(*LoadParams_Poisson)(nil),
|
||||
(*LoadParams_Uniform)(nil),
|
||||
(*LoadParams_Determ)(nil),
|
||||
(*LoadParams_Pareto)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _LoadParams_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*LoadParams)
|
||||
// load
|
||||
switch x := m.Load.(type) {
|
||||
case *LoadParams_ClosedLoop:
|
||||
b.EncodeVarint(1<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.ClosedLoop); err != nil {
|
||||
return err
|
||||
}
|
||||
case *LoadParams_Poisson:
|
||||
b.EncodeVarint(2<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.Poisson); err != nil {
|
||||
return err
|
||||
}
|
||||
case *LoadParams_Uniform:
|
||||
b.EncodeVarint(3<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.Uniform); err != nil {
|
||||
return err
|
||||
}
|
||||
case *LoadParams_Determ:
|
||||
b.EncodeVarint(4<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.Determ); err != nil {
|
||||
return err
|
||||
}
|
||||
case *LoadParams_Pareto:
|
||||
b.EncodeVarint(5<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.Pareto); err != nil {
|
||||
return err
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("LoadParams.Load has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _LoadParams_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*LoadParams)
|
||||
switch tag {
|
||||
case 1: // load.closed_loop
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(ClosedLoopParams)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Load = &LoadParams_ClosedLoop{msg}
|
||||
return true, err
|
||||
case 2: // load.poisson
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(PoissonParams)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Load = &LoadParams_Poisson{msg}
|
||||
return true, err
|
||||
case 3: // load.uniform
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(UniformParams)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Load = &LoadParams_Uniform{msg}
|
||||
return true, err
|
||||
case 4: // load.determ
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(DeterministicParams)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Load = &LoadParams_Determ{msg}
|
||||
return true, err
|
||||
case 5: // load.pareto
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(ParetoParams)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Load = &LoadParams_Pareto{msg}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _LoadParams_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*LoadParams)
|
||||
// load
|
||||
switch x := m.Load.(type) {
|
||||
case *LoadParams_ClosedLoop:
|
||||
s := proto.Size(x.ClosedLoop)
|
||||
n += proto.SizeVarint(1<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *LoadParams_Poisson:
|
||||
s := proto.Size(x.Poisson)
|
||||
n += proto.SizeVarint(2<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *LoadParams_Uniform:
|
||||
s := proto.Size(x.Uniform)
|
||||
n += proto.SizeVarint(3<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *LoadParams_Determ:
|
||||
s := proto.Size(x.Determ)
|
||||
n += proto.SizeVarint(4<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *LoadParams_Pareto:
|
||||
s := proto.Size(x.Pareto)
|
||||
n += proto.SizeVarint(5<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
// presence of SecurityParams implies use of TLS
|
||||
type SecurityParams struct {
|
||||
UseTestCa bool `protobuf:"varint,1,opt,name=use_test_ca,json=useTestCa" json:"use_test_ca,omitempty"`
|
||||
ServerHostOverride string `protobuf:"bytes,2,opt,name=server_host_override,json=serverHostOverride" json:"server_host_override,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SecurityParams) Reset() { *m = SecurityParams{} }
|
||||
func (m *SecurityParams) String() string { return proto.CompactTextString(m) }
|
||||
func (*SecurityParams) ProtoMessage() {}
|
||||
func (*SecurityParams) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
|
||||
|
||||
type ClientConfig struct {
|
||||
// List of targets to connect to. At least one target needs to be specified.
|
||||
ServerTargets []string `protobuf:"bytes,1,rep,name=server_targets,json=serverTargets" json:"server_targets,omitempty"`
|
||||
ClientType ClientType `protobuf:"varint,2,opt,name=client_type,json=clientType,enum=grpc.testing.ClientType" json:"client_type,omitempty"`
|
||||
SecurityParams *SecurityParams `protobuf:"bytes,3,opt,name=security_params,json=securityParams" json:"security_params,omitempty"`
|
||||
// How many concurrent RPCs to start for each channel.
|
||||
// For synchronous client, use a separate thread for each outstanding RPC.
|
||||
OutstandingRpcsPerChannel int32 `protobuf:"varint,4,opt,name=outstanding_rpcs_per_channel,json=outstandingRpcsPerChannel" json:"outstanding_rpcs_per_channel,omitempty"`
|
||||
// Number of independent client channels to create.
|
||||
// i-th channel will connect to server_target[i % server_targets.size()]
|
||||
ClientChannels int32 `protobuf:"varint,5,opt,name=client_channels,json=clientChannels" json:"client_channels,omitempty"`
|
||||
// Only for async client. Number of threads to use to start/manage RPCs.
|
||||
AsyncClientThreads int32 `protobuf:"varint,7,opt,name=async_client_threads,json=asyncClientThreads" json:"async_client_threads,omitempty"`
|
||||
RpcType RpcType `protobuf:"varint,8,opt,name=rpc_type,json=rpcType,enum=grpc.testing.RpcType" json:"rpc_type,omitempty"`
|
||||
// The requested load for the entire client (aggregated over all the threads).
|
||||
LoadParams *LoadParams `protobuf:"bytes,10,opt,name=load_params,json=loadParams" json:"load_params,omitempty"`
|
||||
PayloadConfig *PayloadConfig `protobuf:"bytes,11,opt,name=payload_config,json=payloadConfig" json:"payload_config,omitempty"`
|
||||
HistogramParams *HistogramParams `protobuf:"bytes,12,opt,name=histogram_params,json=histogramParams" json:"histogram_params,omitempty"`
|
||||
// Specify the cores we should run the client on, if desired
|
||||
CoreList []int32 `protobuf:"varint,13,rep,name=core_list,json=coreList" json:"core_list,omitempty"`
|
||||
CoreLimit int32 `protobuf:"varint,14,opt,name=core_limit,json=coreLimit" json:"core_limit,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ClientConfig) Reset() { *m = ClientConfig{} }
|
||||
func (m *ClientConfig) String() string { return proto.CompactTextString(m) }
|
||||
func (*ClientConfig) ProtoMessage() {}
|
||||
func (*ClientConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
|
||||
|
||||
func (m *ClientConfig) GetSecurityParams() *SecurityParams {
|
||||
if m != nil {
|
||||
return m.SecurityParams
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ClientConfig) GetLoadParams() *LoadParams {
|
||||
if m != nil {
|
||||
return m.LoadParams
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ClientConfig) GetPayloadConfig() *PayloadConfig {
|
||||
if m != nil {
|
||||
return m.PayloadConfig
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ClientConfig) GetHistogramParams() *HistogramParams {
|
||||
if m != nil {
|
||||
return m.HistogramParams
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ClientStatus struct {
|
||||
Stats *ClientStats `protobuf:"bytes,1,opt,name=stats" json:"stats,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ClientStatus) Reset() { *m = ClientStatus{} }
|
||||
func (m *ClientStatus) String() string { return proto.CompactTextString(m) }
|
||||
func (*ClientStatus) ProtoMessage() {}
|
||||
func (*ClientStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
|
||||
|
||||
func (m *ClientStatus) GetStats() *ClientStats {
|
||||
if m != nil {
|
||||
return m.Stats
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Request current stats
|
||||
type Mark struct {
|
||||
// if true, the stats will be reset after taking their snapshot.
|
||||
Reset_ bool `protobuf:"varint,1,opt,name=reset" json:"reset,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Mark) Reset() { *m = Mark{} }
|
||||
func (m *Mark) String() string { return proto.CompactTextString(m) }
|
||||
func (*Mark) ProtoMessage() {}
|
||||
func (*Mark) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
|
||||
|
||||
type ClientArgs struct {
|
||||
// Types that are valid to be assigned to Argtype:
|
||||
// *ClientArgs_Setup
|
||||
// *ClientArgs_Mark
|
||||
Argtype isClientArgs_Argtype `protobuf_oneof:"argtype"`
|
||||
}
|
||||
|
||||
func (m *ClientArgs) Reset() { *m = ClientArgs{} }
|
||||
func (m *ClientArgs) String() string { return proto.CompactTextString(m) }
|
||||
func (*ClientArgs) ProtoMessage() {}
|
||||
func (*ClientArgs) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
|
||||
|
||||
type isClientArgs_Argtype interface {
|
||||
isClientArgs_Argtype()
|
||||
}
|
||||
|
||||
type ClientArgs_Setup struct {
|
||||
Setup *ClientConfig `protobuf:"bytes,1,opt,name=setup,oneof"`
|
||||
}
|
||||
type ClientArgs_Mark struct {
|
||||
Mark *Mark `protobuf:"bytes,2,opt,name=mark,oneof"`
|
||||
}
|
||||
|
||||
func (*ClientArgs_Setup) isClientArgs_Argtype() {}
|
||||
func (*ClientArgs_Mark) isClientArgs_Argtype() {}
|
||||
|
||||
func (m *ClientArgs) GetArgtype() isClientArgs_Argtype {
|
||||
if m != nil {
|
||||
return m.Argtype
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ClientArgs) GetSetup() *ClientConfig {
|
||||
if x, ok := m.GetArgtype().(*ClientArgs_Setup); ok {
|
||||
return x.Setup
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ClientArgs) GetMark() *Mark {
|
||||
if x, ok := m.GetArgtype().(*ClientArgs_Mark); ok {
|
||||
return x.Mark
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*ClientArgs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
|
||||
return _ClientArgs_OneofMarshaler, _ClientArgs_OneofUnmarshaler, _ClientArgs_OneofSizer, []interface{}{
|
||||
(*ClientArgs_Setup)(nil),
|
||||
(*ClientArgs_Mark)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _ClientArgs_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*ClientArgs)
|
||||
// argtype
|
||||
switch x := m.Argtype.(type) {
|
||||
case *ClientArgs_Setup:
|
||||
b.EncodeVarint(1<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.Setup); err != nil {
|
||||
return err
|
||||
}
|
||||
case *ClientArgs_Mark:
|
||||
b.EncodeVarint(2<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.Mark); err != nil {
|
||||
return err
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("ClientArgs.Argtype has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _ClientArgs_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*ClientArgs)
|
||||
switch tag {
|
||||
case 1: // argtype.setup
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(ClientConfig)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Argtype = &ClientArgs_Setup{msg}
|
||||
return true, err
|
||||
case 2: // argtype.mark
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(Mark)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Argtype = &ClientArgs_Mark{msg}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _ClientArgs_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*ClientArgs)
|
||||
// argtype
|
||||
switch x := m.Argtype.(type) {
|
||||
case *ClientArgs_Setup:
|
||||
s := proto.Size(x.Setup)
|
||||
n += proto.SizeVarint(1<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *ClientArgs_Mark:
|
||||
s := proto.Size(x.Mark)
|
||||
n += proto.SizeVarint(2<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
type ServerConfig struct {
|
||||
ServerType ServerType `protobuf:"varint,1,opt,name=server_type,json=serverType,enum=grpc.testing.ServerType" json:"server_type,omitempty"`
|
||||
SecurityParams *SecurityParams `protobuf:"bytes,2,opt,name=security_params,json=securityParams" json:"security_params,omitempty"`
|
||||
// Port on which to listen. Zero means pick unused port.
|
||||
Port int32 `protobuf:"varint,4,opt,name=port" json:"port,omitempty"`
|
||||
// Only for async server. Number of threads used to serve the requests.
|
||||
AsyncServerThreads int32 `protobuf:"varint,7,opt,name=async_server_threads,json=asyncServerThreads" json:"async_server_threads,omitempty"`
|
||||
// Specify the number of cores to limit server to, if desired
|
||||
CoreLimit int32 `protobuf:"varint,8,opt,name=core_limit,json=coreLimit" json:"core_limit,omitempty"`
|
||||
// payload config, used in generic server
|
||||
PayloadConfig *PayloadConfig `protobuf:"bytes,9,opt,name=payload_config,json=payloadConfig" json:"payload_config,omitempty"`
|
||||
// Specify the cores we should run the server on, if desired
|
||||
CoreList []int32 `protobuf:"varint,10,rep,name=core_list,json=coreList" json:"core_list,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ServerConfig) Reset() { *m = ServerConfig{} }
|
||||
func (m *ServerConfig) String() string { return proto.CompactTextString(m) }
|
||||
func (*ServerConfig) ProtoMessage() {}
|
||||
func (*ServerConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
|
||||
|
||||
func (m *ServerConfig) GetSecurityParams() *SecurityParams {
|
||||
if m != nil {
|
||||
return m.SecurityParams
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ServerConfig) GetPayloadConfig() *PayloadConfig {
|
||||
if m != nil {
|
||||
return m.PayloadConfig
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ServerArgs struct {
|
||||
// Types that are valid to be assigned to Argtype:
|
||||
// *ServerArgs_Setup
|
||||
// *ServerArgs_Mark
|
||||
Argtype isServerArgs_Argtype `protobuf_oneof:"argtype"`
|
||||
}
|
||||
|
||||
func (m *ServerArgs) Reset() { *m = ServerArgs{} }
|
||||
func (m *ServerArgs) String() string { return proto.CompactTextString(m) }
|
||||
func (*ServerArgs) ProtoMessage() {}
|
||||
func (*ServerArgs) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} }
|
||||
|
||||
type isServerArgs_Argtype interface {
|
||||
isServerArgs_Argtype()
|
||||
}
|
||||
|
||||
type ServerArgs_Setup struct {
|
||||
Setup *ServerConfig `protobuf:"bytes,1,opt,name=setup,oneof"`
|
||||
}
|
||||
type ServerArgs_Mark struct {
|
||||
Mark *Mark `protobuf:"bytes,2,opt,name=mark,oneof"`
|
||||
}
|
||||
|
||||
func (*ServerArgs_Setup) isServerArgs_Argtype() {}
|
||||
func (*ServerArgs_Mark) isServerArgs_Argtype() {}
|
||||
|
||||
func (m *ServerArgs) GetArgtype() isServerArgs_Argtype {
|
||||
if m != nil {
|
||||
return m.Argtype
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ServerArgs) GetSetup() *ServerConfig {
|
||||
if x, ok := m.GetArgtype().(*ServerArgs_Setup); ok {
|
||||
return x.Setup
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ServerArgs) GetMark() *Mark {
|
||||
if x, ok := m.GetArgtype().(*ServerArgs_Mark); ok {
|
||||
return x.Mark
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*ServerArgs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
|
||||
return _ServerArgs_OneofMarshaler, _ServerArgs_OneofUnmarshaler, _ServerArgs_OneofSizer, []interface{}{
|
||||
(*ServerArgs_Setup)(nil),
|
||||
(*ServerArgs_Mark)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _ServerArgs_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*ServerArgs)
|
||||
// argtype
|
||||
switch x := m.Argtype.(type) {
|
||||
case *ServerArgs_Setup:
|
||||
b.EncodeVarint(1<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.Setup); err != nil {
|
||||
return err
|
||||
}
|
||||
case *ServerArgs_Mark:
|
||||
b.EncodeVarint(2<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.Mark); err != nil {
|
||||
return err
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("ServerArgs.Argtype has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _ServerArgs_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*ServerArgs)
|
||||
switch tag {
|
||||
case 1: // argtype.setup
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(ServerConfig)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Argtype = &ServerArgs_Setup{msg}
|
||||
return true, err
|
||||
case 2: // argtype.mark
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(Mark)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Argtype = &ServerArgs_Mark{msg}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _ServerArgs_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*ServerArgs)
|
||||
// argtype
|
||||
switch x := m.Argtype.(type) {
|
||||
case *ServerArgs_Setup:
|
||||
s := proto.Size(x.Setup)
|
||||
n += proto.SizeVarint(1<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *ServerArgs_Mark:
|
||||
s := proto.Size(x.Mark)
|
||||
n += proto.SizeVarint(2<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
type ServerStatus struct {
|
||||
Stats *ServerStats `protobuf:"bytes,1,opt,name=stats" json:"stats,omitempty"`
|
||||
// the port bound by the server
|
||||
Port int32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"`
|
||||
// Number of cores available to the server
|
||||
Cores int32 `protobuf:"varint,3,opt,name=cores" json:"cores,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ServerStatus) Reset() { *m = ServerStatus{} }
|
||||
func (m *ServerStatus) String() string { return proto.CompactTextString(m) }
|
||||
func (*ServerStatus) ProtoMessage() {}
|
||||
func (*ServerStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
|
||||
|
||||
func (m *ServerStatus) GetStats() *ServerStats {
|
||||
if m != nil {
|
||||
return m.Stats
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CoreRequest struct {
|
||||
}
|
||||
|
||||
func (m *CoreRequest) Reset() { *m = CoreRequest{} }
|
||||
func (m *CoreRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*CoreRequest) ProtoMessage() {}
|
||||
func (*CoreRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }
|
||||
|
||||
type CoreResponse struct {
|
||||
// Number of cores available on the server
|
||||
Cores int32 `protobuf:"varint,1,opt,name=cores" json:"cores,omitempty"`
|
||||
}
|
||||
|
||||
func (m *CoreResponse) Reset() { *m = CoreResponse{} }
|
||||
func (m *CoreResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*CoreResponse) ProtoMessage() {}
|
||||
func (*CoreResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }
|
||||
|
||||
type Void struct {
|
||||
}
|
||||
|
||||
func (m *Void) Reset() { *m = Void{} }
|
||||
func (m *Void) String() string { return proto.CompactTextString(m) }
|
||||
func (*Void) ProtoMessage() {}
|
||||
func (*Void) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} }
|
||||
|
||||
// A single performance scenario: input to qps_json_driver
|
||||
type Scenario struct {
|
||||
// Human readable name for this scenario
|
||||
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
|
||||
// Client configuration
|
||||
ClientConfig *ClientConfig `protobuf:"bytes,2,opt,name=client_config,json=clientConfig" json:"client_config,omitempty"`
|
||||
// Number of clients to start for the test
|
||||
NumClients int32 `protobuf:"varint,3,opt,name=num_clients,json=numClients" json:"num_clients,omitempty"`
|
||||
// Server configuration
|
||||
ServerConfig *ServerConfig `protobuf:"bytes,4,opt,name=server_config,json=serverConfig" json:"server_config,omitempty"`
|
||||
// Number of servers to start for the test
|
||||
NumServers int32 `protobuf:"varint,5,opt,name=num_servers,json=numServers" json:"num_servers,omitempty"`
|
||||
// Warmup period, in seconds
|
||||
WarmupSeconds int32 `protobuf:"varint,6,opt,name=warmup_seconds,json=warmupSeconds" json:"warmup_seconds,omitempty"`
|
||||
// Benchmark time, in seconds
|
||||
BenchmarkSeconds int32 `protobuf:"varint,7,opt,name=benchmark_seconds,json=benchmarkSeconds" json:"benchmark_seconds,omitempty"`
|
||||
// Number of workers to spawn locally (usually zero)
|
||||
SpawnLocalWorkerCount int32 `protobuf:"varint,8,opt,name=spawn_local_worker_count,json=spawnLocalWorkerCount" json:"spawn_local_worker_count,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Scenario) Reset() { *m = Scenario{} }
|
||||
func (m *Scenario) String() string { return proto.CompactTextString(m) }
|
||||
func (*Scenario) ProtoMessage() {}
|
||||
func (*Scenario) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} }
|
||||
|
||||
func (m *Scenario) GetClientConfig() *ClientConfig {
|
||||
if m != nil {
|
||||
return m.ClientConfig
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Scenario) GetServerConfig() *ServerConfig {
|
||||
if m != nil {
|
||||
return m.ServerConfig
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// A set of scenarios to be run with qps_json_driver
|
||||
type Scenarios struct {
|
||||
Scenarios []*Scenario `protobuf:"bytes,1,rep,name=scenarios" json:"scenarios,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Scenarios) Reset() { *m = Scenarios{} }
|
||||
func (m *Scenarios) String() string { return proto.CompactTextString(m) }
|
||||
func (*Scenarios) ProtoMessage() {}
|
||||
func (*Scenarios) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }
|
||||
|
||||
func (m *Scenarios) GetScenarios() []*Scenario {
|
||||
if m != nil {
|
||||
return m.Scenarios
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*PoissonParams)(nil), "grpc.testing.PoissonParams")
|
||||
proto.RegisterType((*UniformParams)(nil), "grpc.testing.UniformParams")
|
||||
proto.RegisterType((*DeterministicParams)(nil), "grpc.testing.DeterministicParams")
|
||||
proto.RegisterType((*ParetoParams)(nil), "grpc.testing.ParetoParams")
|
||||
proto.RegisterType((*ClosedLoopParams)(nil), "grpc.testing.ClosedLoopParams")
|
||||
proto.RegisterType((*LoadParams)(nil), "grpc.testing.LoadParams")
|
||||
proto.RegisterType((*SecurityParams)(nil), "grpc.testing.SecurityParams")
|
||||
proto.RegisterType((*ClientConfig)(nil), "grpc.testing.ClientConfig")
|
||||
proto.RegisterType((*ClientStatus)(nil), "grpc.testing.ClientStatus")
|
||||
proto.RegisterType((*Mark)(nil), "grpc.testing.Mark")
|
||||
proto.RegisterType((*ClientArgs)(nil), "grpc.testing.ClientArgs")
|
||||
proto.RegisterType((*ServerConfig)(nil), "grpc.testing.ServerConfig")
|
||||
proto.RegisterType((*ServerArgs)(nil), "grpc.testing.ServerArgs")
|
||||
proto.RegisterType((*ServerStatus)(nil), "grpc.testing.ServerStatus")
|
||||
proto.RegisterType((*CoreRequest)(nil), "grpc.testing.CoreRequest")
|
||||
proto.RegisterType((*CoreResponse)(nil), "grpc.testing.CoreResponse")
|
||||
proto.RegisterType((*Void)(nil), "grpc.testing.Void")
|
||||
proto.RegisterType((*Scenario)(nil), "grpc.testing.Scenario")
|
||||
proto.RegisterType((*Scenarios)(nil), "grpc.testing.Scenarios")
|
||||
proto.RegisterEnum("grpc.testing.ClientType", ClientType_name, ClientType_value)
|
||||
proto.RegisterEnum("grpc.testing.ServerType", ServerType_name, ServerType_value)
|
||||
proto.RegisterEnum("grpc.testing.RpcType", RpcType_name, RpcType_value)
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 1162 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x56, 0xdd, 0x6e, 0xdb, 0x46,
|
||||
0x13, 0x8d, 0x14, 0xc9, 0x96, 0x86, 0x92, 0xac, 0x6f, 0xbf, 0xa4, 0x60, 0x1c, 0x27, 0x6d, 0xd8,
|
||||
0x16, 0x0d, 0x5c, 0xc0, 0x29, 0xd4, 0x02, 0x69, 0xd1, 0x8b, 0x40, 0x56, 0x85, 0xd8, 0x80, 0xe3,
|
||||
0xba, 0x2b, 0x27, 0x45, 0xae, 0x08, 0x9a, 0x5a, 0x4b, 0x44, 0x24, 0x2e, 0xbb, 0x4b, 0xc6, 0xf0,
|
||||
0x2b, 0xf4, 0x99, 0xfa, 0x1c, 0x7d, 0x8d, 0xbe, 0x42, 0x67, 0xff, 0x64, 0x52, 0x11, 0x10, 0xb7,
|
||||
0xbd, 0xe3, 0xce, 0x9c, 0xb3, 0x3b, 0x3b, 0x67, 0x66, 0x96, 0xd0, 0x8d, 0x79, 0x9a, 0x0b, 0xbe,
|
||||
0x38, 0xc8, 0x04, 0xcf, 0x39, 0xe9, 0xcc, 0x44, 0x16, 0x1f, 0xe4, 0x4c, 0xe6, 0x49, 0x3a, 0xdb,
|
||||
0xed, 0x65, 0xd1, 0xf5, 0x82, 0x47, 0x53, 0x69, 0xbc, 0xbb, 0x9e, 0xcc, 0xa3, 0xdc, 0x2e, 0x82,
|
||||
0x01, 0x74, 0xcf, 0x78, 0x22, 0x25, 0x4f, 0xcf, 0x22, 0x11, 0x2d, 0x25, 0x79, 0x02, 0x1d, 0x7e,
|
||||
0x79, 0xc9, 0x04, 0x9b, 0x86, 0x8a, 0xe4, 0xd7, 0x3e, 0xab, 0x3d, 0xad, 0x51, 0xcf, 0xda, 0x4e,
|
||||
0xd0, 0x14, 0x44, 0xd0, 0x7d, 0x9d, 0x26, 0x97, 0x5c, 0x2c, 0x2d, 0xe7, 0x2b, 0xd8, 0x49, 0xd2,
|
||||
0x9c, 0x89, 0x48, 0x88, 0xe4, 0x7d, 0xb4, 0x40, 0xa2, 0xa5, 0xf5, 0xca, 0xe6, 0x13, 0xfe, 0x01,
|
||||
0x70, 0x9e, 0xf8, 0xf5, 0x0f, 0x81, 0x47, 0x49, 0xf0, 0x3d, 0xfc, 0xff, 0x27, 0x86, 0x96, 0x65,
|
||||
0x92, 0x26, 0x78, 0x8b, 0xf8, 0xf6, 0xc1, 0xfd, 0x02, 0x1d, 0x04, 0xb3, 0x9c, 0x5b, 0xca, 0xd7,
|
||||
0xf0, 0xbf, 0xca, 0x91, 0x17, 0x91, 0x64, 0x96, 0xd7, 0x2f, 0x3b, 0x0e, 0xd1, 0x4e, 0xee, 0x41,
|
||||
0x33, 0x5a, 0x64, 0xf3, 0xc8, 0x46, 0x65, 0x16, 0x01, 0x81, 0xfe, 0x68, 0xc1, 0xa5, 0x3a, 0x80,
|
||||
0x67, 0x66, 0xdb, 0xe0, 0x8f, 0x3a, 0x80, 0x3a, 0xcf, 0x9e, 0x32, 0x04, 0x2f, 0xd6, 0x10, 0x8c,
|
||||
0x8b, 0x67, 0x7a, 0x7f, 0x6f, 0xf0, 0xf8, 0xa0, 0xac, 0xc3, 0xc1, 0xfa, 0x1e, 0x47, 0x77, 0x28,
|
||||
0xc4, 0x2b, 0x1b, 0x79, 0x0e, 0xdb, 0x99, 0x51, 0x42, 0x9f, 0xee, 0x0d, 0x1e, 0x56, 0xe9, 0x15,
|
||||
0x99, 0x90, 0xeb, 0xd0, 0x8a, 0x58, 0x18, 0x39, 0xfc, 0xbb, 0x9b, 0x88, 0x15, 0xad, 0x14, 0xd1,
|
||||
0xa2, 0xc9, 0x8f, 0xb0, 0x35, 0xd5, 0x49, 0xf6, 0x1b, 0x9a, 0xf7, 0xa4, 0xca, 0xdb, 0x20, 0x00,
|
||||
0xb2, 0x2d, 0x85, 0x7c, 0x07, 0x5b, 0x99, 0xce, 0xb3, 0xdf, 0xd4, 0xe4, 0xdd, 0xb5, 0x68, 0x4b,
|
||||
0x1a, 0x28, 0x96, 0xc1, 0x1e, 0x6e, 0x41, 0x43, 0x09, 0x17, 0x5c, 0x40, 0x6f, 0xc2, 0xe2, 0x42,
|
||||
0x24, 0xf9, 0xb5, 0xcd, 0xe0, 0x63, 0xf0, 0x0a, 0xc9, 0x42, 0xc5, 0x0f, 0xe3, 0x48, 0x67, 0xb0,
|
||||
0x45, 0xdb, 0x68, 0x3a, 0x47, 0xcb, 0x28, 0x22, 0xdf, 0xc0, 0x3d, 0xc9, 0xc4, 0x7b, 0x26, 0xc2,
|
||||
0x39, 0x47, 0x08, 0xc7, 0x2f, 0x91, 0x4c, 0x99, 0xce, 0x55, 0x9b, 0x12, 0xe3, 0x3b, 0x42, 0xd7,
|
||||
0xcf, 0xd6, 0x13, 0xfc, 0xde, 0x84, 0xce, 0x68, 0x91, 0xb0, 0x34, 0x1f, 0xf1, 0xf4, 0x32, 0x99,
|
||||
0x91, 0x2f, 0xa1, 0x67, 0xb7, 0xc8, 0x23, 0x31, 0x63, 0xb9, 0xc4, 0x53, 0xee, 0x22, 0xb9, 0x6b,
|
||||
0xac, 0xe7, 0xc6, 0x48, 0x7e, 0x50, 0x5a, 0x2a, 0x5a, 0x98, 0x5f, 0x67, 0xe6, 0x80, 0xde, 0xc0,
|
||||
0x5f, 0xd7, 0x52, 0x01, 0xce, 0xd1, 0xaf, 0x34, 0x74, 0xdf, 0x64, 0x0c, 0x3b, 0xd2, 0x5e, 0x2b,
|
||||
0xcc, 0xf4, 0xbd, 0xac, 0x24, 0x7b, 0x55, 0x7a, 0xf5, 0xee, 0xb4, 0x27, 0xab, 0xb9, 0x78, 0x01,
|
||||
0x7b, 0xbc, 0xc8, 0xb1, 0x4d, 0xd3, 0x29, 0xa2, 0x43, 0x64, 0xca, 0x30, 0xc3, 0xb0, 0xe3, 0x79,
|
||||
0x94, 0xa6, 0x6c, 0xa1, 0xe5, 0x6a, 0xd2, 0x07, 0x25, 0x0c, 0x45, 0xc8, 0x19, 0x13, 0x23, 0x03,
|
||||
0x50, 0x7d, 0x66, 0xaf, 0x60, 0x29, 0x52, 0xab, 0xd4, 0xa4, 0x3d, 0x63, 0xb6, 0x38, 0xa9, 0xb2,
|
||||
0x1a, 0xc9, 0xeb, 0x34, 0x0e, 0xdd, 0x8d, 0xe7, 0x82, 0xe1, 0xa4, 0xf0, 0xb7, 0x35, 0x9a, 0x68,
|
||||
0x9f, 0xbd, 0xab, 0xf1, 0x20, 0xa3, 0x85, 0xf1, 0x98, 0xd4, 0xb4, 0x74, 0x6a, 0xee, 0x57, 0xef,
|
||||
0x86, 0xa1, 0xe8, 0xbc, 0x6c, 0x0b, 0xf3, 0xa1, 0xf2, 0xa9, 0x34, 0x77, 0x09, 0x01, 0x9d, 0x90,
|
||||
0xb5, 0x7c, 0xde, 0xb4, 0x12, 0x85, 0xc5, 0x4d, 0x5b, 0x1d, 0x82, 0x1b, 0x5e, 0x61, 0xac, 0x35,
|
||||
0xf4, 0xbd, 0x8d, 0xad, 0x61, 0x30, 0x46, 0x66, 0xda, 0xcd, 0xca, 0x4b, 0x72, 0x04, 0xfd, 0x39,
|
||||
0x96, 0x30, 0x9f, 0xe1, 0x8e, 0x2e, 0x86, 0x8e, 0xde, 0xe5, 0x51, 0x75, 0x97, 0x23, 0x87, 0xb2,
|
||||
0x81, 0xec, 0xcc, 0xab, 0x06, 0xf2, 0x10, 0xda, 0x31, 0x17, 0x2c, 0x5c, 0xa0, 0xdd, 0xef, 0x62,
|
||||
0xe9, 0x34, 0x69, 0x4b, 0x19, 0x4e, 0x70, 0x4d, 0x1e, 0x01, 0x58, 0xe7, 0x32, 0xc9, 0xfd, 0x9e,
|
||||
0xce, 0x5f, 0xdb, 0x78, 0xd1, 0x10, 0xbc, 0x70, 0xb5, 0x38, 0xc1, 0xe1, 0x5b, 0x48, 0xf2, 0x0c,
|
||||
0x9a, 0x7a, 0x0c, 0xdb, 0x51, 0xf1, 0x60, 0x53, 0x79, 0x29, 0xa8, 0xa4, 0x06, 0x17, 0xec, 0x41,
|
||||
0xe3, 0x55, 0x24, 0xde, 0xa9, 0x11, 0x25, 0x98, 0x64, 0xb9, 0xed, 0x10, 0xb3, 0x08, 0x0a, 0x00,
|
||||
0xc3, 0x19, 0x8a, 0x99, 0x24, 0x03, 0xdc, 0x9c, 0xe5, 0x85, 0x9b, 0x43, 0xbb, 0x9b, 0x36, 0x37,
|
||||
0xd9, 0xc1, 0xd6, 0x34, 0x50, 0xf2, 0x14, 0x1a, 0x4b, 0xdc, 0xdf, 0xce, 0x1e, 0x52, 0xa5, 0xa8,
|
||||
0x93, 0x11, 0xaa, 0x11, 0x87, 0x6d, 0xd8, 0xc6, 0x4e, 0x51, 0x05, 0x10, 0xfc, 0x59, 0x87, 0xce,
|
||||
0x44, 0x37, 0x8f, 0x4d, 0x36, 0x6a, 0xed, 0x5a, 0x4c, 0x15, 0x48, 0x6d, 0x53, 0xef, 0x18, 0x82,
|
||||
0xe9, 0x1d, 0xb9, 0xfa, 0xde, 0xd4, 0x3b, 0xf5, 0x7f, 0xd1, 0x3b, 0x04, 0x1a, 0x19, 0x17, 0xb9,
|
||||
0xed, 0x11, 0xfd, 0x7d, 0x53, 0xe5, 0x2e, 0xb6, 0x0d, 0x55, 0x6e, 0xa3, 0xb2, 0x55, 0x5e, 0x55,
|
||||
0xb3, 0xb5, 0xa6, 0xe6, 0x86, 0xba, 0x6c, 0xff, 0xe3, 0xba, 0xac, 0x54, 0x13, 0x54, 0xab, 0x49,
|
||||
0xe9, 0x69, 0x02, 0xba, 0x85, 0x9e, 0x65, 0x01, 0xfe, 0xa3, 0x9e, 0x89, 0x93, 0xf3, 0x56, 0x55,
|
||||
0x7a, 0x03, 0x75, 0x55, 0xba, 0xca, 0x7e, 0xbd, 0x94, 0x7d, 0xac, 0x58, 0x75, 0x2f, 0x33, 0x0a,
|
||||
0x9b, 0xd4, 0x2c, 0x82, 0x2e, 0x78, 0x23, 0xfc, 0xa0, 0xec, 0xb7, 0x02, 0xb7, 0x0b, 0xbe, 0xc0,
|
||||
0xfe, 0xd0, 0x4b, 0x99, 0xf1, 0xd4, 0xbc, 0xc4, 0x86, 0x54, 0x2b, 0x93, 0xf0, 0xf9, 0x78, 0xc3,
|
||||
0x93, 0x69, 0xf0, 0x57, 0x1d, 0x5a, 0x93, 0x98, 0xa5, 0x91, 0x48, 0xb8, 0x3a, 0x33, 0x8d, 0x96,
|
||||
0xa6, 0xd8, 0xda, 0x54, 0x7f, 0xe3, 0x04, 0xed, 0xba, 0x01, 0x68, 0xf4, 0xa9, 0x7f, 0xac, 0x13,
|
||||
0x68, 0x27, 0x2e, 0xbf, 0x15, 0x9f, 0x82, 0x97, 0x16, 0x4b, 0x3b, 0x16, 0x5d, 0xe8, 0x80, 0x26,
|
||||
0xc3, 0x51, 0x33, 0xda, 0x3e, 0x1b, 0xee, 0x84, 0xc6, 0xc7, 0xb4, 0xa1, 0x1d, 0x59, 0x6e, 0x15,
|
||||
0x7b, 0x82, 0xb1, 0xb9, 0xf9, 0xac, 0x4e, 0x30, 0x1c, 0xa9, 0x9e, 0xab, 0xab, 0x48, 0x2c, 0x8b,
|
||||
0x0c, 0x31, 0x78, 0x06, 0xd6, 0xeb, 0x96, 0xc6, 0x74, 0x8d, 0x75, 0x62, 0x8c, 0xea, 0x07, 0xe7,
|
||||
0x82, 0xa5, 0xf1, 0x5c, 0x69, 0xb9, 0x42, 0x9a, 0xca, 0xee, 0xaf, 0x1c, 0x0e, 0xfc, 0x1c, 0x7c,
|
||||
0x99, 0x45, 0x57, 0x29, 0xfe, 0xa6, 0xc4, 0xf8, 0x33, 0x74, 0xc5, 0xc5, 0x3b, 0x7d, 0x83, 0x22,
|
||||
0x75, 0x55, 0x7e, 0x5f, 0xfb, 0x4f, 0x94, 0xfb, 0x57, 0xed, 0x1d, 0x29, 0x67, 0x30, 0x84, 0xb6,
|
||||
0x4b, 0xb8, 0xc4, 0xb7, 0xbf, 0x2d, 0xdd, 0x42, 0xbf, 0xa1, 0xde, 0xe0, 0x93, 0xb5, 0x7b, 0x5b,
|
||||
0x37, 0xbd, 0x01, 0xee, 0x3f, 0x73, 0x33, 0x4a, 0xb7, 0xfb, 0x0e, 0x78, 0x93, 0xb7, 0xa7, 0xa3,
|
||||
0x70, 0x74, 0x72, 0x3c, 0x3e, 0x3d, 0xef, 0xdf, 0x21, 0x7d, 0xe8, 0x0c, 0xcb, 0x96, 0xda, 0xfe,
|
||||
0xb1, 0x6b, 0x82, 0x0a, 0x61, 0x32, 0xa6, 0x6f, 0xc6, 0xb4, 0x4c, 0xb0, 0x96, 0x1a, 0xf1, 0xe1,
|
||||
0x9e, 0xb1, 0xbc, 0x1c, 0x9f, 0x8e, 0xe9, 0xf1, 0xca, 0x53, 0xdf, 0xff, 0x1c, 0xb6, 0xed, 0xbb,
|
||||
0x44, 0xda, 0xd0, 0x7c, 0x7d, 0x3a, 0xa4, 0x6f, 0x71, 0x87, 0x2e, 0x5e, 0xea, 0x9c, 0x8e, 0x87,
|
||||
0xaf, 0x8e, 0x4f, 0x5f, 0xf6, 0x6b, 0x17, 0x5b, 0xfa, 0x97, 0xf8, 0xdb, 0xbf, 0x03, 0x00, 0x00,
|
||||
0xff, 0xff, 0x75, 0x59, 0xf4, 0x03, 0x4e, 0x0b, 0x00, 0x00,
|
||||
}
|
201
benchmark/grpc_testing/control.proto
Normal file
201
benchmark/grpc_testing/control.proto
Normal file
@ -0,0 +1,201 @@
|
||||
// Copyright 2016, 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
import "payloads.proto";
|
||||
import "stats.proto";
|
||||
|
||||
package grpc.testing;
|
||||
|
||||
enum ClientType {
|
||||
SYNC_CLIENT = 0;
|
||||
ASYNC_CLIENT = 1;
|
||||
}
|
||||
|
||||
enum ServerType {
|
||||
SYNC_SERVER = 0;
|
||||
ASYNC_SERVER = 1;
|
||||
ASYNC_GENERIC_SERVER = 2;
|
||||
}
|
||||
|
||||
enum RpcType {
|
||||
UNARY = 0;
|
||||
STREAMING = 1;
|
||||
}
|
||||
|
||||
// Parameters of poisson process distribution, which is a good representation
|
||||
// of activity coming in from independent identical stationary sources.
|
||||
message PoissonParams {
|
||||
// The rate of arrivals (a.k.a. lambda parameter of the exp distribution).
|
||||
double offered_load = 1;
|
||||
}
|
||||
|
||||
message UniformParams {
|
||||
double interarrival_lo = 1;
|
||||
double interarrival_hi = 2;
|
||||
}
|
||||
|
||||
message DeterministicParams {
|
||||
double offered_load = 1;
|
||||
}
|
||||
|
||||
message ParetoParams {
|
||||
double interarrival_base = 1;
|
||||
double alpha = 2;
|
||||
}
|
||||
|
||||
// Once an RPC finishes, immediately start a new one.
|
||||
// No configuration parameters needed.
|
||||
message ClosedLoopParams {
|
||||
}
|
||||
|
||||
message LoadParams {
|
||||
oneof load {
|
||||
ClosedLoopParams closed_loop = 1;
|
||||
PoissonParams poisson = 2;
|
||||
UniformParams uniform = 3;
|
||||
DeterministicParams determ = 4;
|
||||
ParetoParams pareto = 5;
|
||||
};
|
||||
}
|
||||
|
||||
// presence of SecurityParams implies use of TLS
|
||||
message SecurityParams {
|
||||
bool use_test_ca = 1;
|
||||
string server_host_override = 2;
|
||||
}
|
||||
|
||||
message ClientConfig {
|
||||
// List of targets to connect to. At least one target needs to be specified.
|
||||
repeated string server_targets = 1;
|
||||
ClientType client_type = 2;
|
||||
SecurityParams security_params = 3;
|
||||
// How many concurrent RPCs to start for each channel.
|
||||
// For synchronous client, use a separate thread for each outstanding RPC.
|
||||
int32 outstanding_rpcs_per_channel = 4;
|
||||
// Number of independent client channels to create.
|
||||
// i-th channel will connect to server_target[i % server_targets.size()]
|
||||
int32 client_channels = 5;
|
||||
// Only for async client. Number of threads to use to start/manage RPCs.
|
||||
int32 async_client_threads = 7;
|
||||
RpcType rpc_type = 8;
|
||||
// The requested load for the entire client (aggregated over all the threads).
|
||||
LoadParams load_params = 10;
|
||||
PayloadConfig payload_config = 11;
|
||||
HistogramParams histogram_params = 12;
|
||||
|
||||
// Specify the cores we should run the client on, if desired
|
||||
repeated int32 core_list = 13;
|
||||
int32 core_limit = 14;
|
||||
}
|
||||
|
||||
message ClientStatus {
|
||||
ClientStats stats = 1;
|
||||
}
|
||||
|
||||
// Request current stats
|
||||
message Mark {
|
||||
// if true, the stats will be reset after taking their snapshot.
|
||||
bool reset = 1;
|
||||
}
|
||||
|
||||
message ClientArgs {
|
||||
oneof argtype {
|
||||
ClientConfig setup = 1;
|
||||
Mark mark = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ServerConfig {
|
||||
ServerType server_type = 1;
|
||||
SecurityParams security_params = 2;
|
||||
// Port on which to listen. Zero means pick unused port.
|
||||
int32 port = 4;
|
||||
// Only for async server. Number of threads used to serve the requests.
|
||||
int32 async_server_threads = 7;
|
||||
// Specify the number of cores to limit server to, if desired
|
||||
int32 core_limit = 8;
|
||||
// payload config, used in generic server
|
||||
PayloadConfig payload_config = 9;
|
||||
|
||||
// Specify the cores we should run the server on, if desired
|
||||
repeated int32 core_list = 10;
|
||||
}
|
||||
|
||||
message ServerArgs {
|
||||
oneof argtype {
|
||||
ServerConfig setup = 1;
|
||||
Mark mark = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ServerStatus {
|
||||
ServerStats stats = 1;
|
||||
// the port bound by the server
|
||||
int32 port = 2;
|
||||
// Number of cores available to the server
|
||||
int32 cores = 3;
|
||||
}
|
||||
|
||||
message CoreRequest {
|
||||
}
|
||||
|
||||
message CoreResponse {
|
||||
// Number of cores available on the server
|
||||
int32 cores = 1;
|
||||
}
|
||||
|
||||
message Void {
|
||||
}
|
||||
|
||||
// A single performance scenario: input to qps_json_driver
|
||||
message Scenario {
|
||||
// Human readable name for this scenario
|
||||
string name = 1;
|
||||
// Client configuration
|
||||
ClientConfig client_config = 2;
|
||||
// Number of clients to start for the test
|
||||
int32 num_clients = 3;
|
||||
// Server configuration
|
||||
ServerConfig server_config = 4;
|
||||
// Number of servers to start for the test
|
||||
int32 num_servers = 5;
|
||||
// Warmup period, in seconds
|
||||
int32 warmup_seconds = 6;
|
||||
// Benchmark time, in seconds
|
||||
int32 benchmark_seconds = 7;
|
||||
// Number of workers to spawn locally (usually zero)
|
||||
int32 spawn_local_worker_count = 8;
|
||||
}
|
||||
|
||||
// A set of scenarios to be run with qps_json_driver
|
||||
message Scenarios {
|
||||
repeated Scenario scenarios = 1;
|
||||
}
|
345
benchmark/grpc_testing/messages.pb.go
Normal file
345
benchmark/grpc_testing/messages.pb.go
Normal file
@ -0,0 +1,345 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: messages.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package grpc_testing
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// The type of payload that should be returned.
|
||||
type PayloadType int32
|
||||
|
||||
const (
|
||||
// Compressable text format.
|
||||
PayloadType_COMPRESSABLE PayloadType = 0
|
||||
// Uncompressable binary format.
|
||||
PayloadType_UNCOMPRESSABLE PayloadType = 1
|
||||
// Randomly chosen from all other formats defined in this enum.
|
||||
PayloadType_RANDOM PayloadType = 2
|
||||
)
|
||||
|
||||
var PayloadType_name = map[int32]string{
|
||||
0: "COMPRESSABLE",
|
||||
1: "UNCOMPRESSABLE",
|
||||
2: "RANDOM",
|
||||
}
|
||||
var PayloadType_value = map[string]int32{
|
||||
"COMPRESSABLE": 0,
|
||||
"UNCOMPRESSABLE": 1,
|
||||
"RANDOM": 2,
|
||||
}
|
||||
|
||||
func (x PayloadType) String() string {
|
||||
return proto.EnumName(PayloadType_name, int32(x))
|
||||
}
|
||||
func (PayloadType) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
|
||||
|
||||
// Compression algorithms
|
||||
type CompressionType int32
|
||||
|
||||
const (
|
||||
// No compression
|
||||
CompressionType_NONE CompressionType = 0
|
||||
CompressionType_GZIP CompressionType = 1
|
||||
CompressionType_DEFLATE CompressionType = 2
|
||||
)
|
||||
|
||||
var CompressionType_name = map[int32]string{
|
||||
0: "NONE",
|
||||
1: "GZIP",
|
||||
2: "DEFLATE",
|
||||
}
|
||||
var CompressionType_value = map[string]int32{
|
||||
"NONE": 0,
|
||||
"GZIP": 1,
|
||||
"DEFLATE": 2,
|
||||
}
|
||||
|
||||
func (x CompressionType) String() string {
|
||||
return proto.EnumName(CompressionType_name, int32(x))
|
||||
}
|
||||
func (CompressionType) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{1} }
|
||||
|
||||
// A block of data, to simply increase gRPC message size.
|
||||
type Payload struct {
|
||||
// The type of data in body.
|
||||
Type PayloadType `protobuf:"varint,1,opt,name=type,enum=grpc.testing.PayloadType" json:"type,omitempty"`
|
||||
// Primary contents of payload.
|
||||
Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Payload) Reset() { *m = Payload{} }
|
||||
func (m *Payload) String() string { return proto.CompactTextString(m) }
|
||||
func (*Payload) ProtoMessage() {}
|
||||
func (*Payload) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
|
||||
|
||||
// A protobuf representation for grpc status. This is used by test
|
||||
// clients to specify a status that the server should attempt to return.
|
||||
type EchoStatus struct {
|
||||
Code int32 `protobuf:"varint,1,opt,name=code" json:"code,omitempty"`
|
||||
Message string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
|
||||
}
|
||||
|
||||
func (m *EchoStatus) Reset() { *m = EchoStatus{} }
|
||||
func (m *EchoStatus) String() string { return proto.CompactTextString(m) }
|
||||
func (*EchoStatus) ProtoMessage() {}
|
||||
func (*EchoStatus) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} }
|
||||
|
||||
// Unary request.
|
||||
type SimpleRequest struct {
|
||||
// Desired payload type in the response from the server.
|
||||
// If response_type is RANDOM, server randomly chooses one from other formats.
|
||||
ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,enum=grpc.testing.PayloadType" json:"response_type,omitempty"`
|
||||
// Desired payload size in the response from the server.
|
||||
// If response_type is COMPRESSABLE, this denotes the size before compression.
|
||||
ResponseSize int32 `protobuf:"varint,2,opt,name=response_size,json=responseSize" json:"response_size,omitempty"`
|
||||
// Optional input payload sent along with the request.
|
||||
Payload *Payload `protobuf:"bytes,3,opt,name=payload" json:"payload,omitempty"`
|
||||
// Whether SimpleResponse should include username.
|
||||
FillUsername bool `protobuf:"varint,4,opt,name=fill_username,json=fillUsername" json:"fill_username,omitempty"`
|
||||
// Whether SimpleResponse should include OAuth scope.
|
||||
FillOauthScope bool `protobuf:"varint,5,opt,name=fill_oauth_scope,json=fillOauthScope" json:"fill_oauth_scope,omitempty"`
|
||||
// Compression algorithm to be used by the server for the response (stream)
|
||||
ResponseCompression CompressionType `protobuf:"varint,6,opt,name=response_compression,json=responseCompression,enum=grpc.testing.CompressionType" json:"response_compression,omitempty"`
|
||||
// Whether server should return a given status
|
||||
ResponseStatus *EchoStatus `protobuf:"bytes,7,opt,name=response_status,json=responseStatus" json:"response_status,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SimpleRequest) Reset() { *m = SimpleRequest{} }
|
||||
func (m *SimpleRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleRequest) ProtoMessage() {}
|
||||
func (*SimpleRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} }
|
||||
|
||||
func (m *SimpleRequest) GetPayload() *Payload {
|
||||
if m != nil {
|
||||
return m.Payload
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *SimpleRequest) GetResponseStatus() *EchoStatus {
|
||||
if m != nil {
|
||||
return m.ResponseStatus
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Unary response, as configured by the request.
|
||||
type SimpleResponse struct {
|
||||
// Payload to increase message size.
|
||||
Payload *Payload `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"`
|
||||
// The user the request came from, for verifying authentication was
|
||||
// successful when the client expected it.
|
||||
Username string `protobuf:"bytes,2,opt,name=username" json:"username,omitempty"`
|
||||
// OAuth scope.
|
||||
OauthScope string `protobuf:"bytes,3,opt,name=oauth_scope,json=oauthScope" json:"oauth_scope,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SimpleResponse) Reset() { *m = SimpleResponse{} }
|
||||
func (m *SimpleResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleResponse) ProtoMessage() {}
|
||||
func (*SimpleResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} }
|
||||
|
||||
func (m *SimpleResponse) GetPayload() *Payload {
|
||||
if m != nil {
|
||||
return m.Payload
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Client-streaming request.
|
||||
type StreamingInputCallRequest struct {
|
||||
// Optional input payload sent along with the request.
|
||||
Payload *Payload `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"`
|
||||
}
|
||||
|
||||
func (m *StreamingInputCallRequest) Reset() { *m = StreamingInputCallRequest{} }
|
||||
func (m *StreamingInputCallRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingInputCallRequest) ProtoMessage() {}
|
||||
func (*StreamingInputCallRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{4} }
|
||||
|
||||
func (m *StreamingInputCallRequest) GetPayload() *Payload {
|
||||
if m != nil {
|
||||
return m.Payload
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Client-streaming response.
|
||||
type StreamingInputCallResponse struct {
|
||||
// Aggregated size of payloads received from the client.
|
||||
AggregatedPayloadSize int32 `protobuf:"varint,1,opt,name=aggregated_payload_size,json=aggregatedPayloadSize" json:"aggregated_payload_size,omitempty"`
|
||||
}
|
||||
|
||||
func (m *StreamingInputCallResponse) Reset() { *m = StreamingInputCallResponse{} }
|
||||
func (m *StreamingInputCallResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingInputCallResponse) ProtoMessage() {}
|
||||
func (*StreamingInputCallResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{5} }
|
||||
|
||||
// Configuration for a particular response.
|
||||
type ResponseParameters struct {
|
||||
// Desired payload sizes in responses from the server.
|
||||
// If response_type is COMPRESSABLE, this denotes the size before compression.
|
||||
Size int32 `protobuf:"varint,1,opt,name=size" json:"size,omitempty"`
|
||||
// Desired interval between consecutive responses in the response stream in
|
||||
// microseconds.
|
||||
IntervalUs int32 `protobuf:"varint,2,opt,name=interval_us,json=intervalUs" json:"interval_us,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ResponseParameters) Reset() { *m = ResponseParameters{} }
|
||||
func (m *ResponseParameters) String() string { return proto.CompactTextString(m) }
|
||||
func (*ResponseParameters) ProtoMessage() {}
|
||||
func (*ResponseParameters) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{6} }
|
||||
|
||||
// Server-streaming request.
|
||||
type StreamingOutputCallRequest struct {
|
||||
// Desired payload type in the response from the server.
|
||||
// If response_type is RANDOM, the payload from each response in the stream
|
||||
// might be of different types. This is to simulate a mixed type of payload
|
||||
// stream.
|
||||
ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,json=responseType,enum=grpc.testing.PayloadType" json:"response_type,omitempty"`
|
||||
// Configuration for each expected response message.
|
||||
ResponseParameters []*ResponseParameters `protobuf:"bytes,2,rep,name=response_parameters,json=responseParameters" json:"response_parameters,omitempty"`
|
||||
// Optional input payload sent along with the request.
|
||||
Payload *Payload `protobuf:"bytes,3,opt,name=payload" json:"payload,omitempty"`
|
||||
// Compression algorithm to be used by the server for the response (stream)
|
||||
ResponseCompression CompressionType `protobuf:"varint,6,opt,name=response_compression,json=responseCompression,enum=grpc.testing.CompressionType" json:"response_compression,omitempty"`
|
||||
// Whether server should return a given status
|
||||
ResponseStatus *EchoStatus `protobuf:"bytes,7,opt,name=response_status,json=responseStatus" json:"response_status,omitempty"`
|
||||
}
|
||||
|
||||
func (m *StreamingOutputCallRequest) Reset() { *m = StreamingOutputCallRequest{} }
|
||||
func (m *StreamingOutputCallRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingOutputCallRequest) ProtoMessage() {}
|
||||
func (*StreamingOutputCallRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{7} }
|
||||
|
||||
func (m *StreamingOutputCallRequest) GetResponseParameters() []*ResponseParameters {
|
||||
if m != nil {
|
||||
return m.ResponseParameters
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *StreamingOutputCallRequest) GetPayload() *Payload {
|
||||
if m != nil {
|
||||
return m.Payload
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *StreamingOutputCallRequest) GetResponseStatus() *EchoStatus {
|
||||
if m != nil {
|
||||
return m.ResponseStatus
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Server-streaming response, as configured by the request and parameters.
|
||||
type StreamingOutputCallResponse struct {
|
||||
// Payload to increase response size.
|
||||
Payload *Payload `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"`
|
||||
}
|
||||
|
||||
func (m *StreamingOutputCallResponse) Reset() { *m = StreamingOutputCallResponse{} }
|
||||
func (m *StreamingOutputCallResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*StreamingOutputCallResponse) ProtoMessage() {}
|
||||
func (*StreamingOutputCallResponse) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8} }
|
||||
|
||||
func (m *StreamingOutputCallResponse) GetPayload() *Payload {
|
||||
if m != nil {
|
||||
return m.Payload
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// For reconnect interop test only.
|
||||
// Client tells server what reconnection parameters it used.
|
||||
type ReconnectParams struct {
|
||||
MaxReconnectBackoffMs int32 `protobuf:"varint,1,opt,name=max_reconnect_backoff_ms,json=maxReconnectBackoffMs" json:"max_reconnect_backoff_ms,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ReconnectParams) Reset() { *m = ReconnectParams{} }
|
||||
func (m *ReconnectParams) String() string { return proto.CompactTextString(m) }
|
||||
func (*ReconnectParams) ProtoMessage() {}
|
||||
func (*ReconnectParams) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{9} }
|
||||
|
||||
// For reconnect interop test only.
|
||||
// Server tells client whether its reconnects are following the spec and the
|
||||
// reconnect backoffs it saw.
|
||||
type ReconnectInfo struct {
|
||||
Passed bool `protobuf:"varint,1,opt,name=passed" json:"passed,omitempty"`
|
||||
BackoffMs []int32 `protobuf:"varint,2,rep,name=backoff_ms,json=backoffMs" json:"backoff_ms,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ReconnectInfo) Reset() { *m = ReconnectInfo{} }
|
||||
func (m *ReconnectInfo) String() string { return proto.CompactTextString(m) }
|
||||
func (*ReconnectInfo) ProtoMessage() {}
|
||||
func (*ReconnectInfo) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{10} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Payload)(nil), "grpc.testing.Payload")
|
||||
proto.RegisterType((*EchoStatus)(nil), "grpc.testing.EchoStatus")
|
||||
proto.RegisterType((*SimpleRequest)(nil), "grpc.testing.SimpleRequest")
|
||||
proto.RegisterType((*SimpleResponse)(nil), "grpc.testing.SimpleResponse")
|
||||
proto.RegisterType((*StreamingInputCallRequest)(nil), "grpc.testing.StreamingInputCallRequest")
|
||||
proto.RegisterType((*StreamingInputCallResponse)(nil), "grpc.testing.StreamingInputCallResponse")
|
||||
proto.RegisterType((*ResponseParameters)(nil), "grpc.testing.ResponseParameters")
|
||||
proto.RegisterType((*StreamingOutputCallRequest)(nil), "grpc.testing.StreamingOutputCallRequest")
|
||||
proto.RegisterType((*StreamingOutputCallResponse)(nil), "grpc.testing.StreamingOutputCallResponse")
|
||||
proto.RegisterType((*ReconnectParams)(nil), "grpc.testing.ReconnectParams")
|
||||
proto.RegisterType((*ReconnectInfo)(nil), "grpc.testing.ReconnectInfo")
|
||||
proto.RegisterEnum("grpc.testing.PayloadType", PayloadType_name, PayloadType_value)
|
||||
proto.RegisterEnum("grpc.testing.CompressionType", CompressionType_name, CompressionType_value)
|
||||
}
|
||||
|
||||
var fileDescriptor1 = []byte{
|
||||
// 645 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xcc, 0x55, 0x4d, 0x6f, 0xd3, 0x40,
|
||||
0x10, 0x25, 0xdf, 0xe9, 0x24, 0x4d, 0xa3, 0x85, 0x82, 0x5b, 0x54, 0x51, 0x99, 0x4b, 0x55, 0x89,
|
||||
0x20, 0x15, 0x09, 0x24, 0x0e, 0xa0, 0xb4, 0x4d, 0x51, 0x50, 0x9b, 0x84, 0x75, 0x7b, 0xe1, 0x62,
|
||||
0x6d, 0x9c, 0x4d, 0x1a, 0x11, 0x7b, 0x8d, 0x77, 0x8d, 0x28, 0x07, 0xee, 0xfc, 0x60, 0xee, 0xec,
|
||||
0xae, 0xbd, 0x8e, 0xd3, 0xf6, 0xd0, 0xc2, 0x85, 0xdb, 0xce, 0xcc, 0x9b, 0x97, 0x79, 0x33, 0xcf,
|
||||
0x0a, 0xb4, 0x7c, 0xca, 0x39, 0x99, 0x51, 0xde, 0x09, 0x23, 0x26, 0x18, 0x6a, 0xce, 0xa2, 0xd0,
|
||||
0xeb, 0x08, 0xca, 0xc5, 0x3c, 0x98, 0xd9, 0xa7, 0x50, 0x1b, 0x91, 0xab, 0x05, 0x23, 0x13, 0xf4,
|
||||
0x02, 0xca, 0xe2, 0x2a, 0xa4, 0x56, 0x61, 0xb7, 0xb0, 0xd7, 0x3a, 0xd8, 0xea, 0xe4, 0x71, 0x9d,
|
||||
0x14, 0x74, 0x2e, 0x01, 0x58, 0xc3, 0x10, 0x82, 0xf2, 0x98, 0x4d, 0xae, 0xac, 0xa2, 0x84, 0x37,
|
||||
0xb1, 0x7e, 0xdb, 0x6f, 0x01, 0x7a, 0xde, 0x25, 0x73, 0x04, 0x11, 0x31, 0x57, 0x08, 0x8f, 0x4d,
|
||||
0x12, 0xc2, 0x0a, 0xd6, 0x6f, 0x64, 0x41, 0x2d, 0x9d, 0x47, 0x37, 0xae, 0x61, 0x13, 0xda, 0xbf,
|
||||
0x4a, 0xb0, 0xee, 0xcc, 0xfd, 0x70, 0x41, 0x31, 0xfd, 0x1a, 0xcb, 0x9f, 0x45, 0xef, 0x60, 0x3d,
|
||||
0xa2, 0x3c, 0x64, 0x01, 0xa7, 0xee, 0xdd, 0x26, 0x6b, 0x1a, 0xbc, 0x8a, 0xd0, 0xf3, 0x5c, 0x3f,
|
||||
0x9f, 0xff, 0x48, 0x7e, 0xb1, 0xb2, 0x04, 0x39, 0x32, 0x87, 0x5e, 0x42, 0x2d, 0x4c, 0x18, 0xac,
|
||||
0x92, 0x2c, 0x37, 0x0e, 0x36, 0x6f, 0xa5, 0xc7, 0x06, 0xa5, 0x58, 0xa7, 0xf3, 0xc5, 0xc2, 0x8d,
|
||||
0x39, 0x8d, 0x02, 0xe2, 0x53, 0xab, 0x2c, 0xdb, 0xea, 0xb8, 0xa9, 0x92, 0x17, 0x69, 0x0e, 0xed,
|
||||
0x41, 0x5b, 0x83, 0x18, 0x89, 0xc5, 0xa5, 0xcb, 0x3d, 0x26, 0xa7, 0xaf, 0x68, 0x5c, 0x4b, 0xe5,
|
||||
0x87, 0x2a, 0xed, 0xa8, 0x2c, 0x1a, 0xc1, 0xa3, 0x6c, 0x48, 0x8f, 0xf9, 0xa1, 0x0c, 0xf8, 0x9c,
|
||||
0x05, 0x56, 0x55, 0x6b, 0xdd, 0x59, 0x1d, 0xe6, 0x68, 0x09, 0xd0, 0x7a, 0x1f, 0x9a, 0xd6, 0x5c,
|
||||
0x01, 0x75, 0x61, 0x63, 0x29, 0x5b, 0x5f, 0xc2, 0xaa, 0x69, 0x65, 0xd6, 0x2a, 0xd9, 0xf2, 0x52,
|
||||
0xb8, 0x95, 0xad, 0x44, 0xc7, 0xf6, 0x4f, 0x68, 0x99, 0x53, 0x24, 0xf9, 0xfc, 0x9a, 0x0a, 0x77,
|
||||
0x5a, 0xd3, 0x36, 0xd4, 0xb3, 0x0d, 0x25, 0x97, 0xce, 0x62, 0xf4, 0x0c, 0x1a, 0xf9, 0xc5, 0x94,
|
||||
0x74, 0x19, 0x58, 0xb6, 0x14, 0xe9, 0xca, 0x2d, 0x47, 0x44, 0x94, 0xf8, 0x92, 0xba, 0x1f, 0x84,
|
||||
0xb1, 0x38, 0x22, 0x8b, 0x85, 0xb1, 0xc5, 0x7d, 0x47, 0xb1, 0xcf, 0x61, 0xfb, 0x36, 0xb6, 0x54,
|
||||
0xd9, 0x6b, 0x78, 0x42, 0x66, 0xb3, 0x88, 0xce, 0x88, 0xa0, 0x13, 0x37, 0xed, 0x49, 0xfc, 0x92,
|
||||
0x18, 0x77, 0x73, 0x59, 0x4e, 0xa9, 0x95, 0x71, 0xec, 0x3e, 0x20, 0xc3, 0x31, 0x22, 0x91, 0x94,
|
||||
0x25, 0x68, 0xa4, 0x3d, 0x9f, 0x6b, 0xd5, 0x6f, 0x25, 0x77, 0x1e, 0xc8, 0xea, 0x37, 0xa2, 0x5c,
|
||||
0x93, 0xba, 0x10, 0x4c, 0xea, 0x82, 0xdb, 0xbf, 0x8b, 0xb9, 0x09, 0x87, 0xb1, 0xb8, 0x26, 0xf8,
|
||||
0x5f, 0xbf, 0x83, 0x4f, 0x90, 0xf9, 0x44, 0xea, 0x33, 0xa3, 0xca, 0x39, 0x4a, 0x72, 0x79, 0xbb,
|
||||
0xab, 0x2c, 0x37, 0x25, 0x61, 0x14, 0xdd, 0x94, 0x79, 0xef, 0xaf, 0xe6, 0xbf, 0xb4, 0xf9, 0x00,
|
||||
0x9e, 0xde, 0xba, 0xf6, 0xbf, 0xf4, 0xbc, 0xfd, 0x11, 0x36, 0x30, 0xf5, 0x58, 0x10, 0x50, 0x4f,
|
||||
0xe8, 0x65, 0x71, 0xf4, 0x06, 0x2c, 0x9f, 0x7c, 0x77, 0x23, 0x93, 0x76, 0xc7, 0xc4, 0xfb, 0xc2,
|
||||
0xa6, 0x53, 0xd7, 0xe7, 0xc6, 0x5e, 0xb2, 0x9e, 0x75, 0x1d, 0x26, 0xd5, 0x33, 0x6e, 0x9f, 0xc0,
|
||||
0x7a, 0x96, 0xed, 0x07, 0x53, 0x86, 0x1e, 0x43, 0x35, 0x24, 0x9c, 0xd3, 0x64, 0x98, 0x3a, 0x4e,
|
||||
0x23, 0xb4, 0x03, 0x90, 0xe3, 0x54, 0x47, 0xad, 0xe0, 0xb5, 0xb1, 0xe1, 0xd9, 0x7f, 0x0f, 0x8d,
|
||||
0x9c, 0x33, 0x50, 0x1b, 0x9a, 0x47, 0xc3, 0xb3, 0x11, 0xee, 0x39, 0x4e, 0xf7, 0xf0, 0xb4, 0xd7,
|
||||
0x7e, 0x20, 0x1d, 0xdb, 0xba, 0x18, 0xac, 0xe4, 0x0a, 0x08, 0xa0, 0x8a, 0xbb, 0x83, 0xe3, 0xe1,
|
||||
0x59, 0xbb, 0xb8, 0x7f, 0x00, 0x1b, 0xd7, 0xee, 0x81, 0xea, 0x50, 0x1e, 0x0c, 0x07, 0xaa, 0x59,
|
||||
0xbe, 0x3e, 0x7c, 0xee, 0x8f, 0x64, 0x4b, 0x03, 0x6a, 0xc7, 0xbd, 0x93, 0xd3, 0xee, 0x79, 0xaf,
|
||||
0x5d, 0x1c, 0x57, 0xf5, 0x5f, 0xcd, 0xab, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc2, 0x6a, 0xce,
|
||||
0x1e, 0x7c, 0x06, 0x00, 0x00,
|
||||
}
|
172
benchmark/grpc_testing/messages.proto
Normal file
172
benchmark/grpc_testing/messages.proto
Normal file
@ -0,0 +1,172 @@
|
||||
// Copyright 2016, 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.
|
||||
|
||||
// Message definitions to be used by integration test service definitions.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package grpc.testing;
|
||||
|
||||
// The type of payload that should be returned.
|
||||
enum PayloadType {
|
||||
// Compressable text format.
|
||||
COMPRESSABLE = 0;
|
||||
|
||||
// Uncompressable binary format.
|
||||
UNCOMPRESSABLE = 1;
|
||||
|
||||
// Randomly chosen from all other formats defined in this enum.
|
||||
RANDOM = 2;
|
||||
}
|
||||
|
||||
// Compression algorithms
|
||||
enum CompressionType {
|
||||
// No compression
|
||||
NONE = 0;
|
||||
GZIP = 1;
|
||||
DEFLATE = 2;
|
||||
}
|
||||
|
||||
// A block of data, to simply increase gRPC message size.
|
||||
message Payload {
|
||||
// The type of data in body.
|
||||
PayloadType type = 1;
|
||||
// Primary contents of payload.
|
||||
bytes body = 2;
|
||||
}
|
||||
|
||||
// A protobuf representation for grpc status. This is used by test
|
||||
// clients to specify a status that the server should attempt to return.
|
||||
message EchoStatus {
|
||||
int32 code = 1;
|
||||
string message = 2;
|
||||
}
|
||||
|
||||
// Unary request.
|
||||
message SimpleRequest {
|
||||
// Desired payload type in the response from the server.
|
||||
// If response_type is RANDOM, server randomly chooses one from other formats.
|
||||
PayloadType response_type = 1;
|
||||
|
||||
// Desired payload size in the response from the server.
|
||||
// If response_type is COMPRESSABLE, this denotes the size before compression.
|
||||
int32 response_size = 2;
|
||||
|
||||
// Optional input payload sent along with the request.
|
||||
Payload payload = 3;
|
||||
|
||||
// Whether SimpleResponse should include username.
|
||||
bool fill_username = 4;
|
||||
|
||||
// Whether SimpleResponse should include OAuth scope.
|
||||
bool fill_oauth_scope = 5;
|
||||
|
||||
// Compression algorithm to be used by the server for the response (stream)
|
||||
CompressionType response_compression = 6;
|
||||
|
||||
// Whether server should return a given status
|
||||
EchoStatus response_status = 7;
|
||||
}
|
||||
|
||||
// Unary response, as configured by the request.
|
||||
message SimpleResponse {
|
||||
// Payload to increase message size.
|
||||
Payload payload = 1;
|
||||
// The user the request came from, for verifying authentication was
|
||||
// successful when the client expected it.
|
||||
string username = 2;
|
||||
// OAuth scope.
|
||||
string oauth_scope = 3;
|
||||
}
|
||||
|
||||
// Client-streaming request.
|
||||
message StreamingInputCallRequest {
|
||||
// Optional input payload sent along with the request.
|
||||
Payload payload = 1;
|
||||
|
||||
// Not expecting any payload from the response.
|
||||
}
|
||||
|
||||
// Client-streaming response.
|
||||
message StreamingInputCallResponse {
|
||||
// Aggregated size of payloads received from the client.
|
||||
int32 aggregated_payload_size = 1;
|
||||
}
|
||||
|
||||
// Configuration for a particular response.
|
||||
message ResponseParameters {
|
||||
// Desired payload sizes in responses from the server.
|
||||
// If response_type is COMPRESSABLE, this denotes the size before compression.
|
||||
int32 size = 1;
|
||||
|
||||
// Desired interval between consecutive responses in the response stream in
|
||||
// microseconds.
|
||||
int32 interval_us = 2;
|
||||
}
|
||||
|
||||
// Server-streaming request.
|
||||
message StreamingOutputCallRequest {
|
||||
// Desired payload type in the response from the server.
|
||||
// If response_type is RANDOM, the payload from each response in the stream
|
||||
// might be of different types. This is to simulate a mixed type of payload
|
||||
// stream.
|
||||
PayloadType response_type = 1;
|
||||
|
||||
// Configuration for each expected response message.
|
||||
repeated ResponseParameters response_parameters = 2;
|
||||
|
||||
// Optional input payload sent along with the request.
|
||||
Payload payload = 3;
|
||||
|
||||
// Compression algorithm to be used by the server for the response (stream)
|
||||
CompressionType response_compression = 6;
|
||||
|
||||
// Whether server should return a given status
|
||||
EchoStatus response_status = 7;
|
||||
}
|
||||
|
||||
// Server-streaming response, as configured by the request and parameters.
|
||||
message StreamingOutputCallResponse {
|
||||
// Payload to increase response size.
|
||||
Payload payload = 1;
|
||||
}
|
||||
|
||||
// For reconnect interop test only.
|
||||
// Client tells server what reconnection parameters it used.
|
||||
message ReconnectParams {
|
||||
int32 max_reconnect_backoff_ms = 1;
|
||||
}
|
||||
|
||||
// For reconnect interop test only.
|
||||
// Server tells client whether its reconnects are following the spec and the
|
||||
// reconnect backoffs it saw.
|
||||
message ReconnectInfo {
|
||||
bool passed = 1;
|
||||
repeated int32 backoff_ms = 2;
|
||||
}
|
221
benchmark/grpc_testing/payloads.pb.go
Normal file
221
benchmark/grpc_testing/payloads.pb.go
Normal file
@ -0,0 +1,221 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: payloads.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package grpc_testing
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
type ByteBufferParams struct {
|
||||
ReqSize int32 `protobuf:"varint,1,opt,name=req_size,json=reqSize" json:"req_size,omitempty"`
|
||||
RespSize int32 `protobuf:"varint,2,opt,name=resp_size,json=respSize" json:"resp_size,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ByteBufferParams) Reset() { *m = ByteBufferParams{} }
|
||||
func (m *ByteBufferParams) String() string { return proto.CompactTextString(m) }
|
||||
func (*ByteBufferParams) ProtoMessage() {}
|
||||
func (*ByteBufferParams) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{0} }
|
||||
|
||||
type SimpleProtoParams struct {
|
||||
ReqSize int32 `protobuf:"varint,1,opt,name=req_size,json=reqSize" json:"req_size,omitempty"`
|
||||
RespSize int32 `protobuf:"varint,2,opt,name=resp_size,json=respSize" json:"resp_size,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SimpleProtoParams) Reset() { *m = SimpleProtoParams{} }
|
||||
func (m *SimpleProtoParams) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleProtoParams) ProtoMessage() {}
|
||||
func (*SimpleProtoParams) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{1} }
|
||||
|
||||
type ComplexProtoParams struct {
|
||||
}
|
||||
|
||||
func (m *ComplexProtoParams) Reset() { *m = ComplexProtoParams{} }
|
||||
func (m *ComplexProtoParams) String() string { return proto.CompactTextString(m) }
|
||||
func (*ComplexProtoParams) ProtoMessage() {}
|
||||
func (*ComplexProtoParams) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{2} }
|
||||
|
||||
type PayloadConfig struct {
|
||||
// Types that are valid to be assigned to Payload:
|
||||
// *PayloadConfig_BytebufParams
|
||||
// *PayloadConfig_SimpleParams
|
||||
// *PayloadConfig_ComplexParams
|
||||
Payload isPayloadConfig_Payload `protobuf_oneof:"payload"`
|
||||
}
|
||||
|
||||
func (m *PayloadConfig) Reset() { *m = PayloadConfig{} }
|
||||
func (m *PayloadConfig) String() string { return proto.CompactTextString(m) }
|
||||
func (*PayloadConfig) ProtoMessage() {}
|
||||
func (*PayloadConfig) Descriptor() ([]byte, []int) { return fileDescriptor2, []int{3} }
|
||||
|
||||
type isPayloadConfig_Payload interface {
|
||||
isPayloadConfig_Payload()
|
||||
}
|
||||
|
||||
type PayloadConfig_BytebufParams struct {
|
||||
BytebufParams *ByteBufferParams `protobuf:"bytes,1,opt,name=bytebuf_params,json=bytebufParams,oneof"`
|
||||
}
|
||||
type PayloadConfig_SimpleParams struct {
|
||||
SimpleParams *SimpleProtoParams `protobuf:"bytes,2,opt,name=simple_params,json=simpleParams,oneof"`
|
||||
}
|
||||
type PayloadConfig_ComplexParams struct {
|
||||
ComplexParams *ComplexProtoParams `protobuf:"bytes,3,opt,name=complex_params,json=complexParams,oneof"`
|
||||
}
|
||||
|
||||
func (*PayloadConfig_BytebufParams) isPayloadConfig_Payload() {}
|
||||
func (*PayloadConfig_SimpleParams) isPayloadConfig_Payload() {}
|
||||
func (*PayloadConfig_ComplexParams) isPayloadConfig_Payload() {}
|
||||
|
||||
func (m *PayloadConfig) GetPayload() isPayloadConfig_Payload {
|
||||
if m != nil {
|
||||
return m.Payload
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *PayloadConfig) GetBytebufParams() *ByteBufferParams {
|
||||
if x, ok := m.GetPayload().(*PayloadConfig_BytebufParams); ok {
|
||||
return x.BytebufParams
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *PayloadConfig) GetSimpleParams() *SimpleProtoParams {
|
||||
if x, ok := m.GetPayload().(*PayloadConfig_SimpleParams); ok {
|
||||
return x.SimpleParams
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *PayloadConfig) GetComplexParams() *ComplexProtoParams {
|
||||
if x, ok := m.GetPayload().(*PayloadConfig_ComplexParams); ok {
|
||||
return x.ComplexParams
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*PayloadConfig) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
|
||||
return _PayloadConfig_OneofMarshaler, _PayloadConfig_OneofUnmarshaler, _PayloadConfig_OneofSizer, []interface{}{
|
||||
(*PayloadConfig_BytebufParams)(nil),
|
||||
(*PayloadConfig_SimpleParams)(nil),
|
||||
(*PayloadConfig_ComplexParams)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _PayloadConfig_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*PayloadConfig)
|
||||
// payload
|
||||
switch x := m.Payload.(type) {
|
||||
case *PayloadConfig_BytebufParams:
|
||||
b.EncodeVarint(1<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.BytebufParams); err != nil {
|
||||
return err
|
||||
}
|
||||
case *PayloadConfig_SimpleParams:
|
||||
b.EncodeVarint(2<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.SimpleParams); err != nil {
|
||||
return err
|
||||
}
|
||||
case *PayloadConfig_ComplexParams:
|
||||
b.EncodeVarint(3<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.ComplexParams); err != nil {
|
||||
return err
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("PayloadConfig.Payload has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _PayloadConfig_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*PayloadConfig)
|
||||
switch tag {
|
||||
case 1: // payload.bytebuf_params
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(ByteBufferParams)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Payload = &PayloadConfig_BytebufParams{msg}
|
||||
return true, err
|
||||
case 2: // payload.simple_params
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(SimpleProtoParams)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Payload = &PayloadConfig_SimpleParams{msg}
|
||||
return true, err
|
||||
case 3: // payload.complex_params
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(ComplexProtoParams)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Payload = &PayloadConfig_ComplexParams{msg}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _PayloadConfig_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*PayloadConfig)
|
||||
// payload
|
||||
switch x := m.Payload.(type) {
|
||||
case *PayloadConfig_BytebufParams:
|
||||
s := proto.Size(x.BytebufParams)
|
||||
n += proto.SizeVarint(1<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *PayloadConfig_SimpleParams:
|
||||
s := proto.Size(x.SimpleParams)
|
||||
n += proto.SizeVarint(2<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *PayloadConfig_ComplexParams:
|
||||
s := proto.Size(x.ComplexParams)
|
||||
n += proto.SizeVarint(3<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*ByteBufferParams)(nil), "grpc.testing.ByteBufferParams")
|
||||
proto.RegisterType((*SimpleProtoParams)(nil), "grpc.testing.SimpleProtoParams")
|
||||
proto.RegisterType((*ComplexProtoParams)(nil), "grpc.testing.ComplexProtoParams")
|
||||
proto.RegisterType((*PayloadConfig)(nil), "grpc.testing.PayloadConfig")
|
||||
}
|
||||
|
||||
var fileDescriptor2 = []byte{
|
||||
// 250 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2b, 0x48, 0xac, 0xcc,
|
||||
0xc9, 0x4f, 0x4c, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x49, 0x2f, 0x2a, 0x48,
|
||||
0xd6, 0x2b, 0x49, 0x2d, 0x2e, 0xc9, 0xcc, 0x4b, 0x57, 0xf2, 0xe2, 0x12, 0x70, 0xaa, 0x2c, 0x49,
|
||||
0x75, 0x2a, 0x4d, 0x4b, 0x4b, 0x2d, 0x0a, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0x16, 0x92, 0xe4, 0xe2,
|
||||
0x28, 0x4a, 0x2d, 0x8c, 0x2f, 0xce, 0xac, 0x4a, 0x95, 0x60, 0x54, 0x60, 0xd4, 0x60, 0x0d, 0x62,
|
||||
0x07, 0xf2, 0x83, 0x81, 0x5c, 0x21, 0x69, 0x2e, 0xce, 0xa2, 0xd4, 0xe2, 0x02, 0x88, 0x1c, 0x13,
|
||||
0x58, 0x8e, 0x03, 0x24, 0x00, 0x92, 0x54, 0xf2, 0xe6, 0x12, 0x0c, 0xce, 0xcc, 0x2d, 0xc8, 0x49,
|
||||
0x0d, 0x00, 0x59, 0x44, 0xa1, 0x61, 0x22, 0x5c, 0x42, 0xce, 0xf9, 0x20, 0xc3, 0x2a, 0x90, 0x4c,
|
||||
0x53, 0xfa, 0xc6, 0xc8, 0xc5, 0x1b, 0x00, 0xf1, 0x8f, 0x73, 0x7e, 0x5e, 0x5a, 0x66, 0xba, 0x90,
|
||||
0x3b, 0x17, 0x5f, 0x12, 0xd0, 0x03, 0x49, 0xa5, 0x69, 0xf1, 0x05, 0x60, 0x35, 0x60, 0x5b, 0xb8,
|
||||
0x8d, 0xe4, 0xf4, 0x90, 0xfd, 0xa9, 0x87, 0xee, 0x49, 0x0f, 0x86, 0x20, 0x5e, 0xa8, 0x3e, 0xa8,
|
||||
0x43, 0xdd, 0xb8, 0x78, 0x8b, 0xc1, 0xae, 0x87, 0x99, 0xc3, 0x04, 0x36, 0x47, 0x1e, 0xd5, 0x1c,
|
||||
0x0c, 0x0f, 0x02, 0x0d, 0xe2, 0x81, 0xe8, 0x83, 0x9a, 0xe3, 0xc9, 0xc5, 0x97, 0x0c, 0x71, 0x38,
|
||||
0xcc, 0x20, 0x66, 0xb0, 0x41, 0x0a, 0xa8, 0x06, 0x61, 0x7a, 0x0e, 0xe4, 0x24, 0xa8, 0x4e, 0x88,
|
||||
0x80, 0x13, 0x27, 0x17, 0x3b, 0x34, 0xf2, 0x92, 0xd8, 0xc0, 0x91, 0x67, 0x0c, 0x08, 0x00, 0x00,
|
||||
0xff, 0xff, 0xb0, 0x8c, 0x18, 0x4e, 0xce, 0x01, 0x00, 0x00,
|
||||
}
|
55
benchmark/grpc_testing/payloads.proto
Normal file
55
benchmark/grpc_testing/payloads.proto
Normal file
@ -0,0 +1,55 @@
|
||||
// Copyright 2016, 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package grpc.testing;
|
||||
|
||||
message ByteBufferParams {
|
||||
int32 req_size = 1;
|
||||
int32 resp_size = 2;
|
||||
}
|
||||
|
||||
message SimpleProtoParams {
|
||||
int32 req_size = 1;
|
||||
int32 resp_size = 2;
|
||||
}
|
||||
|
||||
message ComplexProtoParams {
|
||||
// TODO (vpai): Fill this in once the details of complex, representative
|
||||
// protos are decided
|
||||
}
|
||||
|
||||
message PayloadConfig {
|
||||
oneof payload {
|
||||
ByteBufferParams bytebuf_params = 1;
|
||||
SimpleProtoParams simple_params = 2;
|
||||
ComplexProtoParams complex_params = 3;
|
||||
}
|
||||
}
|
439
benchmark/grpc_testing/services.pb.go
Normal file
439
benchmark/grpc_testing/services.pb.go
Normal file
@ -0,0 +1,439 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: services.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package grpc_testing
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
import (
|
||||
context "golang.org/x/net/context"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion2
|
||||
|
||||
// Client API for BenchmarkService service
|
||||
|
||||
type BenchmarkServiceClient interface {
|
||||
// One request followed by one response.
|
||||
// The server returns the client payload as-is.
|
||||
UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error)
|
||||
// One request followed by one response.
|
||||
// The server returns the client payload as-is.
|
||||
StreamingCall(ctx context.Context, opts ...grpc.CallOption) (BenchmarkService_StreamingCallClient, error)
|
||||
}
|
||||
|
||||
type benchmarkServiceClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewBenchmarkServiceClient(cc *grpc.ClientConn) BenchmarkServiceClient {
|
||||
return &benchmarkServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *benchmarkServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) {
|
||||
out := new(SimpleResponse)
|
||||
err := grpc.Invoke(ctx, "/grpc.testing.BenchmarkService/UnaryCall", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *benchmarkServiceClient) StreamingCall(ctx context.Context, opts ...grpc.CallOption) (BenchmarkService_StreamingCallClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_BenchmarkService_serviceDesc.Streams[0], c.cc, "/grpc.testing.BenchmarkService/StreamingCall", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &benchmarkServiceStreamingCallClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type BenchmarkService_StreamingCallClient interface {
|
||||
Send(*SimpleRequest) error
|
||||
Recv() (*SimpleResponse, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type benchmarkServiceStreamingCallClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *benchmarkServiceStreamingCallClient) Send(m *SimpleRequest) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *benchmarkServiceStreamingCallClient) Recv() (*SimpleResponse, error) {
|
||||
m := new(SimpleResponse)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// Server API for BenchmarkService service
|
||||
|
||||
type BenchmarkServiceServer interface {
|
||||
// One request followed by one response.
|
||||
// The server returns the client payload as-is.
|
||||
UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error)
|
||||
// One request followed by one response.
|
||||
// The server returns the client payload as-is.
|
||||
StreamingCall(BenchmarkService_StreamingCallServer) error
|
||||
}
|
||||
|
||||
func RegisterBenchmarkServiceServer(s *grpc.Server, srv BenchmarkServiceServer) {
|
||||
s.RegisterService(&_BenchmarkService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _BenchmarkService_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SimpleRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(BenchmarkServiceServer).UnaryCall(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.testing.BenchmarkService/UnaryCall",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(BenchmarkServiceServer).UnaryCall(ctx, req.(*SimpleRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _BenchmarkService_StreamingCall_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(BenchmarkServiceServer).StreamingCall(&benchmarkServiceStreamingCallServer{stream})
|
||||
}
|
||||
|
||||
type BenchmarkService_StreamingCallServer interface {
|
||||
Send(*SimpleResponse) error
|
||||
Recv() (*SimpleRequest, error)
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type benchmarkServiceStreamingCallServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *benchmarkServiceStreamingCallServer) Send(m *SimpleResponse) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *benchmarkServiceStreamingCallServer) Recv() (*SimpleRequest, error) {
|
||||
m := new(SimpleRequest)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
var _BenchmarkService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "grpc.testing.BenchmarkService",
|
||||
HandlerType: (*BenchmarkServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "UnaryCall",
|
||||
Handler: _BenchmarkService_UnaryCall_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "StreamingCall",
|
||||
Handler: _BenchmarkService_StreamingCall_Handler,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// Client API for WorkerService service
|
||||
|
||||
type WorkerServiceClient interface {
|
||||
// Start server with specified workload.
|
||||
// First request sent specifies the ServerConfig followed by ServerStatus
|
||||
// response. After that, a "Mark" can be sent anytime to request the latest
|
||||
// stats. Closing the stream will initiate shutdown of the test server
|
||||
// and once the shutdown has finished, the OK status is sent to terminate
|
||||
// this RPC.
|
||||
RunServer(ctx context.Context, opts ...grpc.CallOption) (WorkerService_RunServerClient, error)
|
||||
// Start client with specified workload.
|
||||
// First request sent specifies the ClientConfig followed by ClientStatus
|
||||
// response. After that, a "Mark" can be sent anytime to request the latest
|
||||
// stats. Closing the stream will initiate shutdown of the test client
|
||||
// and once the shutdown has finished, the OK status is sent to terminate
|
||||
// this RPC.
|
||||
RunClient(ctx context.Context, opts ...grpc.CallOption) (WorkerService_RunClientClient, error)
|
||||
// Just return the core count - unary call
|
||||
CoreCount(ctx context.Context, in *CoreRequest, opts ...grpc.CallOption) (*CoreResponse, error)
|
||||
// Quit this worker
|
||||
QuitWorker(ctx context.Context, in *Void, opts ...grpc.CallOption) (*Void, error)
|
||||
}
|
||||
|
||||
type workerServiceClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewWorkerServiceClient(cc *grpc.ClientConn) WorkerServiceClient {
|
||||
return &workerServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *workerServiceClient) RunServer(ctx context.Context, opts ...grpc.CallOption) (WorkerService_RunServerClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_WorkerService_serviceDesc.Streams[0], c.cc, "/grpc.testing.WorkerService/RunServer", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &workerServiceRunServerClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type WorkerService_RunServerClient interface {
|
||||
Send(*ServerArgs) error
|
||||
Recv() (*ServerStatus, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type workerServiceRunServerClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *workerServiceRunServerClient) Send(m *ServerArgs) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *workerServiceRunServerClient) Recv() (*ServerStatus, error) {
|
||||
m := new(ServerStatus)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *workerServiceClient) RunClient(ctx context.Context, opts ...grpc.CallOption) (WorkerService_RunClientClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_WorkerService_serviceDesc.Streams[1], c.cc, "/grpc.testing.WorkerService/RunClient", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &workerServiceRunClientClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type WorkerService_RunClientClient interface {
|
||||
Send(*ClientArgs) error
|
||||
Recv() (*ClientStatus, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type workerServiceRunClientClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *workerServiceRunClientClient) Send(m *ClientArgs) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *workerServiceRunClientClient) Recv() (*ClientStatus, error) {
|
||||
m := new(ClientStatus)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *workerServiceClient) CoreCount(ctx context.Context, in *CoreRequest, opts ...grpc.CallOption) (*CoreResponse, error) {
|
||||
out := new(CoreResponse)
|
||||
err := grpc.Invoke(ctx, "/grpc.testing.WorkerService/CoreCount", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *workerServiceClient) QuitWorker(ctx context.Context, in *Void, opts ...grpc.CallOption) (*Void, error) {
|
||||
out := new(Void)
|
||||
err := grpc.Invoke(ctx, "/grpc.testing.WorkerService/QuitWorker", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for WorkerService service
|
||||
|
||||
type WorkerServiceServer interface {
|
||||
// Start server with specified workload.
|
||||
// First request sent specifies the ServerConfig followed by ServerStatus
|
||||
// response. After that, a "Mark" can be sent anytime to request the latest
|
||||
// stats. Closing the stream will initiate shutdown of the test server
|
||||
// and once the shutdown has finished, the OK status is sent to terminate
|
||||
// this RPC.
|
||||
RunServer(WorkerService_RunServerServer) error
|
||||
// Start client with specified workload.
|
||||
// First request sent specifies the ClientConfig followed by ClientStatus
|
||||
// response. After that, a "Mark" can be sent anytime to request the latest
|
||||
// stats. Closing the stream will initiate shutdown of the test client
|
||||
// and once the shutdown has finished, the OK status is sent to terminate
|
||||
// this RPC.
|
||||
RunClient(WorkerService_RunClientServer) error
|
||||
// Just return the core count - unary call
|
||||
CoreCount(context.Context, *CoreRequest) (*CoreResponse, error)
|
||||
// Quit this worker
|
||||
QuitWorker(context.Context, *Void) (*Void, error)
|
||||
}
|
||||
|
||||
func RegisterWorkerServiceServer(s *grpc.Server, srv WorkerServiceServer) {
|
||||
s.RegisterService(&_WorkerService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _WorkerService_RunServer_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(WorkerServiceServer).RunServer(&workerServiceRunServerServer{stream})
|
||||
}
|
||||
|
||||
type WorkerService_RunServerServer interface {
|
||||
Send(*ServerStatus) error
|
||||
Recv() (*ServerArgs, error)
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type workerServiceRunServerServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *workerServiceRunServerServer) Send(m *ServerStatus) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *workerServiceRunServerServer) Recv() (*ServerArgs, error) {
|
||||
m := new(ServerArgs)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func _WorkerService_RunClient_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(WorkerServiceServer).RunClient(&workerServiceRunClientServer{stream})
|
||||
}
|
||||
|
||||
type WorkerService_RunClientServer interface {
|
||||
Send(*ClientStatus) error
|
||||
Recv() (*ClientArgs, error)
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type workerServiceRunClientServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *workerServiceRunClientServer) Send(m *ClientStatus) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *workerServiceRunClientServer) Recv() (*ClientArgs, error) {
|
||||
m := new(ClientArgs)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func _WorkerService_CoreCount_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CoreRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(WorkerServiceServer).CoreCount(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.testing.WorkerService/CoreCount",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(WorkerServiceServer).CoreCount(ctx, req.(*CoreRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _WorkerService_QuitWorker_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(Void)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(WorkerServiceServer).QuitWorker(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.testing.WorkerService/QuitWorker",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(WorkerServiceServer).QuitWorker(ctx, req.(*Void))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _WorkerService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "grpc.testing.WorkerService",
|
||||
HandlerType: (*WorkerServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "CoreCount",
|
||||
Handler: _WorkerService_CoreCount_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "QuitWorker",
|
||||
Handler: _WorkerService_QuitWorker_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "RunServer",
|
||||
Handler: _WorkerService_RunServer_Handler,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "RunClient",
|
||||
Handler: _WorkerService_RunClient_Handler,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var fileDescriptor3 = []byte{
|
||||
// 254 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x91, 0xc1, 0x4a, 0xc4, 0x30,
|
||||
0x10, 0x86, 0xa9, 0x07, 0xa1, 0xc1, 0x2e, 0x92, 0x93, 0x46, 0x1f, 0xc0, 0x53, 0x91, 0xd5, 0x17,
|
||||
0x70, 0x8b, 0x1e, 0x05, 0xb7, 0xa8, 0xe7, 0x58, 0x87, 0x1a, 0x36, 0x4d, 0xea, 0xcc, 0x44, 0xf0,
|
||||
0x49, 0x7c, 0x07, 0x9f, 0xd2, 0xee, 0x66, 0x0b, 0xb5, 0xe4, 0xb6, 0xc7, 0xf9, 0xbf, 0xe1, 0x23,
|
||||
0x7f, 0x46, 0x2c, 0x08, 0xf0, 0xcb, 0x34, 0x40, 0x65, 0x8f, 0x9e, 0xbd, 0x3c, 0x69, 0xb1, 0x6f,
|
||||
0x4a, 0x06, 0x62, 0xe3, 0x5a, 0xb5, 0xe8, 0x80, 0x48, 0xb7, 0x23, 0x55, 0x45, 0xe3, 0x1d, 0xa3,
|
||||
0xb7, 0x71, 0x5c, 0xfe, 0x66, 0xe2, 0x74, 0x05, 0xae, 0xf9, 0xe8, 0x34, 0x6e, 0xea, 0x28, 0x92,
|
||||
0x0f, 0x22, 0x7f, 0x76, 0x1a, 0xbf, 0x2b, 0x6d, 0xad, 0xbc, 0x28, 0xa7, 0xbe, 0xb2, 0x36, 0x5d,
|
||||
0x6f, 0x61, 0x0d, 0x9f, 0x61, 0x08, 0xd4, 0x65, 0x1a, 0x52, 0xef, 0x1d, 0x81, 0x7c, 0x14, 0x45,
|
||||
0xcd, 0x08, 0xba, 0x1b, 0xd8, 0x81, 0xae, 0xab, 0xec, 0x3a, 0x5b, 0xfe, 0x1c, 0x89, 0xe2, 0xd5,
|
||||
0xe3, 0x06, 0x70, 0x7c, 0xe9, 0xbd, 0xc8, 0xd7, 0xc1, 0x6d, 0x27, 0x40, 0x79, 0x36, 0x13, 0xec,
|
||||
0xd2, 0x3b, 0x6c, 0x49, 0xa9, 0x14, 0xa9, 0x59, 0x73, 0xa0, 0xad, 0x78, 0xaf, 0xa9, 0xac, 0x01,
|
||||
0xc7, 0x73, 0x4d, 0x4c, 0x53, 0x9a, 0x48, 0x26, 0x9a, 0x95, 0xc8, 0x2b, 0x8f, 0x50, 0xf9, 0x30,
|
||||
0x68, 0xce, 0x67, 0xcb, 0x03, 0x18, 0x9b, 0xaa, 0x14, 0xda, 0xff, 0xd9, 0xad, 0x10, 0x4f, 0xc1,
|
||||
0x70, 0xac, 0x29, 0xe5, 0xff, 0xcd, 0x17, 0x6f, 0xde, 0x55, 0x22, 0x7b, 0x3b, 0xde, 0x5d, 0xf3,
|
||||
0xe6, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x3b, 0x84, 0x02, 0xe3, 0x0c, 0x02, 0x00, 0x00,
|
||||
}
|
71
benchmark/grpc_testing/services.proto
Normal file
71
benchmark/grpc_testing/services.proto
Normal file
@ -0,0 +1,71 @@
|
||||
// Copyright 2016, 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.
|
||||
|
||||
// An integration test service that covers all the method signature permutations
|
||||
// of unary/streaming requests/responses.
|
||||
syntax = "proto3";
|
||||
|
||||
import "messages.proto";
|
||||
import "control.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);
|
||||
|
||||
// One request followed by one response.
|
||||
// The server returns the client payload as-is.
|
||||
rpc StreamingCall(stream SimpleRequest) returns (stream SimpleResponse);
|
||||
}
|
||||
|
||||
service WorkerService {
|
||||
// Start server with specified workload.
|
||||
// First request sent specifies the ServerConfig followed by ServerStatus
|
||||
// response. After that, a "Mark" can be sent anytime to request the latest
|
||||
// stats. Closing the stream will initiate shutdown of the test server
|
||||
// and once the shutdown has finished, the OK status is sent to terminate
|
||||
// this RPC.
|
||||
rpc RunServer(stream ServerArgs) returns (stream ServerStatus);
|
||||
|
||||
// Start client with specified workload.
|
||||
// First request sent specifies the ClientConfig followed by ClientStatus
|
||||
// response. After that, a "Mark" can be sent anytime to request the latest
|
||||
// stats. Closing the stream will initiate shutdown of the test client
|
||||
// and once the shutdown has finished, the OK status is sent to terminate
|
||||
// this RPC.
|
||||
rpc RunClient(stream ClientArgs) returns (stream ClientStatus);
|
||||
|
||||
// Just return the core count - unary call
|
||||
rpc CoreCount(CoreRequest) returns (CoreResponse);
|
||||
|
||||
// Quit this worker
|
||||
rpc QuitWorker(Void) returns (Void);
|
||||
}
|
109
benchmark/grpc_testing/stats.pb.go
Normal file
109
benchmark/grpc_testing/stats.pb.go
Normal file
@ -0,0 +1,109 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: stats.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
package grpc_testing
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
type ServerStats struct {
|
||||
// wall clock time change in seconds since last reset
|
||||
TimeElapsed float64 `protobuf:"fixed64,1,opt,name=time_elapsed,json=timeElapsed" json:"time_elapsed,omitempty"`
|
||||
// change in user time (in seconds) used by the server since last reset
|
||||
TimeUser float64 `protobuf:"fixed64,2,opt,name=time_user,json=timeUser" json:"time_user,omitempty"`
|
||||
// change in server time (in seconds) used by the server process and all
|
||||
// threads since last reset
|
||||
TimeSystem float64 `protobuf:"fixed64,3,opt,name=time_system,json=timeSystem" json:"time_system,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ServerStats) Reset() { *m = ServerStats{} }
|
||||
func (m *ServerStats) String() string { return proto.CompactTextString(m) }
|
||||
func (*ServerStats) ProtoMessage() {}
|
||||
func (*ServerStats) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{0} }
|
||||
|
||||
// Histogram params based on grpc/support/histogram.c
|
||||
type HistogramParams struct {
|
||||
Resolution float64 `protobuf:"fixed64,1,opt,name=resolution" json:"resolution,omitempty"`
|
||||
MaxPossible float64 `protobuf:"fixed64,2,opt,name=max_possible,json=maxPossible" json:"max_possible,omitempty"`
|
||||
}
|
||||
|
||||
func (m *HistogramParams) Reset() { *m = HistogramParams{} }
|
||||
func (m *HistogramParams) String() string { return proto.CompactTextString(m) }
|
||||
func (*HistogramParams) ProtoMessage() {}
|
||||
func (*HistogramParams) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{1} }
|
||||
|
||||
// Histogram data based on grpc/support/histogram.c
|
||||
type HistogramData struct {
|
||||
Bucket []uint32 `protobuf:"varint,1,rep,name=bucket" json:"bucket,omitempty"`
|
||||
MinSeen float64 `protobuf:"fixed64,2,opt,name=min_seen,json=minSeen" json:"min_seen,omitempty"`
|
||||
MaxSeen float64 `protobuf:"fixed64,3,opt,name=max_seen,json=maxSeen" json:"max_seen,omitempty"`
|
||||
Sum float64 `protobuf:"fixed64,4,opt,name=sum" json:"sum,omitempty"`
|
||||
SumOfSquares float64 `protobuf:"fixed64,5,opt,name=sum_of_squares,json=sumOfSquares" json:"sum_of_squares,omitempty"`
|
||||
Count float64 `protobuf:"fixed64,6,opt,name=count" json:"count,omitempty"`
|
||||
}
|
||||
|
||||
func (m *HistogramData) Reset() { *m = HistogramData{} }
|
||||
func (m *HistogramData) String() string { return proto.CompactTextString(m) }
|
||||
func (*HistogramData) ProtoMessage() {}
|
||||
func (*HistogramData) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{2} }
|
||||
|
||||
type ClientStats struct {
|
||||
// Latency histogram. Data points are in nanoseconds.
|
||||
Latencies *HistogramData `protobuf:"bytes,1,opt,name=latencies" json:"latencies,omitempty"`
|
||||
// See ServerStats for details.
|
||||
TimeElapsed float64 `protobuf:"fixed64,2,opt,name=time_elapsed,json=timeElapsed" json:"time_elapsed,omitempty"`
|
||||
TimeUser float64 `protobuf:"fixed64,3,opt,name=time_user,json=timeUser" json:"time_user,omitempty"`
|
||||
TimeSystem float64 `protobuf:"fixed64,4,opt,name=time_system,json=timeSystem" json:"time_system,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ClientStats) Reset() { *m = ClientStats{} }
|
||||
func (m *ClientStats) String() string { return proto.CompactTextString(m) }
|
||||
func (*ClientStats) ProtoMessage() {}
|
||||
func (*ClientStats) Descriptor() ([]byte, []int) { return fileDescriptor4, []int{3} }
|
||||
|
||||
func (m *ClientStats) GetLatencies() *HistogramData {
|
||||
if m != nil {
|
||||
return m.Latencies
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*ServerStats)(nil), "grpc.testing.ServerStats")
|
||||
proto.RegisterType((*HistogramParams)(nil), "grpc.testing.HistogramParams")
|
||||
proto.RegisterType((*HistogramData)(nil), "grpc.testing.HistogramData")
|
||||
proto.RegisterType((*ClientStats)(nil), "grpc.testing.ClientStats")
|
||||
}
|
||||
|
||||
var fileDescriptor4 = []byte{
|
||||
// 342 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x84, 0x92, 0x4f, 0x4f, 0xe3, 0x30,
|
||||
0x10, 0xc5, 0x95, 0xa6, 0xed, 0xb6, 0x93, 0x76, 0x77, 0x65, 0xad, 0x56, 0x41, 0x95, 0xf8, 0x13,
|
||||
0x71, 0xe8, 0x29, 0x07, 0x38, 0x71, 0x06, 0x24, 0x6e, 0x54, 0x0d, 0x9c, 0x23, 0x37, 0x4c, 0x2b,
|
||||
0x8b, 0xc4, 0x0e, 0x99, 0x09, 0x2a, 0x1f, 0x09, 0xf1, 0x25, 0x71, 0x9c, 0x08, 0x0a, 0x48, 0x70,
|
||||
0x49, 0xf2, 0x7e, 0x6f, 0x34, 0xe3, 0xc9, 0x33, 0x04, 0xc4, 0x92, 0x29, 0x2e, 0x2b, 0xc3, 0x46,
|
||||
0x4c, 0x36, 0x55, 0x99, 0xc5, 0x8c, 0xc4, 0x4a, 0x6f, 0x22, 0x0d, 0x41, 0x82, 0xd5, 0x23, 0x56,
|
||||
0x49, 0x53, 0x22, 0x8e, 0x60, 0xc2, 0xaa, 0xc0, 0x14, 0x73, 0x59, 0x12, 0xde, 0x85, 0xde, 0xa1,
|
||||
0x37, 0xf7, 0x96, 0x41, 0xc3, 0x2e, 0x5b, 0x24, 0x66, 0x30, 0x76, 0x25, 0x35, 0x61, 0x15, 0xf6,
|
||||
0x9c, 0x3f, 0x6a, 0xc0, 0xad, 0xd5, 0xe2, 0x00, 0x5c, 0x6d, 0x4a, 0x4f, 0xc4, 0x58, 0x84, 0xbe,
|
||||
0xb3, 0xa1, 0x41, 0x89, 0x23, 0xd1, 0x0d, 0xfc, 0xb9, 0x52, 0xc4, 0x66, 0x53, 0xc9, 0x62, 0x21,
|
||||
0xed, 0x83, 0xc4, 0x3e, 0x40, 0x85, 0x64, 0xf2, 0x9a, 0x95, 0xd1, 0xdd, 0xc4, 0x1d, 0xd2, 0x9c,
|
||||
0xa9, 0x90, 0xdb, 0xb4, 0x34, 0x44, 0x6a, 0x95, 0x63, 0x37, 0x33, 0xb0, 0x6c, 0xd1, 0xa1, 0xe8,
|
||||
0xc5, 0x83, 0xe9, 0x5b, 0xdb, 0x0b, 0xc9, 0x52, 0xfc, 0x87, 0xe1, 0xaa, 0xce, 0xee, 0x91, 0x6d,
|
||||
0x43, 0x7f, 0x3e, 0x5d, 0x76, 0x4a, 0xec, 0xc1, 0xa8, 0x50, 0x3a, 0x25, 0x44, 0xdd, 0x35, 0xfa,
|
||||
0x65, 0x75, 0x62, 0xa5, 0xb3, 0xec, 0x1c, 0x67, 0xf9, 0x9d, 0x25, 0xb7, 0xce, 0xfa, 0x0b, 0x3e,
|
||||
0xd5, 0x45, 0xd8, 0x77, 0xb4, 0xf9, 0x14, 0xc7, 0xf0, 0xdb, 0xbe, 0x52, 0xb3, 0x4e, 0xe9, 0xa1,
|
||||
0x96, 0xf6, 0xb4, 0xe1, 0xc0, 0x99, 0x13, 0x4b, 0xaf, 0xd7, 0x49, 0xcb, 0xc4, 0x3f, 0x18, 0x64,
|
||||
0xa6, 0xd6, 0x1c, 0x0e, 0x9d, 0xd9, 0x8a, 0xe8, 0xd9, 0x83, 0xe0, 0x3c, 0x57, 0xa8, 0xb9, 0xfd,
|
||||
0xe9, 0x67, 0x30, 0xce, 0x25, 0xa3, 0xce, 0x94, 0x6d, 0xd3, 0xec, 0x1f, 0x9c, 0xcc, 0xe2, 0xdd,
|
||||
0x94, 0xe2, 0x0f, 0xbb, 0x2d, 0xdf, 0xab, 0xbf, 0xe4, 0xd5, 0xfb, 0x21, 0x2f, 0xff, 0xfb, 0xbc,
|
||||
0xfa, 0x9f, 0xf3, 0x5a, 0x0d, 0xdd, 0xa5, 0x39, 0x7d, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xea, 0x75,
|
||||
0x34, 0x90, 0x43, 0x02, 0x00, 0x00,
|
||||
}
|
70
benchmark/grpc_testing/stats.proto
Normal file
70
benchmark/grpc_testing/stats.proto
Normal file
@ -0,0 +1,70 @@
|
||||
// Copyright 2016, 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.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package grpc.testing;
|
||||
|
||||
message ServerStats {
|
||||
// wall clock time change in seconds since last reset
|
||||
double time_elapsed = 1;
|
||||
|
||||
// change in user time (in seconds) used by the server since last reset
|
||||
double time_user = 2;
|
||||
|
||||
// change in server time (in seconds) used by the server process and all
|
||||
// threads since last reset
|
||||
double time_system = 3;
|
||||
}
|
||||
|
||||
// Histogram params based on grpc/support/histogram.c
|
||||
message HistogramParams {
|
||||
double resolution = 1; // first bucket is [0, 1 + resolution)
|
||||
double max_possible = 2; // use enough buckets to allow this value
|
||||
}
|
||||
|
||||
// Histogram data based on grpc/support/histogram.c
|
||||
message HistogramData {
|
||||
repeated uint32 bucket = 1;
|
||||
double min_seen = 2;
|
||||
double max_seen = 3;
|
||||
double sum = 4;
|
||||
double sum_of_squares = 5;
|
||||
double count = 6;
|
||||
}
|
||||
|
||||
message ClientStats {
|
||||
// Latency histogram. Data points are in nanoseconds.
|
||||
HistogramData latencies = 1;
|
||||
|
||||
// See ServerStats for details.
|
||||
double time_elapsed = 2;
|
||||
double time_user = 3;
|
||||
double time_system = 4;
|
||||
}
|
@ -1,944 +0,0 @@
|
||||
// Code generated by protoc-gen-go.
|
||||
// source: benchmark/grpc_testing/test.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package grpc_testing is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
benchmark/grpc_testing/test.proto
|
||||
|
||||
It has these top-level messages:
|
||||
StatsRequest
|
||||
ServerStats
|
||||
Payload
|
||||
HistogramData
|
||||
ClientConfig
|
||||
Mark
|
||||
ClientArgs
|
||||
ClientStats
|
||||
ClientStatus
|
||||
ServerConfig
|
||||
ServerArgs
|
||||
ServerStatus
|
||||
SimpleRequest
|
||||
SimpleResponse
|
||||
*/
|
||||
package grpc_testing
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
import (
|
||||
context "golang.org/x/net/context"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
const _ = proto.ProtoPackageIsVersion1
|
||||
|
||||
type PayloadType int32
|
||||
|
||||
const (
|
||||
// Compressable text format.
|
||||
PayloadType_COMPRESSABLE PayloadType = 0
|
||||
// Uncompressable binary format.
|
||||
PayloadType_UNCOMPRESSABLE PayloadType = 1
|
||||
// Randomly chosen from all other formats defined in this enum.
|
||||
PayloadType_RANDOM PayloadType = 2
|
||||
)
|
||||
|
||||
var PayloadType_name = map[int32]string{
|
||||
0: "COMPRESSABLE",
|
||||
1: "UNCOMPRESSABLE",
|
||||
2: "RANDOM",
|
||||
}
|
||||
var PayloadType_value = map[string]int32{
|
||||
"COMPRESSABLE": 0,
|
||||
"UNCOMPRESSABLE": 1,
|
||||
"RANDOM": 2,
|
||||
}
|
||||
|
||||
func (x PayloadType) String() string {
|
||||
return proto.EnumName(PayloadType_name, int32(x))
|
||||
}
|
||||
func (PayloadType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
type ClientType int32
|
||||
|
||||
const (
|
||||
ClientType_SYNCHRONOUS_CLIENT ClientType = 0
|
||||
ClientType_ASYNC_CLIENT ClientType = 1
|
||||
)
|
||||
|
||||
var ClientType_name = map[int32]string{
|
||||
0: "SYNCHRONOUS_CLIENT",
|
||||
1: "ASYNC_CLIENT",
|
||||
}
|
||||
var ClientType_value = map[string]int32{
|
||||
"SYNCHRONOUS_CLIENT": 0,
|
||||
"ASYNC_CLIENT": 1,
|
||||
}
|
||||
|
||||
func (x ClientType) String() string {
|
||||
return proto.EnumName(ClientType_name, int32(x))
|
||||
}
|
||||
func (ClientType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
type ServerType int32
|
||||
|
||||
const (
|
||||
ServerType_SYNCHRONOUS_SERVER ServerType = 0
|
||||
ServerType_ASYNC_SERVER ServerType = 1
|
||||
)
|
||||
|
||||
var ServerType_name = map[int32]string{
|
||||
0: "SYNCHRONOUS_SERVER",
|
||||
1: "ASYNC_SERVER",
|
||||
}
|
||||
var ServerType_value = map[string]int32{
|
||||
"SYNCHRONOUS_SERVER": 0,
|
||||
"ASYNC_SERVER": 1,
|
||||
}
|
||||
|
||||
func (x ServerType) String() string {
|
||||
return proto.EnumName(ServerType_name, int32(x))
|
||||
}
|
||||
func (ServerType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
|
||||
type RpcType int32
|
||||
|
||||
const (
|
||||
RpcType_UNARY RpcType = 0
|
||||
RpcType_STREAMING RpcType = 1
|
||||
)
|
||||
|
||||
var RpcType_name = map[int32]string{
|
||||
0: "UNARY",
|
||||
1: "STREAMING",
|
||||
}
|
||||
var RpcType_value = map[string]int32{
|
||||
"UNARY": 0,
|
||||
"STREAMING": 1,
|
||||
}
|
||||
|
||||
func (x RpcType) String() string {
|
||||
return proto.EnumName(RpcType_name, int32(x))
|
||||
}
|
||||
func (RpcType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
|
||||
|
||||
type StatsRequest struct {
|
||||
// run number
|
||||
TestNum int32 `protobuf:"varint,1,opt,name=test_num" json:"test_num,omitempty"`
|
||||
}
|
||||
|
||||
func (m *StatsRequest) Reset() { *m = StatsRequest{} }
|
||||
func (m *StatsRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StatsRequest) ProtoMessage() {}
|
||||
func (*StatsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
type ServerStats struct {
|
||||
// wall clock time
|
||||
TimeElapsed float64 `protobuf:"fixed64,1,opt,name=time_elapsed" json:"time_elapsed,omitempty"`
|
||||
// user time used by the server process and threads
|
||||
TimeUser float64 `protobuf:"fixed64,2,opt,name=time_user" json:"time_user,omitempty"`
|
||||
// server time used by the server process and all threads
|
||||
TimeSystem float64 `protobuf:"fixed64,3,opt,name=time_system" json:"time_system,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ServerStats) Reset() { *m = ServerStats{} }
|
||||
func (m *ServerStats) String() string { return proto.CompactTextString(m) }
|
||||
func (*ServerStats) ProtoMessage() {}
|
||||
func (*ServerStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
type Payload struct {
|
||||
// The type of data in body.
|
||||
Type PayloadType `protobuf:"varint,1,opt,name=type,enum=grpc.testing.PayloadType" json:"type,omitempty"`
|
||||
// Primary contents of payload.
|
||||
Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Payload) Reset() { *m = Payload{} }
|
||||
func (m *Payload) String() string { return proto.CompactTextString(m) }
|
||||
func (*Payload) ProtoMessage() {}
|
||||
func (*Payload) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
|
||||
type HistogramData struct {
|
||||
Bucket []uint32 `protobuf:"varint,1,rep,name=bucket" json:"bucket,omitempty"`
|
||||
MinSeen float64 `protobuf:"fixed64,2,opt,name=min_seen" json:"min_seen,omitempty"`
|
||||
MaxSeen float64 `protobuf:"fixed64,3,opt,name=max_seen" json:"max_seen,omitempty"`
|
||||
Sum float64 `protobuf:"fixed64,4,opt,name=sum" json:"sum,omitempty"`
|
||||
SumOfSquares float64 `protobuf:"fixed64,5,opt,name=sum_of_squares" json:"sum_of_squares,omitempty"`
|
||||
Count float64 `protobuf:"fixed64,6,opt,name=count" json:"count,omitempty"`
|
||||
}
|
||||
|
||||
func (m *HistogramData) Reset() { *m = HistogramData{} }
|
||||
func (m *HistogramData) String() string { return proto.CompactTextString(m) }
|
||||
func (*HistogramData) ProtoMessage() {}
|
||||
func (*HistogramData) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
|
||||
|
||||
type ClientConfig struct {
|
||||
ServerTargets []string `protobuf:"bytes,1,rep,name=server_targets" json:"server_targets,omitempty"`
|
||||
ClientType ClientType `protobuf:"varint,2,opt,name=client_type,enum=grpc.testing.ClientType" json:"client_type,omitempty"`
|
||||
EnableSsl bool `protobuf:"varint,3,opt,name=enable_ssl" json:"enable_ssl,omitempty"`
|
||||
OutstandingRpcsPerChannel int32 `protobuf:"varint,4,opt,name=outstanding_rpcs_per_channel" json:"outstanding_rpcs_per_channel,omitempty"`
|
||||
ClientChannels int32 `protobuf:"varint,5,opt,name=client_channels" json:"client_channels,omitempty"`
|
||||
PayloadSize int32 `protobuf:"varint,6,opt,name=payload_size" json:"payload_size,omitempty"`
|
||||
// only for async client:
|
||||
AsyncClientThreads int32 `protobuf:"varint,7,opt,name=async_client_threads" json:"async_client_threads,omitempty"`
|
||||
RpcType RpcType `protobuf:"varint,8,opt,name=rpc_type,enum=grpc.testing.RpcType" json:"rpc_type,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ClientConfig) Reset() { *m = ClientConfig{} }
|
||||
func (m *ClientConfig) String() string { return proto.CompactTextString(m) }
|
||||
func (*ClientConfig) ProtoMessage() {}
|
||||
func (*ClientConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
|
||||
|
||||
// Request current stats
|
||||
type Mark struct {
|
||||
}
|
||||
|
||||
func (m *Mark) Reset() { *m = Mark{} }
|
||||
func (m *Mark) String() string { return proto.CompactTextString(m) }
|
||||
func (*Mark) ProtoMessage() {}
|
||||
func (*Mark) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
|
||||
|
||||
type ClientArgs struct {
|
||||
// Types that are valid to be assigned to Argtype:
|
||||
// *ClientArgs_Setup
|
||||
// *ClientArgs_Mark
|
||||
Argtype isClientArgs_Argtype `protobuf_oneof:"argtype"`
|
||||
}
|
||||
|
||||
func (m *ClientArgs) Reset() { *m = ClientArgs{} }
|
||||
func (m *ClientArgs) String() string { return proto.CompactTextString(m) }
|
||||
func (*ClientArgs) ProtoMessage() {}
|
||||
func (*ClientArgs) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
|
||||
|
||||
type isClientArgs_Argtype interface {
|
||||
isClientArgs_Argtype()
|
||||
}
|
||||
|
||||
type ClientArgs_Setup struct {
|
||||
Setup *ClientConfig `protobuf:"bytes,1,opt,name=setup,oneof"`
|
||||
}
|
||||
type ClientArgs_Mark struct {
|
||||
Mark *Mark `protobuf:"bytes,2,opt,name=mark,oneof"`
|
||||
}
|
||||
|
||||
func (*ClientArgs_Setup) isClientArgs_Argtype() {}
|
||||
func (*ClientArgs_Mark) isClientArgs_Argtype() {}
|
||||
|
||||
func (m *ClientArgs) GetArgtype() isClientArgs_Argtype {
|
||||
if m != nil {
|
||||
return m.Argtype
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ClientArgs) GetSetup() *ClientConfig {
|
||||
if x, ok := m.GetArgtype().(*ClientArgs_Setup); ok {
|
||||
return x.Setup
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ClientArgs) GetMark() *Mark {
|
||||
if x, ok := m.GetArgtype().(*ClientArgs_Mark); ok {
|
||||
return x.Mark
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*ClientArgs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
|
||||
return _ClientArgs_OneofMarshaler, _ClientArgs_OneofUnmarshaler, _ClientArgs_OneofSizer, []interface{}{
|
||||
(*ClientArgs_Setup)(nil),
|
||||
(*ClientArgs_Mark)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _ClientArgs_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*ClientArgs)
|
||||
// argtype
|
||||
switch x := m.Argtype.(type) {
|
||||
case *ClientArgs_Setup:
|
||||
b.EncodeVarint(1<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.Setup); err != nil {
|
||||
return err
|
||||
}
|
||||
case *ClientArgs_Mark:
|
||||
b.EncodeVarint(2<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.Mark); err != nil {
|
||||
return err
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("ClientArgs.Argtype has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _ClientArgs_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*ClientArgs)
|
||||
switch tag {
|
||||
case 1: // argtype.setup
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(ClientConfig)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Argtype = &ClientArgs_Setup{msg}
|
||||
return true, err
|
||||
case 2: // argtype.mark
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(Mark)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Argtype = &ClientArgs_Mark{msg}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _ClientArgs_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*ClientArgs)
|
||||
// argtype
|
||||
switch x := m.Argtype.(type) {
|
||||
case *ClientArgs_Setup:
|
||||
s := proto.Size(x.Setup)
|
||||
n += proto.SizeVarint(1<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *ClientArgs_Mark:
|
||||
s := proto.Size(x.Mark)
|
||||
n += proto.SizeVarint(2<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
type ClientStats struct {
|
||||
Latencies *HistogramData `protobuf:"bytes,1,opt,name=latencies" json:"latencies,omitempty"`
|
||||
TimeElapsed float64 `protobuf:"fixed64,3,opt,name=time_elapsed" json:"time_elapsed,omitempty"`
|
||||
TimeUser float64 `protobuf:"fixed64,4,opt,name=time_user" json:"time_user,omitempty"`
|
||||
TimeSystem float64 `protobuf:"fixed64,5,opt,name=time_system" json:"time_system,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ClientStats) Reset() { *m = ClientStats{} }
|
||||
func (m *ClientStats) String() string { return proto.CompactTextString(m) }
|
||||
func (*ClientStats) ProtoMessage() {}
|
||||
func (*ClientStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
|
||||
|
||||
func (m *ClientStats) GetLatencies() *HistogramData {
|
||||
if m != nil {
|
||||
return m.Latencies
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ClientStatus struct {
|
||||
Stats *ClientStats `protobuf:"bytes,1,opt,name=stats" json:"stats,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ClientStatus) Reset() { *m = ClientStatus{} }
|
||||
func (m *ClientStatus) String() string { return proto.CompactTextString(m) }
|
||||
func (*ClientStatus) ProtoMessage() {}
|
||||
func (*ClientStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
|
||||
|
||||
func (m *ClientStatus) GetStats() *ClientStats {
|
||||
if m != nil {
|
||||
return m.Stats
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ServerConfig struct {
|
||||
ServerType ServerType `protobuf:"varint,1,opt,name=server_type,enum=grpc.testing.ServerType" json:"server_type,omitempty"`
|
||||
Threads int32 `protobuf:"varint,2,opt,name=threads" json:"threads,omitempty"`
|
||||
EnableSsl bool `protobuf:"varint,3,opt,name=enable_ssl" json:"enable_ssl,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ServerConfig) Reset() { *m = ServerConfig{} }
|
||||
func (m *ServerConfig) String() string { return proto.CompactTextString(m) }
|
||||
func (*ServerConfig) ProtoMessage() {}
|
||||
func (*ServerConfig) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
|
||||
|
||||
type ServerArgs struct {
|
||||
// Types that are valid to be assigned to Argtype:
|
||||
// *ServerArgs_Setup
|
||||
// *ServerArgs_Mark
|
||||
Argtype isServerArgs_Argtype `protobuf_oneof:"argtype"`
|
||||
}
|
||||
|
||||
func (m *ServerArgs) Reset() { *m = ServerArgs{} }
|
||||
func (m *ServerArgs) String() string { return proto.CompactTextString(m) }
|
||||
func (*ServerArgs) ProtoMessage() {}
|
||||
func (*ServerArgs) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
|
||||
|
||||
type isServerArgs_Argtype interface {
|
||||
isServerArgs_Argtype()
|
||||
}
|
||||
|
||||
type ServerArgs_Setup struct {
|
||||
Setup *ServerConfig `protobuf:"bytes,1,opt,name=setup,oneof"`
|
||||
}
|
||||
type ServerArgs_Mark struct {
|
||||
Mark *Mark `protobuf:"bytes,2,opt,name=mark,oneof"`
|
||||
}
|
||||
|
||||
func (*ServerArgs_Setup) isServerArgs_Argtype() {}
|
||||
func (*ServerArgs_Mark) isServerArgs_Argtype() {}
|
||||
|
||||
func (m *ServerArgs) GetArgtype() isServerArgs_Argtype {
|
||||
if m != nil {
|
||||
return m.Argtype
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ServerArgs) GetSetup() *ServerConfig {
|
||||
if x, ok := m.GetArgtype().(*ServerArgs_Setup); ok {
|
||||
return x.Setup
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ServerArgs) GetMark() *Mark {
|
||||
if x, ok := m.GetArgtype().(*ServerArgs_Mark); ok {
|
||||
return x.Mark
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XXX_OneofFuncs is for the internal use of the proto package.
|
||||
func (*ServerArgs) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) {
|
||||
return _ServerArgs_OneofMarshaler, _ServerArgs_OneofUnmarshaler, _ServerArgs_OneofSizer, []interface{}{
|
||||
(*ServerArgs_Setup)(nil),
|
||||
(*ServerArgs_Mark)(nil),
|
||||
}
|
||||
}
|
||||
|
||||
func _ServerArgs_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
|
||||
m := msg.(*ServerArgs)
|
||||
// argtype
|
||||
switch x := m.Argtype.(type) {
|
||||
case *ServerArgs_Setup:
|
||||
b.EncodeVarint(1<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.Setup); err != nil {
|
||||
return err
|
||||
}
|
||||
case *ServerArgs_Mark:
|
||||
b.EncodeVarint(2<<3 | proto.WireBytes)
|
||||
if err := b.EncodeMessage(x.Mark); err != nil {
|
||||
return err
|
||||
}
|
||||
case nil:
|
||||
default:
|
||||
return fmt.Errorf("ServerArgs.Argtype has unexpected type %T", x)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _ServerArgs_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
|
||||
m := msg.(*ServerArgs)
|
||||
switch tag {
|
||||
case 1: // argtype.setup
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(ServerConfig)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Argtype = &ServerArgs_Setup{msg}
|
||||
return true, err
|
||||
case 2: // argtype.mark
|
||||
if wire != proto.WireBytes {
|
||||
return true, proto.ErrInternalBadWireType
|
||||
}
|
||||
msg := new(Mark)
|
||||
err := b.DecodeMessage(msg)
|
||||
m.Argtype = &ServerArgs_Mark{msg}
|
||||
return true, err
|
||||
default:
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
func _ServerArgs_OneofSizer(msg proto.Message) (n int) {
|
||||
m := msg.(*ServerArgs)
|
||||
// argtype
|
||||
switch x := m.Argtype.(type) {
|
||||
case *ServerArgs_Setup:
|
||||
s := proto.Size(x.Setup)
|
||||
n += proto.SizeVarint(1<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case *ServerArgs_Mark:
|
||||
s := proto.Size(x.Mark)
|
||||
n += proto.SizeVarint(2<<3 | proto.WireBytes)
|
||||
n += proto.SizeVarint(uint64(s))
|
||||
n += s
|
||||
case nil:
|
||||
default:
|
||||
panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
type ServerStatus struct {
|
||||
Stats *ServerStats `protobuf:"bytes,1,opt,name=stats" json:"stats,omitempty"`
|
||||
Port int32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ServerStatus) Reset() { *m = ServerStatus{} }
|
||||
func (m *ServerStatus) String() string { return proto.CompactTextString(m) }
|
||||
func (*ServerStatus) ProtoMessage() {}
|
||||
func (*ServerStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
|
||||
|
||||
func (m *ServerStatus) GetStats() *ServerStats {
|
||||
if m != nil {
|
||||
return m.Stats
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SimpleRequest struct {
|
||||
// Desired payload type in the response from the server.
|
||||
// If response_type is RANDOM, server randomly chooses one from other formats.
|
||||
ResponseType PayloadType `protobuf:"varint,1,opt,name=response_type,enum=grpc.testing.PayloadType" json:"response_type,omitempty"`
|
||||
// Desired payload size in the response from the server.
|
||||
// If response_type is COMPRESSABLE, this denotes the size before compression.
|
||||
ResponseSize int32 `protobuf:"varint,2,opt,name=response_size" json:"response_size,omitempty"`
|
||||
// Optional input payload sent along with the request.
|
||||
Payload *Payload `protobuf:"bytes,3,opt,name=payload" json:"payload,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SimpleRequest) Reset() { *m = SimpleRequest{} }
|
||||
func (m *SimpleRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleRequest) ProtoMessage() {}
|
||||
func (*SimpleRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} }
|
||||
|
||||
func (m *SimpleRequest) GetPayload() *Payload {
|
||||
if m != nil {
|
||||
return m.Payload
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type SimpleResponse struct {
|
||||
Payload *Payload `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"`
|
||||
}
|
||||
|
||||
func (m *SimpleResponse) Reset() { *m = SimpleResponse{} }
|
||||
func (m *SimpleResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*SimpleResponse) ProtoMessage() {}
|
||||
func (*SimpleResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
|
||||
|
||||
func (m *SimpleResponse) GetPayload() *Payload {
|
||||
if m != nil {
|
||||
return m.Payload
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*StatsRequest)(nil), "grpc.testing.StatsRequest")
|
||||
proto.RegisterType((*ServerStats)(nil), "grpc.testing.ServerStats")
|
||||
proto.RegisterType((*Payload)(nil), "grpc.testing.Payload")
|
||||
proto.RegisterType((*HistogramData)(nil), "grpc.testing.HistogramData")
|
||||
proto.RegisterType((*ClientConfig)(nil), "grpc.testing.ClientConfig")
|
||||
proto.RegisterType((*Mark)(nil), "grpc.testing.Mark")
|
||||
proto.RegisterType((*ClientArgs)(nil), "grpc.testing.ClientArgs")
|
||||
proto.RegisterType((*ClientStats)(nil), "grpc.testing.ClientStats")
|
||||
proto.RegisterType((*ClientStatus)(nil), "grpc.testing.ClientStatus")
|
||||
proto.RegisterType((*ServerConfig)(nil), "grpc.testing.ServerConfig")
|
||||
proto.RegisterType((*ServerArgs)(nil), "grpc.testing.ServerArgs")
|
||||
proto.RegisterType((*ServerStatus)(nil), "grpc.testing.ServerStatus")
|
||||
proto.RegisterType((*SimpleRequest)(nil), "grpc.testing.SimpleRequest")
|
||||
proto.RegisterType((*SimpleResponse)(nil), "grpc.testing.SimpleResponse")
|
||||
proto.RegisterEnum("grpc.testing.PayloadType", PayloadType_name, PayloadType_value)
|
||||
proto.RegisterEnum("grpc.testing.ClientType", ClientType_name, ClientType_value)
|
||||
proto.RegisterEnum("grpc.testing.ServerType", ServerType_name, ServerType_value)
|
||||
proto.RegisterEnum("grpc.testing.RpcType", RpcType_name, RpcType_value)
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion2
|
||||
|
||||
// Client API for TestService service
|
||||
|
||||
type TestServiceClient interface {
|
||||
// One request followed by one response.
|
||||
// The server returns the client payload as-is.
|
||||
UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error)
|
||||
// One request followed by one response.
|
||||
// The server returns the client payload as-is.
|
||||
StreamingCall(ctx context.Context, opts ...grpc.CallOption) (TestService_StreamingCallClient, error)
|
||||
}
|
||||
|
||||
type testServiceClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewTestServiceClient(cc *grpc.ClientConn) TestServiceClient {
|
||||
return &testServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *testServiceClient) UnaryCall(ctx context.Context, in *SimpleRequest, opts ...grpc.CallOption) (*SimpleResponse, error) {
|
||||
out := new(SimpleResponse)
|
||||
err := grpc.Invoke(ctx, "/grpc.testing.TestService/UnaryCall", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *testServiceClient) StreamingCall(ctx context.Context, opts ...grpc.CallOption) (TestService_StreamingCallClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_TestService_serviceDesc.Streams[0], c.cc, "/grpc.testing.TestService/StreamingCall", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &testServiceStreamingCallClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type TestService_StreamingCallClient interface {
|
||||
Send(*SimpleRequest) error
|
||||
Recv() (*SimpleResponse, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type testServiceStreamingCallClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *testServiceStreamingCallClient) Send(m *SimpleRequest) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *testServiceStreamingCallClient) Recv() (*SimpleResponse, error) {
|
||||
m := new(SimpleResponse)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// Server API for TestService service
|
||||
|
||||
type TestServiceServer interface {
|
||||
// One request followed by one response.
|
||||
// The server returns the client payload as-is.
|
||||
UnaryCall(context.Context, *SimpleRequest) (*SimpleResponse, error)
|
||||
// One request followed by one response.
|
||||
// The server returns the client payload as-is.
|
||||
StreamingCall(TestService_StreamingCallServer) error
|
||||
}
|
||||
|
||||
func RegisterTestServiceServer(s *grpc.Server, srv TestServiceServer) {
|
||||
s.RegisterService(&_TestService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _TestService_UnaryCall_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SimpleRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TestServiceServer).UnaryCall(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/grpc.testing.TestService/UnaryCall",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TestServiceServer).UnaryCall(ctx, req.(*SimpleRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _TestService_StreamingCall_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(TestServiceServer).StreamingCall(&testServiceStreamingCallServer{stream})
|
||||
}
|
||||
|
||||
type TestService_StreamingCallServer interface {
|
||||
Send(*SimpleResponse) error
|
||||
Recv() (*SimpleRequest, error)
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type testServiceStreamingCallServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *testServiceStreamingCallServer) Send(m *SimpleResponse) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *testServiceStreamingCallServer) Recv() (*SimpleRequest, error) {
|
||||
m := new(SimpleRequest)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
var _TestService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "grpc.testing.TestService",
|
||||
HandlerType: (*TestServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "UnaryCall",
|
||||
Handler: _TestService_UnaryCall_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "StreamingCall",
|
||||
Handler: _TestService_StreamingCall_Handler,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// Client API for Worker service
|
||||
|
||||
type WorkerClient interface {
|
||||
// Start test with specified workload
|
||||
RunTest(ctx context.Context, opts ...grpc.CallOption) (Worker_RunTestClient, error)
|
||||
// Start test with specified workload
|
||||
RunServer(ctx context.Context, opts ...grpc.CallOption) (Worker_RunServerClient, error)
|
||||
}
|
||||
|
||||
type workerClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewWorkerClient(cc *grpc.ClientConn) WorkerClient {
|
||||
return &workerClient{cc}
|
||||
}
|
||||
|
||||
func (c *workerClient) RunTest(ctx context.Context, opts ...grpc.CallOption) (Worker_RunTestClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_Worker_serviceDesc.Streams[0], c.cc, "/grpc.testing.Worker/RunTest", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &workerRunTestClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type Worker_RunTestClient interface {
|
||||
Send(*ClientArgs) error
|
||||
Recv() (*ClientStatus, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type workerRunTestClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *workerRunTestClient) Send(m *ClientArgs) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *workerRunTestClient) Recv() (*ClientStatus, error) {
|
||||
m := new(ClientStatus)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *workerClient) RunServer(ctx context.Context, opts ...grpc.CallOption) (Worker_RunServerClient, error) {
|
||||
stream, err := grpc.NewClientStream(ctx, &_Worker_serviceDesc.Streams[1], c.cc, "/grpc.testing.Worker/RunServer", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &workerRunServerClient{stream}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type Worker_RunServerClient interface {
|
||||
Send(*ServerArgs) error
|
||||
Recv() (*ServerStatus, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type workerRunServerClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *workerRunServerClient) Send(m *ServerArgs) error {
|
||||
return x.ClientStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *workerRunServerClient) Recv() (*ServerStatus, error) {
|
||||
m := new(ServerStatus)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// Server API for Worker service
|
||||
|
||||
type WorkerServer interface {
|
||||
// Start test with specified workload
|
||||
RunTest(Worker_RunTestServer) error
|
||||
// Start test with specified workload
|
||||
RunServer(Worker_RunServerServer) error
|
||||
}
|
||||
|
||||
func RegisterWorkerServer(s *grpc.Server, srv WorkerServer) {
|
||||
s.RegisterService(&_Worker_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Worker_RunTest_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(WorkerServer).RunTest(&workerRunTestServer{stream})
|
||||
}
|
||||
|
||||
type Worker_RunTestServer interface {
|
||||
Send(*ClientStatus) error
|
||||
Recv() (*ClientArgs, error)
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type workerRunTestServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *workerRunTestServer) Send(m *ClientStatus) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *workerRunTestServer) Recv() (*ClientArgs, error) {
|
||||
m := new(ClientArgs)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func _Worker_RunServer_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
return srv.(WorkerServer).RunServer(&workerRunServerServer{stream})
|
||||
}
|
||||
|
||||
type Worker_RunServerServer interface {
|
||||
Send(*ServerStatus) error
|
||||
Recv() (*ServerArgs, error)
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type workerRunServerServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *workerRunServerServer) Send(m *ServerStatus) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func (x *workerRunServerServer) Recv() (*ServerArgs, error) {
|
||||
m := new(ServerArgs)
|
||||
if err := x.ServerStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
var _Worker_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "grpc.testing.Worker",
|
||||
HandlerType: (*WorkerServer)(nil),
|
||||
Methods: []grpc.MethodDesc{},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "RunTest",
|
||||
Handler: _Worker_RunTest_Handler,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "RunServer",
|
||||
Handler: _Worker_RunServer_Handler,
|
||||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 867 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x55, 0x51, 0x8f, 0xdb, 0x44,
|
||||
0x10, 0x3e, 0xe7, 0xe2, 0xe4, 0x3c, 0x4e, 0xd2, 0xb0, 0xb4, 0x25, 0x3d, 0xee, 0xa1, 0x18, 0x44,
|
||||
0x4f, 0x87, 0x48, 0xab, 0x20, 0x21, 0xde, 0x20, 0x4d, 0x53, 0xae, 0xa2, 0xe7, 0xab, 0xec, 0x3b,
|
||||
0x50, 0x9f, 0xac, 0x8d, 0xb3, 0x4d, 0xac, 0x73, 0xd6, 0xae, 0x77, 0x0d, 0x04, 0x5e, 0x78, 0xe1,
|
||||
0x1f, 0xf0, 0x17, 0xf8, 0x9f, 0xec, 0x8e, 0x6d, 0xe1, 0x04, 0x83, 0x0e, 0xf5, 0x29, 0xf2, 0xec,
|
||||
0xcc, 0xb7, 0xdf, 0x37, 0xf3, 0xcd, 0x06, 0x3e, 0x5a, 0x30, 0x1e, 0xae, 0x37, 0x34, 0xbb, 0x79,
|
||||
0xbc, 0xca, 0xd2, 0x30, 0x90, 0x4c, 0xc8, 0x88, 0xaf, 0x1e, 0xeb, 0xdf, 0x71, 0x9a, 0x25, 0x32,
|
||||
0x21, 0x3d, 0x7d, 0x30, 0x2e, 0x0f, 0x9c, 0x87, 0xd0, 0xf3, 0x25, 0x95, 0xc2, 0x63, 0x6f, 0x73,
|
||||
0x15, 0x22, 0x43, 0x38, 0xd2, 0x47, 0x01, 0xcf, 0x37, 0x23, 0xe3, 0xa1, 0x71, 0x6a, 0x3a, 0xdf,
|
||||
0x81, 0xed, 0xb3, 0xec, 0x47, 0x96, 0x61, 0x1e, 0xb9, 0x0b, 0x3d, 0x19, 0x6d, 0x58, 0xc0, 0x62,
|
||||
0x9a, 0x0a, 0xb6, 0xc4, 0x24, 0x83, 0xbc, 0x07, 0x16, 0x46, 0x73, 0xc1, 0xb2, 0x51, 0x0b, 0x43,
|
||||
0xef, 0x83, 0x8d, 0x21, 0xb1, 0x15, 0x92, 0x6d, 0x46, 0x87, 0x3a, 0xe8, 0x7c, 0x03, 0xdd, 0x57,
|
||||
0x74, 0x1b, 0x27, 0x74, 0x49, 0x1e, 0x41, 0x5b, 0x6e, 0x53, 0x86, 0x00, 0x83, 0xc9, 0x83, 0x71,
|
||||
0x9d, 0xd6, 0xb8, 0x4c, 0xba, 0x52, 0x09, 0xa4, 0x07, 0xed, 0x45, 0xb2, 0xdc, 0x22, 0x6c, 0xcf,
|
||||
0xf9, 0x09, 0xfa, 0xe7, 0x91, 0x90, 0xc9, 0x2a, 0xa3, 0x9b, 0x67, 0x54, 0x52, 0x32, 0x80, 0xce,
|
||||
0x22, 0x0f, 0x6f, 0x98, 0x54, 0x48, 0x87, 0xa7, 0x7d, 0xad, 0x60, 0x13, 0xf1, 0x40, 0x30, 0xc6,
|
||||
0x4b, 0x26, 0x3a, 0x42, 0x7f, 0x2e, 0x22, 0x48, 0x83, 0xd8, 0x70, 0x28, 0x94, 0xc0, 0x36, 0x7e,
|
||||
0xdc, 0x87, 0x81, 0xfa, 0x08, 0x92, 0x37, 0x81, 0x78, 0x9b, 0xd3, 0x8c, 0x89, 0x91, 0x89, 0xf1,
|
||||
0x3e, 0x98, 0x61, 0x92, 0x73, 0x39, 0xea, 0x20, 0xf5, 0xdf, 0x5b, 0xd0, 0x9b, 0xc5, 0x11, 0xe3,
|
||||
0x72, 0x96, 0xf0, 0x37, 0xd1, 0x0a, 0xeb, 0xb0, 0x31, 0x81, 0xa4, 0xd9, 0x8a, 0x49, 0x81, 0x04,
|
||||
0x2c, 0xf2, 0x39, 0xd8, 0x21, 0xe6, 0x05, 0xa8, 0xaf, 0x85, 0xfa, 0x46, 0xbb, 0xfa, 0x0a, 0x20,
|
||||
0x94, 0x47, 0x00, 0x18, 0xa7, 0x8b, 0x58, 0x75, 0x4a, 0xc4, 0xc8, 0xef, 0x88, 0x7c, 0x02, 0x27,
|
||||
0x49, 0x2e, 0x85, 0xa4, 0x7c, 0xa9, 0xb2, 0x03, 0x55, 0x29, 0x82, 0x54, 0x5d, 0x14, 0xae, 0x29,
|
||||
0xe7, 0x2c, 0x46, 0xe2, 0x26, 0xf9, 0x00, 0xee, 0x94, 0x17, 0x95, 0xf1, 0x82, 0xb9, 0xa9, 0x67,
|
||||
0x94, 0x16, 0x0d, 0x0c, 0x44, 0xf4, 0x0b, 0x43, 0x01, 0x26, 0x39, 0x81, 0xbb, 0x54, 0x6c, 0x79,
|
||||
0x18, 0x54, 0xec, 0xd6, 0x19, 0xa3, 0x4b, 0x31, 0xea, 0xe2, 0xe9, 0x23, 0x38, 0x42, 0xc3, 0x68,
|
||||
0xca, 0x47, 0x48, 0xf9, 0xde, 0x2e, 0x65, 0x2f, 0x0d, 0x35, 0x5f, 0xa7, 0x03, 0xed, 0x0b, 0xe5,
|
||||
0x2f, 0x67, 0x0d, 0x50, 0xa8, 0x98, 0x66, 0x2b, 0x41, 0x3e, 0x03, 0x53, 0x30, 0x99, 0xa7, 0x38,
|
||||
0x4e, 0x7b, 0x72, 0xdc, 0x24, 0xb7, 0xe8, 0xdb, 0xf9, 0x01, 0x71, 0xa0, 0xad, 0x2d, 0x8a, 0xad,
|
||||
0xb1, 0x27, 0x64, 0x37, 0x57, 0x83, 0x9f, 0x1f, 0x3c, 0xb5, 0xa0, 0xab, 0xba, 0xaa, 0xe9, 0x38,
|
||||
0xbf, 0x82, 0x5d, 0x00, 0x14, 0x0e, 0x1c, 0x83, 0x15, 0x53, 0xa9, 0x7c, 0x1e, 0x31, 0x51, 0x5e,
|
||||
0xf7, 0xe1, 0x2e, 0xc4, 0xae, 0x41, 0xf6, 0x1d, 0x7b, 0xf8, 0x4f, 0xc7, 0xb6, 0x9b, 0x1c, 0x8b,
|
||||
0x2e, 0x70, 0xbe, 0xaa, 0xa6, 0xae, 0x2f, 0xcf, 0x05, 0x39, 0x55, 0x42, 0x35, 0x8d, 0xf2, 0xe6,
|
||||
0x07, 0x4d, 0x42, 0x91, 0xa7, 0xb3, 0x50, 0xab, 0x85, 0xfe, 0x28, 0xfd, 0xa2, 0x7c, 0x51, 0xf9,
|
||||
0xe5, 0x6f, 0xdf, 0xef, 0xf9, 0xa2, 0x28, 0x40, 0x5f, 0xdc, 0x81, 0x6e, 0x35, 0xa1, 0x16, 0x4e,
|
||||
0xa8, 0xc1, 0x28, 0x7a, 0x08, 0x45, 0xc9, 0x2d, 0x86, 0x50, 0x27, 0xf3, 0xff, 0x87, 0xf0, 0xbc,
|
||||
0x52, 0x73, 0xab, 0x3e, 0xd4, 0x5f, 0x0c, 0xb5, 0xbf, 0x69, 0x92, 0xc9, 0x42, 0x85, 0xf3, 0x9b,
|
||||
0x01, 0x7d, 0x3f, 0xda, 0xa4, 0x31, 0xab, 0x9e, 0x9c, 0x27, 0xd0, 0x57, 0x4b, 0x97, 0x26, 0x5c,
|
||||
0xb0, 0xe0, 0x76, 0x2f, 0xc2, 0xbd, 0x5a, 0x05, 0x1a, 0xbc, 0x68, 0xd0, 0xa7, 0xd0, 0x2d, 0x6d,
|
||||
0x8f, 0xdd, 0xb1, 0xf7, 0x1d, 0x5c, 0x42, 0xa8, 0x91, 0x0e, 0x2a, 0x06, 0x05, 0x48, 0xbd, 0xd2,
|
||||
0xf8, 0x8f, 0xca, 0xb3, 0xaf, 0xc1, 0xae, 0xf3, 0x18, 0x2a, 0x6f, 0x5c, 0x5e, 0xbc, 0xf2, 0xe6,
|
||||
0xbe, 0x3f, 0x7d, 0xfa, 0x72, 0x3e, 0x3c, 0x50, 0x33, 0x1a, 0x5c, 0xbb, 0x3b, 0x31, 0x43, 0x8d,
|
||||
0xad, 0xe3, 0x4d, 0xdd, 0x67, 0x97, 0x17, 0xc3, 0xd6, 0xd9, 0x97, 0xd5, 0xd2, 0x60, 0xfd, 0x7d,
|
||||
0x20, 0xfe, 0x6b, 0x77, 0x76, 0xee, 0x5d, 0xba, 0x97, 0xd7, 0x7e, 0x30, 0x7b, 0xf9, 0x62, 0xee,
|
||||
0x5e, 0x29, 0x14, 0x85, 0x3b, 0xd5, 0x07, 0x55, 0xc4, 0xd0, 0x75, 0x35, 0x6b, 0xec, 0xd5, 0xf9,
|
||||
0x73, 0xef, 0xfb, 0xb9, 0x57, 0xaf, 0x2b, 0x23, 0xc6, 0xd9, 0xc7, 0xd0, 0x2d, 0xf7, 0x96, 0x58,
|
||||
0x60, 0x5e, 0xbb, 0x53, 0xef, 0xb5, 0xca, 0xeb, 0x83, 0xe5, 0x5f, 0x79, 0xf3, 0xe9, 0xc5, 0x0b,
|
||||
0xf7, 0xdb, 0xa1, 0x31, 0xf9, 0xd3, 0x00, 0xfb, 0x4a, 0x29, 0xd5, 0x37, 0x44, 0x21, 0x23, 0xcf,
|
||||
0xc1, 0xba, 0xe6, 0x34, 0xdb, 0xce, 0x68, 0x1c, 0x93, 0xbd, 0xd5, 0xda, 0x19, 0xdd, 0xf1, 0x49,
|
||||
0xf3, 0x61, 0xd9, 0x55, 0x57, 0x4d, 0x5a, 0x2a, 0x07, 0xab, 0xe7, 0x78, 0xf5, 0x8e, 0x58, 0xa7,
|
||||
0xc6, 0x13, 0x63, 0xf2, 0x87, 0x01, 0x9d, 0x1f, 0x92, 0xec, 0x86, 0x65, 0x64, 0xa6, 0x74, 0xe5,
|
||||
0x5c, 0x93, 0x26, 0x8d, 0x2f, 0xab, 0x5e, 0x87, 0xe3, 0xe3, 0x7f, 0xdb, 0xcd, 0x5c, 0x68, 0x3c,
|
||||
0x32, 0x07, 0x4b, 0x81, 0x14, 0x7d, 0x25, 0x8d, 0x8b, 0xd8, 0x04, 0x53, 0xdf, 0x02, 0x0d, 0xb3,
|
||||
0xe8, 0xe0, 0xff, 0xea, 0x17, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0xc5, 0xdf, 0x5b, 0x40, 0x7c,
|
||||
0x07, 0x00, 0x00,
|
||||
}
|
@ -1,148 +0,0 @@
|
||||
// An integration test service that covers all the method signature permutations
|
||||
// of unary/streaming requests/responses.
|
||||
syntax = "proto3";
|
||||
|
||||
package grpc.testing;
|
||||
|
||||
enum PayloadType {
|
||||
// Compressable text format.
|
||||
COMPRESSABLE = 0;
|
||||
|
||||
// Uncompressable binary format.
|
||||
UNCOMPRESSABLE = 1;
|
||||
|
||||
// Randomly chosen from all other formats defined in this enum.
|
||||
RANDOM = 2;
|
||||
}
|
||||
|
||||
message StatsRequest {
|
||||
// run number
|
||||
int32 test_num = 1;
|
||||
}
|
||||
|
||||
message ServerStats {
|
||||
// wall clock time
|
||||
double time_elapsed = 1;
|
||||
|
||||
// user time used by the server process and threads
|
||||
double time_user = 2;
|
||||
|
||||
// server time used by the server process and all threads
|
||||
double time_system = 3;
|
||||
}
|
||||
|
||||
message Payload {
|
||||
// The type of data in body.
|
||||
PayloadType type = 1;
|
||||
// Primary contents of payload.
|
||||
bytes body = 2;
|
||||
}
|
||||
|
||||
message HistogramData {
|
||||
repeated uint32 bucket = 1;
|
||||
double min_seen = 2;
|
||||
double max_seen = 3;
|
||||
double sum = 4;
|
||||
double sum_of_squares = 5;
|
||||
double count = 6;
|
||||
}
|
||||
|
||||
enum ClientType {
|
||||
SYNCHRONOUS_CLIENT = 0;
|
||||
ASYNC_CLIENT = 1;
|
||||
}
|
||||
|
||||
enum ServerType {
|
||||
SYNCHRONOUS_SERVER = 0;
|
||||
ASYNC_SERVER = 1;
|
||||
}
|
||||
|
||||
enum RpcType {
|
||||
UNARY = 0;
|
||||
STREAMING = 1;
|
||||
}
|
||||
|
||||
message ClientConfig {
|
||||
repeated string server_targets = 1;
|
||||
ClientType client_type = 2;
|
||||
bool enable_ssl = 3;
|
||||
int32 outstanding_rpcs_per_channel = 4;
|
||||
int32 client_channels = 5;
|
||||
int32 payload_size = 6;
|
||||
// only for async client:
|
||||
int32 async_client_threads = 7;
|
||||
RpcType rpc_type = 8;
|
||||
}
|
||||
|
||||
// Request current stats
|
||||
message Mark {}
|
||||
|
||||
message ClientArgs {
|
||||
oneof argtype {
|
||||
ClientConfig setup = 1;
|
||||
Mark mark = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ClientStats {
|
||||
HistogramData latencies = 1;
|
||||
double time_elapsed = 3;
|
||||
double time_user = 4;
|
||||
double time_system = 5;
|
||||
}
|
||||
|
||||
message ClientStatus {
|
||||
ClientStats stats = 1;
|
||||
}
|
||||
|
||||
message ServerConfig {
|
||||
ServerType server_type = 1;
|
||||
int32 threads = 2;
|
||||
bool enable_ssl = 3;
|
||||
}
|
||||
|
||||
message ServerArgs {
|
||||
oneof argtype {
|
||||
ServerConfig setup = 1;
|
||||
Mark mark = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message ServerStatus {
|
||||
ServerStats stats = 1;
|
||||
int32 port = 2;
|
||||
}
|
||||
|
||||
message SimpleRequest {
|
||||
// Desired payload type in the response from the server.
|
||||
// If response_type is RANDOM, server randomly chooses one from other formats.
|
||||
PayloadType response_type = 1;
|
||||
|
||||
// Desired payload size in the response from the server.
|
||||
// If response_type is COMPRESSABLE, this denotes the size before compression.
|
||||
int32 response_size = 2;
|
||||
|
||||
// Optional input payload sent along with the request.
|
||||
Payload payload = 3;
|
||||
}
|
||||
|
||||
message SimpleResponse {
|
||||
Payload payload = 1;
|
||||
}
|
||||
|
||||
service TestService {
|
||||
// One request followed by one response.
|
||||
// The server returns the client payload as-is.
|
||||
rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
|
||||
|
||||
// One request followed by one response.
|
||||
// The server returns the client payload as-is.
|
||||
rpc StreamingCall(stream SimpleRequest) returns (stream SimpleResponse);
|
||||
}
|
||||
|
||||
service Worker {
|
||||
// Start test with specified workload
|
||||
rpc RunTest(stream ClientArgs) returns (stream ClientStatus);
|
||||
// Start test with specified workload
|
||||
rpc RunServer(stream ServerArgs) returns (stream ServerStatus);
|
||||
}
|
@ -28,7 +28,7 @@ func main() {
|
||||
grpclog.Fatalf("Failed to serve: %v", err)
|
||||
}
|
||||
}()
|
||||
addr, stopper := benchmark.StartServer(":0") // listen on all interfaces
|
||||
addr, stopper := benchmark.StartServer(benchmark.ServerInfo{Addr: ":0", Type: "protobuf"}) // listen on all interfaces
|
||||
grpclog.Println("Server Address: ", addr)
|
||||
<-time.After(time.Duration(*duration) * time.Second)
|
||||
stopper()
|
||||
|
15
benchmark/server/testdata/ca.pem
vendored
Normal file
15
benchmark/server/testdata/ca.pem
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICSjCCAbOgAwIBAgIJAJHGGR4dGioHMA0GCSqGSIb3DQEBCwUAMFYxCzAJBgNV
|
||||
BAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX
|
||||
aWRnaXRzIFB0eSBMdGQxDzANBgNVBAMTBnRlc3RjYTAeFw0xNDExMTEyMjMxMjla
|
||||
Fw0yNDExMDgyMjMxMjlaMFYxCzAJBgNVBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0
|
||||
YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxDzANBgNVBAMT
|
||||
BnRlc3RjYTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwEDfBV5MYdlHVHJ7
|
||||
+L4nxrZy7mBfAVXpOc5vMYztssUI7mL2/iYujiIXM+weZYNTEpLdjyJdu7R5gGUu
|
||||
g1jSVK/EPHfc74O7AyZU34PNIP4Sh33N+/A5YexrNgJlPY+E3GdVYi4ldWJjgkAd
|
||||
Qah2PH5ACLrIIC6tRka9hcaBlIECAwEAAaMgMB4wDAYDVR0TBAUwAwEB/zAOBgNV
|
||||
HQ8BAf8EBAMCAgQwDQYJKoZIhvcNAQELBQADgYEAHzC7jdYlzAVmddi/gdAeKPau
|
||||
sPBG/C2HCWqHzpCUHcKuvMzDVkY/MP2o6JIW2DBbY64bO/FceExhjcykgaYtCH/m
|
||||
oIU63+CFOTtR7otyQAWHqXa7q4SbCDlG7DyRFxqG0txPtGvy12lgldA2+RgcigQG
|
||||
Dfcog5wrJytaQ6UA0wE=
|
||||
-----END CERTIFICATE-----
|
16
benchmark/server/testdata/server1.key
vendored
Normal file
16
benchmark/server/testdata/server1.key
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAOHDFScoLCVJpYDD
|
||||
M4HYtIdV6Ake/sMNaaKdODjDMsux/4tDydlumN+fm+AjPEK5GHhGn1BgzkWF+slf
|
||||
3BxhrA/8dNsnunstVA7ZBgA/5qQxMfGAq4wHNVX77fBZOgp9VlSMVfyd9N8YwbBY
|
||||
AckOeUQadTi2X1S6OgJXgQ0m3MWhAgMBAAECgYAn7qGnM2vbjJNBm0VZCkOkTIWm
|
||||
V10okw7EPJrdL2mkre9NasghNXbE1y5zDshx5Nt3KsazKOxTT8d0Jwh/3KbaN+YY
|
||||
tTCbKGW0pXDRBhwUHRcuRzScjli8Rih5UOCiZkhefUTcRb6xIhZJuQy71tjaSy0p
|
||||
dHZRmYyBYO2YEQ8xoQJBAPrJPhMBkzmEYFtyIEqAxQ/o/A6E+E4w8i+KM7nQCK7q
|
||||
K4JXzyXVAjLfyBZWHGM2uro/fjqPggGD6QH1qXCkI4MCQQDmdKeb2TrKRh5BY1LR
|
||||
81aJGKcJ2XbcDu6wMZK4oqWbTX2KiYn9GB0woM6nSr/Y6iy1u145YzYxEV/iMwff
|
||||
DJULAkB8B2MnyzOg0pNFJqBJuH29bKCcHa8gHJzqXhNO5lAlEbMK95p/P2Wi+4Hd
|
||||
aiEIAF1BF326QJcvYKmwSmrORp85AkAlSNxRJ50OWrfMZnBgzVjDx3xG6KsFQVk2
|
||||
ol6VhqL6dFgKUORFUWBvnKSyhjJxurlPEahV6oo6+A+mPhFY8eUvAkAZQyTdupP3
|
||||
XEFQKctGz+9+gKkemDp7LBBMEMBXrGTLPhpEfcjv/7KPdnFHYmhYeBTBnuVmTVWe
|
||||
F98XJ7tIFfJq
|
||||
-----END PRIVATE KEY-----
|
16
benchmark/server/testdata/server1.pem
vendored
Normal file
16
benchmark/server/testdata/server1.pem
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICnDCCAgWgAwIBAgIBBzANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJBVTET
|
||||
MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ
|
||||
dHkgTHRkMQ8wDQYDVQQDEwZ0ZXN0Y2EwHhcNMTUxMTA0MDIyMDI0WhcNMjUxMTAx
|
||||
MDIyMDI0WjBlMQswCQYDVQQGEwJVUzERMA8GA1UECBMISWxsaW5vaXMxEDAOBgNV
|
||||
BAcTB0NoaWNhZ28xFTATBgNVBAoTDEV4YW1wbGUsIENvLjEaMBgGA1UEAxQRKi50
|
||||
ZXN0Lmdvb2dsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAOHDFSco
|
||||
LCVJpYDDM4HYtIdV6Ake/sMNaaKdODjDMsux/4tDydlumN+fm+AjPEK5GHhGn1Bg
|
||||
zkWF+slf3BxhrA/8dNsnunstVA7ZBgA/5qQxMfGAq4wHNVX77fBZOgp9VlSMVfyd
|
||||
9N8YwbBYAckOeUQadTi2X1S6OgJXgQ0m3MWhAgMBAAGjazBpMAkGA1UdEwQCMAAw
|
||||
CwYDVR0PBAQDAgXgME8GA1UdEQRIMEaCECoudGVzdC5nb29nbGUuZnKCGHdhdGVy
|
||||
em9vaS50ZXN0Lmdvb2dsZS5iZYISKi50ZXN0LnlvdXR1YmUuY29thwTAqAEDMA0G
|
||||
CSqGSIb3DQEBCwUAA4GBAJFXVifQNub1LUP4JlnX5lXNlo8FxZ2a12AFQs+bzoJ6
|
||||
hM044EDjqyxUqSbVePK0ni3w1fHQB5rY9yYC5f8G7aqqTY1QOhoUk8ZTSTRpnkTh
|
||||
y4jjdvTZeLDVBlueZUTDRmy2feY5aZIU18vFDK08dTG0A87pppuv1LNIR3loveU8
|
||||
-----END CERTIFICATE-----
|
@ -145,6 +145,17 @@ func NewHistogram(opts HistogramOptions) *Histogram {
|
||||
return &h
|
||||
}
|
||||
|
||||
// Clear resets all the content of histogram.
|
||||
func (h *Histogram) Clear() {
|
||||
h.count = newCounter()
|
||||
h.sum = newCounter()
|
||||
h.sumOfSquares = newCounter()
|
||||
h.tracker = newTracker()
|
||||
for _, v := range h.buckets {
|
||||
v.count = newCounter()
|
||||
}
|
||||
}
|
||||
|
||||
// Opts returns a copy of the options used to create the Histogram.
|
||||
func (h *Histogram) Opts() HistogramOptions {
|
||||
return h.opts
|
||||
|
353
benchmark/worker/benchmark_client.go
Normal file
353
benchmark/worker/benchmark_client.go
Normal file
@ -0,0 +1,353 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"math"
|
||||
"runtime"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/benchmark"
|
||||
testpb "google.golang.org/grpc/benchmark/grpc_testing"
|
||||
"google.golang.org/grpc/benchmark/stats"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
)
|
||||
|
||||
var (
|
||||
caFile = "benchmark/server/testdata/ca.pem"
|
||||
)
|
||||
|
||||
type benchmarkClient struct {
|
||||
closeConns func()
|
||||
stop chan bool
|
||||
mu sync.RWMutex
|
||||
lastResetTime time.Time
|
||||
histogram *stats.Histogram
|
||||
}
|
||||
|
||||
func printClientConfig(config *testpb.ClientConfig) {
|
||||
// Some config options are ignored:
|
||||
// - client type:
|
||||
// will always create sync client
|
||||
// - async client threads.
|
||||
// - core list
|
||||
grpclog.Printf(" * client type: %v (ignored, always creates sync client)", config.ClientType)
|
||||
grpclog.Printf(" * async client threads: %v (ignored)", config.AsyncClientThreads)
|
||||
grpclog.Printf(" * core list: %v (ignored)", config.CoreList)
|
||||
|
||||
grpclog.Printf(" - security params: %v", config.SecurityParams)
|
||||
grpclog.Printf(" - core limit: %v", config.CoreLimit)
|
||||
grpclog.Printf(" - payload config: %v", config.PayloadConfig)
|
||||
grpclog.Printf(" - rpcs per chann: %v", config.OutstandingRpcsPerChannel)
|
||||
grpclog.Printf(" - channel number: %v", config.ClientChannels)
|
||||
grpclog.Printf(" - load params: %v", config.LoadParams)
|
||||
grpclog.Printf(" - rpc type: %v", config.RpcType)
|
||||
grpclog.Printf(" - histogram params: %v", config.HistogramParams)
|
||||
grpclog.Printf(" - server targets: %v", config.ServerTargets)
|
||||
}
|
||||
|
||||
func setupClientEnv(config *testpb.ClientConfig) {
|
||||
// Use one cpu core by default.
|
||||
// TODO: Revisit this for the optimal default setup.
|
||||
if config.CoreLimit > 1 {
|
||||
runtime.GOMAXPROCS(int(config.CoreLimit))
|
||||
} else {
|
||||
runtime.GOMAXPROCS(1)
|
||||
}
|
||||
}
|
||||
|
||||
// createConns creates connections according to given config.
|
||||
// It returns the connections and corresponding function to close them.
|
||||
// It returns non-nil error if there is anything wrong.
|
||||
func createConns(config *testpb.ClientConfig) ([]*grpc.ClientConn, func(), error) {
|
||||
var opts []grpc.DialOption
|
||||
|
||||
// Sanity check for client type.
|
||||
switch config.ClientType {
|
||||
case testpb.ClientType_SYNC_CLIENT:
|
||||
case testpb.ClientType_ASYNC_CLIENT:
|
||||
default:
|
||||
return nil, nil, grpc.Errorf(codes.InvalidArgument, "unknow client type: %v", config.ClientType)
|
||||
}
|
||||
|
||||
// Check and set security options.
|
||||
if config.SecurityParams != nil {
|
||||
creds, err := credentials.NewClientTLSFromFile(abs(caFile), config.SecurityParams.ServerHostOverride)
|
||||
if err != nil {
|
||||
return nil, nil, grpc.Errorf(codes.InvalidArgument, "failed to create TLS credentials %v", err)
|
||||
}
|
||||
opts = append(opts, grpc.WithTransportCredentials(creds))
|
||||
} else {
|
||||
opts = append(opts, grpc.WithInsecure())
|
||||
}
|
||||
|
||||
// Use byteBufCodec if it is required.
|
||||
if config.PayloadConfig != nil {
|
||||
switch config.PayloadConfig.Payload.(type) {
|
||||
case *testpb.PayloadConfig_BytebufParams:
|
||||
opts = append(opts, grpc.WithCodec(byteBufCodec{}))
|
||||
case *testpb.PayloadConfig_SimpleParams:
|
||||
default:
|
||||
return nil, nil, grpc.Errorf(codes.InvalidArgument, "unknow payload config: %v", config.PayloadConfig)
|
||||
}
|
||||
}
|
||||
|
||||
// Create connections.
|
||||
connCount := int(config.ClientChannels)
|
||||
conns := make([]*grpc.ClientConn, connCount)
|
||||
for connIndex := 0; connIndex < connCount; connIndex++ {
|
||||
conns[connIndex] = benchmark.NewClientConn(config.ServerTargets[connIndex%len(config.ServerTargets)], opts...)
|
||||
}
|
||||
|
||||
return conns, func() {
|
||||
for _, conn := range conns {
|
||||
conn.Close()
|
||||
}
|
||||
}, nil
|
||||
}
|
||||
|
||||
func performRPCs(config *testpb.ClientConfig, conns []*grpc.ClientConn, bc *benchmarkClient) error {
|
||||
// Read payload size and type from config.
|
||||
var (
|
||||
payloadReqSize, payloadRespSize int
|
||||
payloadType string
|
||||
)
|
||||
if config.PayloadConfig != nil {
|
||||
switch c := config.PayloadConfig.Payload.(type) {
|
||||
case *testpb.PayloadConfig_BytebufParams:
|
||||
payloadReqSize = int(c.BytebufParams.ReqSize)
|
||||
payloadRespSize = int(c.BytebufParams.RespSize)
|
||||
payloadType = "bytebuf"
|
||||
case *testpb.PayloadConfig_SimpleParams:
|
||||
payloadReqSize = int(c.SimpleParams.ReqSize)
|
||||
payloadRespSize = int(c.SimpleParams.RespSize)
|
||||
payloadType = "protobuf"
|
||||
default:
|
||||
return grpc.Errorf(codes.InvalidArgument, "unknow payload config: %v", config.PayloadConfig)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO add open loop distribution.
|
||||
switch config.LoadParams.Load.(type) {
|
||||
case *testpb.LoadParams_ClosedLoop:
|
||||
case *testpb.LoadParams_Poisson:
|
||||
return grpc.Errorf(codes.Unimplemented, "unsupported load params: %v", config.LoadParams)
|
||||
default:
|
||||
return grpc.Errorf(codes.InvalidArgument, "unknown load params: %v", config.LoadParams)
|
||||
}
|
||||
|
||||
rpcCountPerConn := int(config.OutstandingRpcsPerChannel)
|
||||
|
||||
switch config.RpcType {
|
||||
case testpb.RpcType_UNARY:
|
||||
bc.doCloseLoopUnary(conns, rpcCountPerConn, payloadReqSize, payloadRespSize)
|
||||
// TODO open loop.
|
||||
case testpb.RpcType_STREAMING:
|
||||
bc.doCloseLoopStreaming(conns, rpcCountPerConn, payloadReqSize, payloadRespSize, payloadType)
|
||||
// TODO open loop.
|
||||
default:
|
||||
return grpc.Errorf(codes.InvalidArgument, "unknown rpc type: %v", config.RpcType)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func startBenchmarkClient(config *testpb.ClientConfig) (*benchmarkClient, error) {
|
||||
printClientConfig(config)
|
||||
|
||||
// Set running environment like how many cores to use.
|
||||
setupClientEnv(config)
|
||||
|
||||
conns, closeConns, err := createConns(config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
bc := &benchmarkClient{
|
||||
histogram: stats.NewHistogram(stats.HistogramOptions{
|
||||
NumBuckets: int(math.Log(config.HistogramParams.MaxPossible)/math.Log(1+config.HistogramParams.Resolution)) + 1,
|
||||
GrowthFactor: config.HistogramParams.Resolution,
|
||||
BaseBucketSize: (1 + config.HistogramParams.Resolution),
|
||||
MinValue: 0,
|
||||
}),
|
||||
stop: make(chan bool),
|
||||
lastResetTime: time.Now(),
|
||||
closeConns: closeConns,
|
||||
}
|
||||
|
||||
if err = performRPCs(config, conns, bc); err != nil {
|
||||
// Close all connections if performRPCs failed.
|
||||
closeConns()
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return bc, nil
|
||||
}
|
||||
|
||||
func (bc *benchmarkClient) doCloseLoopUnary(conns []*grpc.ClientConn, rpcCountPerConn int, reqSize int, respSize int) {
|
||||
for _, conn := range conns {
|
||||
client := testpb.NewBenchmarkServiceClient(conn)
|
||||
// For each connection, create rpcCountPerConn goroutines to do rpc.
|
||||
for j := 0; j < rpcCountPerConn; j++ {
|
||||
go func() {
|
||||
// TODO: do warm up if necessary.
|
||||
// Now relying on worker client to reserve time to do warm up.
|
||||
// The worker client needs to wait for some time after client is created,
|
||||
// before starting benchmark.
|
||||
done := make(chan bool)
|
||||
for {
|
||||
go func() {
|
||||
start := time.Now()
|
||||
if err := benchmark.DoUnaryCall(client, reqSize, respSize); err != nil {
|
||||
select {
|
||||
case <-bc.stop:
|
||||
case done <- false:
|
||||
}
|
||||
return
|
||||
}
|
||||
elapse := time.Since(start)
|
||||
bc.mu.Lock()
|
||||
bc.histogram.Add(int64(elapse))
|
||||
bc.mu.Unlock()
|
||||
select {
|
||||
case <-bc.stop:
|
||||
case done <- true:
|
||||
}
|
||||
}()
|
||||
select {
|
||||
case <-bc.stop:
|
||||
return
|
||||
case <-done:
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (bc *benchmarkClient) doCloseLoopStreaming(conns []*grpc.ClientConn, rpcCountPerConn int, reqSize int, respSize int, payloadType string) {
|
||||
var doRPC func(testpb.BenchmarkService_StreamingCallClient, int, int) error
|
||||
if payloadType == "bytebuf" {
|
||||
doRPC = benchmark.DoByteBufStreamingRoundTrip
|
||||
} else {
|
||||
doRPC = benchmark.DoStreamingRoundTrip
|
||||
}
|
||||
for _, conn := range conns {
|
||||
// For each connection, create rpcCountPerConn goroutines to do rpc.
|
||||
for j := 0; j < rpcCountPerConn; j++ {
|
||||
c := testpb.NewBenchmarkServiceClient(conn)
|
||||
stream, err := c.StreamingCall(context.Background())
|
||||
if err != nil {
|
||||
grpclog.Fatalf("%v.StreamingCall(_) = _, %v", c, err)
|
||||
}
|
||||
// Create benchmark rpc goroutine.
|
||||
go func() {
|
||||
// TODO: do warm up if necessary.
|
||||
// Now relying on worker client to reserve time to do warm up.
|
||||
// The worker client needs to wait for some time after client is created,
|
||||
// before starting benchmark.
|
||||
done := make(chan bool)
|
||||
for {
|
||||
go func() {
|
||||
start := time.Now()
|
||||
if err := doRPC(stream, reqSize, respSize); err != nil {
|
||||
select {
|
||||
case <-bc.stop:
|
||||
case done <- false:
|
||||
}
|
||||
return
|
||||
}
|
||||
elapse := time.Since(start)
|
||||
bc.mu.Lock()
|
||||
bc.histogram.Add(int64(elapse))
|
||||
bc.mu.Unlock()
|
||||
select {
|
||||
case <-bc.stop:
|
||||
case done <- true:
|
||||
}
|
||||
}()
|
||||
select {
|
||||
case <-bc.stop:
|
||||
return
|
||||
case <-done:
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (bc *benchmarkClient) getStats() *testpb.ClientStats {
|
||||
bc.mu.RLock()
|
||||
defer bc.mu.RUnlock()
|
||||
timeElapsed := time.Since(bc.lastResetTime).Seconds()
|
||||
|
||||
histogramValue := bc.histogram.Value()
|
||||
b := make([]uint32, len(histogramValue.Buckets))
|
||||
for i, v := range histogramValue.Buckets {
|
||||
b[i] = uint32(v.Count)
|
||||
}
|
||||
return &testpb.ClientStats{
|
||||
Latencies: &testpb.HistogramData{
|
||||
Bucket: b,
|
||||
MinSeen: float64(histogramValue.Min),
|
||||
MaxSeen: float64(histogramValue.Max),
|
||||
Sum: float64(histogramValue.Sum),
|
||||
SumOfSquares: float64(histogramValue.SumOfSquares),
|
||||
Count: float64(histogramValue.Count),
|
||||
},
|
||||
TimeElapsed: timeElapsed,
|
||||
TimeUser: 0,
|
||||
TimeSystem: 0,
|
||||
}
|
||||
}
|
||||
|
||||
// reset clears the contents for histogram and set lastResetTime to Now().
|
||||
// It is called to get ready for benchmark runs.
|
||||
func (bc *benchmarkClient) reset() {
|
||||
bc.mu.Lock()
|
||||
defer bc.mu.Unlock()
|
||||
bc.lastResetTime = time.Now()
|
||||
bc.histogram.Clear()
|
||||
}
|
||||
|
||||
func (bc *benchmarkClient) shutdown() {
|
||||
close(bc.stop)
|
||||
bc.closeConns()
|
||||
}
|
172
benchmark/worker/benchmark_server.go
Normal file
172
benchmark/worker/benchmark_server.go
Normal file
@ -0,0 +1,172 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/benchmark"
|
||||
testpb "google.golang.org/grpc/benchmark/grpc_testing"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
)
|
||||
|
||||
var (
|
||||
// File path related to google.golang.org/grpc.
|
||||
certFile = "benchmark/server/testdata/server1.pem"
|
||||
keyFile = "benchmark/server/testdata/server1.key"
|
||||
)
|
||||
|
||||
type benchmarkServer struct {
|
||||
port int
|
||||
cores int
|
||||
closeFunc func()
|
||||
mu sync.RWMutex
|
||||
lastResetTime time.Time
|
||||
}
|
||||
|
||||
func printServerConfig(config *testpb.ServerConfig) {
|
||||
// Some config options are ignored:
|
||||
// - server type:
|
||||
// will always start sync server
|
||||
// - async server threads
|
||||
// - core list
|
||||
grpclog.Printf(" * server type: %v (ignored, always starts sync server)", config.ServerType)
|
||||
grpclog.Printf(" * async server threads: %v (ignored)", config.AsyncServerThreads)
|
||||
grpclog.Printf(" * core list: %v (ignored)", config.CoreList)
|
||||
|
||||
grpclog.Printf(" - security params: %v", config.SecurityParams)
|
||||
grpclog.Printf(" - core limit: %v", config.CoreLimit)
|
||||
grpclog.Printf(" - port: %v", config.Port)
|
||||
grpclog.Printf(" - payload config: %v", config.PayloadConfig)
|
||||
}
|
||||
|
||||
func startBenchmarkServer(config *testpb.ServerConfig, serverPort int) (*benchmarkServer, error) {
|
||||
printServerConfig(config)
|
||||
|
||||
// Use one cpu core by default.
|
||||
// TODO: Revisit this for the optimal default setup.
|
||||
numOfCores := 1
|
||||
if config.CoreLimit > 1 {
|
||||
numOfCores = int(config.CoreLimit)
|
||||
}
|
||||
runtime.GOMAXPROCS(numOfCores)
|
||||
|
||||
var opts []grpc.ServerOption
|
||||
|
||||
// Sanity check for server type.
|
||||
switch config.ServerType {
|
||||
case testpb.ServerType_SYNC_SERVER:
|
||||
case testpb.ServerType_ASYNC_SERVER:
|
||||
case testpb.ServerType_ASYNC_GENERIC_SERVER:
|
||||
default:
|
||||
return nil, grpc.Errorf(codes.InvalidArgument, "unknow server type: %v", config.ServerType)
|
||||
}
|
||||
|
||||
// Set security options.
|
||||
if config.SecurityParams != nil {
|
||||
creds, err := credentials.NewServerTLSFromFile(abs(certFile), abs(keyFile))
|
||||
if err != nil {
|
||||
grpclog.Fatalf("failed to generate credentials %v", err)
|
||||
}
|
||||
opts = append(opts, grpc.Creds(creds))
|
||||
}
|
||||
|
||||
// Priority: config.Port > serverPort > default (0).
|
||||
port := int(config.Port)
|
||||
if port == 0 {
|
||||
port = serverPort
|
||||
}
|
||||
|
||||
// Create different benchmark server according to config.
|
||||
var (
|
||||
addr string
|
||||
closeFunc func()
|
||||
err error
|
||||
)
|
||||
if config.PayloadConfig != nil {
|
||||
switch payload := config.PayloadConfig.Payload.(type) {
|
||||
case *testpb.PayloadConfig_BytebufParams:
|
||||
opts = append(opts, grpc.CustomCodec(byteBufCodec{}))
|
||||
addr, closeFunc = benchmark.StartServer(benchmark.ServerInfo{
|
||||
Addr: ":" + strconv.Itoa(port),
|
||||
Type: "bytebuf",
|
||||
Metadata: payload.BytebufParams.RespSize,
|
||||
}, opts...)
|
||||
case *testpb.PayloadConfig_SimpleParams:
|
||||
addr, closeFunc = benchmark.StartServer(benchmark.ServerInfo{
|
||||
Addr: ":" + strconv.Itoa(port),
|
||||
Type: "protobuf",
|
||||
}, opts...)
|
||||
case *testpb.PayloadConfig_ComplexParams:
|
||||
return nil, grpc.Errorf(codes.Unimplemented, "unsupported payload config: %v", config.PayloadConfig)
|
||||
default:
|
||||
return nil, grpc.Errorf(codes.InvalidArgument, "unknow payload config: %v", config.PayloadConfig)
|
||||
}
|
||||
} else {
|
||||
// Start protobuf server if payload config is nil.
|
||||
addr, closeFunc = benchmark.StartServer(benchmark.ServerInfo{
|
||||
Addr: ":" + strconv.Itoa(port),
|
||||
Type: "protobuf",
|
||||
}, opts...)
|
||||
}
|
||||
|
||||
grpclog.Printf("benchmark server listening at %v", addr)
|
||||
addrSplitted := strings.Split(addr, ":")
|
||||
p, err := strconv.Atoi(addrSplitted[len(addrSplitted)-1])
|
||||
if err != nil {
|
||||
grpclog.Fatalf("failed to get port number from server address: %v", err)
|
||||
}
|
||||
|
||||
return &benchmarkServer{port: p, cores: numOfCores, closeFunc: closeFunc, lastResetTime: time.Now()}, nil
|
||||
}
|
||||
|
||||
func (bs *benchmarkServer) getStats() *testpb.ServerStats {
|
||||
// TODO wall time, sys time, user time.
|
||||
bs.mu.RLock()
|
||||
defer bs.mu.RUnlock()
|
||||
return &testpb.ServerStats{TimeElapsed: time.Since(bs.lastResetTime).Seconds(), TimeUser: 0, TimeSystem: 0}
|
||||
}
|
||||
|
||||
func (bs *benchmarkServer) reset() {
|
||||
bs.mu.Lock()
|
||||
defer bs.mu.Unlock()
|
||||
bs.lastResetTime = time.Now()
|
||||
}
|
239
benchmark/worker/main.go
Normal file
239
benchmark/worker/main.go
Normal file
@ -0,0 +1,239 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
testpb "google.golang.org/grpc/benchmark/grpc_testing"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/grpclog"
|
||||
)
|
||||
|
||||
var (
|
||||
driverPort = flag.Int("driver_port", 10000, "port for communication with driver")
|
||||
serverPort = flag.Int("server_port", 0, "port for benchmark server if not specified by server config message")
|
||||
)
|
||||
|
||||
type byteBufCodec struct {
|
||||
}
|
||||
|
||||
func (byteBufCodec) Marshal(v interface{}) ([]byte, error) {
|
||||
b, ok := v.(*[]byte)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("failed to marshal: %v is not type of *[]byte")
|
||||
}
|
||||
return *b, nil
|
||||
}
|
||||
|
||||
func (byteBufCodec) Unmarshal(data []byte, v interface{}) error {
|
||||
b, ok := v.(*[]byte)
|
||||
if !ok {
|
||||
return fmt.Errorf("failed to marshal: %v is not type of *[]byte")
|
||||
}
|
||||
*b = data
|
||||
return nil
|
||||
}
|
||||
|
||||
func (byteBufCodec) String() string {
|
||||
return "bytebuffer"
|
||||
}
|
||||
|
||||
// workerServer implements WorkerService rpc handlers.
|
||||
// It can create benchmarkServer or benchmarkClient on demand.
|
||||
type workerServer struct {
|
||||
stop chan<- bool
|
||||
serverPort int
|
||||
}
|
||||
|
||||
func (s *workerServer) RunServer(stream testpb.WorkerService_RunServerServer) error {
|
||||
var bs *benchmarkServer
|
||||
defer func() {
|
||||
// Close benchmark server when stream ends.
|
||||
grpclog.Printf("closing benchmark server")
|
||||
if bs != nil {
|
||||
bs.closeFunc()
|
||||
}
|
||||
}()
|
||||
for {
|
||||
in, err := stream.Recv()
|
||||
if err == io.EOF {
|
||||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var out *testpb.ServerStatus
|
||||
switch argtype := in.Argtype.(type) {
|
||||
case *testpb.ServerArgs_Setup:
|
||||
grpclog.Printf("server setup received:")
|
||||
if bs != nil {
|
||||
grpclog.Printf("server setup received when server already exists, closing the existing server")
|
||||
bs.closeFunc()
|
||||
}
|
||||
bs, err = startBenchmarkServer(argtype.Setup, s.serverPort)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
out = &testpb.ServerStatus{
|
||||
Stats: bs.getStats(),
|
||||
Port: int32(bs.port),
|
||||
Cores: int32(bs.cores),
|
||||
}
|
||||
|
||||
case *testpb.ServerArgs_Mark:
|
||||
grpclog.Printf("server mark received:")
|
||||
grpclog.Printf(" - %v", argtype)
|
||||
if bs == nil {
|
||||
return grpc.Errorf(codes.InvalidArgument, "server does not exist when mark received")
|
||||
}
|
||||
out = &testpb.ServerStatus{
|
||||
Stats: bs.getStats(),
|
||||
Port: int32(bs.port),
|
||||
Cores: int32(bs.cores),
|
||||
}
|
||||
if argtype.Mark.Reset_ {
|
||||
bs.reset()
|
||||
}
|
||||
}
|
||||
|
||||
if err := stream.Send(out); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *workerServer) RunClient(stream testpb.WorkerService_RunClientServer) error {
|
||||
var bc *benchmarkClient
|
||||
defer func() {
|
||||
// Shut down benchmark client when stream ends.
|
||||
grpclog.Printf("shuting down benchmark client")
|
||||
if bc != nil {
|
||||
bc.shutdown()
|
||||
}
|
||||
}()
|
||||
for {
|
||||
in, err := stream.Recv()
|
||||
if err == io.EOF {
|
||||
return nil
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var out *testpb.ClientStatus
|
||||
switch t := in.Argtype.(type) {
|
||||
case *testpb.ClientArgs_Setup:
|
||||
grpclog.Printf("client setup received:")
|
||||
if bc != nil {
|
||||
grpclog.Printf("client setup received when client already exists, shuting down the existing client")
|
||||
bc.shutdown()
|
||||
}
|
||||
bc, err = startBenchmarkClient(t.Setup)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
out = &testpb.ClientStatus{
|
||||
Stats: bc.getStats(),
|
||||
}
|
||||
|
||||
case *testpb.ClientArgs_Mark:
|
||||
grpclog.Printf("client mark received:")
|
||||
grpclog.Printf(" - %v", t)
|
||||
if bc == nil {
|
||||
return grpc.Errorf(codes.InvalidArgument, "client does not exist when mark received")
|
||||
}
|
||||
out = &testpb.ClientStatus{
|
||||
Stats: bc.getStats(),
|
||||
}
|
||||
if t.Mark.Reset_ {
|
||||
bc.reset()
|
||||
}
|
||||
}
|
||||
|
||||
if err := stream.Send(out); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *workerServer) CoreCount(ctx context.Context, in *testpb.CoreRequest) (*testpb.CoreResponse, error) {
|
||||
grpclog.Printf("core count: %v", runtime.NumCPU())
|
||||
return &testpb.CoreResponse{int32(runtime.NumCPU())}, nil
|
||||
}
|
||||
|
||||
func (s *workerServer) QuitWorker(ctx context.Context, in *testpb.Void) (*testpb.Void, error) {
|
||||
grpclog.Printf("quiting worker")
|
||||
s.stop <- true
|
||||
return &testpb.Void{}, nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
lis, err := net.Listen("tcp", ":"+strconv.Itoa(*driverPort))
|
||||
if err != nil {
|
||||
grpclog.Fatalf("failed to listen: %v", err)
|
||||
}
|
||||
grpclog.Printf("worker listening at port %v", *driverPort)
|
||||
|
||||
s := grpc.NewServer()
|
||||
stop := make(chan bool)
|
||||
testpb.RegisterWorkerServiceServer(s, &workerServer{
|
||||
stop: stop,
|
||||
serverPort: *serverPort,
|
||||
})
|
||||
|
||||
go func() {
|
||||
<-stop
|
||||
// Wait for 1 second before stopping the server to make sure the return value of QuitWorker is sent to client.
|
||||
// TODO revise this once server graceful stop is supported in gRPC.
|
||||
time.Sleep(time.Second)
|
||||
s.Stop()
|
||||
}()
|
||||
|
||||
s.Serve(lis)
|
||||
}
|
75
benchmark/worker/util.go
Normal file
75
benchmark/worker/util.go
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright 2016, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
// abs returns the absolute path the given relative file or directory path,
|
||||
// relative to the google.golang.org/grpc directory in the user's GOPATH.
|
||||
// If rel is already absolute, it is returned unmodified.
|
||||
func abs(rel string) string {
|
||||
if filepath.IsAbs(rel) {
|
||||
return rel
|
||||
}
|
||||
v, err := goPackagePath("google.golang.org/grpc")
|
||||
if err != nil {
|
||||
log.Fatalf("Error finding google.golang.org/grpc/testdata directory: %v", err)
|
||||
}
|
||||
return filepath.Join(v, rel)
|
||||
}
|
||||
|
||||
func goPackagePath(pkg string) (path string, err error) {
|
||||
gp := os.Getenv("GOPATH")
|
||||
if gp == "" {
|
||||
return path, os.ErrNotExist
|
||||
}
|
||||
for _, p := range filepath.SplitList(gp) {
|
||||
dir := filepath.Join(p, "src", filepath.FromSlash(pkg))
|
||||
fi, err := os.Stat(dir)
|
||||
if os.IsNotExist(err) {
|
||||
continue
|
||||
}
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if !fi.IsDir() {
|
||||
continue
|
||||
}
|
||||
return dir, nil
|
||||
}
|
||||
return path, os.ErrNotExist
|
||||
}
|
Reference in New Issue
Block a user