Skip to content
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

test: add test-benchmark-http2 #23863

Closed
wants to merge 1 commit into from
Closed

Conversation

Trott
Copy link
Member

@Trott Trott commented Oct 25, 2018

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added benchmark Issues and PRs related to the benchmark subsystem. http Issues or PRs related to the http subsystem. http2 Issues or PRs related to the http2 subsystem. test Issues and PRs related to the tests. labels Oct 25, 2018
@Trott
Copy link
Member Author

Trott commented Oct 25, 2018

@jasnell
Copy link
Member

jasnell commented Oct 25, 2018

Has h2load been installed on all of the CI machines?

@Trott
Copy link
Member Author

Trott commented Oct 25, 2018

Has h2load been installed on all of the CI machines?

I doubt it. This PR uses a test double instead.

@Trott
Copy link
Member Author

Trott commented Oct 25, 2018

@nodejs/testing

client.on('error', (e) => { throw e; });
const req = client.request({ ':path': '/' });
request(req, client);
req.end();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ':path' defaults to '/' and, when using a GET request, the req.end() is unnecessary because http2 will automatically end()... so this can be simplified to:

request(client.request(), client);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks, will change.


const duration = process.env.duration || 0;
const url = process.env.test_url;

const start = process.hrtime();
let throughput = 0;

function request(res) {
function request(res, client) {
res.on('data', () => {});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
res.on('data', () => {});
res.resume();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, why not? Done.

@Trott Trott force-pushed the test-benchmark-http2 branch from 5a73395 to fdc18b3 Compare October 25, 2018 21:36
@Trott
Copy link
Member Author

Trott commented Oct 25, 2018

const common = require('../common');

if (!common.enoughTestMem)
common.skip('Insufficient memory for HTTP benchmark test');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTTP2?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to HTTP/2. Thanks!

@Trott
Copy link
Member Author

Trott commented Oct 26, 2018

Pushed a new commit, so... CI: https://ci.nodejs.org/job/node-test-pull-request/18164/

@Trott
Copy link
Member Author

Trott commented Oct 27, 2018

Needs another review... /cc @joyeecheung (primary author of the existing HTTP benchmark test double)

Copy link
Contributor

@refack refack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but left some nits

benchmark/_http-benchmarkers.js Show resolved Hide resolved
benchmark/_test-double-benchmarker.js Outdated Show resolved Hide resolved
benchmark/_test-double-benchmarker.js Outdated Show resolved Hide resolved
}
});
}

function run() {
http.get(url, request);
if (http.get) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
if (http.get) {
if (myModule === 'http') {

makes is clear what we're benching

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment indicating it's 'HTTP' for now. Hope that's sufficient. (If we ever need a test double for https, only the comment will need updating and not the code.)

@Trott Trott force-pushed the test-benchmark-http2 branch from ab76e5e to 61c98d6 Compare October 28, 2018 01:21
@Trott
Copy link
Member Author

Trott commented Oct 28, 2018

@Trott
Copy link
Member Author

Trott commented Oct 29, 2018

Landed in 2812759

@Trott Trott closed this Oct 29, 2018
Trott added a commit to Trott/io.js that referenced this pull request Oct 29, 2018
PR-URL: nodejs#23863
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos pushed a commit that referenced this pull request Nov 1, 2018
PR-URL: #23863
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@MylesBorins
Copy link
Contributor

this requires a manual backport to 8.x and 10.x

should it be backported?

@Trott
Copy link
Member Author

Trott commented Nov 27, 2018

should it be backported?

Low value. I'd say no.

@Trott Trott deleted the test-benchmark-http2 branch January 13, 2022 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmark Issues and PRs related to the benchmark subsystem. http Issues or PRs related to the http subsystem. http2 Issues or PRs related to the http2 subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants