5

sometimes I feel my server not responding as smoothly as I would expect (i have a Intel(R) Xeon(TM) CPU 2.80GHz Quad Core), given that for example, the 'top' commands reports a low load < 0.5, CPU are almost completely idle ...

I maybe have internet connectivity issues, so I don't really know if it's me or if it's the server itself.

Is there anykind of benchmarking script (or something analogous) I could run and see the actual performance of the server ?

1
  • 2
    drive there and ask to take a look?
    – mdma
    Jun 9, 2010 at 23:25

5 Answers 5

7

The virt-what script will identify many different types of hypervisors and container technologies. It's pre-packaged for most major Linux distributions (e.g. apt-get install virt-what or yum install virt-what) and its output is suitable for use in shell scripts. It correctly performs its detection from inside the virtual guest.

Current types of virtualization detected:

  • hyperv Microsoft Hyper-V
  • kvm Linux Kernel Virtual Machine (KVM)
  • lxc Linux Containers
  • openvz OpenVZ or Virtuozzo
  • powervm_lx86 IBM PowerVM Lx86 Linux/x86 emulator
  • qemu QEMU (unaccelerated)
  • uml User-Mode Linux (UML)
  • virtage Hitachi Virtualization Manager (HVM) Virtage LPAR
  • virtualbox VirtualBox
  • virtualpc Microsoft VirtualPC
  • vmware VMware
  • xen Xen
  • xen-dom0 Xen dom0 (privileged domain)
  • xen-domU Xen domU (paravirtualized guest domain)
  • xen-hvm Xen guest fully virtualized (HVM)

The Puppet tool facter uses virt-what internally to determine the type of virtualization in use, so if you are using Puppet, you already have this installed.

2
  • This is a wonderful solution... that doesn't work on anything that isn't Linux (or doesn't have a linux-like /proc). All the world is not a Linux box...
    – voretaq7
    Dec 4, 2013 at 19:53
  • @voretaq7 It only uses /proc to detect Linux containers and UML; it uses dmidecode and calling Intel's CPUID instruction from assembly for everything else. It should be portable to BSD with minimal modification. Dec 4, 2013 at 19:59
6

On Linux, it is possible to look for tell-tale signs of virtualisation depending on the type of hypervisor used. You can typically start by looking in /proc/cpuinfo for the CPU type. Some hypervisors report fake CPU types such as "QEMU Virtual CPU". If it is running VZ, you can find /proc/user_beancounters that report resource usage. With Xen, you will find a /proc/xen directory.

So, it is possible to guess if you are running under some sort of virtualisation.

3
  • so does this mean that /proc/cpuinfo never lies abour what CPU you have ?
    – arod
    Jun 10, 2010 at 3:03
  • 2
    No! I cat /proc/cpuinfo on my vmware virutal machine and cpu is Genuine Intel Xeon...
    – lg.
    Jun 10, 2010 at 7:48
  • @siran - it's possible to lie but like I said, that's just a place to start, and it is a process of elimination. @lg - you can check /proc/vmware to know that it is running vmware.
    – sybreon
    Jun 10, 2010 at 14:10
3

If you can run perl scripts (depending on your OS), there's one called imvirt which can detect quite a few based on various system info (/proc/cpuinfo, dmidecode, etc.) - it sounds like you're on ubuntu, so there are packages for Jaunty, Karmic and Lucid, or you can grab it from Sourceforge.

1

There are things that were looked at by the antivirus companies for detecting blue pill virus variants.

Basically it's extremely hard for a VM to match the real time clock with the CPU counters. If you have access to install a driver, you should be able to put the system into no interrupts and watch the counters. If you have a virtualised system then your clock will drift in chunks when the VM is switched out by the hypervisor (which is supposedly impossible based on the interrupt bit).

2
  • 1
    this sound interesting... how can this be done in a Ubuntu Linux box ?
    – arod
    Jun 10, 2010 at 3:06
  • As I said, write a driver, disable interrupts in your driver, then create a real time loop that is watching the RTC on the system. If it ever drifts by more than the real time cycles that you should have allocated then you are in a VM. Note that you couldn't wait too long in your driver otherwise you'll probably break some hardware that has to process interrupts to work.
    – Spence
    Nov 11, 2014 at 2:58
0

Look for steal cpu cycles. You can get this in top for example. "If your VM displays a high %st in top (steal time), this means CPU cycles are being taken away from your VM to serve other purposes."

Not the answer you're looking for? Browse other questions tagged .