Fix issues with express benchmark and synchronize package.json with template

pull/8419/head
murgatroid99 8 years ago
parent 697b167ff3
commit 3dc67018a0
  1. 1
      package.json
  2. 8
      src/node/performance/benchmark_client_express.js
  3. 8
      src/node/performance/benchmark_server_express.js
  4. 2
      src/node/performance/worker_service_impl.js
  5. 2
      templates/package.json.template

@ -36,6 +36,7 @@
},
"devDependencies": {
"async": "^1.5.0",
"body-parser": "^1.15.2",
"express": "^4.14.0",
"google-auth-library": "^0.9.2",
"google-protobuf": "^3.0.0",

@ -92,7 +92,9 @@ function BenchmarkClient(server_targets, channels, histogram_params,
this.client_options = [];
for (var i = 0; i < channels; i++) {
var new_options = _.assign({host: server_targets[i]}, options);
var host_port;
host_port = server_targets[i % server_targets.length].split(':')
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;
}
@ -172,7 +174,7 @@ BenchmarkClient.prototype.startClosedLoop = function(
}
}
startAllClients(_.assign(options, self.client_options),
startAllClients(_.map(self.client_options, _.partial(_.assign, options)),
outstanding_rpcs_per_channel, makeCall, self);
};
@ -236,7 +238,7 @@ BenchmarkClient.prototype.startPoisson = function(
var averageIntervalMs = (1 / offered_load) * 1000;
startAllClients(_.assign(options, self.client_options),
startAllClients(_.map(self.client_options, _.partial(_.assign, options)),
outstanding_rpcs_per_channel, function(opts){
var p = PoissonProcess.create(averageIntervalMs, function() {
makeCall(opts, p);

@ -46,15 +46,17 @@ var EventEmitter = require('events');
var util = require('util');
var express = require('express');
var bodyParser = require('body-parser')
function unaryCall(req, res) {
var reqObj = JSON.parse(req.body);
var reqObj = req.body;
var payload = {body: '0'.repeat(reqObj.response_size)};
res.send(JSON.dumps(payload));
res.json(payload);
}
function BenchmarkServer(host, port, tls, generic, response_size) {
var app = express();
app.use(bodyParser.json())
app.put('/serviceProto.BenchmarkService.service/unaryCall', unaryCall);
this.input_host = host;
this.input_port = port;
@ -78,7 +80,7 @@ util.inherits(BenchmarkServer, EventEmitter);
BenchmarkServer.prototype.start = function() {
var self = this;
this.server.listen(this.input_port, this.input_hostname, function() {
this.last_wall_time = process.hrtime();
self.last_wall_time = process.hrtime();
self.emit('started');
});
};

@ -140,7 +140,6 @@ module.exports = function WorkerServiceImpl(benchmark_impl, server) {
console.log('ServerConfig %j', request.setup);
server = new BenchmarkServer('[::]', request.setup.port,
request.setup.security_params);
server.start();
server.on('started', function() {
stats = server.mark();
call.write({
@ -148,6 +147,7 @@ module.exports = function WorkerServiceImpl(benchmark_impl, server) {
port: server.getPort()
});
});
server.start();
break;
case 'mark':
if (server) {

@ -36,6 +36,8 @@
},
"devDependencies": {
"async": "^1.5.0",
"body-parser": "^1.15.2",
"express": "^4.14.0",
"google-auth-library": "^0.9.2",
"google-protobuf": "^3.0.0",
"istanbul": "^0.3.21",

Loading…
Cancel
Save