core,grpclb: Resolve isAndroid only once on class loading#10345
core,grpclb: Resolve isAndroid only once on class loading#10345temawi merged 1 commit intogrpc:masterfrom
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! |
|
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.