Skip to content

Conversation

@yadvr
Copy link
Member

@yadvr yadvr commented Aug 25, 2023

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.

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)

Screenshot 2023-08-25 at 12 25 22 PM Screenshot 2023-08-25 at 12 28 25 PM

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

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 <[email protected]>
@yadvr
Copy link
Member Author

yadvr commented Aug 25, 2023

@blueorangutan ui

@blueorangutan
Copy link

@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' }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes a warning

var params = { details: 'servoff,tmpl,nics' }
if (store.getters.metrics) {
params = { state: 'running' }
params = { details: 'servoff,tmpl,nics,stats' }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VM stats in the API response can cause 5-10x delay compared to normal list API response

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is tmpl needed in the details? or stats?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my concern is opposite to @DaanHoogland :-D
is 'servoff,tmpl,nics' or servoff,tmpl,nics,stats enough for UI ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, thanks @rohityadavcloud
I will test it

@blueorangutan
Copy link

if (['listVirtualMachinesMetrics'].includes(this.apiName) && this.dataView) {
delete params.state
delete params.details
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rohityadavcloud
can you explain why state and details are removed ?

all others look good

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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' }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is tmpl needed in the details? or stats?

resourceType: 'UserVm',
params: () => {
var params = {}
var params = { details: 'servoff,tmpl,nics' }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weizhouapache because of these params, details and state...

}
if (['listVirtualMachinesMetrics'].includes(this.apiName) && this.dataView) {
delete params.details
Copy link
Member Author

@yadvr yadvr Aug 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we remove the details as it may not be all, and set for the list view (tabular view)

@codecov
Copy link

codecov bot commented Aug 25, 2023

Codecov Report

Merging #7911 (b4629ad) into 4.18 (3c38ed7) will decrease coverage by 0.01%.
Report is 4 commits behind head on 4.18.
The diff coverage is n/a.

❗ Current head b4629ad differs from pull request most recent head c10873e. Consider uploading reports for the commit c10873e to get more accurate results

@@             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 yadvr requested a review from weizhouapache August 25, 2023 11:40
@yadvr
Copy link
Member Author

yadvr commented Aug 25, 2023

@blueorangutan ui

@blueorangutan
Copy link

@rohityadavcloud a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Copy link
Member

@weizhouapache weizhouapache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code lgtm

the display is almost identical to the original page

without this PR
image

with this PR
image

@dseralathan
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GUI - search instance always give the first VM name and GUI is very slow

6 participants