Create contention on purpose and watch steal time appear

short · 40 min · Objective 1.2

Task

Oversubscribe your own host deliberately, then read the metric that reveals contention from inside a guest. The point is to see steal time move, because a number you have watched respond to a cause you created is a number you will recognise on a production system.

Steps

  1. Give each guest as many vCPUs as your host has physical cores, so the two guests together are oversubscribed by roughly 2:1. Record the host core count and each guest's vCPU count in lab/contend.txt.
  2. With only the first guest running, capture an idle baseline: run vmstat 1 10 and record the st column and the id column.
  3. Start the second guest and run a CPU-saturating workload on it -- a few processes running openssl speed or an equivalent busy loop.
  4. Back in the first guest, run vmstat 1 30 again and record the st column. Compare the two captures in lab/contend.txt.
  5. Write one sentence on why the first guest's own CPU utilisation does not explain its slowdown, and one on what you would do about this if it happened on a rented instance.

Verify

grep -Ec 'st|steal' lab/contend.txt
awk '/baseline/,0' lab/contend.txt | grep -Eco '[0-9]+'
grep -Eci 'relocat|stop and start|larger instance|dedicated' lab/contend.txt

The last check is the remedy: recognising steal time is only useful if you know that moving the instance is the first thing to try.

This is an independent study companion for CompTIA Cloud+ CV0-004 and is not produced by or endorsed by CompTIA.