You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m working on a healthcheck script for NATS using the CLI command:
nats server check server
I want to set CPU warning and critical thresholds based on the number of CPUs. Previously, I was using nproc to detect the number of cores and calculate thresholds. For example, in a non-containerized environment, if I have 2 cores and want a warning threshold at 80%, I might set it as 2 * 80 = 160% (assuming the monitoring tool sums CPU usage across all cores).
However, I noticed an interesting behavior when running NATS on AWS ECS Fargate. Consider a container with 0.25 vCPU. When querying the VARZ endpoint, I get something like:
{
...
"cores": 2,
"cpu": 10,
...
}
The "cores": 2 value corresponds to the number of logical CPUs on the host, not the vCPU allocated to my container. This is consistent with nproc, which also shows 2.
My main question:
Is the "cpu" value from VARZ (10 in this example) calculated relative to the allocated vCPU (0.25) or to the logical cores on the host (2)?
This distinction is critical because it changes how I should calculate CPU thresholds for alerts. If VARZ CPU % reflects actual usage relative to the container’s vCPU allocation, I should base thresholds on the container CPU configuration rather than the nproc / cores value.
Has anyone experienced similar monitoring or alerting issues on AWS Fargate because of this? Any guidance on best practices for CPU-based health checks in containerized NATS would be greatly appreciated.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello NATS community,
I’m working on a healthcheck script for NATS using the CLI command:
nats server check serverI want to set CPU warning and critical thresholds based on the number of CPUs. Previously, I was using nproc to detect the number of cores and calculate thresholds. For example, in a non-containerized environment, if I have 2 cores and want a warning threshold at 80%, I might set it as 2 * 80 = 160% (assuming the monitoring tool sums CPU usage across all cores).
However, I noticed an interesting behavior when running NATS on AWS ECS Fargate. Consider a container with 0.25 vCPU. When querying the VARZ endpoint, I get something like:
{
...
"cores": 2,
"cpu": 10,
...
}
The "cores": 2 value corresponds to the number of logical CPUs on the host, not the vCPU allocated to my container. This is consistent with nproc, which also shows 2.
My main question:
Is the "cpu" value from VARZ (10 in this example) calculated relative to the allocated vCPU (0.25) or to the logical cores on the host (2)?
This distinction is critical because it changes how I should calculate CPU thresholds for alerts. If VARZ CPU % reflects actual usage relative to the container’s vCPU allocation, I should base thresholds on the container CPU configuration rather than the nproc / cores value.
Has anyone experienced similar monitoring or alerting issues on AWS Fargate because of this? Any guidance on best practices for CPU-based health checks in containerized NATS would be greatly appreciated.
Thank you very much!
Beta Was this translation helpful? Give feedback.
All reactions