74

My VPS provider gives me the choice between KVM and OpenVZ. What is the best choice for a VPS with 128MB or 256MB RAM?

5 Answers5

191

KVM does not provide anywhere near the performance of OpenVZ (or Virtuozzo, its commercial equivalent). It's extremely important to note that KVM requires a running kernel inside the VPS, whereas OpenVZ runs containers using a shared kernel. This means that a 256MB KVM VPS does not actually have the same amount of memory available to userspace that OpenVZ does. OpenVZ is an extremely lightweight virtualization technology that easily outperforms full virtualization.

KVM does provide better isolation, although this isn't usually apparent to userspace in a container.

As for the original question, if I were shopping for a VPS, there are two factors to consider:

1) At the same price point, you'll get less for your money with KVM. 256MB of KVM is less than 256MB of OpenVZ because you have to run your own kernel so there's less for your actual applications. On the other hand, some hosters charge more for OpenVZ, so you'll need to do the math.

2) It's easier for hosting companies to overcommit OpenVZ systems, so bad hosting companies may put you on a system with too many containers, so be wary of this.

Cliff Wells
  • 1,943
  • 2
  • 11
  • 2
  • 16
    This should have been the correct answer, because this is how it is in fact working. And there are a few companies that give resource guarantees even for IO - choose those if you want reliable VPS's that you can grow in. – t.mikael.d Mar 03 '13 at 09:18
  • 5
    The major problem with OpenVZ is that it doesn't provide the features that KVM does. For example TUN/TAP support often requires asking the provider to do specialized setup. For a VPS that costs $5/month, who can afford to service tickets like that just in order to give the customer 10MB more memory? 10MB memory costs 0.05 USD. If more than 1 in 500 customers give you a support ticket because of OpenVZ, go for KVM. – user239558 Jul 17 '13 at 17:07
  • 7
    One difference that doesn't seem to be covered explicityly in any of the answers is that b/c OpenVZ is a container, it can only provide the same Kernel as it's Host. So you couldn't run Debian inside of a CentOS host, for example. KVM is a full blown virtualization technology that can run any OS in the container, even Windows. – slm Oct 24 '13 at 13:20
  • 3
    @slm I have several OpenVZ conainers with Debian, Ubuntu and Centos all in one Proxmox, the kernel restriction doesn't affect the distro choice. – MGP Jun 12 '14 at 20:48
  • 1
    @ManuelGutierrez, they all run on the Linux kernel so I would expect so. – Adrian Günter Nov 19 '15 at 18:04
  • 1
    `you couldn't run Debian inside of a CentOS host` - you can absolutely run a Debian userspace on a CentOS kernel. The API between kernel and userspace is very well defined and stable. – thomasrutter Oct 09 '17 at 02:29
  • However, when the new Debian is using a newer kernel, and your OpenVZ host still uses the ancient 2.6 for example, you'll definitely get problems. – Neurotransmitter Oct 31 '17 at 15:30
29

KVM has much better isolation than OpenVZ and in my experience KVM gets better performance as well. However I've heard some say they get better performance from OpenVZ. KVM has come a long way in the past year though, so I wouldn't be surprised if it's surpassed OpenVZ by now...

KVM also supports any operating system (in theory), whereas OpenVZ is limited to Linux only.

We're using KVM exclusively for our virtualization systems and have no interest in switching to anything else.

bensie
  • 5,373
  • 1
  • 31
  • 34
3

If your buying from a VPS provider, then KVM/Xen. OpenVZ/LXC suppliers can oversell their products.

If it's your own server then you can have a mix of OpenVZ/LXC and KVM on the same machine.

FlappySocks
  • 3,772
  • 3
  • 32
  • 33
1

Choose KVM because OpenVZ is often cheaper to others hosts :)

mazgalici
  • 608
  • 6
  • 10
  • It's cheaper mostly because the overhead is much much less than other virtualization technologies so you can fit more VM's per Node. Many still think that only OpenVZ can be oversold, but that is true for most types of virtualization types. Performance reference: http://wiki.openvz.org/Performance – t.mikael.d Nov 15 '13 at 14:25
-3

OpenVZ does not give your processes the full amount of allocated memory due to overhead, so for smaller memory VPSes, I would lean towards choosing KVM or XEN.

Michael Dillon
  • 31,973
  • 6
  • 70
  • 106