Which VM needs more resources?

I have a physical server which runs 8 virtual machines with virt-manager and kvm.

Since one VM is not needed any more, I want to give the remaining virtual machines more resources.

I'm looking for ways that can help me to find out:

Which VM does need more resources?

With "resources" I mean:

  • Number of CPUs
  • Available RAM

Disk space is not important, there is enough.

Environment: Linux hypervisor, Linux VMs


Solution 1:

I can recommend you this recent article:

http://techblog.netflix.com/2015/11/linux-performance-analysis-in-60s.html

The tools mentioned are:

  • uptime (the load average is important for you)

$ uptime
00:30:00 up 25 days, 6:28, 3 users, load average: 0,01, 0,02, 0,05

  • dmesg | tail
  • vmstat 1
  • mpstat -P ALL 1
  • pidstat 1
  • iostat -XZ 1
  • free -m
  • sar -n DEV 1
  • sar -n TCP, ETCP 1
  • top

We can also add ps.

These commands need to be executed on each VM.

I use fluently htop rather than top which is much more pleasant.

On CentOS 7, you can install htop via:

# yum install htop

If EPEL repo is not present or your system:

# yum install epel-release

For the management of RAM, I also put this well-known link: http://www.linuxatemyram.com/

Also, if you follow the link to the video in the article, you have the list of the tools and a quick presentation of each at 27:10 (Linux Performance Tools, Brendan Gregg, part 1 of 2)

I hope this will help ! :)

Solution 2:

To see which VM needs more resources, it isn't enough to look at real-time data, like what virt-manager can show. You also need historical data, as in how much resources was used over time, how high do the spikes go, etc. For that, you need a monitoring solution that can store and present historical data. Quite a few, with libvirt support, can be named, but you should choose one yourself, this is not a product recommendation site.

Solution 3:

The first para of @stephanyDionysio 's answer is very salient. There probably aren't good generic solutions here. Tools like he suggests might help identify candidates for attention, but I don't think that's the way to focus your attention.

I'd suggest that rather than starting from VM performance, start from what functionality is annoying your users by going slow, or even if it's not annoying them is associated with a lot of user time, or other business costs, and get to know what affects performance there. It may be that extra resources helps there, or it might be that you find something else entirely that can be improved, but focus on the bits where it makes a big difference.

While not a good example in terms of the resources you have (being mostly IO constrained), consider something like a backup process. It could be churning away for hours, and come up high in the lists of what the machine is working hard on, but making it faster isn't going to deliver much benefit to your users unless it's so slow it's not completing overnight.