Skip to content

Backend caching for AMT API endpoints to reduce latency and backend load #774

@nmgaston

Description

@nmgaston

Is your feature request related to a problem? Please describe.
When users interact with the KVM interface or monitor device status in the console, many API calls to AMT firmware are issued repeatedly (for power state, feature support, KVM displays). Every call adds 150–500ms latency and creates excess backend load, especially during rapid power actions and status polling. This leads to slow response times and unnecessary strain on the backend.

Describe the solution you'd like
Introduce a thread-safe in-memory cache for AMT API endpoints:

  • Power state should use a 5-second TTL (to reflect frequent state changes).
  • Features and KVM displays should use a 30-second TTL (as these change infrequently).
  • Cache must be invalidated automatically on power actions.
  • The cache should use TTL-based expiration, support concurrent access (e.g., with sync.RWMutex), and do background cleanup.
  • No API contract or request/response changes should be introduced.
  • Add log output/metrics for cache hits/misses/invalidations.
  • Show performance improvement and backend load reduction with load testing (use baseline-test.sh to demonstrate efficiency).

Describe alternatives you've considered
Considered persistent/distributed caching, but determined in-memory cache is sufficient for current usage and reduces complexity/risk for this iteration.

Additional context

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

In Review

Status

Q1 2026 (Current)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions