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

[Task] Caching of Automated Analysis Report JSON #1450

Open
Tracked by #1464
andrewazores opened this issue Apr 13, 2023 · 0 comments
Open
Tracked by #1464

[Task] Caching of Automated Analysis Report JSON #1450

andrewazores opened this issue Apr 13, 2023 · 0 comments
Labels
feat New feature or request

Comments

@andrewazores
Copy link
Member

https://github.com/cryostatio/cryostat/issues/880#issuecomment-1156753942

Currently, only the HTML-formatted responses are cached. The cache time is per document, and once the cached entry expires then the next request causes a full regeneration. Requests for JSON-formatted data are always generated fresh on every request.

cryostatio/cryostat-web#949

The HTML-formatted responses will no longer be displayed in the Cryostat web UI, but it may be nice for some users to still have this API present, so this code path should not be removed (yet). We should, however, apply some caching strategy to the JSON side of things.

My initial thought is to set up the cache so that each entry has a key like <JVM_ID, Rule_ID>, and a value like <Rule_ID, Rule_Name, Rule_Description, Rule_Category[], Rule_Score>. The key JVM_ID is the unique hash ID for the target that the analysis was performed against and the Rule_ID is of course the ID for the specific analysis rule that was evaluated.

This way, the client can continue to request specific rule evaluations by query parameter. The client and server can negotiate a caching strategy using standard HTTP headers like Cache-Control, If-Modified-Since/If-Unmodified-Since, and Last-Modified. If all of the client's requested analyses are already in the cache and are fresh enough then the server simply responds with those values. If any of the requested analyses are either not in the cache or are not fresh enough then the server re-analyzes all of the requested rules (so that the response has a consistent data age/freshness across all metrics), updates the cache, and responds to the client. The server should also have its own policy for maximum cache entry age and a maximum cache size/weight as well to ensure that the key space doesn't grow too large and waste server resources.

@andrewazores andrewazores added good first issue Good for newcomers feat New feature or request labels Apr 13, 2023
@andrewazores andrewazores moved this to Todo in 2.4.0 release Apr 13, 2023
@andrewazores andrewazores removed the good first issue Good for newcomers label May 19, 2023
@andrewazores andrewazores moved this from Todo to Backlog in 2.4.0 release May 23, 2023
@tthvo tthvo self-assigned this Oct 6, 2023
@tthvo tthvo removed their assignment Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request
Projects
No open projects
Status: Backlog
Development

No branches or pull requests

2 participants