solo-io / gloo

The Feature-rich, Kubernetes-native, Next-Generation API Gateway Built on Envoy
https://docs.solo.io/
Apache License 2.0
4.03k stars 433 forks source link

Investigate performance implications of config status metrics #5794

Open MitchAman opened 2 years ago

MitchAman commented 2 years ago

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

github-actions[bot] commented 1 month ago

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.