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

Update http.zig max_simultaneous_requests from 256 to 65535 for default NodeJS like request behavior. #12221

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

metaspartan
Copy link

@metaspartan metaspartan commented Jun 28, 2024

Update http.zig max_simultaneous_requests from 256 to 65535 for default NodeJS like request behavior.

What does this PR do?

  • Documentation or TypeScript types (it's okay to leave the rest blank in this case)
  • Code changes

How did you verify your code works?

Update http.zig `max_simultaneous_requests` from 256 to 65535 for default NodeJS like request behavior.
@Jarred-Sumner
Copy link
Collaborator

Jarred-Sumner commented Jul 3, 2024

I'm not sure this is the right default for fetch. Your operating system has an upper limit of something like 16,000 - 64,000 maximum open sockets unless you manually configure linux to behave otherwise.

If any of the requests are short-lived, it also prevents HTTP Keep Alive from kicking in

https://example.com:

Elapsed Limit
5.27s 9999
2.26s 256 (default)

http://example.com:

Elapsed Limit
5.20s 9999
2.26s 256 (default)
const p = []
for (let i = 0; i < 1000; i++) {
  p.push(fetch('https://example.com/').then(re => console.count("Completed")));
 }
 await Promise.all(p);

It feels like we could address this more effectively with smarter scheduling.

That being said, if it's a loopback address maybe we shouldn't rate limit at all

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.

None yet

2 participants