Skip to content

EC2 CPU utilization is normal, but application response time is increasing — what should be investigated first?

0

Suppose an application running on EC2 starts experiencing increased response times, but CPU utilization remains around 30–40% and memory utilization also appears normal. What would be the recommended troubleshooting sequence in AWS? I'm particularly interested in how experienced AWS engineers correlate:

  • CloudWatch EC2 metrics
  • EBS latency and throughput
  • Network metrics
  • Application logs
  • Load Balancer metrics
  • Database performance
  • Application-level latency Is there a preferred methodology for determining whether the bottleneck is compute, storage, networking, or an external dependency when CPU utilization doesn't indicate a problem?
3 Answers
0

When CPU and memory utilization appear normal but application response times are increasing, the issue typically lies outside the compute layer. Based on AWS best practices, here's the recommended troubleshooting sequence:

Start with EBS Performance Metrics

EBS volume performance is often the culprit when infrastructure metrics look healthy but applications are slow. Check these volume-level metrics first:

  • VolumeIOPSExceededCheck and VolumeThroughputExceededCheck to identify if volumes are hitting their IOPS or throughput limits
  • VolumeAvgIOPS and VolumeAvgThroughput to see actual usage patterns
  • BurstBalance for gp2/gp3 volumes to ensure burst capacity isn't depleted
  • VolumeQueueLength to identify if I/O requests are queuing

Also verify instance-level EBS metrics:

  • EBSIOBalance% to check if the instance itself is throttling EBS traffic
  • InstanceEBSIOPSExceededCheck and InstanceEBSThroughputExceededCheck

EBS volumes created from snapshots require initialization, which causes temporary performance degradation. If you recently launched instances or attached volumes, this could be the issue. For performance-sensitive workloads, consider using EBS fast snapshot restore or pre-warming volumes before cutover.

Check Filesystem Utilization

A filesystem at 95-96% capacity can cause severe performance degradation for applications that write temporary files or logs. Set CloudWatch alerts at 85% and 95% thresholds to catch this early.

Investigate Application Configuration

When CloudWatch metrics look normal but the application is still slow, the issue is likely in the application configuration itself. Connection pools, thread pools, and timeout settings often need tuning for the cloud environment. Database connection pool settings are a common culprit—check min-pool-size, max-pool-size, and connection timeout values.

Network and External Dependencies

After ruling out storage and application configuration:

  • Review network metrics for packet loss or bandwidth saturation
  • Check load balancer metrics for backend connection errors or unhealthy targets
  • Examine database performance metrics, particularly connection counts, query latency, and lock waits
  • Correlate application logs with CloudWatch metrics to identify external API calls or dependencies causing delays

Methodology for Root Cause Analysis

Establish comprehensive monitoring coverage including:

  • CloudWatch dashboards tracking CPU, memory, disk I/O, and network metrics
  • EBS volume performance and initialization status
  • Filesystem utilization alerts
  • Application-level health checks and custom metrics

Install the CloudWatch agent for custom metrics including memory and disk utilization at the OS level. Use detailed performance statistics or OS-level tools to check for micro-bursts that might not show up in standard 5-minute CloudWatch intervals.

The key principle: don't stop at the infrastructure layer. When basic compute metrics are normal, the bottleneck is almost always in storage I/O, application configuration, or external dependencies. Plan for 3-5 days of active monitoring and tuning after any changes, as performance issues often emerge during this stabilization window.
Sources
Lessons from Production Migrations: Troubleshooting Complex Issues with AWS Application Migration Service | Migration & Modernization
Lessons from Production Migrations: Troubleshooting Complex Issues with AWS Transform MGN | Migration & Modernization
Troubleshoot Amazon EBS performance issues on EC2 | AWS re:Post
Recommended alarms (Classic) - Amazon CloudWatch

answered a month ago

EXPERT

reviewed a month ago

0

When latency rises but CPU stays moderate, the application is usually waiting rather than working. It's waiting on disk, the network, a lock, a pool, a dependency, or a throttle. The most reliable way to find what is to start from the user-facing latency and break it down along the request path (outside-in). Then check each resource for saturation, not just utilization.

0. Describe the symptom first

Five minutes here saves hours later:

  • When did it start? Line it up with deployments, configuration changes, traffic growth, batch jobs, and backup windows.
  • Is it all requests or some? Check specific endpoints, tenants, and payload sizes.
  • Is it p50 or only p99? Higher p99 with a steady p50 points to queueing or contention. A rise in both points to a slower dependency or resource.
  • Is it every instance or AZ, or one? A single bad host or AZ narrows the search immediately.

1. Load balancer: inside or outside the instance?

  • TargetResponseTime (look at p50, p90, p99, broken down per target and per AZ):
    • If it's normal while clients see slowness, the problem is in front of your instances: CloudFront, DNS, TLS, client networks, or ALB capacity.
    • If it's elevated, the time is being spent in or behind your targets.
  • Also check HTTPCode_Target_5XX, TargetConnectionErrorCount, RequestCount per target (is the balance uneven?), and ActiveConnectionCount.

2. Application: where does the time go inside a request?

  • Distributed tracing (X-Ray, OpenTelemetry, or an APM tool) splits each request into your code, DB calls, downstream HTTP calls, and queueing. It's the fastest way to find the culprit.
  • Without tracing, log per-request timings for each external call.
  • In the logs, look for:
    • pool timeouts ("waiting for connection")
    • ThrottlingException, ProvisionedThroughputExceeded, or SlowDown
    • retries
    • GC pause logs

SDK retries with backoff are a common hidden cause. AWS calls are throttled and quietly retried, which adds latency without producing errors.

3. Host: how 30–40% CPU can still be the problem

  • Burstable instances (T family): check CPUCreditBalance. When credits run out, the instance is held to its baseline, and on many T sizes that's about 30–40% CPU. A flat line at that level is the classic sign.
  • Single-thread saturation: one core at 100% on a 4-vCPU instance shows as 25% average. Use mpstat -P ALL and look at per-thread CPU.
  • Steal time (%st in top/vmstat): on burstable instances, steal can also show credit throttling.
  • Exhausted pools: thread pools and DB connection pools at their limit mean requests queue at low CPU. Check pool metrics and thread dumps.
  • Other checks: run-queue length (vmstat r column), %iowait, GC pauses, lock contention, and file-descriptor limits.

4. EBS: storage saturation

  • Latency per I/O: VolumeTotalReadTime / VolumeReadOps, and the same for writes. Watch VolumeQueueLength.
  • Burst depletion: BurstBalance on gp2, st1, and sc1 volumes, and EBSIOBalance% and EBSByteBalance% at the instance level. Smaller instance sizes burst to their EBS limits and then fall back to baseline.
  • Limits reached: the volume and instance "IOPS/throughput exceeded" check metrics.
  • On the host: iostat -x 1 and look at await and %util.

5. Network: limits that CPU graphs never show

  • ENA allowance counters (ethtool -S eth0, or through the CloudWatch agent): bw_in/out_allowance_exceeded, pps_allowance_exceeded, conntrack_allowance_exceeded. Any count that keeps rising means AWS is shaping your traffic.
  • TCP retransmits: nstat or netstat -s.
  • NAT Gateway: ErrorPortAllocation and PacketsDropCount, if outbound calls go through NAT.
  • DNS: the VPC resolver allows about 1,024 packets per second per ENI. Applications that resolve on every request, with no DNS caching, run into this limit.
  • Path: check whether calls unexpectedly cross AZs or regions.

6. Database

  • RDS/Aurora Performance Insights: compare DB load with vCPU count, and look at the top wait events and top SQL. This usually shows the answer within minutes.
  • Metrics: ReadLatency, WriteLatency, DiskQueueDepth, DatabaseConnections, and replica lag. On db.t* instances, check CPU credits and burst balance.
  • Other checks: the slow query log, lock waits, and execution plans that changed after a statistics update or a data-volume change.

7. Other dependencies

Check third-party APIs, other internal services, and per-request calls to Secrets Manager, STS, or Parameter Store, which can be both throttled and slow. Also check DynamoDB throttling and the lag of any queue consumer the request waits on.

How to correlate across all of these

  1. Build one CloudWatch dashboard with aligned time ranges and periods. Include ALB latency, app p99, CPU credits, EBS queue length, ENA counters, and DB load.
  2. Find the metric that changed first. The root cause usually moves before the symptom. Anything that changes after the latency rises is usually a consequence.
  3. Compare a healthy target with an unhealthy one, or a good time window with a bad one. What differs is usually the cause.
  4. Use the USE method for resources (utilization, saturation, errors) and RED for services (rate, errors, duration). For "CPU looks fine" problems, saturation is the signal that matters: queue lengths, credit balances, pool waits, and allowance counters.

Rule of thumb: latency rises while CPU stays flat almost always means waiting. The most common causes, in rough order, are T-instance credit exhaustion, connection or thread pool limits, database waits, EBS burst or limits, throttled dependencies with silent retries, and network allowance shaping.

EXPERT

answered a month ago

EXPERT

reviewed a month ago

0

A useful rule: when CPU is moderate but latency climbs, the request is usually waiting, not computing. The job is to find where it waits. This order works well because each step halves the search space.

1. Split the time at the load balancer. TargetResponseTime is the time from the request leaving the ALB until the target starts sending response headers. Look at p95/p99, not the average.

  • If it rises in step with what users see, the delay is on the instance or behind it (code, dependencies, storage).
  • If it stays flat while users see slowness, look in front of the target: client network, TLS, DNS, or ALB-side errors (HTTPCode_ELB_5XX_Count vs HTTPCode_Target_5XX_Count, RejectedConnectionCount, TargetConnectionErrorCount).

ALB access logs give target_processing_time per request, so you can see whether it's every request or particular paths.

2. Check that "30–40% CPU" really means headroom.

  • Burstable (T-family) instances: check CPUCreditBalance. In standard mode, once credits run out the instance is held to its baseline, so CPU can look moderate while the application is starved.
  • Average across vCPUs: a single-threaded hot path can max out one core while the instance average looks fine. Check per-core usage on the box (for example top and press 1).

3. Check the network allowances (often missed). EC2 shapes traffic that exceeds the instance's limits by queueing and then dropping packets, which shows up as latency, not as CPU. On Linux, ethtool -S eth0 shows bw_in_allowance_exceeded, bw_out_allowance_exceeded, pps_allowance_exceeded and conntrack_allowance_exceeded. Any of these going up during the slow periods is a strong signal. The CloudWatch agent can publish them so you can graph them next to latency.

4. Storage. As the other answers say, check EBS (VolumeQueueLength, the IOPS/throughput "exceeded check" metrics, and burst balance on gp2).

5. Dependencies and in-process waits. Add tracing (X-Ray or OpenTelemetry) so each request shows the time spent in database calls, external APIs and your own code. Low CPU plus rising latency is a classic sign of:

  • connection-pool exhaustion (threads waiting for a DB connection);
  • lock contention;
  • a slow downstream service.

On the database side, compare connection counts and query latency for the same window.

6. Line it all up on one timeline. Put p99 TargetResponseTime, the ENA allowance counters, EBS queue length and DB latency on one CloudWatch dashboard. The metric that moves first is usually your bottleneck.

answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.