Skip to content

Commit 892e43f

Browse files
fix: Improve Kubernetes dashboard performance (#1333)
These are the minimal set of changes needed to improve the kubernetes dashboard with 100k+ pods. **Changes:** * Fixed a performance issue in ChartUtils that caused computation to be O(n^2). This caused charts to slow down rendering to a crawl and freeze the page. It's not as noticeable with a smaller data set. This was the main issue. * Limited the number of items returned in the nodes, namespaces, and pods tables to 10k. This was the second biggest issue. * Introduced a virtualized table to each of the tables to speed up rendering. This was the third biggest issue. * Increased the amount of unique items returned from the metadata query so that users can filter for the items they need (UX improvement) **Future changes that will improve the experience even more:** 1) Fetch 10k, but add pagination (UX) 2) Improve query for fetching tabular data. It's timeseries, but realistically, we can make a smarter more performant query 3) To fill out the data in the tables (cpu, memory, uptime, etc...) we make separate queries and combine them on the server side. We could make this one large query (we have an existing ticket in the backlog for it). 4) Chart rendering is very computational intensive. It would be a better user experience to load these after the table loads. **Outstanding (existing) bugs that exist that I will fix in follow-up tickets:** 1) The namespaces query uses the wrong time window. It does not respect the global time picker date range. 2) Sorting of the table columns is broken. Ref: HDX-2370 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 2743d85 commit 892e43f

File tree

5 files changed

+451
-218
lines changed

5 files changed

+451
-218
lines changed

.changeset/flat-countries-teach.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hyperdx/app": patch
3+
---
4+
5+
fix: Improve loading of kubernetes dashboard

packages/app/src/ChartUtils.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,11 @@ export function formatResponseForTimeChart({
600600
const ts = date.getTime() / 1000;
601601

602602
for (const valueColumn of valueColumns) {
603-
const tsBucket = tsBucketMap.get(ts) ?? {};
603+
let tsBucket = tsBucketMap.get(ts);
604+
if (tsBucket == null) {
605+
tsBucket = { [timestampColumn.name]: ts };
606+
tsBucketMap.set(ts, tsBucket);
607+
}
604608

605609
const keyName = [
606610
// Simplify the display name if there's only one series and a group by
@@ -614,11 +618,8 @@ export function formatResponseForTimeChart({
614618
const value =
615619
typeof rawValue === 'number' ? rawValue : Number.parseFloat(rawValue);
616620

617-
tsBucketMap.set(ts, {
618-
...tsBucket,
619-
[timestampColumn.name]: ts,
620-
[keyName]: value,
621-
});
621+
// Mutate the existing bucket object to avoid repeated large object copies
622+
tsBucket[keyName] = value;
622623

623624
let color: string | undefined = undefined;
624625
if (

0 commit comments

Comments
 (0)