Skip to content

ServiceOptions#getApplicationName() - performance issue #2290

@dargiri

Description

@dargiri

Dear Google Team,

During our company internal performance testing we found that there are some places for improvement (although it's not critical but very nice to have). Method com.google.cloud.ServiceOptions#getApplicationName() is used with each request (for example from code of method com.google.cloud.datastore.spi.v1.HttpDatastoreRpc#getHttpRequestInitializer() )
. This method is used each time during EACH request. Basically what it does under the hood: it loads some resource from classpath with EACH request. It is leading to not necessary memory and CPU consumption. It is especially notable on a high-loaded project with millions requests per day.

Proposal is to cache result of method ServiceOptions#getApplicationName(). It's constant value anyway(by it's nature) - so there's no need to load it each time with each request (it won't change). Or load it once on startup.

Bug found in a library: com.google.cloud:google-cloud-datastore:1.2.3

Best Regards,
Dionis Argiri

Metadata

Metadata

Assignees

Labels

api: datastoreIssues related to the Datastore API.performancepriority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions