perf: cache AMT features to reduce duplicate HTTP requests#3169
Open
perf: cache AMT features to reduce duplicate HTTP requests#3169
Conversation
f5e3c40 to
1e4fb23
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
What are you changing?
Introduces a TTL-based in-memory cache for AMT features in
DevicesServiceto eliminate duplicate HTTP requests during KVM sessions. This is a frontend complement to the backend caching introduced in #768.When a user opens the KVM view, both the KVM component and the device toolbar independently call
getAMTFeatures(), resulting in two identical HTTP requests to the management server in rapid succession. With this change, warm SPA navigations reduce/featuresnetwork calls from 2 → 1, cutting redundant requests by 50% for that operation. In benchmarks, individual/featurescalls served from the in-memory cache recorded 0ms network time vs. 167–534ms for a backend round-trip.getAMTFeaturesCached(guid, ttlMs?)— returns the cached result immediately if fresher than the TTL, otherwise falls back to a real HTTP requestenvironment.amtFeaturesCacheTtlMs(default: 30s, capped at 3 min), consistent with the 30s TTL used on the backend in build(deps): update to angular14 #768DeviceToolbarComponentnow callsgetAMTFeaturesCached()instead ofgetAMTFeatures(), eliminating the duplicate round-trip when the toolbar loads shortly after the KVM componentamtFeaturesCacheTtlMsconfig fieldAnything the reviewer should know when reviewing this PR?
DevicesServicesingleton — it does not persist across full page reloads, only across SPA navigations within the same session/featurestime drops to 0ms on cached hits vs. 167–534ms on cache misses, consistent with the 1000–3000x per-call speedup measured for the backend cache in build(deps): update to angular14 #768cypress/e2e/integration/performance/:kvm-benchmark.spec.ts— measures KVM page load time per API call across multiple runs and writes results to CSVkvm-cache-validation.spec.ts— validates that on warm SPA revisits the secondgetAMTFeaturescall is served from cache and does not trigger a network requestdevice-toolbar.component.spec.tshas been updated to cover the cached pathAssociated PRs