Repository navigation
[release-2.1] perf(ui): fix performance issue with high number of pages - #5933
Conversation
|
Pipeline controller notification This PR uses the pipeline controller for second-stage tests. Selection and triggering follow the repository configuration. Use |
PR Summary by QodoAdd opt-in frontend system scale benchmark
AI Description
Merge Risk
|
Code Review by Qodo 1. App navigation misses the routing fix
|
e314e17 to
96f368e
Compare
|
The container image build workflow finished with status: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-2.1 #5933 +/- ##
============================================
Coverage 76.02% 76.02%
============================================
Files 64 64
Lines 705 705
Branches 100 100
============================================
Hits 536 536
Misses 168 168
Partials 1 1
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
|
The container image build workflow finished with status: |
Adds an opt-in benchmark that measures app tree creation, route resolution and route change time as the number of plugins, page extensions and entity content extensions grows. It is skipped unless the BENCH environment variable is set. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com>
Each sidebar item created its own style hook, which attached a separate style sheet for every item. The hooks are now shared between all components with an equal sidebar config. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com>
Each Box in a sidebar item attached its own dynamic style sheet, three per item. None of them carried any styles, so they are replaced with plain elements. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com>
13f51e4 to
6c71fff
Compare
Each route resolution matched the source location against the entire route tree. The cost grows with the number of routes in the app and is paid by every caller on every location change. The matches for the most recently used source locations are now cached. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Christoph Jerolimov <jerolimov+git@redhat.com>
|
|
Scheduling tests matching the |
|
e2e errors are related to keycloak, not this change /retest |
|
/retest |
1f12312
into
redhat-developer:release-2.1



Summary
While migrating to the New Frontend System we noticed some degradation in the frontend reaction time, esp. when switching between routes. This happen when switching between pages but also when switching between catalog tabs.
There was two main issues:
Switching routes re-renders all
SidebarItems. The call tomakeSidebarStylesis already memorized, but since it should be the same for all SidebarItem's we could get one step further and reuse the same classes for all. To be 100% backward compatible it stringifies the config and use this as cache-key.Then I switched from Material UI Box to div and span because its adds always another style calculation even the Box has no prop here except the style classnames.
As example, for "50 pages with sidebar items" it took (on my machine) 2160 ms before and 621 ms with both fixes.
This fix was accepted upstream as
https://github.com/backstage/backstage/pull/37175and will be part of Backstage 1.58.Another routing issue was already fixed in Backstage 1.57 by @schultzp2020 but for 1.49 we need a routing fix as well.
Which issue(s) does this PR fix
Benchmark
The first PR adds a unit test that can be started with
yarn test:benchthat confirms that this reduce the (re) rendering time.Before (0fa365f)
First fix (7a6cc04)
Second fix (6c71fff)
Route fix (7571e8d)
Performance tests on a cluster
2.1.0 cold 39.8s goes down to 27.2s, and next warm 15.8s goes down to 7.9s.
release-2.1 @ c7a1027 (RHDH Version: 2.1.0, Backstage Version: 1.54.9)
Step Durations
Network Stats (based on 20 runs)
perDomain
perResourceType
perStatusCode
5933 @ 7571e8d (RHDH Version: 2.1.1, Backstage Version: 1.54.9)
Step Durations
Network Stats (based on 20 runs)
perDomain
perResourceType
perStatusCode
Evidence
See above. Performance improvement is high. The fix has a low risk to break somewthing.
Testing
Deploy the PR on a cluster
Use https://github.com/redhat-developer/rhdh-loadtest to deploy it with 200 plugins and run the included tests against it.
Merge Danger
Door: one-way or two-way (can we walk back through it?)
We can go back and remove this at any point if this introduce any other issue.
Blast radius: one-word scope of impact
Full app because it affects the page routing
How to revert
Revert the merge commit, no flag.
PR acceptance criteria
How to test changes / Special notes to the reviewer
Deploy the PR on a cluster
Use https://github.com/redhat-developer/rhdh-loadtest to deploy it with 200 plugins and run the included tests against it.