-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
benchmark: support for multiple http benchmarkers #8140
benchmark: support for multiple http benchmarkers #8140
Conversation
This adds support for multiple HTTP benchmarkers. Adds autocannon as the secondary benchmarker.
return false; | ||
else | ||
return true; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps simplify this to just:
return !(result.error && result.error.code === 'ENOENT');
Good stuff. Left a few comments. @mscdex @nodejs/benchmarking |
* When running the benchmakrs, set `NODE_HTTP_BENCHMARKER` environment variable | ||
to desired benchmarker. | ||
* To select the default benchmarker for a particular benchmark, specify it as | ||
`benchmarker` key (e.g. `benchmarker: 'wrk'`) in configuration passed to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a good idea. The options to createBenchmark
should just be the benchmark parameters. If you want this feature, I think it would be much better to add an option object to bench.http
.
var bench = common.createBenchmark(main, {
num: [1, 4, 8, 16],
size: [1, 64, 256],
c: [100],
benchmarker: ['wrk']
});
function main(conf) {
bench.http({
url: '/',
duration: 10,
connections: conf.c,
benchmarker: conf.benchmarker
}, function () { ... });
}
Updated, PTAL. I've moved the benchmarkers code to |
Updated the PR again, @AndreasMadsen PTAL Benchmark options are now passed as object. For each benchmarker node will be restarted. By default only one benchmarker will be used. |
process.exit(1); | ||
self.report(result, elapsed); | ||
if (cb) { | ||
cb(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a little odd. I think you should make the .run
signature
http_benchmarkers.run(options, function(error, results) { ... })
that way you can check the error and call the callback appropriately. Actually I don't care so much if the behaviour is the same. It is just that we should avoid calling process.exit()
from more than one file, as that makes the program difficult to reason about. This way the process.exit()
logic can be in common.js
.
@bzoz Great. I think this is much better. |
new WrkBenchmarker() ]; | ||
|
||
var default_http_benchmarker; | ||
var supported_http_benchmarkers = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use const
@AndreasMadsen updated with your suggestions |
this.name = 'autocannon'; | ||
} | ||
|
||
AutocannonBenchmarker.prototype.autocannon_exe = process.platform === 'win32' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think strings should be put on the prototype. I would just evaluate it in the constructor.
Updated, PTAL As for ENV - the |
That we could fix, either such it defaults to a string or simply skip the property. I think the latter would be best. |
I think it would be better to just add this as string. Otherwise I think it would be confusing for users - it would seem that sometimes it does not work. Also, no feedback when one would misspell config option. Anyhow - I'll change |
Updated, PTAL |
@AndreasMadsen BTW, why the "dont-land-on-v*.x" labels? |
'instructions.')); | ||
return; | ||
} | ||
var benchmarker = benchmarkers[options.benchmarker]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use const
Some major changes to the benchmark suite has been made, this PR depends on those changes and thus it can't land on v6 or earlier. See #7890 |
I don't want to hold this any more and I don't have this much time to review code. So except for the minor The current version is much better than original, however I still think there are some very implicit things that I don't like (but can tolerate). What is implicit:
I think all this can be solved by just enforcing explicitly setting the benchmarker parameter in the var bench = common.createBenchmark(main, {
num: [1, 4, 8, 16],
size: [1, 64, 256],
c: [100],
benchmarker: bench.default_http_benchmarker
});
function main(conf) {
bench.http({
url: '/',
duration: 10,
connections: conf.c,
benchmarker: conf.benchmarker
}, function () { ... });
} This way the benchmarker is added to the output and no special logic is needed for Yes, if |
I would like to keep it the way it is now - without explicitly adding Thanks for all the suggestions! |
Let's also cc @nodejs/collaborators as this is a fairly big addition and someone might have stronger opinions. |
LGTM |
Any more opinions? If not, I would like to land this tomorrow. |
Maybe you shouldn't put me under |
@AndreasMadsen can you please recap why you are not onboard? Just to understand for someone jumping into this later on. |
@mcollina I've covered that in #8140 (comment). tl;dr: there are a few implicit things which I think are confusion/surprising, and they could become explicit with minimal effort. |
can we get you to to agree, or some other opinion? |
@mcollina I do these reviews in my spare time. I'm sure we could agree if given enough time, but my time is quite limited these days (exams, assignments, etc.). edit: I hope you don't take it the wrong way. I can understand that someone suddenly deciding not to spend more spare time on someone else can be offensive. I had reasonable time two weeks ago, but very little these weeks. I'm sorry. |
This adds support for multiple HTTP benchmarkers. Adds autocannon as the secondary benchmarker. PR-URL: #8140 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
CI: https://ci.nodejs.org/job/node-test-pull-request/3903/ (failures unrealated) Landed in b1bbc68 @AndreasMadsen I did as you asked. Anyhow, thanks for all your input! It was very helpful in improving the quality of this PR. |
Checklist
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
benchmark
Description of change
Continued from #7180
Add support for multiple HTTP benchmarkers. Adds autocannon as the secondary benchmarker.
This allows for all http benchmarks to be executed under Windows. All available tools (
wrk
andautocannon
) will be used to run HTTP benchmarks. It will fail if none of the tools is installed.cc @nodejs/benchmarking