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 which provide better insight into real-world resource usage in the hope of “right-sizing” your Linux environment. For the purpose of demonstration, an Ubuntu 12.04 server will be used, however, 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.
- The ‘free -m’ command is a simple to understand utility which displays the amount of allocated, free and used memory (in megabytes) on your server.
- The ‘top’ command will provide greater visibility as to exactly which processes are using the resources.
- P orders by CPU usage (default)
- T sorts by time
- A sorts by age (newest first)
- M orders items by RAM usage
- 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.
- ‘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'. In this example, we look at the performance counters for the apt-get command. For detailed instructions on verbiage, please see the man page here.