Skip to content

perf: cache AMT features to reduce duplicate HTTP requests#3169

Open
nmgaston wants to merge 1 commit intomainfrom
frontEndCacheAMTFeatures
Open

perf: cache AMT features to reduce duplicate HTTP requests#3169
nmgaston wants to merge 1 commit intomainfrom
frontEndCacheAMTFeatures

Conversation

@nmgaston
Copy link
Contributor

@nmgaston nmgaston commented Mar 4, 2026

PR Checklist

  • Unit Tests have been added for new changes
  • API tests have been updated if applicable
  • All commented code has been removed
  • If you've added a dependency, you've ensured license is compatible with Apache 2.0 and clearly outlined the added dependency.

What are you changing?

Introduces a TTL-based in-memory cache for AMT features in DevicesService to 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 /features network calls from 2 → 1, cutting redundant requests by 50% for that operation. In benchmarks, individual /features calls served from the in-memory cache recorded 0ms network time vs. 167–534ms for a backend round-trip.

  • Added getAMTFeaturesCached(guid, ttlMs?) — returns the cached result immediately if fresher than the TTL, otherwise falls back to a real HTTP request
  • TTL is configurable per environment via environment.amtFeaturesCacheTtlMs (default: 30s, capped at 3 min), consistent with the 30s TTL used on the backend in build(deps): update to angular14 #768
  • DeviceToolbarComponent now calls getAMTFeaturesCached() instead of getAMTFeatures(), eliminating the duplicate round-trip when the toolbar loads shortly after the KVM component
  • All existing environments updated with the new amtFeaturesCacheTtlMs config field

Anything the reviewer should know when reviewing this PR?

  • The cache is in-memory and scoped to the DevicesService singleton — it does not persist across full page reloads, only across SPA navigations within the same session
  • Cold loads (first visit / full reload) are unaffected — both components still receive a fresh HTTP response
  • Benchmark data shows /features time 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 #768
  • Two new Cypress performance suites have been added under cypress/e2e/integration/performance/:
    • kvm-benchmark.spec.ts — measures KVM page load time per API call across multiple runs and writes results to CSV
    • kvm-cache-validation.spec.ts — validates that on warm SPA revisits the second getAMTFeatures call is served from cache and does not trigger a network request
  • device-toolbar.component.spec.ts has been updated to cover the cached path

Associated PRs

@nmgaston nmgaston changed the title Front end cache amt features perf: cache AMT features to reduce duplicate HTTP requests Mar 4, 2026
@nmgaston nmgaston force-pushed the frontEndCacheAMTFeatures branch 3 times, most recently from f5e3c40 to 1e4fb23 Compare March 5, 2026 00:45
@nmgaston nmgaston marked this pull request as ready for review March 5, 2026 01:02
@nmgaston nmgaston requested review from Copilot, madhavilosetty-intel and rsdmike and removed request for Copilot March 5, 2026 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant