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

Acquire all stream related quota and cache it locally since no more than one write can happen in parallel on stream #1614

Merged
merged 5 commits into from
Oct 26, 2017

Conversation

MakMukhi
Copy link
Contributor

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

@thelinuxfoundation
Copy link

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,
The Linux Foundation CLA GitHub bot

@MakMukhi
Copy link
Contributor Author

I signed it!

if size > streamQuota {
size = streamQuota
} // No need to do that for localSendQuota since that's only a soft limit.
streamQuota -= size
Copy link
Member

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

runPingPongTest(t, 1048576)
}

func runPingPongTest(t *testing.T, msgSize int) {
Copy link
Member

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?

@@ -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
Copy link
Member

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"?

Copy link
Member

@dfawley dfawley left a 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.

@MakMukhi MakMukhi merged commit e9a5821 into grpc:master Oct 26, 2017
@menghanl menghanl added this to the 1.8 Release milestone Nov 7, 2017
@menghanl menghanl added the Type: Performance Performance improvements (CPU, network, memory, etc) label Nov 7, 2017
@MakMukhi MakMukhi deleted the gimme_all_stream_quota branch May 4, 2018 02:04
@lock lock bot locked as resolved and limited conversation to collaborators Oct 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Performance Performance improvements (CPU, network, memory, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants