René's URL Explorer Experiment


Title: HTTP2 download of parallel requests is slower than HTTP1.1 · Issue #54874 · nodejs/node · GitHub

Open Graph Title: HTTP2 download of parallel requests is slower than HTTP1.1 · Issue #54874 · nodejs/node

X Title: HTTP2 download of parallel requests is slower than HTTP1.1 · Issue #54874 · nodejs/node

Description: Version v20.17.0 Platform MacOS Sonoma 14.5, 2,3 GHz Quad-Core Intel Core i7 Subsystem No response What steps will reproduce the bug? Define an http2 and http1.1 clients and fetch some data in parallel. You can use the script below. If y...

Open Graph Description: Version v20.17.0 Platform MacOS Sonoma 14.5, 2,3 GHz Quad-Core Intel Core i7 Subsystem No response What steps will reproduce the bug? Define an http2 and http1.1 clients and fetch some data in para...

X Description: Version v20.17.0 Platform MacOS Sonoma 14.5, 2,3 GHz Quad-Core Intel Core i7 Subsystem No response What steps will reproduce the bug? Define an http2 and http1.1 clients and fetch some data in para...

Opengraph URL: https://github.com/nodejs/node/issues/54874

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"HTTP2 download of parallel requests is slower than HTTP1.1","articleBody":"### Version\r\n\r\nv20.17.0\r\n\r\n### Platform\r\n\r\n```text\r\nMacOS Sonoma 14.5, 2,3 GHz Quad-Core Intel Core i7\r\n```\r\n\r\n\r\n### Subsystem\r\n\r\n_No response_\r\n\r\n### What steps will reproduce the bug?\r\n\r\nDefine an http2 and http1.1 clients and fetch some data in parallel.\r\n\r\nYou can use the script below. If you run it using the following command, it will send 25 parallel requests using HTTP1.1\r\n```sh\r\nnode client.js\r\n```\r\n\r\nor you can run this command and it will send 25 parallel requests using HTTP2:\r\n```sh\r\nnode client.js http2\r\n```\r\n\r\n\u003cdetails>\r\n\u003csummary>client.js\u003c/summary>\r\n\u003cp>\r\n\r\n\r\n\r\n\r\n\r\n```javascript\r\nimport http2 from 'node:http2';\r\nimport https from 'node:https';\r\n\r\nconst isHttp2 = process.argv[2] === 'http2';\r\n\r\nconst MB = 1024 * 1024;\r\nconst WINDOW_SIZE = 32 * MB;\r\n\r\nconst url = new URL('https://nodejs.org/dist/v17.1.0/node-v17.1.0-x64.msi');\r\n\r\nconst client = http2.connect(url, {\r\n  settings: {\r\n    initialWindowSize: WINDOW_SIZE,\r\n  },\r\n});\r\n\r\nclient.on('connect', () => {\r\n  client.setLocalWindowSize(WINDOW_SIZE);\r\n});\r\n\r\nconst fetchHttp1 = (id) => {\r\n  return new Promise((resolve) => {\r\n    const req = https.request({\r\n        host: url.host,\r\n        path: url.pathname,\r\n        headers: {\r\n          connection: 'keep-alive',\r\n        },\r\n      }, (res) => {\r\n        res.on('data', () => {});\r\n        res.on('end', () => {\r\n          console.log(`Complete request with id: ${id}`);\r\n          resolve();\r\n        });\r\n      },\r\n    );\r\n\r\n    req.end();\r\n  });\r\n};\r\n\r\nconst fetchHttp2 = (id) => {\r\n  return new Promise((resolve) => {\r\n    const req = client.request({\r\n      ':path': url.pathname,\r\n    });\r\n    req.on('data', () => {});\r\n    req.on('end', () => {\r\n      console.log(`Complete request with id: ${id}`);\r\n      resolve();\r\n    });\r\n    req.end();\r\n  });\r\n};\r\n\r\nconst main = async () => {\r\n  console.log(`Starting requests using HTTP${isHttp2 ? '2' : '1.1'} protocol.`);\r\n\r\n  const startTime = Date.now();\r\n\r\n  await Promise.all(\r\n    Array.from({ length: 25 })\r\n      .fill(null)\r\n      .map((_, index) => isHttp2 ? fetchHttp2(index) : fetchHttp1(index)),\r\n  );\r\n\r\n  console.log(`Requests complete. Completion time: ${(Date.now() - startTime) / 1000}s`);\r\n};\r\n\r\nmain();\r\n``` \r\n\r\n\r\n\r\n\r\n\u003c/p>\r\n\u003c/details> \r\n\r\n\r\n### How often does it reproduce? Is there a required condition?\r\n\r\nIt's not quite stable, because sometimes http2 has the same performance or even better performance.\r\n\r\n### What is the expected behavior? Why is that the expected behavior?\r\n\r\nI expect http2 to be faster or at least have the same performance as http1.1.\r\n\r\n### What do you see instead?\r\n\r\nInstead, I often see that http1.1 requests are faster. Most of the times http2 took 25s to complete while http1.1 took 20s.\r\n\r\nThere's a problem, though, because those results are not consistent when using the URL I provided in the example. \r\n\r\nBut, the results are consistent with some internal APIs I'm working with. First, I thought there might be a problem with our internal APIs, but making 25 parallel requests to our internal APIs using `curl` has consistently the same performance on both http 1.1 and http2.\r\n\r\nI ran curl with the following command:\r\n```sh\r\ncurl --config ./config.txt --parallel --parallel-max 25 --http2\r\n```\r\n\r\nwhere config.txt looked like this:\r\n```txt\r\nurl = \"our-internal-api\"\r\noutput = \"/dev/null\"\r\n// repeated 25 times\r\n```\r\n\r\n### Additional information\r\n\r\nI was thinking the reason for such slowness would be TCP stall because http2 uses only 1 tcp connection, so I checked in wireshark how many tcp connections creates node vs curl when using http2, and both created only 1 tcp connection.\r\n\r\nAlso, I noticed node receives first 10 http2 requests randomly, but then sequentially, while http1 requests are all received randomly.\r\n\r\nhttp2:\r\n\r\n\u003cimg width=\"405\" alt=\"image\" src=\"https://github.com/user-attachments/assets/7b1b155e-656b-4266-aca9-64cb009f02cd\">\r\n\r\n---\r\n\r\nhttp1:\r\n\r\n\u003cimg width=\"424\" alt=\"image\" src=\"https://github.com/user-attachments/assets/f317b751-ed98-44aa-b562-1854ccc88835\">\r\n","author":{"url":"https://github.com/stanislav-halyn","@type":"Person","name":"stanislav-halyn"},"datePublished":"2024-09-10T14:46:45Z","url":"https://github.com/nodejs/node/issues/54874"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:73db01bc-6b4c-9702-94af-5560a377629a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id83B8:278B88:1C0FCB:262CDE:6AED4366
html-safe-nonceca0389a08a34408da8047c078b668104929ba060373c342461de47dce9e8aba4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4M0I4OjI3OEI4ODoxQzBGQ0I6MjYyQ0RFOjZBRUQ0MzY2IiwidmlzaXRvcl9pZCI6Ijc1MjAwNDEzODY5MDg2NjQ2NzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac2e56c2b0866be6cf0fda635366c7ae2838f1a252d67afd261b4393853a6e07d9
hovercard-subject-tagissue:2516684987
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/54874/issue_layout
twitter:imagehttps://opengraph.githubassets.com/afa54a70b784a82393183c035ecf6bc6e15d36ed113f003e0fe4b69a90958a31/nodejs/node/issues/54874
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/afa54a70b784a82393183c035ecf6bc6e15d36ed113f003e0fe4b69a90958a31/nodejs/node/issues/54874
og:image:altVersion v20.17.0 Platform MacOS Sonoma 14.5, 2,3 GHz Quad-Core Intel Core i7 Subsystem No response What steps will reproduce the bug? Define an http2 and http1.1 clients and fetch some data in para...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamestanislav-halyn
hostnamegithub.com
expected-hostnamegithub.com
None56fb42677ae87ed3e64410323d67980aa65d0485568a7858f874e7edfc6d1c11
turbo-cache-controlno-preview
go-importgithub.com/nodejs/node git https://github.com/nodejs/node.git
octolytics-dimension-user_id9950313
octolytics-dimension-user_loginnodejs
octolytics-dimension-repository_id27193779
octolytics-dimension-repository_nwonodejs/node
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id27193779
octolytics-dimension-repository_network_root_nwonodejs/node
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9c9a37e2423ed382cf39f70b5aa4b4858b40a3b0
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/nodejs/node/issues/54874#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F54874
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fnodejs%2Fnode%2Fissues%2F54874
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=nodejs%2Fnode
Reloadhttps://github.com/nodejs/node/issues/54874
Reloadhttps://github.com/nodejs/node/issues/54874
Reloadhttps://github.com/nodejs/node/issues/54874
nodejshttps://github.com/nodejs
nodehttps://github.com/nodejs/node
Codehttps://github.com/nodejs/node
Issues655 (655)https://github.com/nodejs/node/issues
Pull requests664 (664)https://github.com/nodejs/node/pulls
Actionshttps://github.com/nodejs/node/actions
Projectshttps://github.com/nodejs/node/projects
Security and qualityhttps://github.com/nodejs/node/security
Insightshttps://github.com/nodejs/node/pulse
https://github.com/nodejs/node
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/54874
New issuehttps://github.com/login?return_to=https://github.com/nodejs/node/issues/54874
HTTP2 download of parallel requests is slower than HTTP1.1https://github.com/nodejs/node/issues/54874#top
http2Issues and PRs related to the http2 subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22http2%22
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
https://github.com/stanislav-halyn
stanislav-halynhttps://github.com/stanislav-halyn
on Sep 10, 2024https://github.com/nodejs/node/issues/54874#issue-2516684987
https://private-user-images.githubusercontent.com/41181938/366090359-7b1b155e-656b-4266-aca9-64cb009f02cd.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTM5MzQ0ODIsIm5iZiI6MTc5MzkzNDE4MiwicGF0aCI6Ii80MTE4MTkzOC8zNjYwOTAzNTktN2IxYjE1NWUtNjU2Yi00MjY2LWFjYTktNjRjYjAwOWYwMmNkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjExMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYxMTA2VDAzMDMwMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU5N2UxOTAwYzYxNGE2MDY3NGNkZDQwOGU5Y2YxOWE3M2I0OGUwNGQ5YmNkMmU4MGIxZGZlZDFmMThlZjY1ZmQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.v2CVW7YPQkCc7yEQDi66DXH6SXkODheoXFUjlXpGXjk
https://private-user-images.githubusercontent.com/41181938/366091013-f317b751-ed98-44aa-b562-1854ccc88835.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTM5MzQ0ODIsIm5iZiI6MTc5MzkzNDE4MiwicGF0aCI6Ii80MTE4MTkzOC8zNjYwOTEwMTMtZjMxN2I3NTEtZWQ5OC00NGFhLWI1NjItMTg1NGNjYzg4ODM1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjExMDYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYxMTA2VDAzMDMwMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc5NGQ5MTBhZGQ1MGExN2MwNGQxMjhhNWI3MDUxY2RhMmU2NjY5YzU0ZDI3MzVhZTFlNWNmZDVmZDhmMTNiMTgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.ZtuIvSL9X3pqERwXYiQtU0gyULaLg2hX3dOJ9o5tvaU
avivkellerhttps://github.com/avivkeller
http2Issues and PRs related to the http2 subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22http2%22
on Sep 10, 2024https://github.com/nodejs/node/issues/54874#event-14200644440
https://github.com/avivkeller
avivkellerhttps://github.com/avivkeller
on Sep 10, 2024https://github.com/nodejs/node/issues/54874#issuecomment-2341185475
https://github.com/stanislav-halyn
stanislav-halynhttps://github.com/stanislav-halyn
on Sep 10, 2024https://github.com/nodejs/node/issues/54874#issuecomment-2341427440
@redyetidevhttps://github.com/redyetidev
https://github.com/stanislav-halyn
stanislav-halynhttps://github.com/stanislav-halyn
on Sep 10, 2024https://github.com/nodejs/node/issues/54874#issuecomment-2341596521
https://github.com/mcollina
mcollinahttps://github.com/mcollina
on Sep 11, 2024https://github.com/nodejs/node/issues/54874#issuecomment-2344016079
@jasnellhttps://github.com/jasnell
https://github.com/stanislav-halyn
stanislav-halynhttps://github.com/stanislav-halyn
on Sep 11, 2024https://github.com/nodejs/node/issues/54874#issuecomment-2344120588
@mcollinahttps://github.com/mcollina
https://github.com/puskin
puskinhttps://github.com/puskin
on Sep 24, 2024https://github.com/nodejs/node/issues/54874#issuecomment-2370443444
@stanislav-halynhttps://github.com/stanislav-halyn
https://github.com/stanislav-halyn
stanislav-halynhttps://github.com/stanislav-halyn
on Sep 24, 2024https://github.com/nodejs/node/issues/54874#issuecomment-2370566212
https://github.com/puskin
puskinhttps://github.com/puskin
on Sep 24, 2024https://github.com/nodejs/node/issues/54874#issuecomment-2370596453
@stanislav-halynhttps://github.com/stanislav-halyn
https://github.com/stanislav-halyn
stanislav-halynhttps://github.com/stanislav-halyn
on Sep 24, 2024https://github.com/nodejs/node/issues/54874#issuecomment-2370712815
https://github.com/stanislav-halyn
stanislav-halynhttps://github.com/stanislav-halyn
on Sep 24, 2024https://github.com/nodejs/node/issues/54874#issuecomment-2370756828
https://github.com/stanislav-halyn
stanislav-halynhttps://github.com/stanislav-halyn
on Sep 24, 2024https://github.com/nodejs/node/issues/54874#issuecomment-2370786001
https://github.com/stanislav-halyn
stanislav-halynhttps://github.com/stanislav-halyn
on Sep 24, 2024https://github.com/nodejs/node/issues/54874#issuecomment-2370788192
@mcollinahttps://github.com/mcollina
@jasnellhttps://github.com/jasnell
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on Apr 27, 2026https://github.com/nodejs/node/issues/54874#issuecomment-4323666468
GitHub Actionshttps://help.github.com/en/actions
github-actionshttps://github.com/apps/github-actions
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
on Apr 27, 2026https://github.com/nodejs/node/issues/54874#event-24887910592
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
on May 27, 2026https://github.com/nodejs/node/issues/54874#issuecomment-4550550179
GitHub Actionshttps://help.github.com/en/actions
github-actionshttps://github.com/apps/github-actions
not plannedhttps://github.com/nodejs/node/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Anot-planned
on May 27, 2026https://github.com/nodejs/node/issues/54874#event-25994352572
Sign up for freehttps://github.com/signup?return_to=https://github.com/nodejs/node/issues/54874
Sign in to commenthttps://github.com/login?return_to=https://github.com/nodejs/node/issues/54874
http2Issues and PRs related to the http2 subsystem.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22http2%22
staleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.https://github.com/nodejs/node/issues?q=state%3Aopen%20label%3A%22stale%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.