0

I'm wondering what kind of performance hit numerical calculations will have in a virtualized setting? More specifically, what kind of performance loss can I expect from running CPU-bound C++ code in a virtualized windows OS as opposed to a native Linux one, on rather fast x86_64 multi-core machines?

I'll be happy to add precisions as needed, but as I don't know much about virtualization, I don't know what info is relevant.

static_rtti
  • 53,760
  • 47
  • 136
  • 192
  • On modern, well spec'ed and configured hardware that is not over-subscribed, the perf hit is relatively small. – Mitch Wheat Jun 13 '12 at 10:05
  • @MitchWheat: can you be more specific? Are we talking about 1%, 5% or 30%? Also, what factors does performance depend on? – static_rtti Jun 13 '12 at 10:10

2 Answers2

4

Processes are just bunches of threads which are streams of instructions executing in a sequential fashion. In modern virtualisation solutions, as far as the CPU is concerned, the host and the guest processes execute together and differ only in that the I/O of the latter is being trapped and virtualised. Memory is also virtualised but that occurs more or less in the hardware MMU. Guest instructions are directly executed by the CPU otherwise it would not be virtualisation but rather emulation and as long as they do not access any virtualised resources they would execute just as fast as the host instructions. At the end it all depends on how well the CPU could cope with the increased number of running processes.

There are lightweight virtualisation solutions like zones in Solaris that partition the process space in order to give the appearance of multiple copies of the OS but it all happens under the umbrella of a single OS kernel.

The performance hit for pure computational codes is very small, often under 1-2%. The catch is that in reality all programs read and write data and computational codes usually read and write lots of data. Virtualised I/O is usually much slower than direct I/O even with solutions like Intel VT-* or AMD-V.

Exact numbers depend heavily on the specific hardware.

Hristo Iliev
  • 72,659
  • 12
  • 135
  • 186
  • Could you give me an idea of how much slower I/O is on a virtualized setting? – static_rtti Jun 13 '12 at 12:19
  • No, I can't. As I've already said - _it depends on the setup_. It could be slow if a file is used as a virtual disk or it could be just as fast if a dedicated PCI controller is being virtualised with something like VT-d or if the hypervisor performs heavy I/O caching. – Hristo Iliev Jun 13 '12 at 13:00
  • 1
    Yup but in general most virtualised I/O systems have a performance penalty much less than 2x and if the application isn't I/O bound as this is unlikely to be, this will not be a material hit to overall run-times. – TerryE Jun 13 '12 at 18:12
1

Goaded by @Mitch Wheat's unarguable assertion that my original post here was not an answer, here's an attempt to recast it as an answer:

I work mostly on HPC in the energy sector. Some of the computations that my scientist colleagues run take O(10^5) CPU-hours, we're seriously thinking about O(10^6) CPU-hours jobs in the near future.

I get well paid to squeeze every last drop of performance out of our codes, I'd think it was a good day's work if I could knock 1% off the run-time of some of our programs. Sometimes it has taken me a month to get that sort of performance improvement, sure I may be slow, but it's still cost-effective for our scientists.

I shudder therefore, when bright salespeople offering the latest and best in data center software (of which virtualization is one aspect) which will only, as I see it, shackle my codes to a pile of anchor chain from a 250,00dwt tanker (that was a metaphor).

I have read the question carefully and understand that OP is not proposing that virtualization would help, I'm offering the perspective of a practitioner. If this is still too much of a comment, do the SO thing and vote to close, I promise I won't be offended !

High Performance Mark
  • 77,191
  • 7
  • 105
  • 161
  • In my case, virtualization will be useful because I must run code designed to work on different OSes on the same hardware. So using virtualization is largely a hack to solve poor planning issues rather than a tool to improve performance. – static_rtti Jun 13 '12 at 10:13
  • 1
    Nowhere in the OP's question is there a suggestion that virtualisation will make anything go faster... – Mitch Wheat Jun 13 '12 at 10:15
  • 2
    @HighPerformanceMark, IMO your post is noise. In the scenario that static_ttl raised in the OP, virtualisation will have not material penalty in terms of performance and my have other tangible benefits. – TerryE Jun 13 '12 at 18:10
  • "Sometimes it has taken me a month to get that sort of performance improvement [1%]" - That sounds like alot of wasted effort. – Mitch Wheat Jun 15 '12 at 02:09
  • ...not in the sense that shaving off 1% results in a significant saving, but in the sense of looking for orders of magnitude gains – Mitch Wheat Jun 15 '12 at 02:25