Uh oh!
There was an error while loading. Please reload this page.
ui: speed up compute instance listing - #7911
Conversation
The default listVirtualMachinesMetrics APIs assumings details=all which isn't really used in the list view. By changing this to a subset of details, we can see gains upto 10x in listing speed in the UI. When moving to the resource/detail view of the UI, don't pass state or details so `all` the details of the instance are returned. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
yadvr
commented
Aug 25, 2023
blueorangutan
commented
Aug 25, 2023
@rohityadavcloud a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress. |
| var params = {} | ||
| var params = { details: 'servoff,tmpl,nics' } | ||
| if (store.getters.metrics) { | ||
| params = { state: 'running' } |
There was a problem hiding this comment.
I've removed running as otherwise metrics doesn't return all VMs in the list. One can select VM state explicitly in the compute/instance page if they want.
There was a problem hiding this comment.
just realised I can remove state from the params
| export const DARK_MODE = 'DARK_MODE' | ||
| export const VUE_VERSION = 'VUE_VERSION' | ||
| export const CUSTOM_COLUMNS = 'CUSTOM_COLUMNS' | ||
| export const RELOAD_ALL_PROJECTS = 'RELOAD_ALL_PROJECTS' |
| var params = { details: 'servoff,tmpl,nics' } | ||
| if (store.getters.metrics) { | ||
| params = { state: 'running' } | ||
| params = { details: 'servoff,tmpl,nics,stats' } |
There was a problem hiding this comment.
VM stats in the API response can cause 5-10x delay compared to normal list API response
There was a problem hiding this comment.
is tmpl needed in the details? or stats?
There was a problem hiding this comment.
my concern is opposite to @DaanHoogland :-D
is 'servoff,tmpl,nics' or servoff,tmpl,nics,stats enough for UI ?
There was a problem hiding this comment.
Yes, these are enough just for list view (table view); the stats are only needed when the metrics button is clicked. For the resource view, we delete the params.details, so by default details=all is used when listing a single VM.
There was a problem hiding this comment.
@weizhouapache@DaanHoogland
I tested this again both as root admin and normal user account; for VMs and templates with and without resource icons; these are enough details to render the list view (table); when the user clicks any VM/instance, then we call the API remove the details and all details are listed/used in the resource view. While not ideal, this speeds up the listing.
There was a problem hiding this comment.
great, thanks @rohityadavcloud
I will test it
blueorangutan
commented
Aug 25, 2023
UI build: ✔️ |
| if (['listVirtualMachinesMetrics'].includes(this.apiName) && this.dataView) { | ||
| delete params.state | ||
| delete params.details | ||
| } |
There was a problem hiding this comment.
@rohityadavcloud
can you explain why state and details are removed ?
all others look good
There was a problem hiding this comment.
These are added by the router config, I'll ping you on that code; so we must remove if the keys exists for dataView (or resource view, when only one item is being listed such as the VM)
DaanHoogland
left a comment
There was a problem hiding this comment.
code looks good. I can't judge the performance gain in qa, but am relying on the author in this case.
| var params = { details: 'servoff,tmpl,nics' } | ||
| if (store.getters.metrics) { | ||
| params = { state: 'running' } | ||
| params = { details: 'servoff,tmpl,nics,stats' } |
There was a problem hiding this comment.
is tmpl needed in the details? or stats?
| resourceType: 'UserVm', | ||
| params: () => { | ||
| var params = {} | ||
| var params = { details: 'servoff,tmpl,nics' } |
There was a problem hiding this comment.
@weizhouapache because of these params, details and state...
| } | ||
| if (['listVirtualMachinesMetrics'].includes(this.apiName) && this.dataView) { | ||
| delete params.details |
There was a problem hiding this comment.
we remove the details as it may not be all, and set for the list view (tabular view)
Codecov Report
@@ Coverage Diff @@## 4.18 #7911 +/- ##
============================================
- Coverage 13.06% 13.06% -0.01% - Complexity 9088 9091 +3
============================================
Files 2720 2720 Lines 257391 257415 +24 Branches 40130 40136 +6 ============================================
Hits 33621 33621 - Misses 219548 219569 +21 - Partials 4222 4225 +3 see 6 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
yadvr
commented
Aug 25, 2023
blueorangutan
commented
Aug 25, 2023
@rohityadavcloud a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress. |
blueorangutan
commented
Aug 25, 2023
UI build: ✔️ |
dseralathan
commented
Feb 12, 2024
the VM search give exact VM and is not changing to the first VM in list after we exclude state,IP of VM at filter in field |


The default listVirtualMachinesMetrics APIs assumings details=all which isn't really used in the list view. By changing this to a subset of details, we can see gains upto 10x in listing speed in the UI. When moving to the resource/detail view of the UI, don't pass state or details so
allthe details of the instance are returned.Possibly fixes#7910
In the screenshot below, we can see passing details=min, and other combinations show significant reduction in network time (from 300-400ms to 20-40ms)
Types of changes