虚拟机上的基准测试、分析

发布于 2024-12-05 05:31:41 字数 701 浏览 2 评论 0原文

您可以在许多不同的来源上阅读有关虚拟机中的时间保持问题的信息。由于每个基准测试都依赖于时间记录,因此我不确定如何解释 vmware 上的 apache 基准测试或 xdebug 分析器结果以及它们的可信度。

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

VMware 建议构建用于性能测试的特殊虚拟机。此外还有许多提示,似乎是解决方案(安装 VMware Tools、特殊配置等)。

特别是当涉及到磁盘 I/O 性能问题时,我非常关心结果的准确性。 Rasmus Lerdorf 在 drupalcon 上谈到了这一点,他说他在统计调用方面的一些性能改进在他的 VMware 基准测试中是不可见的,因为 VMware 具有无法与物理磁盘相比的特殊磁盘缓存:

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

毕竟我不确定 VMware 是否是能够进行任何基准测试。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

枉心 2024-12-12 05:31:41

很大程度上取决于您想要做什么。

  1. 只需进行测量以寻找回归
  2. 找到可以修复的时间消耗以提高性能

许多人认为这些是相同的,但我认为这来自于实际执行的有限经验 (2)。

我做(2)的方法不是测量,而是在几个随机的时间点询问正在发生的事情及其原因。
为此,是否在虚拟机上并不重要。
如果它正在做一些需要花费大量时间的偷偷摸摸的事情,您将看到它是否在虚拟机上。
确切的分数并不重要。揭露偷偷摸摸的活动才是最重要的。

这是一个 Python 示例,但你可以这样做任何语言。

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.

夜光 2024-12-12 05:31:41

好吧,如果没有 vmware-tools,磁盘缓存和性能下降可能是真的。
但我发现 Vmware 对开发非常有帮助,因为我有一个 Linux 虚拟机作为我的开发服务器,而我在 Windows 中编码。
我可以轻松地进行基准测试并找到代码中的潜在瓶颈。

它可能并不完美,并且可能会遗漏一些东西,但它仍然比设置专用 Linux 盒子更容易、更便宜。

更新
ApacheBench 是一个用于测试可扩展性和原始 RequestPerSeconds 指标的好工具。

但为了查找 PHP 脚本中的瓶颈并测试代码优化效果,我总是使用 XDebug 以及 WebgrindWinCacheGrind 查看探查器输出。

如果您有 Linux 机器,则可以使用 pecl install xdebug 安装 XDebug;对于 Windows,您可以在 xdebug 站点上找到预构建的二进制文件。

我使用以下 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"

profiler_enable_trigger 如果需要,我可以通过将 XDEBUG_PROFILE 作为查询字符串传递来选择性地进行分析参数。
我还设置了 webgrind,这样我就可以直接在浏览器本身中以图形方式查看输出。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文