Skip to content
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

Experimental caching metrics #3554

Closed
Geal opened this issue Aug 9, 2023 · 0 comments · Fixed by #3558
Closed

Experimental caching metrics #3554

Geal opened this issue Aug 9, 2023 · 0 comments · Fixed by #3558
Assignees

Comments

@Geal
Copy link
Contributor

Geal commented Aug 9, 2023

Follow up to #3532 that was reverted. We want metrics to evaluate how much data is reused between queries

@Geal Geal self-assigned this Aug 9, 2023
@Geal Geal closed this as completed in #3558 Sep 6, 2023
Geal added a commit that referenced this issue Sep 6, 2023
Fix #3554

This creates a new metric recorded only if we set the configuration
option `telemetry.metrics.common.experimental_cache_metrics.enabled` to
`true`.

* `apollo.router.operations.entity` (histogram): cache hit ratio per
subgraph and entity type

This simulates an entity cache to find out if it would be useful. Each
time we do a subgraph query, we use as cache key:
- subgraph name
- entity type
- query
- vary headers
- entity key

We record if we have seen this entity before (using a bloom filter) and
calculate the cache hit ratio for that query, per subgraph and entity
type.

---------

Signed-off-by: Benjamin Coenen <[email protected]>
Co-authored-by: Benjamin Coenen <[email protected]>
garypen pushed a commit that referenced this issue Sep 12, 2023
Fix #3554

This creates a new metric recorded only if we set the configuration
option `telemetry.metrics.common.experimental_cache_metrics.enabled` to
`true`.

* `apollo.router.operations.entity` (histogram): cache hit ratio per
subgraph and entity type

This simulates an entity cache to find out if it would be useful. Each
time we do a subgraph query, we use as cache key:
- subgraph name
- entity type
- query
- vary headers
- entity key

We record if we have seen this entity before (using a bloom filter) and
calculate the cache hit ratio for that query, per subgraph and entity
type.

---------

Signed-off-by: Benjamin Coenen <[email protected]>
Co-authored-by: Benjamin Coenen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant