在生产中对Web应用程序进行性能分析的性能成本 [英] Performance Cost of Profiling a Web-Application in Production

查看:100
本文介绍了在生产中对Web应用程序进行性能分析的性能成本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用大型复杂的tomcat Java Web应用程序解决性能问题.目前最大的问题是,内存使用量有时会激增,应用程序将变得无响应.我已经修复了我可以使用日志分析器和日志文件的贝叶斯分析解决的所有问题.我正在考虑在生产的Tomcat服务器上运行探查器.

I am attempting to solve performance issues with a large and complex tomcat java web application. The biggest issue at the moment is that, from time to time, the memory usage spikes and the application becomes unresponsive. I've fixed everything I can fix with log profilers and Bayesian analysis of the log files. I'm considering running a profiler on the production tomcat server.

温柔的读者注意事项:

我了解有些人可能会发现将产品应用程序构成冒犯性的想法.请放心,我已经用尽了大多数其他选项.我正在考虑这样做的原因是,我没有足够的资源来完全复制测试服务器上的生产设置,并且无法导致测试服务器上出现感兴趣的故障.

I understand that some may find the very notion of profiling a production app offensive. Please be assured that I have exhausted most of the other options. The reason I am considering this is that I do not have the resources to completely duplicate our production setup on my test server, and I have been unable to cause the failures of interest on my test server.

问题:

我正在寻找对在tomcat上运行的Java Web应用程序有效的答案,或者以与语言无关的方式回答此问题.

I am looking for answers which work either for a java web application running on tomcat, or answer this question in a language agnostic way.

  • 分析的性能成本是多少?
  • 在生产环境中远程连接和配置Web应用程序是个坏主意的其他原因(奇怪的故障模式,安全性问题等)?
  • 分析对内存占用有多大影响?
  • 具体来说,是否存在性能成本非常低的Java分析工具?
  • 是否有任何用于分析Web应用程序的Java分析工具?
  • 是否有人对使用visualVM进行性能分析的性能成本有基准?
  • visualVM可以扩展到什么大小的应用程序和数据集?

推荐答案

OProfile 及其祖先 DPCI 用于剖析生产系统.这些操作的开销非常低,而且它们可以对您的完整系统(包括内核)进行概要分析,因此您可以在内核和库中的VM 中发现性能问题.

OProfile and its ancestor DPCI were developed for profiling production systems. The overhead for these is very low, and they profile your full system, including the kernel, so you can find performance problems in the VM and in the kernel and libraries.

要回答您的问题:

  1. 开销:这些是采样的探查器,也就是说,它们生成计时器或他们的索赔)以获得合理的采样间隔.

  1. Overhead: These are sampled profilers, that is, they generate timer or performance counter interrupts at some regular interval, and they take a look at what code is currently executing. They use that to build a histogram of where you spend your time, and the overhead is very low (1-8% is what they claim) for reasonable sampling intervals.

看看此图的采样频率与OProfile开销之间的关系.如果默认设置不符合您的喜好,则可以调整采样频率以降低开销.

Take a look at this graph of sampling frequency vs. overhead for OProfile. You can tune the sampling frequency for lower overhead if the defaults are not to your liking.

在生产中的用途:使用OProfile的唯一警告是您需要将其安装在生产机器上.我相信自RHEL3以来,Red Hat中就已经有内核支持,而且我很确定其他发行版也支持它.

Usage in production: The only caveat to using OProfile is that you'll need to install it on your production machine. I believe there's kernel support in Red Hat since RHEL3, and I'm pretty sure other distributions support it.

内存:我不确定OProfile的确切内存占用量是多少,但是我相信它会保留相对较小的缓冲区并偶尔将其转储到日志文件中.

Memory: I'm not sure what the exact memory footprint of OProfile is, but I believe it keeps relatively small buffers around and dumps them to log files occasionally.

Java: OProfile包括支持Java的配置文件代理,它们了解在JIT中运行的代码.因此,您将能够看到Java调用,而不仅仅是解释器和JIT中的C调用.

Java: OProfile includes profiling agents that support Java and that are aware of code running in JITs. So you'll be able to see Java calls, not just the C calls in the interpreter and JIT.

网络应用程序::OProfile是系统级的探查器,因此它不知道网络应用程序可能具有的会话,事务等内容.

Web Apps: OProfile is a system-level profiler, so it's not aware of things like sessions, transactions, etc. that a web app would have.

也就是说,这是一个完整系统探查器,因此,如果您的性能问题是由操作系统和JIT之间的不良交互导致的,或者它是在某些第三方库中的,因为OProfile对内核和库进行了配置,所以将能够看到这一点.这对于生产系统是一个优势,因为您可以发现由于测试环境中可能不存在的生产环境配置错误或细节而导致的问题.

That said, it is a full-system profiler, so if your performance problem is caused by bad interactions between the OS and the JIT, or if it's in some third-party library, you'll be able to see that, because OProfile profiles the kernel and libraries. This is an advantage for production systems, as you can catch problems that are due to misconfigurations or particulars of the production environment that might not exist in your test environment.

VisualVM:不确定这一点,因为我没有使用VisualVM的经验

VisualVM: Not sure about this one, as I have no experience with VisualVM

有关使用OProfile查找性能瓶颈的教程

Here's a tutorial on using OProfile to find performance bottlenecks.

这篇关于在生产中对Web应用程序进行性能分析的性能成本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆