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

feat: async connect #887

Merged
merged 11 commits into from
Jul 19, 2021
Merged

feat: async connect #887

merged 11 commits into from
Jul 19, 2021

Conversation

ronag
Copy link
Member

@ronag ronag commented Jul 18, 2021

Fixes: #885

@ronag ronag requested a review from mcollina July 18, 2021 18:21
@ronag
Copy link
Member Author

ronag commented Jul 18, 2021

@szmarczak

@codecov-commenter
Copy link

codecov-commenter commented Jul 18, 2021

Codecov Report

Merging #887 (e618fb5) into main (104be9c) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #887   +/-   ##
=======================================
  Coverage   99.81%   99.81%           
=======================================
  Files          26       26           
  Lines        2121     2132   +11     
=======================================
+ Hits         2117     2128   +11     
  Misses          4        4           
Impacted Files Coverage Δ
lib/core/symbols.js 100.00% <ø> (ø)
lib/client.js 100.00% <100.00%> (ø)
lib/core/connect.js 100.00% <100.00%> (ø)
lib/pool.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 104be9c...e618fb5. Read the comment docs.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

the code looks good, could you also take a look at benchmarks?

lib/core/connect.js Outdated Show resolved Hide resolved
@szmarczak
Copy link
Member

szmarczak commented Jul 18, 2021

@mcollina Seems like there's no performance regression. There is always some difference in various tests in other runs but they're heading for about the same value.

Node.js v16.5.0

async connect:

szm@solus ~/Desktop/undici $ node benchmarks/benchmark.js 
│ Tests               │ Samples │           Result │ Tolerance │ Difference with slowest │
|─────────────────────|─────────|──────────────────|───────────|─────────────────────────|
│ http - no keepalive │      10 │  6501.19 req/sec │  ± 2.71 % │                       - │
|─────────────────────|─────────|──────────────────|───────────|─────────────────────────|
│ http - keepalive    │      85 │  9121.99 req/sec │  ± 2.96 % │               + 40.31 % │
|─────────────────────|─────────|──────────────────|───────────|─────────────────────────|
│ undici - pipeline   │      70 │ 13159.92 req/sec │  ± 2.80 % │              + 102.42 % │
|─────────────────────|─────────|──────────────────|───────────|─────────────────────────|
│ undici - request    │      60 │ 15766.59 req/sec │  ± 2.97 % │              + 142.52 % │
|─────────────────────|─────────|──────────────────|───────────|─────────────────────────|
│ undici - stream     │      15 │ 20320.07 req/sec │  ± 2.56 % │              + 212.56 % │
|─────────────────────|─────────|──────────────────|───────────|─────────────────────────|
│ undici - dispatch   │      20 │ 23858.58 req/sec │  ± 2.85 % │              + 266.99 % │

main:

szm@solus ~/Desktop/undici $ node benchmarks/benchmark.js 
│ Tests               │ Samples │           Result │ Tolerance │ Difference with slowest │
|─────────────────────|─────────|──────────────────|───────────|─────────────────────────|
│ http - no keepalive │      15 │  5553.42 req/sec │  ± 2.52 % │                       - │
|─────────────────────|─────────|──────────────────|───────────|─────────────────────────|
│ http - keepalive    │      40 │  8982.60 req/sec │  ± 2.78 % │               + 61.75 % │
|─────────────────────|─────────|──────────────────|───────────|─────────────────────────|
│ undici - pipeline   │      70 │ 13000.28 req/sec │  ± 2.86 % │              + 134.10 % │
|─────────────────────|─────────|──────────────────|───────────|─────────────────────────|
│ undici - request    │      10 │ 18970.56 req/sec │  ± 2.80 % │              + 241.60 % │
|─────────────────────|─────────|──────────────────|───────────|─────────────────────────|
│ undici - stream     │      25 │ 21187.96 req/sec │  ± 2.64 % │              + 281.53 % │
|─────────────────────|─────────|──────────────────|───────────|─────────────────────────|
│ undici - dispatch   │      25 │ 22509.90 req/sec │  ± 2.90 % │              + 305.33 % │

@ronag ronag requested review from mcollina and dnlup July 19, 2021 06:09
@ronag ronag force-pushed the main branch 2 times, most recently from 6679898 to 4b5ed0b Compare July 19, 2021 07:13
@ronag ronag merged commit 15dad45 into main Jul 19, 2021
@Uzlopak Uzlopak deleted the sync-connect branch February 21, 2024 12:38
crysmags pushed a commit to crysmags/undici that referenced this pull request Feb 27, 2024
* feat: async connect

Fixes: nodejs#885

* fixup

* fixup

* fixup

* fixup

* fixup

* fixup

* fixup

* fixup

* fixup

* fixuP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Asynchronous connect function
5 participants