liveBook · Manning

Resource utilization

As explained in Amazon Web Services in Action, Third Edition: An in-depth guide to AWS

CPU utilization is the proportion of processor capacity consumed by a system or workload over a measurement interval.

CPU utilization is the percentage of processor capacity a workload uses during a measurement interval. In AWS, CloudWatch collects CPUUtilization and other metrics so you can monitor capacity and respond to changing load. section 11.5 section 17.2.2

High utilization can mean long waits, not just a busy processor. Wait time can rise sharply around 80–90% utilization because work arrives unevenly. Leave capacity for bursts rather than treating 100% as an operating target. section 11.5.1

Check what a percentage measures before acting on it. An ElastiCache host can show low overall CPU utilization while a single-threaded Redis process saturates one core. Monitor EngineCPUUtilization for that process; also watch swap usage, which can hurt an in-memory cache’s performance. section 11.5.1

To scale an EC2 application with CPU utilization:

  • Choose a CloudWatch metric and scope it to the instances in an Auto Scaling group. An alarm can evaluate a statistic over specified periods against a threshold. section 17.2.2
  • Connect the alarm to a scaling policy that changes the group’s desired instance count, or use target tracking to specify a CPU target without defining scaling steps and thresholds yourself. section 17.2.2 section 17.3.1

Scaling a WordPress site

A WordPress deployment places Apache web servers behind a load balancer, with shared data in RDS and EFS. Its Auto Scaling group uses target tracking with ASGAverageCPUUtilization set to 70. As CPU load changes, the policy adjusts the number of EC2 instances. The load balancer distributes requests across them. section 17.3.1 section 17.3

Listing 17.6 Creating a scalable, HA WordPress setup, part 3
ScalingPolicy:
  Type: 'AWS::AutoScaling::ScalingPolicy'                     #1
  Properties:
    AutoScalingGroupName: !Ref AutoScalingGroup               #2
    PolicyType: TargetTrackingScaling                         #3
    TargetTrackingConfiguration:                              #4
      PredefinedMetricSpecification:                          #5
        PredefinedMetricType: ASGAverageCPUUtilization        #6
      TargetValue: 70                                         #7
    EstimatedInstanceWarmup: 60                               #8

See the CloudFormation scaling policy’s predefined average-CPU metric, target value of 70, and instance warmup setting. section 17.3.1

How Amazon Web Services in Action, Third Edition: An in-depth guide to AWS covers it

How deep it goes
Explains thresholds, a Redis host-versus-process measurement trap, and the metric-to-alarm-to-policy path; it does not derive queuing theory.
Examples
Shows a WordPress Auto Scaling policy targeting 70% average CPU utilization and a Redis process that can saturate one core.
What it assumes
Introduces CloudWatch metric, alarm, and scaling-policy roles while assuming an EC2 workload to monitor or scale.
What you can do after
Operate/configure it by monitoring the appropriate CPU metric and setting an EC2 target-tracking policy or CloudWatch alarm for scaling.
How it connects
Connects CPU utilization to CloudWatch metrics, alarms, target-tracking scaling, Auto Scaling groups, load balancing, and Redis process monitoring.

Also explained in

Compare how 8 books explain resource utilization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Amazon Web Services in Action, Third Edition: An in-depth guide to AWS. The section links point to the parts of the book it draws on.