虚拟机的基准测试,分析

虚拟机的基准测试,分析

问题描述:

On many different sources you can read about time keeping issues in virtual machines. As every benchmark relies on time keeping i am not sure how to interpret e.g. apache benchmark or xdebug profiler results on vmware and how credible they are.

http://communities.vmware.com/docs/DOC-5581

VMware suggests to build a special vm for performance testing. There are many tips in addition which seems to be workaround solutions (install VMware Tools, special configuration and so on).

Especially when it comes to disk i/o performance issues i´m very concerned about how accurate the results are. Rasmus Lerdorf talked about it at drupalcon, saying that some of his performance improvements regarding stat calls aren´t visible in his VMware benchmarks because VMware has special disk caching you can´t compare to physical disks:

http://www.nowpublic.com/tech-biz/rasmus-lerdorf-simple-hard-drupalcon-2008-key-note

After all this I´m not sure if VMware is capable for any benchmarking at all.

在许多不同的来源上,您可以阅读有关虚拟机中的时间问题的信息。 因为每个基准都依赖于时间保持我不知道如何解释例如 apache基准测试或xdebug profiler在vmware上的结果以及它们的可信度。 p>

http://communities.vmware.com/docs/ DOC-5581 p>

VMware建议为性能测试构建一个特殊的vm。 此外还有许多提示似乎是解决方法(安装VMware Tools,特殊配置等)。 p>

特别是当涉及到磁盘i / o性能问题时,我非常 关注结果的准确程度。 Rasmus Lerdorf在drupalcon上谈到了这一点,他说他的VMware基准测试中有一些关于stat调用的性能提升不明显,因为VMware有特殊的磁盘缓存,你无法与物理磁盘相比: p> http://www.nowpublic .com / tech-biz / rasmus-lerdorf-simple-hard-drupalcon-2008-key-note p>

毕竟我不确定VMware是否能够 任何基准测试。 p> div>

A lot depends on what you are trying to do.

  1. Just keep measurements to look for regressions
  2. Find time-drains that you can fix to improve performance

Many people think these are the same, but I think that comes from limited experience actually doing (2).

The way I do (2) is not measuring, but asking, at a few random points in time, what is happening and why. For that, it doesn't matter very much if it's on a virtual machine or not. If it's doing something sneaky that takes a large fraction of time, you will see that whether or not it's on a virtual machine. The exact fraction doesn't matter. Exposing the sneaky activity is what matters.

Here's an example in python, but you can do it in any language.

Well it may be true about disk caching and slow performance without vmware-tools.
But I've found Vmware to be very helpful in development as I have a Linux Virtual Machine as my dev server, while I code in Windows.
And I can easily benchmark and find potential bottlenecks in my code.

It may not be perfect and might miss some things, but still it is much easier and cheaper than setting up a dedicated Linux box.

Update
ApacheBench is a good tool for testing scalability and raw RequestPerSeconds metric.

But for finding Bottlenecks in my PHP scripts and testing out code optimization effects, I always use XDebug along with either Webgrind or WinCacheGrind to view profiler output.

If you have a linux box you can install XDebug using pecl install xdebug or for windows you can find prebuilt binaries on the xdebug site.

I use the following config for Xdebug

[xdebug]
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "/opt/lampp/htdocs/profiles"
xdebug.profiler_output_name = "cachegrind.out.%s.%t"

with profiler_enable_trigger I can selectively profile if needed by passing XDEBUG_PROFILE as query string parameter.
Also I have set up webgrind so I can directly view the output graphiclly in the browser itself.