-
Notifications
You must be signed in to change notification settings - Fork 51.5k
fix: PAY-4106 - Make workers memory constraints more container aware #22698
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: master
Are you sure you want to change the base?
Conversation
BundleMonUnchanged files (2)
No change in files bundle size Groups updated (2)
Final result: ✅ View report in BundleMon website ➡️ |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
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.
3 issues found across 7 files
Prompt for AI agents (all 3 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/frontend/editor-ui/src/features/settings/orchestration.ee/components/WorkerChartsAccordion.vue">
<violation number="1" location="packages/frontend/editor-ui/src/features/settings/orchestration.ee/components/WorkerChartsAccordion.vue:88">
P1: Bug: CPU chart labels should be assigned from `newDataJobs.labels` (the newly built labels), not from `dataCPU.value.labels` (stale state). This will cause label synchronization issues between charts.</violation>
<violation number="2" location="packages/frontend/editor-ui/src/features/settings/orchestration.ee/components/WorkerChartsAccordion.vue:96">
P1: Bug: Memory chart labels should be assigned from `newDataJobs.labels` (the newly built labels), not from `dataMemoryUsage.value.labels` (stale state). This will cause label synchronization issues between charts.</violation>
</file>
<file name="packages/frontend/editor-ui/src/features/settings/orchestration.ee/components/WorkerCard.vue">
<violation number="1" location="packages/frontend/editor-ui/src/features/settings/orchestration.ee/components/WorkerCard.vue:74">
P3: Unit notation 'Gb' should be 'GB'. 'Gb' means gigabits (used for data transfer rates), while 'GB' means gigabytes (used for memory/storage). The original code correctly used 'GB'.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
| const usedMem = totalMem - item.data.process.memory.available; | ||
| const usage = (usedMem / totalMem) * 100; | ||
| newDataMemoryUsage.labels = dataMemoryUsage.value.labels; |
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.
P1: Bug: Memory chart labels should be assigned from newDataJobs.labels (the newly built labels), not from dataMemoryUsage.value.labels (stale state). This will cause label synchronization issues between charts.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/frontend/editor-ui/src/features/settings/orchestration.ee/components/WorkerChartsAccordion.vue, line 96:
<comment>Bug: Memory chart labels should be assigned from `newDataJobs.labels` (the newly built labels), not from `dataMemoryUsage.value.labels` (stale state). This will cause label synchronization issues between charts.</comment>
<file context>
@@ -74,22 +74,31 @@ orchestrationStore.$onAction(({ name, store }) => {
+ const usedMem = totalMem - item.data.process.memory.available;
+
+ const usage = (usedMem / totalMem) * 100;
+ newDataMemoryUsage.labels = dataMemoryUsage.value.labels;
+ newDataMemoryUsage.datasets[0].data.push(usage.toFixed(2));
});
</file context>
| newDataMemoryUsage.labels = dataMemoryUsage.value.labels; | |
| newDataMemoryUsage.labels = newDataJobs.labels; |
✅ Addressed in d659c15
| newDataMemory.datasets[0].data.push(maxMemory - memAsGb(item.data.freeMem)); | ||
| newDataMemory.labels = newDataJobs.labels; | ||
| newDataCPU.labels = dataCPU.value.labels; |
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.
P1: Bug: CPU chart labels should be assigned from newDataJobs.labels (the newly built labels), not from dataCPU.value.labels (stale state). This will cause label synchronization issues between charts.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/frontend/editor-ui/src/features/settings/orchestration.ee/components/WorkerChartsAccordion.vue, line 88:
<comment>Bug: CPU chart labels should be assigned from `newDataJobs.labels` (the newly built labels), not from `dataCPU.value.labels` (stale state). This will cause label synchronization issues between charts.</comment>
<file context>
@@ -74,22 +74,31 @@ orchestrationStore.$onAction(({ name, store }) => {
- newDataMemory.datasets[0].data.push(maxMemory - memAsGb(item.data.freeMem));
- newDataMemory.labels = newDataJobs.labels;
+
+ newDataCPU.labels = dataCPU.value.labels;
+ const totalMem = item.data.isInContainer
+ ? item.data.process.memory.constraint
</file context>
| newDataCPU.labels = dataCPU.value.labels; | |
| newDataCPU.labels = newDataJobs.labels; |
✅ Addressed in d659c15
| Average Load: {{ averageWorkerLoadFromLoadsAsString(worker.loadAvg ?? [0]) }} | Free Memory: | ||
| {{ memAsGb(worker.freeMem).toFixed(2) }}GB / {{ memAsGb(worker.totalMem).toFixed(2) }}GB | ||
| Average Load: {{ averageWorkerLoadFromLoadsAsString(worker.loadAvg ?? [0]) }} | Free memory: | ||
| {{ memAsGb(worker.process.memory.available) }}Gb / |
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.
P3: Unit notation 'Gb' should be 'GB'. 'Gb' means gigabits (used for data transfer rates), while 'GB' means gigabytes (used for memory/storage). The original code correctly used 'GB'.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/frontend/editor-ui/src/features/settings/orchestration.ee/components/WorkerCard.vue, line 74:
<comment>Unit notation 'Gb' should be 'GB'. 'Gb' means gigabits (used for data transfer rates), while 'GB' means gigabytes (used for memory/storage). The original code correctly used 'GB'.</comment>
<file context>
@@ -69,8 +70,13 @@ onBeforeUnmount(() => {
- Average Load: {{ averageWorkerLoadFromLoadsAsString(worker.loadAvg ?? [0]) }} | Free Memory:
- {{ memAsGb(worker.freeMem).toFixed(2) }}GB / {{ memAsGb(worker.totalMem).toFixed(2) }}GB
+ Average Load: {{ averageWorkerLoadFromLoadsAsString(worker.loadAvg ?? [0]) }} | Free memory:
+ {{ memAsGb(worker.process.memory.available) }}Gb /
+ {{
+ memAsGb(
</file context>
| {{ memAsGb(worker.process.memory.available) }}Gb / | |
| {{ memAsGb(worker.process.memory.available) }}GB / |
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.
Fair point - updated
|
E2E Tests: n8n tests passed after 8m 54.7s Run Details
Groups
This message was posted automatically by
currents.dev | Integration Settings
|
This comment has been minimized.
This comment has been minimized.
d659c15 to
28b62d3
Compare
...ontend/editor-ui/src/features/settings/orchestration.ee/components/WorkerChartsAccordion.vue
Outdated
Show resolved
Hide resolved
28b62d3 to
974ff66
Compare
| const maxMemory = memAsGb(orchestrationStore.workers[props.workerId]?.totalMem) ?? 1; | ||
| const optionsMemory: Partial<ChartOptions<'line'>> = optionsBase(); | ||
| if (optionsMemory.scales?.y) optionsMemory.scales.y.suggestedMax = maxMemory; | ||
| if (optionsMemory.scales?.y) optionsMemory.scales.y.suggestedMax = 100; |
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.
Where does this 100 value come from?
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.
It's a percentage - so 100%
Summary
Moves to use
process.constrainedMemoryinstead ofos.totalmem()for determinig total available memory. According to the docs since Node 22 it backs off touv_get_constrained_memoryin libuv which means it should lookup from cgroups when available.Also adds an accordion section with other memory stats in it to give a better picture.
Changes the free memory chart to a more useful
Memory usage (%)one.Will raise a follow up ticket for this PR as the workers details page has a mix of os/host, process and job information on it.
Related Linear tickets, Github issues, and Community forum
closes PAY-4106
Review / Merge checklist
release/backport(if the PR is an urgent fix that needs to be backported