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

client: Drop two calls to pretty.ToJSON and move code outside of lock #7132

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

townba
Copy link
Contributor

@townba townba commented Apr 16, 2024

RELEASE NOTES:

  • client: improve RPC performance by reducing work while holding a lock

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.

Could you please add a comment to addrConn's mu field that says something like "This is taken on the RPC path, so its usage should be minimized as much as possible. TODO: find a lock-free way to retrieve the transport and state from the addrConn without a lock"

if limit > 5 {
limit = 5
}
channelz.Infof(logger, ac.channelz, "addrConn: updateAddrs addrs (%d of %d): %v", limit, len(addrs), addrs[:limit])
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 show what this looks like, please? (Mainly I'm not sure: does %v on a slice call String() for each member?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks something like this:

addrConn: updateAddrs addrs (3 of 3): [{Addr: "127.0.0.1:35771", ServerName: "", } {Addr: "127.0.0.1:41729", ServerName: "", } {Addr: "127.0.0.1:36587", ServerName: "", }]

Copy link
Member

Choose a reason for hiding this comment

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

Great, thanks!

@dfawley dfawley added this to the 1.64 Release milestone Apr 16, 2024
@dfawley dfawley added the Type: Performance Performance improvements (CPU, network, memory, etc) label Apr 16, 2024
@dfawley
Copy link
Member

dfawley commented Apr 16, 2024

This may be significant enough to warrant a patch release. We should at least cherry-pick it so it will be in the next patch release, even if we don't want to do a release for only this.

@townba
Copy link
Contributor Author

townba commented Apr 16, 2024

Could you please add a comment to addrConn's mu field that says something like …

Done.

@townba
Copy link
Contributor Author

townba commented Apr 16, 2024

PTAL

if limit > 5 {
limit = 5
}
channelz.Infof(logger, ac.channelz, "addrConn: updateAddrs addrs (%d of %d): %v", limit, len(addrs), addrs[:limit])
Copy link
Member

Choose a reason for hiding this comment

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

Great, thanks!

clientconn.go Outdated
Comment on lines 1180 to 1181
// TODO: Find a lock-free way to retrieve the transport and state from the
// addrConn without a lock.
Copy link
Member

@dfawley dfawley Apr 16, 2024

Choose a reason for hiding this comment

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

Oops, "lock-free ... without a lock" - please remove one or the other. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. PTAL

@dfawley dfawley merged commit 006e2ba into grpc:master Apr 17, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Performance Performance improvements (CPU, network, memory, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants