Breaking

Site add
blog single post
Tech

VMs on a Laptop: Realistic Performance Expectations

Two computers, one set of parts

Running a virtual machine on a laptop feels like a small act of magic the first time you do it. One moment you have a single computer, the next you have two, each with its own operating system, sat side by side on the same screen. The disappointment usually arrives ten minutes later, when the guest system starts to crawl and you wonder whether you have broken something. You have not. You have simply met the physics of sharing one machine's resources between two.

So what should you actually expect? Less than native speed, certainly, but often far better than people fear, provided you understand where the bottlenecks live.

The overhead is smaller than folklore suggests

A modern hypervisor is efficient. For ordinary productivity work, the cost of virtualisation is modest, typically in the region of five to fifteen per cent of raw processing power. The bigger issue is contention: the host and the guest are competing for the same silicon, and when both want it at once, both slow down. That is why a virtual machine that feels snappy when idle can feel dreadful the moment you start compiling code in it while a browser churns away in the background. A good companion resource on this is MM88.

Where the resources actually go

  • Processor: allocate no more than half of your physical cores to the guest. Overcommitting looks generous in the settings panel and punishes you in practice, because the host still needs headroom to stay responsive.
  • Memory: this is the hard wall. An eight gigabyte laptop can realistically spare three or four gigabytes; a sixteen gigabyte machine can comfortably give away eight. Once the host starts swapping to disk, everything collapses.
  • Storage: the single most common cause of disappointment. A virtual disk on a mechanical drive will feel glacial. On a decent solid state drive, it feels almost native.
  • Graphics: most laptops offer no real graphics passthrough, so 3D acceleration in a guest is limited. Do not plan on gaming or heavy video editing inside a virtual machine.

What common workloads feel like

A lightweight Linux server guest with two virtual cores and four gigabytes of memory, running on a recent eight-core laptop, is close to native for command-line work, web serving and scripting. It is a perfectly pleasant place to spend a working day.

A full Windows desktop guest is a different proposition. It wants at least four gigabytes to itself, needs virtualisation-friendly firmware settings, and on an eight gigabyte host it will feel like a mid-range laptop from several years ago. Usable, but you will notice the pauses.

Anything involving nested virtualisation, large Docker builds or long compilations will feel noticeably slower, perhaps half speed, and will make the fans audible.

Laptop-specific problems

Desktops have it easy. Laptops bring extra complications. Sustained load from two operating systems means heat, and after fifteen or twenty minutes of hard work most thin machines will throttle, so performance drops precisely when you need it. Battery life roughly halves, sometimes worse. Suspend and hibernation also become unreliable, so get into the habit of pausing the guest before you close the lid, or you may return to a corrupted disk.

Getting closer to native speed

  • Check that hardware virtualisation is enabled in the firmware. Plenty of laptops ship with it switched off, and without it everything runs in slow software emulation.
  • Install the guest tools or additions package. The right drivers make an enormous difference to graphics and mouse behaviour.
  • Use a fixed-size virtual disk rather than a dynamically growing one, and keep it on the internal drive.
  • Trim the host: close the browser tabs, quit the sync clients, and let the guest have the resources you promised it.
  • If you only need a Linux userspace rather than a whole machine, containers or Windows Subsystem for Linux will be considerably quicker.

A sensible bottom line

A virtual machine on a laptop is a compromise, but a good one. Treat it as a second computer roughly one tier below your host in capability, give it plenty of memory and fast storage, and it will serve you well. Expect it to match bare metal and you will be cross. Expect a capable, slightly slower machine that you can snapshot, clone and delete without consequence, and you will wonder how you ever worked without one.

Comments