Skip to content

perf(monitor): improve monitor query and chart performance for large ranges - #13874

Open
CNCoreSteb wants to merge 1 commit into
1Panel-dev:dev-v2from
CNCoreSteb:perf/monitor-large-range
Open

CNCoreSteb wants to merge 1 commit into
1Panel-dev:dev-v2from
CNCoreSteb:perf/monitor-large-range

Conversation

@CNCoreSteb

@CNCoreSteb CNCoreSteb commented Sep 20, 2026 •

Copy link
Copy Markdown

What this PR does / why we need it?

Selecting a long time range (e.g. 30 days) on the monitor page makes the UI noticeably laggy, and on hosts with many historical devices (frequently recreated veth interfaces, removed disks) the option dropdowns become very large. This PR improves both the chart rendering and the query path without adding any new API.

Summary of your change

  • Enable LTTB sampling in the shared line chart component so dense series render a bounded number of points.
  • Monitor IO/network queries: an empty io/network value now means "no name filter", returning rows for all devices in a single request instead of fanning out one request per device name.
  • IO/network/GPU option endpoints now merge names recorded in the monitor database with live devices, so removed devices stay selectable for historical queries. The logic moves from the API handlers into the service layer.
  • Add composite indexes monitor_ios(name, created_at), monitor_networks(name, created_at) and monitor_gpus(product_name, created_at), matching the actual name = ? AND created_at BETWEEN query pattern.
  • Remove the MonitorGPU model from MonitorDB auto-migration (GPU data lives in GPUMonitorDB; the table was unused).
  • Fix the memory param: the backend previously compared against "mem" so memory data was never returned.
  • Add unit tests covering wildcard queries, option merging and index creation.

Please indicate you've done the following:

  • Made sure tests are passing and test coverage is added if needed.
  • Made sure commit message follow the rule of Conventional Commits specification.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed.

…ranges

- enable LTTB sampling in the shared line chart to bound rendered points
- empty io/network in monitor search now means no name filter, returning
  all device rows in one query instead of fanning out per device
- merge device names recorded in the monitor db into io/network/gpu
  options so removed devices stay selectable; move logic to service layer
- add composite indexes (name, created_at) on monitor_ios/monitor_networks
  and (product_name, created_at) on monitor_gpus
- stop migrating the unused MonitorGPU model into MonitorDB
- fix the memory param which was compared against "mem" and never matched
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