Vsphere ICM 8 Lab 23
Vsphere ICM 8 Lab 23
0
INSTALL, CONFIGURE, MANAGE
Contents
Introduction .............................................................................................................................................. 3
Objectives ................................................................................................................................................. 3
Lab Topology ............................................................................................................................................. 4
Lab Settings ............................................................................................................................................... 5
1 Prepare the Lab Environment ........................................................................................................... 6
2 Create CPU Contention ................................................................................................................... 14
3 Verify the CPU Share Functionality ................................................................................................. 23
Introduction
In this lab, you will observe the behavior of Virtual Machines (VMs) with different CPU share values.
Controlling VM resources is important because it helps in optimizing the use of available resources and
ensuring that VMs operate effectively and efficiently. This includes managing CPU, memory, storage,
and network resources, and balancing the allocation of these resources among multiple VMs. By
controlling VM resources, the performance and stability of the virtual infrastructure can be improved,
and resource utilization can be optimized. This in turn helps ensure that VMs meet their business
requirements, provide a better user experience, and improve overall infrastructure utilization.
To create CPU contention, you will use stress-ng. Stress-ng is a Linux tool that is used to stress test a
computer's hardware, including its CPU. It creates CPU contention by generating a high load on the
system and making the CPU work to its maximum capacity. This allows administrators to evaluate the
system's performance under heavy load, and determine if there are any potential performance issues,
such as CPU contention. By using stress-ng to create CPU contention, administrators can determine if
the system can handle peak loads, and if additional hardware or optimizations are required to improve
performance.
Objectives
Lab Topology
Lab Settings
The information in the table below will be needed to complete the lab. The task sections further below
provide details on the use of this information.
In this task, you will migrate LinuxGUI-01 and LinuxGUI-02 compute to sa-esxi-01.vclass.local and the
storage to the iSCSI-Datastore.
To launch the console window for a VM, either click on the machine’s
graphic image from the topology page, or click on the machine’s
respective tab from the Navigator.
2. Launch the Mozilla Firefox web browser by either clicking on the icon found in the bottom toolbar
or by navigating to Start Menu > Internet > Firefox Web Browser.
If the VMware Getting Started webpage does not load, please wait an
additional 3 - 5 minutes, and refresh the page to continue. This is
because the vCenter Server Appliance is still booting up and requires
extra time to initialize.
4. To log in to the vCenter Server Appliance, enter [email protected] as the username and
NDGlabpass123! as the password. Click LOGIN.
5. In the Navigator, ensure you are viewing the Hosts and Clusters tab, and select sa-
vcsa.vclass.local. In the right pane, select Datastores and right-click on iSCSI-Datastore. In the
Actions pull-down menu, click Increase Datastore Capacity….
6. In the Increase Datastore Capacity window on the Select Device step, select LUN 3 and click NEXT.
7. On the Specify Configuration step, leave the defaults, and click NEXT.
8. On the Ready to Complete step, review the information, and click FINISH.
9. Repeat steps 5 – 8, and expand the iSCI-Datastore using LUN 4 and Lun 2. For Lun 2, you will only
increase the size by 10 GB for lab purposes.
10. Ensure you are still viewing the Datastores tab. Verify that iSCSI-Datastore is showing a capacity of
59 GB and at least 32 GB of free space.
11. In the Recent Tasks pane, verify that the iSCSI-Datastore tasks have successfully completed.
13. In the ICM-Datacenter main workspace, click the Virtual Machines tab, and select LinuxGUI-01 and
LinuxGUI-02.
16. In the 2 Virtual Machines – Migrate window on the Select a migration type, select Change both
compute resource and storage. Click NEXT.
17. On the Select a compute resource step, expand ICM-Datacenter and select sa-esxi-01.vclass.local.
18. On the Select storage step, select the iSCSI-Datastore. In the Select virtual disk format drop-down
menu, select Thin Provision. Click NEXT.
19. On the Select Networks step, verify that VM Network is selected for the Destination Network. Click
NEXT.
20. On the Ready to complete, review the information, and click FINISH.
21. Monitor the Recent Tasks pane, and confirm the that both Linux-GUI VMs have successfully
migrated. This will take 2 - 4 minutes to complete.
Confirm that the LinuxGUI-01 and LinuxGUI-02 VMs are located on sa-esxi-
01.vclass.local and utilizing the iSCSI-Datastore as their storage source.
22. Leave the vSphere Client open, and continue to the next task.
In this task, you will create CPU contention between the LinuxGUI-01 and LinuxGUI-02 VMs for testing
your lab environment. You will use CPU scheduling affinity to force both VMs to be scheduled on the
same logical CPU, and you will utilize the stress-ng tool on both VMs to generate CPU activity. By
creating contention, you force the VMs to compete for and share the limited logical CPU resources on
the ESXi host. This approach might lead to performance degradation.
CPU scheduling affinity is a mechanism that binds a process to a specific set of CPU cores. While it may
be tempting to use this feature to intentionally create CPU contention in a production environment,
this is generally not recommended. Using CPU scheduling affinity to create contention can have several
negative effects, including:
It is generally recommended to avoid using CPU scheduling affinity in production environments for the
purpose of creating CPU contention. Instead, it is better to use more sophisticated resource
management and workload scheduling techniques, such as CPU capping or Quality of Service (QoS)
controls, to manage CPU utilization and ensure predictable performance.
CPU contention in vSphere refers to a situation where there is high demand for CPU resources from
VMs running on a vSphere host, and the available CPU resources are not enough to meet the demand.
This results in the VMs having to wait for CPU time, leading to decreased performance and potential
service disruptions. To prevent CPU contention, it is important to monitor CPU utilization, configure
resource reservations and limits for VMs, and overprovision CPU resources on the host to ensure that
sufficient CPU resources are available.
1. Click the VMs and Templates tab, and expand sa-vcsa.vclass.local and ICM-Datacenter. Right-click
on LinuxGUI-01 and select Edit Settings.
2. In the Edit Settings window, expand CPU. In the Scheduling Affinity text box, enter 0. Click OK.
5. In the Edit Settings window, expand CPU. In the Scheduling Affinity text box, enter 0. Click OK.
7. In the Navigator, select LinuxGUI-01 and click the Monitor tab. Select Utilization and verify that
the Shares value is Normal (1000).
8. In the Navigator, select LinuxGUI-02 and click the Monitor tab. Select Utilization and verify that
the Shares value is Normal (1000).
9. Select the LunuxGUI-01 VM and select the Summary tab. In the Guest OS pane, click LAUNCH WEB
CONSOLE. If the LinuxGUI-01 VM is sleeping, click inside the web console to wake it up.
11. In the Terminal window, enter the command below and press Enter.
The stress-ng command with the option --shm 0 will initiate a stress test on all
currently active CPU cores, with each core running a separate shared memory
stressor. For example, if machine has 4 threads, the command will run 4
shared memory stressors simultaneously.
The -v option is a flag used in the stress-ng command line tool. Stress-ng is a
stress testing tool that can be used to test the stability and performance of
Linux systems. The -v option stands for verbose and it enables verbose output
mode. When the verbose option is enabled, stress-ng will display detailed
information about the stress tests that are being performed, including the test
name, the number of instances running, and the duration of the tests.
12. Return to the vSphere Client by clicking the vSphere-LinuxGUI-01-*** tab in Firefox.
13. Select the LunuxGUI-02 VM and select the Summary tab. In the Guest OS pane, click LAUNCH WEB
CONSOLE. If the LinuxGUI-02 VM is sleeping, click inside the web console to wake it up.
15. In the Terminal window, enter the command below and press Enter.
16. Return to the vSphere Client by clicking the vSphere-LinuxGUI-02-*** tab in Firefox.
17. After 2 - 4 minutes, return to the LinuxGUI-01 and LinuxGUI-02 VMs. Select the Monitor tab and
click Utilization. Notice the CPU Consumed is in blue and the CPU Active is in green.
Contention of VMs can occur when multiple VMs are competing for the same
physical resources, such as CPU, memory, or storage. This competition can
result in increased latency, decreased CPU utilization, and reduced
performance of the VMs. When this occurs, you may notice that the VMs are
not running at their full potential, and that their performance is being
impacted by the competition for resources. The level of performance
degradation will depend on the extent of the contention and the workloads of
the VMs. If contention is severe, it may become necessary to allocate more
resources or balance the workloads to resolve the issue.
18. Review the amount of Consumed and Active CPU values between LinuxGUI-01 and LinuxGUI-02.
Results may slightly vary.
19. Leave the vSphere Client open, and continue to the next task.
In this task, you will verify that the VMs receive the correct CPU allocation during contention. CPU
allocation is based on the number of shares given to the VM.
CPU Shares is a functionality in vSphere that allows administrators to allocate CPU resources to VMs
based on relative importance. It enables prioritization of VMs, so that when CPU resources are limited,
more important VMs receive a larger share of the available resources, while less important VMs
receive a smaller share. This helps ensure that critical VMs receive the resources they need to operate
properly, while non-critical VMs do not consume an excessive amount of resources.
2. In the Edit Settings window, expand CPU. From the Shares drop-down menu, verify that High is
selected. Click OK.
4. In Edit Settings window, expand CPU. From the Shares drop-down menu, verify that Low is
selected. Click OK.
Before proceeding to the next step, allow 2 - 4 minutes for the LinuxGUI VMs
to normalize from changing the amount of shares value.
5. In the Navigator, select LinuxGUI-01 and click the Monitor tab. Select Utilization and verify the
Shares value is High (2000). The warning icon is advising that CPU usage is high in the VM. You may
disregard the warning for this lab.
A VM CPU usage high warning message typically indicates that the CPU
utilization of a VM has reached a level that may cause performance issues. This
message is typically generated by virtualization software or a virtualization
management tool, and is used to alert administrators that one or more VMs
are consuming an excessive amount of CPU resources.
6. In the Navigator, select LinuxGUI-02 and click the Monitor tab. Select Utilization and verify that
the Shares value is Low (500).
7. Notice the CPU Consumed values are in blue and the CPU Active values are in green.
8. Changing the Shares value has impacted the performance on each LinuxGUI VM.
9. Shut down the LinuxGUI VMs by clicking the Shutdown Guest OS icon.
10. The lab is now complete; you may end your reservation.