Is your feature request related to a problem? Please describe.
There are potential performance implications around having many labels or complex JSONPaths to obtain the labels for config status metrics. The metrics were recently added in this PR: https://github.com/solo-io/gloo/pull/5710
At the moment, getMutators() is called every time the translation loop runs and writes statuses, even if nothing has changed. extractValueFromResource() is the potentially expensive function. For every label on a metric, extractValueFromResource() needs to parse and lookup values on potentially large custom resources using a JSON path. Performance testing here should be sure to include:
Many labels per metric
Large (many nested fields) resources
Inefficient JSON Paths (there's quite a few operations that are more complex that just selecting a single field)
Describe the solution you'd like
Determine how severe the performance implications are, and ways to mitigate. If potential performance hit is reasonably concerning, implement a mitigation.
A potential solution proposed is to cache the result of a JSON Path find operation with respect to resource version and labelToPath, to avoid costly logic to lookup label values from resources.
This issue has been marked as stale because of no activity in the last 180 days. It will be closed in the next 180 days unless it is tagged "no stalebot" or other activity occurs.
Version
1.11.x (beta)
Is your feature request related to a problem? Please describe.
There are potential performance implications around having many labels or complex JSONPaths to obtain the labels for config status metrics. The metrics were recently added in this PR: https://github.com/solo-io/gloo/pull/5710
At the moment,
getMutators()
is called every time the translation loop runs and writes statuses, even if nothing has changed.extractValueFromResource()
is the potentially expensive function. For every label on a metric,extractValueFromResource()
needs to parse and lookup values on potentially large custom resources using a JSON path. Performance testing here should be sure to include:Describe the solution you'd like
Determine how severe the performance implications are, and ways to mitigate. If potential performance hit is reasonably concerning, implement a mitigation.
A potential solution proposed is to cache the result of a JSON Path find operation with respect to resource version and
labelToPath
, to avoid costly logic to lookup label values from resources.Additional Context
https://github.com/solo-io/gloo/pull/5710/files#r784110472