Right-sizing For the Cloud: Basic Performance Statistics on Linux Machines

Updated by Jake Malmad on Oct 26, 2021
Article Code: kb/1017


Right-sizing For the Cloud: Basic Performance Statistics on Linux Machines


One of the benefits of the Lumen Cloud platform is the elasticity of resource allocation; our utility based model allows customers to pay only for the required compute resources, unlike the physical model wherein one is sizing for the maximum possible required resources. When greater capacity is needed, simply adjust your machines allocation to scale. When planning an initial deployment, some consideration is required. Migrating workloads to a cloud environment isn’t quite as simple as a 1:1 mapping of physical to virtual resources. Nearly all hypervisors have mechanisms to consolidate resources requirements to extract greater performance out of lesser resources (e.g., memory ballooning, transparent page sharing, etc.).

This article will focus on a few commands that provide better insight into real-world resource usage in the hope of “right-sizing” your Linux environment. These commands translate across most distributions. Of course, if you are looking to transition your virtualized environment to take advantage of Lumen Cloud’s enterprise performance or global data centers, you can already view most detailed resource utilization in your existing hypervisor.

  1. The ‘free -m’ command is a simple to understand utility that displays the amount of allocated, free and used memory (in megabytes) on your server.

  2. The ‘top’ command will provide greater visibility as to exactly which processes are using the resources.
    1. P orders by CPU usage (default)
    2. T sorts by time
    3. A sorts by age (newest first)
    4. M orders items by RAM usage
  3. The ‘iotop' command is similar to the ‘top’ command, but displays running statistics for I/O. The appropriate package will need to be installed on certain distributions. In Ubuntu/Debian, this is accomplished by running 'sudo apt-get install iotop'.

    There are several columns displayed, showing the program ID, user, disk read, disk write, swap activity, and command. These can be useful in troubleshooting or monitoring I/O activity and determining the appropriate size for your virtual machine.

  4. Perf stat’ is a powerful tool similar to PerfMon in the Windows world. It is installed by issuing the 'sudo apt-get install linux-tools' (you may need to specify 'apt-get install linux-tools-3.2.0-23'). Once the package has been installed, you can issue the 'perf stat' command to start granular performance counters on processes, hardware or software cycles. For a full list of pre-defined events, use the command 'perf list'.