-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Acquire all stream related quota and cache it locally since no more than one write can happen in parallel on stream #1614
Conversation
…ly one write can happen on a stream at a time.
Thank you for your pull request. Before we can look at your contribution, we need to ensure all contributors are covered by a Contributor License Agreement. After the following items are addressed, please respond with a new comment here, and the automated system will re-verify.
Regards, |
I signed it! |
transport/http2_client.go
Outdated
if size > streamQuota { | ||
size = streamQuota | ||
} // No need to do that for localSendQuota since that's only a soft limit. | ||
streamQuota -= size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the code would be clearer as:
if tq < size {
size = tq
}
streamQuota -= size
localSendQuota -= size
transport/transport_test.go
Outdated
runPingPongTest(t, 1048576) | ||
} | ||
|
||
func runPingPongTest(t *testing.T, msgSize int) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment to say what this test is supposed to catch that our other tests don't?
transport/transport_test.go
Outdated
@@ -2183,6 +2183,10 @@ func TestPingPong1MB(t *testing.T) { | |||
runPingPongTest(t, 1048576) | |||
} | |||
|
|||
// The continous ping-pong of data on a stream is meant to excercise the | |||
// flow-control logic to catch potential deadlocks. | |||
// These tests were added after a deadlock was caught by benchmarking |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can leave this bit of trivia out...
Maybe say: "This is a stress-test of flow control logic"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM; please tweak the comment a little.
This is a small optimization upon which a follow optimization will be built to reduce lock contention.
Benchmarks: https://docs.google.com/a/google.com/spreadsheets/d/1G-p6-uTt8IHRLGXLuTR6TAxeL3I5krVf5r9C86cJPDc/edit?usp=sharing