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

Connection Reuse Support for HTTP2 #2396

Open
1 task done
meme-lord opened this issue Jan 16, 2025 · 0 comments
Open
1 task done

Connection Reuse Support for HTTP2 #2396

meme-lord opened this issue Jan 16, 2025 · 0 comments

Comments

@meme-lord
Copy link

What problem are you trying to solve?

When doing two HTTP1 requests the HTTP request reuses the keep-alive connection. This is more efficient as it avoids the overhead of creating two connections.
However when using HTTP2 a new connection is always created. This has a performance impact when doing many requests.

Describe the feature

Somehow reuse connections when making two http2 requests to the same host within a timeframe.

import got from 'got';

(async () => {
  try {
    // first request
    const response1 = await got('https://www.google.com', { http2: true });
    console.log('response 1:', response1.statusCode);

    // second request
    const response2 = await got('https://www.google.com/search?q=hello', { http2: true });
    console.log('response 2:', response2.statusCode);
  } catch (err) {
    console.error('error:', err);
  }
})();

By looking in wireshark I can see this opens two separate tcp connections

Checklist

  • I have read the documentation and made sure this feature doesn't already exist.
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

No branches or pull requests

1 participant