|
4 | 4 | import GraphErrors from '$lib/GraphErrors.svelte';
|
5 | 5 | import type { EChartsOption } from 'echarts';
|
6 | 6 |
|
7 |
| - import { UtilizationResourceType } from '$houdini'; |
8 |
| - import { euroValueFormatter } from '$lib/chart/cost_transformer'; |
9 |
| - import { cpuUtilization, memoryUtilization, yearlyOverageCost } from '$lib/utils/resources'; |
10 | 7 | import { changeParams } from '$lib/utils/searchparams';
|
11 | 8 | import {
|
12 | 9 | BodyLong,
|
|
181 | 178 | <GraphErrors errors={$ResourceUtilizationForApp.errors} />
|
182 | 179 |
|
183 | 180 | <div class="wrapper">
|
| 181 | + <Heading size="medium" level="2">Analyzing Your Resource Usage</Heading> |
184 | 182 | <BodyLong>
|
185 |
| - These graphs help you analyze your app's CPU and memory usage over time. |
| 183 | + These graphs show your application's CPU and memory usage. |
186 | 184 | <ul>
|
187 |
| - <li>Blue Line (Requests): The guaranteed CPU or memory allocation for your app.</li> |
188 |
| - <li>Red Line (Limits, if present): The maximum allowed usage before restrictions apply.</li> |
189 |
| - <li>Shaded Area: The actual resource consumption over time.</li> |
| 185 | + <li>Blue Line (Requests): The minimum CPU or memory guaranteed to your app.</li> |
| 186 | + <li>Red Line (Limits, if present): The maximum CPU or memory your app can use.</li> |
| 187 | + <li> |
| 188 | + Shaded Areas: The actual resource consumption over time for each running instance of your |
| 189 | + app. |
| 190 | + </li> |
190 | 191 | </ul>
|
191 |
| - Your app can exceed the request line, which is expected if additional resources are available: |
| 192 | + Your app can use more than its requested amount if resources are available. |
192 | 193 | <ul>
|
193 | 194 | <li>
|
194 |
| - For CPU: Exceeding requests may cause throttling, leading to reduced performance but no |
195 |
| - crashes. |
| 195 | + CPU: Exceeding requests might cause <strong>throttling</strong>, potentially reducing |
| 196 | + performance. |
196 | 197 | </li>
|
197 | 198 | <li>
|
198 |
| - For Memory: Exceeding the limit causes termination (OOMKilled) because memory cannot be |
199 |
| - throttled. |
| 199 | + Memory: Exceeding the limit will cause that specific app instance to be terminated |
| 200 | + (OOMKilled). |
200 | 201 | </li>
|
201 | 202 | </ul>
|
202 |
| - <div>To optimize costs while maintaining performance:</div> |
| 203 | + <div><strong>Optimize your resource settings:</strong></div> |
203 | 204 | <div>✅ If usage is consistently below requests, consider lowering requests to save money.</div>
|
204 | 205 | <div>✅ If CPU usage is frequently throttled, increasing requests may improve performance.</div>
|
205 |
| - <div> |
206 |
| - ✅ If memory usage hits the limit, increasing requests or optimizing memory use may prevent |
207 |
| - crashes. |
208 |
| - </div> |
209 | 206 | </BodyLong>
|
210 | 207 | <div class="section">
|
211 | 208 | <Heading level="2" size="medium" spacing>Memory usage</Heading>
|
212 | 209 | {#if $ResourceUtilizationForApp.data}
|
213 | 210 | {@const utilization =
|
214 | 211 | $ResourceUtilizationForApp.data.team.environment.application.utilization}
|
215 |
| - <BodyLong spacing> |
216 |
| - At the latest data point, usage is {( |
217 |
| - memoryUtilization(utilization.requested_memory, utilization.current_memory) * 100 |
218 |
| - ).toFixed(0)}% of {prettyBytes(utilization.requested_memory, { |
219 |
| - locale: 'en', |
220 |
| - minimumFractionDigits: 2, |
221 |
| - maximumFractionDigits: 2, |
222 |
| - binary: true |
223 |
| - })} requested memory. Based on this data point, the estimated annual cost of unused memory of |
224 |
| - {euroValueFormatter( |
225 |
| - yearlyOverageCost( |
226 |
| - UtilizationResourceType.MEMORY, |
227 |
| - utilization.requested_memory, |
228 |
| - utilization.current_memory |
229 |
| - ) |
230 |
| - )}. |
231 |
| - </BodyLong> |
232 | 212 | <div style="justify-self: end;">
|
233 | 213 | <ToggleGroup
|
234 | 214 | value={interval}
|
|
264 | 244 | />
|
265 | 245 | </div>
|
266 | 246 | {:else}
|
267 |
| - <div style="height: 436px; display: flex; justify-content: center; align-items: center;"> |
| 247 | + <div style="height: 380px; display: flex; justify-content: center; align-items: center;"> |
268 | 248 | <Loader size="3xlarge" />
|
269 | 249 | </div>
|
270 | 250 | {/if}
|
|
274 | 254 | {#if $ResourceUtilizationForApp.data}
|
275 | 255 | {@const utilization =
|
276 | 256 | $ResourceUtilizationForApp.data.team.environment.application.utilization}
|
277 |
| - <BodyLong spacing> |
278 |
| - At the latest data point, usage is {cpuUtilization( |
279 |
| - utilization.requested_cpu, |
280 |
| - utilization.current_cpu |
281 |
| - )}% of {utilization.requested_cpu.toLocaleString('en-GB', { |
282 |
| - minimumFractionDigits: 2, |
283 |
| - maximumFractionDigits: 2 |
284 |
| - })} requested CPUs. Based on this data point, the estimated annual cost of unused CPU of {euroValueFormatter( |
285 |
| - yearlyOverageCost( |
286 |
| - UtilizationResourceType.CPU, |
287 |
| - utilization.requested_cpu, |
288 |
| - utilization.current_cpu |
289 |
| - ) |
290 |
| - )}. |
291 |
| - </BodyLong> |
292 | 257 | <div style="justify-self: end;">
|
293 | 258 | <ToggleGroup
|
294 | 259 | value={interval}
|
|
313 | 278 | />
|
314 | 279 | </div>
|
315 | 280 | {:else}
|
316 |
| - <div style="height: 436px; display: flex; justify-content: center; align-items: center;"> |
| 281 | + <div style="height: 380px; display: flex; justify-content: center; align-items: center;"> |
317 | 282 | <Loader size="3xlarge" />
|
318 | 283 | </div>
|
319 | 284 | {/if}
|
|
0 commit comments