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

Increase HTTP/2 stream pool max size to 100 #24712

Merged
merged 1 commit into from
Aug 10, 2020
Merged

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Aug 9, 2020

Addresses #13750

A benchmark with 100 concurrent requests on a connection uses all 100 streams. The previous lower value resulted in streams not being reused because the pool was at capacity. They are garbage collected and new streams have to be created.

Before:

image

After:

image

Copy link
Contributor

@jkotalik jkotalik left a comment

Choose a reason for hiding this comment

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

I'm not against this change but we should think about it. This means we will now have significantly more idle memory per connection. For example, let's say 100 requests were sent from the client to the server (100 streams) and then the connection was left open afterwards. We would now have 100 stream objects pooled but not being used for the connection.

I agree for the benchmark it makes sense to have 100, but for normal use cases I'm not convinced yet. How much memory is idled between 40 and 100 streams?

@JamesNK
Copy link
Member Author

JamesNK commented Aug 10, 2020

What do we think of supporting expiring pooled streams?

When a stream is pooled we set the drain timeout (just to reuse an existing property), and every heartbeat we look at the oldest streams in the pool and remove all that exceeds the timeout.

For example, if a stream sits in the pool unused for longer than 5 seconds then it gets removed.

@halter73
Copy link
Member

How much memory is idled between 40 and 100 streams?

We should collect a profile and get a real number for this, but I think it's safe to say the memory usage for streams on an idle connection that previously had at least 100 concurrent streams open (the worst case) will be at most 2.5x worse what it was before.

What do we think of supporting expiring pooled streams?

I think that's a great idea. @jkotalik also suggested "Pruning pool over time for long running connections" when he first added the 40 stream pool (#18601) though it wasn't really discussed much then IIRC. I think it can be done in a separate PR though as it's something we should do whether or not this PR is merged.

@JamesNK JamesNK requested a review from jkotalik August 10, 2020 22:28
@JamesNK JamesNK dismissed jkotalik’s stale review August 10, 2020 22:29

Will add feature to expiry old pooled streams in followup PR

@JamesNK JamesNK merged commit 3de55df into master Aug 10, 2020
@JamesNK JamesNK deleted the jamesnk/streampool-maxsize branch August 10, 2020 22:29
@JamesNK JamesNK added this to the 5.0.0-rc1 milestone Aug 10, 2020
@jkotalik
Copy link
Contributor

Sounds good!

@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions HTTP2 Perf
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants