mirror of https://github.com/grpc/grpc.git
commit
b69251c2f6
59 changed files with 1355 additions and 496 deletions
@ -0,0 +1,15 @@ |
||||
gRPC Fail Fast Semantics |
||||
======================== |
||||
|
||||
Fail fast requests allow terminating requests (with status UNAVAILABLE) prior |
||||
to the deadline of the request being met. |
||||
|
||||
gRPC implementations of fail fast can terminate requests whenever a channel is |
||||
in the TRANSIENT_FAILURE or SHUTDOWN states. If the channel is in any other |
||||
state (CONNECTING, READY, or IDLE) the request should not be terminated. |
||||
|
||||
Fail fast SHOULD be the default for gRPC implementations, with an option to |
||||
switch to non fail fast. |
||||
|
||||
The opposite of fail fast is 'ignore connectivity'. |
||||
|
@ -1,39 +0,0 @@ |
||||
// GENERATED CODE -- DO NOT EDIT!
|
||||
|
||||
var grpc = require('grpc'); |
||||
var helloworld_pb = require('./helloworld_pb.js'); |
||||
|
||||
function serialize_HelloReply(arg) { |
||||
if (!(arg instanceof helloworld_pb.HelloReply)) { |
||||
throw new Error('Expected argument of type HelloReply'); |
||||
} |
||||
return new Buffer(arg.serializeBinary()); |
||||
} |
||||
function deserialize_HelloReply(buffer_arg) { |
||||
return helloworld_pb.HelloReply.deserializeBinary(new Uint8Array(buffer_arg)); |
||||
} |
||||
function serialize_HelloRequest(arg) { |
||||
if (!(arg instanceof helloworld_pb.HelloRequest)) { |
||||
throw new Error('Expected argument of type HelloRequest'); |
||||
} |
||||
return new Buffer(arg.serializeBinary()); |
||||
} |
||||
function deserialize_HelloRequest(buffer_arg) { |
||||
return helloworld_pb.HelloRequest.deserializeBinary(new Uint8Array(buffer_arg)); |
||||
} |
||||
|
||||
var GreeterService = exports.GreeterService = { |
||||
sayHello: { |
||||
path: '/helloworld.Greeter/SayHello', |
||||
requestStream: false, |
||||
responseStream: false, |
||||
requestType: helloworld_pb.HelloRequest, |
||||
responseType: helloworld_pb.HelloReply, |
||||
requestSerialize: serialize_HelloRequest, |
||||
requestDeserialize: deserialize_HelloRequest, |
||||
responseSerialize: serialize_HelloReply, |
||||
responseDeserialize: deserialize_HelloReply, |
||||
}, |
||||
}; |
||||
|
||||
exports.GreeterClient = grpc.makeGenericClientConstructor(GreeterService); |
@ -1,332 +0,0 @@ |
||||
/** |
||||
* @fileoverview |
||||
* @enhanceable |
||||
* @public |
||||
*/ |
||||
// GENERATED CODE -- DO NOT EDIT!
|
||||
|
||||
var jspb = require('google-protobuf'); |
||||
var goog = jspb; |
||||
var global = Function('return this')(); |
||||
|
||||
goog.exportSymbol('proto.helloworld.HelloReply', null, global); |
||||
goog.exportSymbol('proto.helloworld.HelloRequest', null, global); |
||||
|
||||
/** |
||||
* Generated by JsPbCodeGenerator. |
||||
* @param {Array=} opt_data Optional initial data array, typically from a |
||||
* server response, or constructed directly in Javascript. The array is used |
||||
* in place and becomes part of the constructed object. It is not cloned. |
||||
* If no data is provided, the constructed object will be empty, but still |
||||
* valid. |
||||
* @extends {jspb.Message} |
||||
* @constructor |
||||
*/ |
||||
proto.helloworld.HelloRequest = function(opt_data) { |
||||
jspb.Message.initialize(this, opt_data, 0, -1, null, null); |
||||
}; |
||||
goog.inherits(proto.helloworld.HelloRequest, jspb.Message); |
||||
if (goog.DEBUG && !COMPILED) { |
||||
proto.helloworld.HelloRequest.displayName = 'proto.helloworld.HelloRequest'; |
||||
} |
||||
|
||||
|
||||
if (jspb.Message.GENERATE_TO_OBJECT) { |
||||
/** |
||||
* Creates an object representation of this proto suitable for use in Soy templates. |
||||
* Field names that are reserved in JavaScript and will be renamed to pb_name. |
||||
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. |
||||
* For the list of reserved names please see: |
||||
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. |
||||
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance |
||||
* for transitional soy proto support: http://goto/soy-param-migration
|
||||
* @return {!Object} |
||||
*/ |
||||
proto.helloworld.HelloRequest.prototype.toObject = function(opt_includeInstance) { |
||||
return proto.helloworld.HelloRequest.toObject(opt_includeInstance, this); |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* Static version of the {@see toObject} method. |
||||
* @param {boolean|undefined} includeInstance Whether to include the JSPB |
||||
* instance for transitional soy proto support: |
||||
* http://goto/soy-param-migration
|
||||
* @param {!proto.helloworld.HelloRequest} msg The msg instance to transform. |
||||
* @return {!Object} |
||||
*/ |
||||
proto.helloworld.HelloRequest.toObject = function(includeInstance, msg) { |
||||
var f, obj = { |
||||
name: msg.getName() |
||||
}; |
||||
|
||||
if (includeInstance) { |
||||
obj.$jspbMessageInstance = msg |
||||
} |
||||
return obj; |
||||
}; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Deserializes binary data (in protobuf wire format). |
||||
* @param {jspb.ByteSource} bytes The bytes to deserialize. |
||||
* @return {!proto.helloworld.HelloRequest} |
||||
*/ |
||||
proto.helloworld.HelloRequest.deserializeBinary = function(bytes) { |
||||
var reader = new jspb.BinaryReader(bytes); |
||||
var msg = new proto.helloworld.HelloRequest; |
||||
return proto.helloworld.HelloRequest.deserializeBinaryFromReader(msg, reader); |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* Deserializes binary data (in protobuf wire format) from the |
||||
* given reader into the given message object. |
||||
* @param {!proto.helloworld.HelloRequest} msg The message object to deserialize into. |
||||
* @param {!jspb.BinaryReader} reader The BinaryReader to use. |
||||
* @return {!proto.helloworld.HelloRequest} |
||||
*/ |
||||
proto.helloworld.HelloRequest.deserializeBinaryFromReader = function(msg, reader) { |
||||
while (reader.nextField()) { |
||||
if (reader.isEndGroup()) { |
||||
break; |
||||
} |
||||
var field = reader.getFieldNumber(); |
||||
switch (field) { |
||||
case 1: |
||||
var value = /** @type {string} */ (reader.readString()); |
||||
msg.setName(value); |
||||
break; |
||||
default: |
||||
reader.skipField(); |
||||
break; |
||||
} |
||||
} |
||||
return msg; |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* Class method variant: serializes the given message to binary data |
||||
* (in protobuf wire format), writing to the given BinaryWriter. |
||||
* @param {!proto.helloworld.HelloRequest} message |
||||
* @param {!jspb.BinaryWriter} writer |
||||
*/ |
||||
proto.helloworld.HelloRequest.serializeBinaryToWriter = function(message, writer) { |
||||
message.serializeBinaryToWriter(writer); |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* Serializes the message to binary data (in protobuf wire format). |
||||
* @return {!Uint8Array} |
||||
*/ |
||||
proto.helloworld.HelloRequest.prototype.serializeBinary = function() { |
||||
var writer = new jspb.BinaryWriter(); |
||||
this.serializeBinaryToWriter(writer); |
||||
return writer.getResultBuffer(); |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* Serializes the message to binary data (in protobuf wire format), |
||||
* writing to the given BinaryWriter. |
||||
* @param {!jspb.BinaryWriter} writer |
||||
*/ |
||||
proto.helloworld.HelloRequest.prototype.serializeBinaryToWriter = function (writer) { |
||||
var f = undefined; |
||||
f = this.getName(); |
||||
if (f.length > 0) { |
||||
writer.writeString( |
||||
1, |
||||
f |
||||
); |
||||
} |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* Creates a deep clone of this proto. No data is shared with the original. |
||||
* @return {!proto.helloworld.HelloRequest} The clone. |
||||
*/ |
||||
proto.helloworld.HelloRequest.prototype.cloneMessage = function() { |
||||
return /** @type {!proto.helloworld.HelloRequest} */ (jspb.Message.cloneMessage(this)); |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* optional string name = 1; |
||||
* @return {string} |
||||
*/ |
||||
proto.helloworld.HelloRequest.prototype.getName = function() { |
||||
return /** @type {string} */ (jspb.Message.getFieldProto3(this, 1, "")); |
||||
}; |
||||
|
||||
|
||||
/** @param {string} value */ |
||||
proto.helloworld.HelloRequest.prototype.setName = function(value) { |
||||
jspb.Message.setField(this, 1, value); |
||||
}; |
||||
|
||||
|
||||
|
||||
/** |
||||
* Generated by JsPbCodeGenerator. |
||||
* @param {Array=} opt_data Optional initial data array, typically from a |
||||
* server response, or constructed directly in Javascript. The array is used |
||||
* in place and becomes part of the constructed object. It is not cloned. |
||||
* If no data is provided, the constructed object will be empty, but still |
||||
* valid. |
||||
* @extends {jspb.Message} |
||||
* @constructor |
||||
*/ |
||||
proto.helloworld.HelloReply = function(opt_data) { |
||||
jspb.Message.initialize(this, opt_data, 0, -1, null, null); |
||||
}; |
||||
goog.inherits(proto.helloworld.HelloReply, jspb.Message); |
||||
if (goog.DEBUG && !COMPILED) { |
||||
proto.helloworld.HelloReply.displayName = 'proto.helloworld.HelloReply'; |
||||
} |
||||
|
||||
|
||||
if (jspb.Message.GENERATE_TO_OBJECT) { |
||||
/** |
||||
* Creates an object representation of this proto suitable for use in Soy templates. |
||||
* Field names that are reserved in JavaScript and will be renamed to pb_name. |
||||
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. |
||||
* For the list of reserved names please see: |
||||
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. |
||||
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance |
||||
* for transitional soy proto support: http://goto/soy-param-migration
|
||||
* @return {!Object} |
||||
*/ |
||||
proto.helloworld.HelloReply.prototype.toObject = function(opt_includeInstance) { |
||||
return proto.helloworld.HelloReply.toObject(opt_includeInstance, this); |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* Static version of the {@see toObject} method. |
||||
* @param {boolean|undefined} includeInstance Whether to include the JSPB |
||||
* instance for transitional soy proto support: |
||||
* http://goto/soy-param-migration
|
||||
* @param {!proto.helloworld.HelloReply} msg The msg instance to transform. |
||||
* @return {!Object} |
||||
*/ |
||||
proto.helloworld.HelloReply.toObject = function(includeInstance, msg) { |
||||
var f, obj = { |
||||
message: msg.getMessage() |
||||
}; |
||||
|
||||
if (includeInstance) { |
||||
obj.$jspbMessageInstance = msg |
||||
} |
||||
return obj; |
||||
}; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Deserializes binary data (in protobuf wire format). |
||||
* @param {jspb.ByteSource} bytes The bytes to deserialize. |
||||
* @return {!proto.helloworld.HelloReply} |
||||
*/ |
||||
proto.helloworld.HelloReply.deserializeBinary = function(bytes) { |
||||
var reader = new jspb.BinaryReader(bytes); |
||||
var msg = new proto.helloworld.HelloReply; |
||||
return proto.helloworld.HelloReply.deserializeBinaryFromReader(msg, reader); |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* Deserializes binary data (in protobuf wire format) from the |
||||
* given reader into the given message object. |
||||
* @param {!proto.helloworld.HelloReply} msg The message object to deserialize into. |
||||
* @param {!jspb.BinaryReader} reader The BinaryReader to use. |
||||
* @return {!proto.helloworld.HelloReply} |
||||
*/ |
||||
proto.helloworld.HelloReply.deserializeBinaryFromReader = function(msg, reader) { |
||||
while (reader.nextField()) { |
||||
if (reader.isEndGroup()) { |
||||
break; |
||||
} |
||||
var field = reader.getFieldNumber(); |
||||
switch (field) { |
||||
case 1: |
||||
var value = /** @type {string} */ (reader.readString()); |
||||
msg.setMessage(value); |
||||
break; |
||||
default: |
||||
reader.skipField(); |
||||
break; |
||||
} |
||||
} |
||||
return msg; |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* Class method variant: serializes the given message to binary data |
||||
* (in protobuf wire format), writing to the given BinaryWriter. |
||||
* @param {!proto.helloworld.HelloReply} message |
||||
* @param {!jspb.BinaryWriter} writer |
||||
*/ |
||||
proto.helloworld.HelloReply.serializeBinaryToWriter = function(message, writer) { |
||||
message.serializeBinaryToWriter(writer); |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* Serializes the message to binary data (in protobuf wire format). |
||||
* @return {!Uint8Array} |
||||
*/ |
||||
proto.helloworld.HelloReply.prototype.serializeBinary = function() { |
||||
var writer = new jspb.BinaryWriter(); |
||||
this.serializeBinaryToWriter(writer); |
||||
return writer.getResultBuffer(); |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* Serializes the message to binary data (in protobuf wire format), |
||||
* writing to the given BinaryWriter. |
||||
* @param {!jspb.BinaryWriter} writer |
||||
*/ |
||||
proto.helloworld.HelloReply.prototype.serializeBinaryToWriter = function (writer) { |
||||
var f = undefined; |
||||
f = this.getMessage(); |
||||
if (f.length > 0) { |
||||
writer.writeString( |
||||
1, |
||||
f |
||||
); |
||||
} |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* Creates a deep clone of this proto. No data is shared with the original. |
||||
* @return {!proto.helloworld.HelloReply} The clone. |
||||
*/ |
||||
proto.helloworld.HelloReply.prototype.cloneMessage = function() { |
||||
return /** @type {!proto.helloworld.HelloReply} */ (jspb.Message.cloneMessage(this)); |
||||
}; |
||||
|
||||
|
||||
/** |
||||
* optional string message = 1; |
||||
* @return {string} |
||||
*/ |
||||
proto.helloworld.HelloReply.prototype.getMessage = function() { |
||||
return /** @type {string} */ (jspb.Message.getFieldProto3(this, 1, "")); |
||||
}; |
||||
|
||||
|
||||
/** @param {string} value */ |
||||
proto.helloworld.HelloReply.prototype.setMessage = function(value) { |
||||
jspb.Message.setField(this, 1, value); |
||||
}; |
||||
|
||||
|
||||
goog.object.extend(exports, proto.helloworld); |
@ -0,0 +1,28 @@ |
||||
# 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. |
@ -0,0 +1,132 @@ |
||||
# 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. |
||||
|
||||
"""Entry point for running stress tests.""" |
||||
|
||||
import argparse |
||||
import Queue |
||||
import threading |
||||
|
||||
from grpc.beta import implementations |
||||
from src.proto.grpc.testing import metrics_pb2 |
||||
from src.proto.grpc.testing import test_pb2 |
||||
|
||||
from tests.interop import methods |
||||
from tests.qps import histogram |
||||
from tests.stress import metrics_server |
||||
from tests.stress import test_runner |
||||
|
||||
|
||||
def _args(): |
||||
parser = argparse.ArgumentParser(description='gRPC Python stress test client') |
||||
parser.add_argument( |
||||
'--server_addresses', |
||||
help='comma seperated list of hostname:port to run servers on', |
||||
default='localhost:8080', type=str) |
||||
parser.add_argument( |
||||
'--test_cases', |
||||
help='comma seperated list of testcase:weighting of tests to run', |
||||
default='large_unary:100', |
||||
type=str) |
||||
parser.add_argument( |
||||
'--test_duration_secs', |
||||
help='number of seconds to run the stress test', |
||||
default=-1, type=int) |
||||
parser.add_argument( |
||||
'--num_channels_per_server', |
||||
help='number of channels per server', |
||||
default=1, type=int) |
||||
parser.add_argument( |
||||
'--num_stubs_per_channel', |
||||
help='number of stubs to create per channel', |
||||
default=1, type=int) |
||||
parser.add_argument( |
||||
'--metrics_port', |
||||
help='the port to listen for metrics requests on', |
||||
default=8081, type=int) |
||||
return parser.parse_args() |
||||
|
||||
|
||||
def _test_case_from_arg(test_case_arg): |
||||
for test_case in methods.TestCase: |
||||
if test_case_arg == test_case.value: |
||||
return test_case |
||||
else: |
||||
raise ValueError('No test case {}!'.format(test_case_arg)) |
||||
|
||||
|
||||
def _parse_weighted_test_cases(test_case_args): |
||||
weighted_test_cases = {} |
||||
for test_case_arg in test_case_args.split(','): |
||||
name, weight = test_case_arg.split(':', 1) |
||||
test_case = _test_case_from_arg(name) |
||||
weighted_test_cases[test_case] = int(weight) |
||||
return weighted_test_cases |
||||
|
||||
|
||||
def run_test(args): |
||||
test_cases = _parse_weighted_test_cases(args.test_cases) |
||||
test_servers = args.server_addresses.split(',') |
||||
# Propagate any client exceptions with a queue |
||||
exception_queue = Queue.Queue() |
||||
stop_event = threading.Event() |
||||
hist = histogram.Histogram(1, 1) |
||||
runners = [] |
||||
|
||||
server = metrics_pb2.beta_create_MetricsService_server( |
||||
metrics_server.MetricsServer(hist)) |
||||
server.add_insecure_port('[::]:{}'.format(args.metrics_port)) |
||||
server.start() |
||||
|
||||
for test_server in test_servers: |
||||
host, port = test_server.split(':', 1) |
||||
for _ in xrange(args.num_channels_per_server): |
||||
channel = implementations.insecure_channel(host, int(port)) |
||||
for _ in xrange(args.num_stubs_per_channel): |
||||
stub = test_pb2.beta_create_TestService_stub(channel) |
||||
runner = test_runner.TestRunner(stub, test_cases, hist, |
||||
exception_queue, stop_event) |
||||
runners.append(runner) |
||||
|
||||
for runner in runners: |
||||
runner.start() |
||||
try: |
||||
raise exception_queue.get(block=True, timeout=args.test_duration_secs) |
||||
except Queue.Empty: |
||||
# No exceptions thrown, success |
||||
pass |
||||
finally: |
||||
stop_event.set() |
||||
for runner in runners: |
||||
runner.join() |
||||
runner = None |
||||
server.stop(0) |
||||
|
||||
if __name__ == '__main__': |
||||
run_test(_args()) |
@ -0,0 +1,60 @@ |
||||
# 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. |
||||
|
||||
"""MetricsService for publishing stress test qps data.""" |
||||
|
||||
import time |
||||
|
||||
from src.proto.grpc.testing import metrics_pb2 |
||||
|
||||
GAUGE_NAME = 'python_overall_qps' |
||||
|
||||
|
||||
class MetricsServer(metrics_pb2.BetaMetricsServiceServicer): |
||||
|
||||
def __init__(self, histogram): |
||||
self._start_time = time.time() |
||||
self._histogram = histogram |
||||
|
||||
def _get_qps(self): |
||||
count = self._histogram.get_data().count |
||||
delta = time.time() - self._start_time |
||||
self._histogram.reset() |
||||
self._start_time = time.time() |
||||
return int(count/delta) |
||||
|
||||
def GetAllGauges(self, request, context): |
||||
qps = self._get_qps() |
||||
return [metrics_pb2.GaugeResponse(name=GAUGE_NAME, long_value=qps)] |
||||
|
||||
def GetGauge(self, request, context): |
||||
if request.name != GAUGE_NAME: |
||||
raise Exception('Gauge {} does not exist'.format(request.name)) |
||||
qps = self._get_qps() |
||||
return metrics_pb2.GaugeResponse(name=GAUGE_NAME, long_value=qps) |
@ -0,0 +1,73 @@ |
||||
# 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. |
||||
|
||||
"""Thread that sends random weighted requests on a TestService stub.""" |
||||
|
||||
import random |
||||
import threading |
||||
import time |
||||
import traceback |
||||
|
||||
|
||||
def _weighted_test_case_generator(weighted_cases): |
||||
weight_sum = sum(weighted_cases.itervalues()) |
||||
|
||||
while True: |
||||
val = random.uniform(0, weight_sum) |
||||
partial_sum = 0 |
||||
for case in weighted_cases: |
||||
partial_sum += weighted_cases[case] |
||||
if val <= partial_sum: |
||||
yield case |
||||
break |
||||
|
||||
|
||||
class TestRunner(threading.Thread): |
||||
|
||||
def __init__(self, stub, test_cases, hist, exception_queue, stop_event): |
||||
super(TestRunner, self).__init__() |
||||
self._exception_queue = exception_queue |
||||
self._stop_event = stop_event |
||||
self._stub = stub |
||||
self._test_cases = _weighted_test_case_generator(test_cases) |
||||
self._histogram = hist |
||||
|
||||
def run(self): |
||||
while not self._stop_event.is_set(): |
||||
try: |
||||
test_case = next(self._test_cases) |
||||
start_time = time.time() |
||||
test_case.test_interoperability(self._stub, None) |
||||
end_time = time.time() |
||||
self._histogram.add((end_time - start_time)*1e9) |
||||
except Exception as e: |
||||
traceback.print_exc() |
||||
self._exception_queue.put( |
||||
Exception("An exception occured during test {}" |
||||
.format(test_case), e)) |
@ -0,0 +1,12 @@ |
||||
# Ruby gRPC Tools |
||||
|
||||
This package distributes protoc and the Ruby gRPC protoc plugin for Windows, Linux, and Mac. |
||||
|
||||
Before this package is published, the following directories should be filled with the corresponding `protoc` and `grpc_ruby_plugin` executables. |
||||
|
||||
- `bin/x86-linux` |
||||
- `bin/x86_64-linux` |
||||
- `bin/x86-macos` |
||||
- `bin/x86_64-macos` |
||||
- `bin/x86-windows` |
||||
- `bin/x86_64-windows` |
@ -0,0 +1,41 @@ |
||||
#!/usr/bin/env ruby |
||||
# 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. |
||||
|
||||
require 'rbconfig' |
||||
|
||||
require_relative '../os_check' |
||||
|
||||
protoc_name = 'protoc' + RbConfig::CONFIG['EXEEXT'] |
||||
|
||||
protoc_path = File.join(File.dirname(__FILE__), |
||||
RbConfig::CONFIG['host_cpu'] + '-' + OS.os_name, |
||||
protoc_name) |
||||
|
||||
exec([ protoc_path, protoc_path ], *ARGV) |
@ -0,0 +1,41 @@ |
||||
#!/usr/bin/env ruby |
||||
# 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. |
||||
|
||||
require 'rbconfig' |
||||
|
||||
require_relative '../os_check' |
||||
|
||||
plugin_name = 'grpc_ruby_plugin' + RbConfig::CONFIG['EXEEXT'] |
||||
|
||||
plugin_path = File.join(File.dirname(__FILE__), |
||||
RbConfig::CONFIG['host_cpu'] + '-' + OS.os_name, |
||||
plugin_name) |
||||
|
||||
exec([ plugin_path, plugin_path ], *ARGV) |
@ -0,0 +1,22 @@ |
||||
# -*- ruby -*- |
||||
# encoding: utf-8 |
||||
require_relative 'version.rb' |
||||
Gem::Specification.new do |s| |
||||
s.name = 'grpc-tools' |
||||
s.version = GRPC::Tools::VERSION |
||||
s.authors = ['grpc Authors'] |
||||
s.email = 'grpc-io@googlegroups.com' |
||||
s.homepage = 'https://github.com/google/grpc/tree/master/src/ruby/tools' |
||||
s.summary = 'Development tools for Ruby gRPC' |
||||
s.description = 'protoc and the Ruby gRPC protoc plugin' |
||||
s.license = 'BSD-3-Clause' |
||||
|
||||
s.files = %w( version.rb os_check.rb README.md ) |
||||
s.files += Dir.glob('bin/**/*') |
||||
|
||||
s.bindir = 'bin' |
||||
|
||||
s.platform = Gem::Platform::RUBY |
||||
|
||||
s.executables = %w( protoc.rb protoc_grpc_ruby_plugin.rb ) |
||||
end |
@ -0,0 +1,45 @@ |
||||
# 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. |
||||
|
||||
# This is based on http://stackoverflow.com/a/171011/159388 by Aaron Hinni |
||||
|
||||
require 'rbconfig' |
||||
|
||||
module OS |
||||
def OS.os_name |
||||
case RbConfig::CONFIG['host_os'] |
||||
when /cygwin|mswin|mingw|bccwin|wince|emx/ |
||||
'windows' |
||||
when /darwin/ |
||||
'macos' |
||||
else |
||||
'linux' |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,34 @@ |
||||
# Copyright 2015, Google Inc. |
||||
# All rights reserved. |
||||
# |
||||
# Redistribution and use in source and binary forms, with or without |
||||
# modification, are permitted provided that the following conditions are |
||||
# met: |
||||
# |
||||
# * Redistributions of source code must retain the above copyright |
||||
# notice, this list of conditions and the following disclaimer. |
||||
# * Redistributions in binary form must reproduce the above |
||||
# copyright notice, this list of conditions and the following disclaimer |
||||
# in the documentation and/or other materials provided with the |
||||
# distribution. |
||||
# * Neither the name of Google Inc. nor the names of its |
||||
# contributors may be used to endorse or promote products derived from |
||||
# this software without specific prior written permission. |
||||
# |
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
module GRPC |
||||
module Tools |
||||
VERSION = '0.14.0.dev' |
||||
end |
||||
end |
@ -0,0 +1,36 @@ |
||||
%YAML 1.2 |
||||
--- | |
||||
# Copyright 2015, Google Inc. |
||||
# All rights reserved. |
||||
# |
||||
# Redistribution and use in source and binary forms, with or without |
||||
# modification, are permitted provided that the following conditions are |
||||
# met: |
||||
# |
||||
# * Redistributions of source code must retain the above copyright |
||||
# notice, this list of conditions and the following disclaimer. |
||||
# * Redistributions in binary form must reproduce the above |
||||
# copyright notice, this list of conditions and the following disclaimer |
||||
# in the documentation and/or other materials provided with the |
||||
# distribution. |
||||
# * Neither the name of Google Inc. nor the names of its |
||||
# contributors may be used to endorse or promote products derived from |
||||
# this software without specific prior written permission. |
||||
# |
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
module GRPC |
||||
module Tools |
||||
VERSION = '${settings.ruby_version.ruby()}' |
||||
end |
||||
end |
@ -0,0 +1,41 @@ |
||||
%YAML 1.2 |
||||
--- | |
||||
# Copyright 2015, Google Inc. |
||||
# All rights reserved. |
||||
# |
||||
# Redistribution and use in source and binary forms, with or without |
||||
# modification, are permitted provided that the following conditions are |
||||
# met: |
||||
# |
||||
# * Redistributions of source code must retain the above copyright |
||||
# notice, this list of conditions and the following disclaimer. |
||||
# * Redistributions in binary form must reproduce the above |
||||
# copyright notice, this list of conditions and the following disclaimer |
||||
# in the documentation and/or other materials provided with the |
||||
# distribution. |
||||
# * Neither the name of Google Inc. nor the names of its |
||||
# contributors may be used to endorse or promote products derived from |
||||
# this software without specific prior written permission. |
||||
# |
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
FROM debian:jessie |
||||
|
||||
<%include file="../../apt_get_basic.include"/> |
||||
<%include file="../../ccache_setup.include"/> |
||||
<%include file="../../cxx_deps.include"/> |
||||
<%include file="../../gcp_api_libraries.include"/> |
||||
<%include file="../../csharp_deps.include"/> |
||||
# Define the default command. |
||||
CMD ["bash"] |
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,101 @@ |
||||
# Copyright 2015, Google Inc. |
||||
# All rights reserved. |
||||
# |
||||
# Redistribution and use in source and binary forms, with or without |
||||
# modification, are permitted provided that the following conditions are |
||||
# met: |
||||
# |
||||
# * Redistributions of source code must retain the above copyright |
||||
# notice, this list of conditions and the following disclaimer. |
||||
# * Redistributions in binary form must reproduce the above |
||||
# copyright notice, this list of conditions and the following disclaimer |
||||
# in the documentation and/or other materials provided with the |
||||
# distribution. |
||||
# * Neither the name of Google Inc. nor the names of its |
||||
# contributors may be used to endorse or promote products derived from |
||||
# this software without specific prior written permission. |
||||
# |
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
||||
FROM debian:jessie |
||||
|
||||
# Install Git and basic packages. |
||||
RUN apt-get update && apt-get install -y \ |
||||
autoconf \ |
||||
autotools-dev \ |
||||
build-essential \ |
||||
bzip2 \ |
||||
ccache \ |
||||
curl \ |
||||
gcc \ |
||||
gcc-multilib \ |
||||
git \ |
||||
golang \ |
||||
gyp \ |
||||
lcov \ |
||||
libc6 \ |
||||
libc6-dbg \ |
||||
libc6-dev \ |
||||
libgtest-dev \ |
||||
libtool \ |
||||
make \ |
||||
perl \ |
||||
strace \ |
||||
python-dev \ |
||||
python-setuptools \ |
||||
python-yaml \ |
||||
telnet \ |
||||
unzip \ |
||||
wget \ |
||||
zip && apt-get clean |
||||
|
||||
#================ |
||||
# Build profiling |
||||
RUN apt-get update && apt-get install -y time && apt-get clean |
||||
|
||||
# Prepare ccache |
||||
RUN ln -s /usr/bin/ccache /usr/local/bin/gcc |
||||
RUN ln -s /usr/bin/ccache /usr/local/bin/g++ |
||||
RUN ln -s /usr/bin/ccache /usr/local/bin/cc |
||||
RUN ln -s /usr/bin/ccache /usr/local/bin/c++ |
||||
RUN ln -s /usr/bin/ccache /usr/local/bin/clang |
||||
RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ |
||||
|
||||
#================= |
||||
# C++ dependencies |
||||
RUN apt-get update && apt-get -y install libgflags-dev libgtest-dev libc++-dev clang && apt-get clean |
||||
|
||||
# Google Cloud platform API libraries |
||||
RUN apt-get update && apt-get install -y python-pip && apt-get clean |
||||
RUN pip install --upgrade google-api-python-client |
||||
|
||||
|
||||
#================ |
||||
# C# dependencies |
||||
|
||||
# Update to a newer version of mono |
||||
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF |
||||
RUN echo "deb http://download.mono-project.com/repo/debian wheezy main" | tee /etc/apt/sources.list.d/mono-xamarin.list |
||||
RUN echo "deb http://download.mono-project.com/repo/debian wheezy-apache24-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list |
||||
RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list |
||||
RUN echo "deb http://download.mono-project.com/repo/debian wheezy-libtiff-compat main" | tee -a /etc/apt/sources.list.d/mono-xamarin.list |
||||
|
||||
# Install dependencies |
||||
RUN apt-get update && apt-get -y dist-upgrade && apt-get install -y \ |
||||
mono-devel \ |
||||
ca-certificates-mono \ |
||||
nuget \ |
||||
&& apt-get clean |
||||
|
||||
# Define the default command. |
||||
CMD ["bash"] |
@ -0,0 +1,47 @@ |
||||
#!/bin/bash |
||||
# Copyright 2015, Google Inc. |
||||
# All rights reserved. |
||||
# |
||||
# Redistribution and use in source and binary forms, with or without |
||||
# modification, are permitted provided that the following conditions are |
||||
# met: |
||||
# |
||||
# * Redistributions of source code must retain the above copyright |
||||
# notice, this list of conditions and the following disclaimer. |
||||
# * Redistributions in binary form must reproduce the above |
||||
# copyright notice, this list of conditions and the following disclaimer |
||||
# in the documentation and/or other materials provided with the |
||||
# distribution. |
||||
# * Neither the name of Google Inc. nor the names of its |
||||
# contributors may be used to endorse or promote products derived from |
||||
# this software without specific prior written permission. |
||||
# |
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
# |
||||
# Builds C# interop server and client in a base image. |
||||
set -e |
||||
|
||||
mkdir -p /var/local/git |
||||
git clone --recursive /var/local/jenkins/grpc /var/local/git/grpc |
||||
|
||||
# Copy service account keys if available |
||||
cp -r /var/local/jenkins/service_account $HOME || true |
||||
|
||||
cd /var/local/git/grpc |
||||
|
||||
# Build C++ metrics client (to query the metrics from csharp stress client) |
||||
make metrics_client -j |
||||
|
||||
# Build C# interop client & server |
||||
tools/run_tests/run_tests.py -l csharp -c dbg --build_only |
||||
|
@ -0,0 +1,90 @@ |
||||
{ |
||||
"dockerImages": { |
||||
"grpc_stress_csharp" : { |
||||
"buildScript": "tools/jenkins/build_interop_stress_image.sh", |
||||
"dockerFileDir": "grpc_interop_stress_csharp" |
||||
} |
||||
}, |
||||
|
||||
"clientTemplates": { |
||||
"baseTemplates": { |
||||
"default": { |
||||
"wrapperScriptPath": "/var/local/git/grpc/tools/gcp/stress_test/run_client.py", |
||||
"pollIntervalSecs": 60, |
||||
"clientArgs": { |
||||
"num_channels_per_server":5, |
||||
"num_stubs_per_channel":10, |
||||
"test_cases": "empty_unary:1,large_unary:1,client_streaming:1,server_streaming:1,empty_stream:1", |
||||
"metrics_port": 8081 |
||||
}, |
||||
"metricsPort": 8081, |
||||
"metricsArgs": { |
||||
"metrics_server_address": "localhost:8081", |
||||
"total_only": "true" |
||||
} |
||||
} |
||||
}, |
||||
"templates": { |
||||
"csharp_client": { |
||||
"baseTemplate": "default", |
||||
"stressClientCmd": [ |
||||
"mono", |
||||
"/var/local/git/grpc/src/csharp/Grpc.IntegrationTesting.StressClient/bin/Debug/Grpc.IntegrationTesting.StressClient.exe" |
||||
], |
||||
"metricsClientCmd": ["/var/local/git/grpc/bins/opt/metrics_client"] |
||||
} |
||||
} |
||||
}, |
||||
|
||||
"serverTemplates": { |
||||
"baseTemplates":{ |
||||
"default": { |
||||
"wrapperScriptPath": "/var/local/git/grpc/tools/gcp/stress_test/run_server.py", |
||||
"serverPort": 8080, |
||||
"serverArgs": { |
||||
"port": 8080 |
||||
} |
||||
} |
||||
}, |
||||
"templates": { |
||||
"csharp_server": { |
||||
"baseTemplate": "default", |
||||
"stressServerCmd": [ |
||||
"mono", |
||||
"/var/local/git/grpc/src/csharp/Grpc.IntegrationTesting.Server/bin/Debug/Grpc.IntegrationTesting.Server.exe" |
||||
] |
||||
} |
||||
} |
||||
}, |
||||
|
||||
"testMatrix": { |
||||
"serverPodSpecs": { |
||||
"stress-server-csharp": { |
||||
"serverTemplate": "csharp_server", |
||||
"dockerImage": "grpc_stress_csharp", |
||||
"numInstances": 1 |
||||
} |
||||
}, |
||||
|
||||
"clientPodSpecs": { |
||||
"stress-client-csharp": { |
||||
"clientTemplate": "csharp_client", |
||||
"dockerImage": "grpc_stress_csharp", |
||||
"numInstances": 10, |
||||
"serverPodSpec": "stress-server-csharp" |
||||
} |
||||
} |
||||
}, |
||||
|
||||
"globalSettings": { |
||||
"buildDockerImages": true, |
||||
"pollIntervalSecs": 60, |
||||
"testDurationSecs": 7200, |
||||
"kubernetesProxyPort": 8001, |
||||
"datasetIdNamePrefix": "stress_test_csharp", |
||||
"summaryTableId": "summary", |
||||
"qpsTableId": "qps", |
||||
"podWarmupSecs": 60 |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue