Merge pull request #10713 from murgatroid99/node_message_size_benchmarks

Node message size benchmarks
pull/10748/head^2
Michael Lumish 8 years ago committed by GitHub
commit 5f4758e478
  1. 16
      src/node/performance/benchmark_client.js
  2. 10
      src/node/performance/benchmark_client_express.js
  3. 15
      src/node/performance/benchmark_server.js
  4. 8
      src/node/performance/benchmark_server_express.js
  5. 41
      tools/run_tests/performance/scenario_config.py

@ -88,7 +88,10 @@ function timeDiffToNanos(time_diff) {
*/ */
function BenchmarkClient(server_targets, channels, histogram_params, function BenchmarkClient(server_targets, channels, histogram_params,
security_params) { security_params) {
var options = {}; var options = {
"grpc.max_receive_message_length": -1,
"grpc.max_send_message_length": -1
};
var creds; var creds;
if (security_params) { if (security_params) {
var ca_path; var ca_path;
@ -180,6 +183,8 @@ BenchmarkClient.prototype.startClosedLoop = function(
self.last_wall_time = process.hrtime(); self.last_wall_time = process.hrtime();
self.last_usage = process.cpuUsage();
var makeCall; var makeCall;
var argument; var argument;
@ -270,6 +275,8 @@ BenchmarkClient.prototype.startPoisson = function(
self.last_wall_time = process.hrtime(); self.last_wall_time = process.hrtime();
self.last_usage = process.cpuUsage();
var makeCall; var makeCall;
var argument; var argument;
@ -354,9 +361,11 @@ BenchmarkClient.prototype.startPoisson = function(
*/ */
BenchmarkClient.prototype.mark = function(reset) { BenchmarkClient.prototype.mark = function(reset) {
var wall_time_diff = process.hrtime(this.last_wall_time); var wall_time_diff = process.hrtime(this.last_wall_time);
var usage_diff = process.cpuUsage(this.last_usage);
var histogram = this.histogram; var histogram = this.histogram;
if (reset) { if (reset) {
this.last_wall_time = process.hrtime(); this.last_wall_time = process.hrtime();
this.last_usage = process.cpuUsage();
this.histogram = new Histogram(histogram.resolution, this.histogram = new Histogram(histogram.resolution,
histogram.max_possible); histogram.max_possible);
} }
@ -371,9 +380,8 @@ BenchmarkClient.prototype.mark = function(reset) {
count: histogram.getCount() count: histogram.getCount()
}, },
time_elapsed: wall_time_diff[0] + wall_time_diff[1] / 1e9, time_elapsed: wall_time_diff[0] + wall_time_diff[1] / 1e9,
// Not sure how to measure these values time_user: usage_diff.user / 1000000,
time_user: 0, time_system: usage_diff.system / 1000000
time_system: 0
}; };
}; };

@ -95,7 +95,6 @@ function BenchmarkClient(server_targets, channels, histogram_params,
var host_port; var host_port;
host_port = server_targets[i % server_targets.length].split(':'); host_port = server_targets[i % server_targets.length].split(':');
var new_options = _.assign({hostname: host_port[0], port: +host_port[1]}, options); var new_options = _.assign({hostname: host_port[0], port: +host_port[1]}, options);
new_options.agent = new protocol.Agent(new_options);
this.client_options[i] = new_options; this.client_options[i] = new_options;
} }
@ -137,6 +136,7 @@ BenchmarkClient.prototype.startClosedLoop = function(
} }
self.last_wall_time = process.hrtime(); self.last_wall_time = process.hrtime();
self.last_usage = process.cpuUsage();
var argument = { var argument = {
response_size: resp_size, response_size: resp_size,
@ -207,6 +207,7 @@ BenchmarkClient.prototype.startPoisson = function(
} }
self.last_wall_time = process.hrtime(); self.last_wall_time = process.hrtime();
self.last_usage = process.cpuUsage();
var argument = { var argument = {
response_size: resp_size, response_size: resp_size,
@ -264,9 +265,11 @@ BenchmarkClient.prototype.startPoisson = function(
*/ */
BenchmarkClient.prototype.mark = function(reset) { BenchmarkClient.prototype.mark = function(reset) {
var wall_time_diff = process.hrtime(this.last_wall_time); var wall_time_diff = process.hrtime(this.last_wall_time);
var usage_diff = process.cpuUsage(this.last_usage);
var histogram = this.histogram; var histogram = this.histogram;
if (reset) { if (reset) {
this.last_wall_time = process.hrtime(); this.last_wall_time = process.hrtime();
this.last_usage = process.cpuUsage();
this.histogram = new Histogram(histogram.resolution, this.histogram = new Histogram(histogram.resolution,
histogram.max_possible); histogram.max_possible);
} }
@ -281,9 +284,8 @@ BenchmarkClient.prototype.mark = function(reset) {
count: histogram.getCount() count: histogram.getCount()
}, },
time_elapsed: wall_time_diff[0] + wall_time_diff[1] / 1e9, time_elapsed: wall_time_diff[0] + wall_time_diff[1] / 1e9,
// Not sure how to measure these values time_user: usage_diff.user / 1000000,
time_user: 0, time_system: usage_diff.system / 1000000
time_system: 0
}; };
}; };

@ -132,7 +132,12 @@ function BenchmarkServer(host, port, tls, generic, response_size) {
server_creds = grpc.ServerCredentials.createInsecure(); server_creds = grpc.ServerCredentials.createInsecure();
} }
var server = new grpc.Server(); var options = {
"grpc.max_receive_message_length": -1,
"grpc.max_send_message_length": -1
};
var server = new grpc.Server(options);
this.port = server.bind(host + ':' + port, server_creds); this.port = server.bind(host + ':' + port, server_creds);
if (generic) { if (generic) {
server.addService(genericService, { server.addService(genericService, {
@ -156,6 +161,7 @@ util.inherits(BenchmarkServer, EventEmitter);
BenchmarkServer.prototype.start = function() { BenchmarkServer.prototype.start = function() {
this.server.start(); this.server.start();
this.last_wall_time = process.hrtime(); this.last_wall_time = process.hrtime();
this.last_usage = process.cpuUsage();
this.emit('started'); this.emit('started');
}; };
@ -175,14 +181,15 @@ BenchmarkServer.prototype.getPort = function() {
*/ */
BenchmarkServer.prototype.mark = function(reset) { BenchmarkServer.prototype.mark = function(reset) {
var wall_time_diff = process.hrtime(this.last_wall_time); var wall_time_diff = process.hrtime(this.last_wall_time);
var usage_diff = process.cpuUsage(this.last_usage);
if (reset) { if (reset) {
this.last_wall_time = process.hrtime(); this.last_wall_time = process.hrtime();
this.last_usage = process.cpuUsage();
} }
return { return {
time_elapsed: wall_time_diff[0] + wall_time_diff[1] / 1e9, time_elapsed: wall_time_diff[0] + wall_time_diff[1] / 1e9,
// Not sure how to measure these values time_user: usage_diff.user / 1000000,
time_user: 0, time_system: usage_diff.system / 1000000
time_system: 0
}; };
}; };

@ -81,6 +81,7 @@ BenchmarkServer.prototype.start = function() {
var self = this; var self = this;
this.server.listen(this.input_port, this.input_hostname, function() { this.server.listen(this.input_port, this.input_hostname, function() {
self.last_wall_time = process.hrtime(); self.last_wall_time = process.hrtime();
self.last_usage = process.cpuUsage();
self.emit('started'); self.emit('started');
}); });
}; };
@ -91,14 +92,15 @@ BenchmarkServer.prototype.getPort = function() {
BenchmarkServer.prototype.mark = function(reset) { BenchmarkServer.prototype.mark = function(reset) {
var wall_time_diff = process.hrtime(this.last_wall_time); var wall_time_diff = process.hrtime(this.last_wall_time);
var usage_diff = process.cpuUsage(this.last_usage);
if (reset) { if (reset) {
this.last_wall_time = process.hrtime(); this.last_wall_time = process.hrtime();
this.last_usage = process.cpuUsage();
} }
return { return {
time_elapsed: wall_time_diff[0] + wall_time_diff[1] / 1e9, time_elapsed: wall_time_diff[0] + wall_time_diff[1] / 1e9,
// Not sure how to measure these values time_user: usage_diff.user / 1000000,
time_user: 0, time_system: usage_diff.system / 1000000
time_system: 0
}; };
}; };

@ -513,7 +513,22 @@ class NodeLanguage:
'node_protobuf_unary_ping_pong_1MB', rpc_type='UNARY', 'node_protobuf_unary_ping_pong_1MB', rpc_type='UNARY',
client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER', client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
req_size=1024*1024, resp_size=1024*1024, req_size=1024*1024, resp_size=1024*1024,
categories=[SCALABLE, SMOKETEST]) categories=[SCALABLE])
sizes = [('1B', 1), ('1KB', 1024), ('10KB', 10 * 1024),
('1MB', 1024 * 1024), ('10MB', 10 * 1024 * 1024),
('100MB', 100 * 1024 * 1024)]
for size_name, size in sizes:
for secure in (True, False):
yield _ping_pong_scenario(
'node_protobuf_unary_ping_pong_%s_resp_%s' %
(size_name, 'secure' if secure else 'insecure'),
rpc_type='UNARY',
client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
req_size=0, resp_size=size,
secure=secure,
categories=[SCALABLE])
# TODO(murgatroid99): fix bugs with this scenario and re-enable it # TODO(murgatroid99): fix bugs with this scenario and re-enable it
# yield _ping_pong_scenario( # yield _ping_pong_scenario(
@ -528,11 +543,10 @@ class NodeLanguage:
# client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER', # client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
# unconstrained_client='async') # unconstrained_client='async')
# TODO(jtattermusch): make this scenario work yield _ping_pong_scenario(
#yield _ping_pong_scenario( 'node_to_cpp_protobuf_async_unary_ping_pong', rpc_type='UNARY',
# 'node_to_cpp_protobuf_async_unary_ping_pong', rpc_type='UNARY', client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
# client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER', server_language='c++', async_server_threads=1)
# server_language='c++', async_server_threads=1)
# TODO(jtattermusch): make this scenario work # TODO(jtattermusch): make this scenario work
#yield _ping_pong_scenario( #yield _ping_pong_scenario(
@ -829,6 +843,21 @@ class NodeExpressLanguage:
unconstrained_client='async', unconstrained_client='async',
categories=[SCALABLE, SMOKETEST]) categories=[SCALABLE, SMOKETEST])
sizes = [('1B', 1), ('1KB', 1024), ('10KB', 10 * 1024),
('1MB', 1024 * 1024), ('10MB', 10 * 1024 * 1024),
('100MB', 100 * 1024 * 1024)]
for size_name, size in sizes:
for secure in (True, False):
yield _ping_pong_scenario(
'node_express_json_unary_ping_pong_%s_resp_%s' %
(size_name, 'secure' if secure else 'insecure'),
rpc_type='UNARY',
client_type='ASYNC_CLIENT', server_type='ASYNC_SERVER',
req_size=0, resp_size=size,
secure=secure,
categories=[SCALABLE])
def __str__(self): def __str__(self):
return 'node_express' return 'node_express'

Loading…
Cancel
Save