-
Notifications
You must be signed in to change notification settings - Fork 8
Reduce contracts and deployments loading time #4233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Conversation
- Handle migrations in parallel if needed - Add grid client cache - Add batch processing utility - Create grid clients in parallel with caching - Load contracts and node IDs in parallel for each machine - Process consumptions in batches - Process wireguard configs in batches
@@ -188,35 +187,82 @@ const loading = ref(false); | |||
|
|||
onMounted(loadDeployments); | |||
async function loadDeployments() { | |||
const start = performance.now(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not needed in the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and pleaes check all other performance related logs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, it's for you guys to test performance. If it's ok, I'll remove it before merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use allsettled instead of promise.all for better error handling
@@ -188,35 +187,82 @@ const loading = ref(false); | |||
|
|||
onMounted(loadDeployments); | |||
async function loadDeployments() { | |||
const start = performance.now(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and pleaes check all other performance related logs
}); | ||
loading.value = false; | ||
async function fetchClusterDetails(item: any) { | ||
if (item.detailsLoading || (item.billing !== undefined && item.wireguard !== undefined)) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that needed?
const chunk1 = await loadVms(grid!); | ||
if (chunk1.count > 0 && migrateGateways) { | ||
await migrateModule(grid!.gateway); | ||
const [chunk1, chunk2, chunk3] = await Promise.all([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest using allsettled to avoid errors on partall request error
} | ||
}); | ||
const items = await Promise.all(promises); | ||
|
||
const items = await Promise.all(machinePromises); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also here we shouldn't use promise.all
|
||
const BATCH_SIZE = 10; | ||
const consumptions = await batchProcess(vms, BATCH_SIZE, async batch => { | ||
return Promise.all( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here should use allsettled
Description
Deployments:
Contracts:
Changes
Before: deployments loading time takes around 20 to 25 seconds
After: deployments loading time takes around 15 to 20 seconds
Related Issues
Tested Scenarios
Check deployments loading
Time taken
in the console for deployments and contractsDocumentation PR
For UI changes, Please provide the Documentation PR on info_grid
To consider
Preliminary Checks:
UI Checks:
Code Quality Checks:
Testing Checklist
General Checklist