-
Notifications
You must be signed in to change notification settings - Fork 4k
core,grpclb: Resolve isAndroid only once on class loading #10345
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
Conversation
|
|
3ee9873 to
2a8b3d2
Compare
Motivation: When multiple NameResolvers are created, the Classloader is scanned every time trying to figure out if the Platform is Android. This expensive work could be done only once. Modification: Cache isAndroid resolution in a constant. Result: Less expensive multiple NameResolvers instantiation.
|
@grpc-google-owners Any idea why the CI has been stuck for 13 hours? |
|
Is there a performance issue you are trying to resolve with this optimization? This would potentially save some "handful" of calls to get the class loader and a class at channel creation time, but those are not on any time sensitive RPC call path. I'm just trying to justify the, albeit slight, increase in code complexity. |
|
@temawi our use case is non standard I reckon 😄 At Gatling, we're currently working on supporting gRPC load tests. |
|
@slandelle thanks for the background, I'll go ahead and merge this. I hope it will be helpful to you guys! |
ejona86
left a comment
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.
LGTM
|
Thanks guys! We've spotted several other hotspots so we'll definitely provide some other PRs in a few weeks. |
Motivation:
When multiple NameResolvers are created, the Classloader is scanned every time trying to figure out if the Platform is Android. This expensive work could be done only once.
Modification:
Cache isAndroid resolution in a constant.
Result:
Less expensive multiple NameResolvers instantiation.