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

[internal] Investigate fetch timings when Socket is reused #32960

Closed
Skn0tt opened this issue Oct 4, 2024 · 4 comments · Fixed by #33087
Closed

[internal] Investigate fetch timings when Socket is reused #32960

Skn0tt opened this issue Oct 4, 2024 · 4 comments · Fixed by #33087
Assignees
Labels

Comments

@Skn0tt
Copy link
Member

Skn0tt commented Oct 4, 2024

          I wonder what does this mean for the timings? If the socket is reused, will it get zero `connect` timings? What if sending does not start right away - should that count as `blocked` or `queued`?

Originally posted by @dgozman in #32956 (comment)

@Skn0tt
Copy link
Member Author

Skn0tt commented Oct 4, 2024

To answer the questions, here's what I think our behaviour should be:

  • If the socket is reused, the connect timing should be -1, because that timing doesn't apply to the current request
  • If sending doesn't start right away, that should count as blocked. If sending does start right away, blocked should be zero.

@Skn0tt
Copy link
Member Author

Skn0tt commented Oct 14, 2024

My hypothesis for #32956 was that we're reusing Sockets. Now that i'm looking more into this, i'm less sure about it. The default Node.js Agent does reuse Sockets, but we use our own Happy Eyeballs implementation. Judging by its code, it doesn't reuse Sockets. I'll need to investigate that more.

@Skn0tt
Copy link
Member Author

Skn0tt commented Oct 14, 2024

I've added some debugging into our python tests, and it indeed seems like sockets are reused. Let's find out where that happens.
Image

@Skn0tt
Copy link
Member Author

Skn0tt commented Oct 14, 2024

Oh, HttpHappyEyeballsAgent extends http.Agent. That explains why we're getting the socket reuse behaviour.

@Skn0tt Skn0tt pinned this issue Oct 14, 2024
@Skn0tt Skn0tt unpinned this issue Oct 14, 2024
Skn0tt added a commit that referenced this issue Oct 14, 2024
Closes #32960

If the socket is reused, the connect and DNS timings are set to -1,
because that timing doesn't apply to the current request. The time
between request start and the socket being free is counted as `blocked`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants