Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
1b1e38a5
Commit
1b1e38a5
authored
8 years ago
by
Craig Tiller
Browse files
Options
Downloads
Plain Diff
Merge branch 'node_qps_wait_for_ready' of github.com:murgatroid99/grpc into error
parents
e1cbd621
40f57265
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/node/performance/benchmark_client.js
+38
-12
38 additions, 12 deletions
src/node/performance/benchmark_client.js
with
38 additions
and
12 deletions
src/node/performance/benchmark_client.js
+
38
−
12
View file @
1b1e38a5
...
...
@@ -42,6 +42,8 @@ var fs = require('fs');
var
path
=
require
(
'
path
'
);
var
util
=
require
(
'
util
'
);
var
EventEmitter
=
require
(
'
events
'
);
var
async
=
require
(
'
async
'
);
var
_
=
require
(
'
lodash
'
);
var
PoissonProcess
=
require
(
'
poisson-process
'
);
var
Histogram
=
require
(
'
./histogram
'
);
...
...
@@ -127,6 +129,36 @@ function BenchmarkClient(server_targets, channels, histogram_params,
util
.
inherits
(
BenchmarkClient
,
EventEmitter
);
/**
* Start every client in the list of clients by waiting for each to be ready,
* then starting outstanding_rpcs_per_channel calls on each of them
* @param {Array<grpc.Client>} client_list The list of clients
* @param {Number} outstanding_rpcs_per_channel The number of calls to start
* on each client
* @param {function(grpc.Client)} makeCall Function to make a single call on
* a single client
* @param {EventEmitter} emitter The event emitter to send errors on, if
* necessary
*/
function
startAllClients
(
client_list
,
outstanding_rpcs_per_channel
,
makeCall
,
emitter
)
{
var
ready_wait_funcs
=
_
.
map
(
client_list
,
function
(
client
)
{
return
_
.
partial
(
grpc
.
waitForClientReady
,
client
,
Infinity
);
});
async
.
parallel
(
ready_wait_funcs
,
function
(
err
)
{
if
(
err
)
{
emitter
.
emit
(
'
error
'
,
err
);
return
;
}
_
.
each
(
client_list
,
function
(
client
)
{
_
.
times
(
outstanding_rpcs_per_channel
,
function
()
{
makeCall
(
client
);
});
});
});
}
/**
* Start a closed-loop test. For each channel, start
* outstanding_rpcs_per_channel RPCs. Then, whenever an RPC finishes, start
...
...
@@ -212,11 +244,7 @@ BenchmarkClient.prototype.startClosedLoop = function(
};
}
_
.
each
(
client_list
,
function
(
client
)
{
_
.
times
(
outstanding_rpcs_per_channel
,
function
()
{
makeCall
(
client
);
});
});
startAllClients
(
client_list
,
outstanding_rpcs_per_channel
,
makeCall
,
self
);
};
/**
...
...
@@ -310,14 +338,12 @@ BenchmarkClient.prototype.startPoisson = function(
var
averageIntervalMs
=
(
1
/
offered_load
)
*
1000
;
_
.
each
(
client_list
,
function
(
client
)
{
_
.
times
(
outstanding_rpcs_per_channel
,
function
()
{
var
p
=
PoissonProcess
.
create
(
averageIntervalMs
,
function
()
{
makeCall
(
client
,
p
);
});
p
.
start
();
startAllClients
(
client_list
,
outstanding_rpcs_per_channel
,
function
(
client
){
var
p
=
PoissonProcess
.
create
(
averageIntervalMs
,
function
()
{
makeCall
(
client
,
p
);
});
});
p
.
start
();
},
self
);
};
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment