- Newest
- Most votes
- Most comments
The short CPU steal spikes you observed—despite nearly full burst capacity—point to transient host-level scheduling contention rather than guest CPU credit exhaustion. Several bounded read-only measurements can help distinguish between these scenarios:
Key Diagnostic Signals:
-
Burst Capacity Metrics: Your instance showed 100% burst capacity (approximately 288 minutes available), which rules out CPU credit depletion as the cause. When burstable instances deplete their credit balance, steal time rises consistently, not in brief spikes. The fact that your burst capacity remained at 100% throughout the event confirms the instance had sufficient credits to burst.
-
Steal Time Patterns: CPU steal time represents periods when your instance is ready to execute but cannot proceed because the underlying physical host has allocated resources elsewhere. Brief spikes (as opposed to sustained elevation) typically indicate momentary contention from neighboring instances on the same physical host or temporary hypervisor overload, rather than systematic under-provisioning.
-
Monitoring Granularity Differences: The discrepancy between your short-interval measurements (61-59% steal over sub-second periods) and longer-interval averages (1.06% steal over 599 seconds, 17-19% CPU utilization over five minutes) is expected. CloudWatch samples at 1-5 minute intervals and collects metrics at the hypervisor level, while instance-level tools like /proc/stat provide second-by-second data from within the guest OS. Short bursts of host contention can be masked in coarser-grained averages.
-
Runnable Tasks and Queue Depth: Your observation of 5-6 runnable tasks with zero listener receive queue and low idle time during the spike suggests the guest workload was active but waiting on CPU scheduling from the host. This pattern is consistent with external scheduling delays rather than internal application bottlenecks.
Read-Only Diagnostic Approach:
To distinguish host scheduling contention from guest load without generating additional traffic or modifying the instance:
-
Continue monitoring steal time using instance-level tools (top, vmstat, sar) during normal operations. Keep steal time below 5% as a general guideline. Brief spikes above this threshold during low overall CPU utilization point to host-side issues.
-
Compare CloudWatch CPUUtilization metrics with instance-level CPU measurements during suspected events. Large discrepancies suggest hypervisor-level sampling differences or host contention.
-
Review historical steal time data using sar to identify patterns. If spikes correlate with specific times of day, they may reflect predictable neighbor activity on the shared physical host.
-
Monitor the BurstCapacityPercentage and BurstCapacityTime metrics continuously. Sustained values near 100% confirm that credit exhaustion is not the issue.
Known Conditions:
The combination you describe—brief high steal time with full burst capacity, low aggregate CPU utilization, and no reproduction in longer samples—is consistent with transient neighbor contention on the shared physical host. This can occur when another instance on the same hardware experiences sudden CPU demands, temporarily starving your instance of scheduling time. The hypervisor's resource allocation can create these momentary delays even when your instance has available burst credits.
Your existing guard correctly stopped the test when it detected the anomaly. Without the ability to migrate to dedicated resources or change instance configuration, the primary no-cost diagnostic path is continued passive monitoring of steal time patterns to determine if the spikes are isolated incidents or recurring issues that might warrant future architectural changes.
Sources
Troubleshoot high CPU utilization on my EC2 instance | AWS re:Post
GetInstanceMetricData - Amazon Lightsail
Detect Lightsail instance bursting for optimal performance - Amazon Lightsail
GetInstanceMetricDataRequest (AWS SDK for Java - 2.42.38)
GetInstanceMetricDataRequest.Builder (AWS SDK for Java - 2.42.38)
answered a month ago
Relevant content
- AWS OFFICIALUpdated 2 years ago
