性能测试基础知识
我有一些关于理解性能测试基础知识的基本问题。我知道在不同的情况下我们可能想做 - 压力测试 - 耐力测试等 但我在这里的主要目标是确保应用程序在一组接近较高端或至少高于平均负载的负载下的响应时间是合适的。
我的问题如下:
当您开始计划申请的预期回复时间时;你觉得怎么样?如果那是第一步的话。我的意思是,我现在有一个网络应用程序。我是否只是从空中拉出一个数字并说“我希望应用程序需要 3 秒来响应每个请求”?然后去弄清楚我的应用程序缺少什么才能获得该响应时间?
或者反过来,你用一组给定的硬件开始性能测试,然后说,让我们看看我现在得到的响应时间,然后查看结果,然后说,现在是 8 秒,我我希望它最多为 3 秒,那么让我们看看如何将其优化为 3 秒?但3秒又没空了?我确信,仅扩大机器规模不会延长响应时间。仅当单台机器/服务器处于负载并且您开始集群时,它才会获得响应时间?
现在,对于一个用户,我的响应时间为 3 秒,但随着负载的增加,它会呈指数下降;那么我应该在哪里划清“我需要进一步优化代码”(有上限)和“我需要扩展我的服务器”(这也有限制)之间的界限
最好的免费工具是什么进行性能和负载测试?我用过一点Jmeter。但是还有其他好的、开源的吗?
如果我必须优化代码,我会开始分析需要大量时间响应请求的特定流程?
基本上我想看看人们如何从头到尾对其应用程序进行性能测试。任何链接或文章都会非常有帮助。
谢谢。
I have some basic questions around understanding fundamentals of Performance testing. I know that under various circumstances we might want to do
- Stress Testing
- Endurance Testing etc.
But my main objective here is to ensure that response time is decent from application under a set of load which is towards a higher end or in least above average load.
My questions are as follows:
When you start to plan your expected response time of application; what do you consider. If thats the first step at all. I mean, I have a web application now. Do I just pull out a figure from air and say "I would expect application to take 3 seconds to respond to each request". and then go about figuring out what my application is lacking to get that response time?
OR is it the other way round, and you start performance test with a given set of hardware and say, lets see what response time I get now, and then look at results and say, well it's 8 seconds right now, I'd like it to be 3 seconds at max, so lets see how we can optimize it to be 3 seconds? But again is 3 seconds out of air? I am sure, scaling up machines only will not get response time up. It'll get response time up only when single machine/server is under load and you start clustering?
Now for one single user I have response time as 3 seconds but as the load increases it goes down exponentially; so where do I draw the line between "I need to optimize code further" (which has it's upper limit) and "I need to scale up my servers" (Which has a limit too)
What are the best free tools to do performance and load testing? I have used Jmeter a bit. But is there anything else, that is good and open source?
If I have to optimize code, I start profiling the specific flows which took lot of time responding to requests?
Basically I'd like to see how one goes about from end to end doing performance testing for their application. Any links or articles would be very helpful.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
性能测试委员会是您自由交流性能测试经验、知识和实践的门户。
另请阅读 Microsoft 模式和 PerfTestingGuide性能测试实践。本指南向您展示了实施性能测试的端到端方法。
phoenix 提到了开源工具。
The Performance Testing Council is your gateway to freely exchange experiences, knowledge, and practice of performance testing.
Also read Microsoft Patterns & Practises for Performance testing. This guide shows you an end-to-end approach for implementing performance testing.
phoenix mentioned the Open Source tools.
首先,您可以阅读
加速网站速度的最佳实践
有关工具
开源性能测试工具
性能:工具
First of all you can read
Best Practices for Speeding Up Your Web Site
For tools
Open source performance testing tools
performance: tools
此链接和这展示了在以下情况下调整应用程序性能的示例和方法:应用程序没有任何明显的“瓶颈”。它在单个线程上的工作最为直观。我没有在网络应用程序上使用它的经验,尽管其他人有。我同意分析并不容易,但我一直依赖这种技术,而且我认为它非常简单/有效。
This link and this show an example and method of performance tuning an application when the application does not have any obvious "bottlenecks". It works most intuitively on individual threads. I have no experience using it on web applications, although other people do. I agree that profiling is not easy, but I've always relied on this technique, and I think it is pretty easy / effective.
首先,正确设计您的应用程序。
使用分析器,查看应用程序中的瓶颈所在,并在可能的情况下消除它们。在改进性能之前先测量性能。
First of all, design your application properly.
Use a profiler, see where the bottlenecks in your application are, and take them away if possible. MEASURE performance before improving it.
我将尝试提供基本的分步指南,可用于在您的项目中实施性能测试。
1 - 开始测试之前,您应该知道物理内存量和分配给 JVM 的内存量等。数据库大小为您当前的环境收集尽可能多的指标。 了解您的环境
2 - 下一步是确定常见的数据库生产规模和预期的年度增长。您将需要测试您的应用程序在一年、两年、五年等后的行为方式,
3 - 自动化环境设置,这将对您将来的回归测试和缺陷修复验证有很大帮助。所以你需要有数据库转储来进行测试。以当前(基线)、一年、五年的数量。
4 - 完成基本信息收集后 - 考虑在负载下监控服务器,也许您已经有了一些监控解决方案,例如 http://newrelic.com/ 这将帮助您确定性能下降的原因(CPU/Mem/线程数量等)一些性能测试工具确实内置了监控系统。
此时,您已准备好使用工具和负载选择,已经提供了有关如何执行此操作的材料,因此我将跳过工作负载选择部分。
5 - 选择工具 我认为 JMeter + http://blazemeter.com/ 是什么此时您需要,两者都有很多不错的文章和教育材料,对于您的脚本录制,我建议使用 blazemeters Chrom 扩展而不是内置的 JMeters 解决方案。如果您仍然认为您确实缺乏 JMeter 中如何完成工作的知识,我建议您阅读这本书 - Bayo Erinle 的 Performance Testing With JMeter 2.9
6 - 分析结果,审查测试计划并采取相应的操作。
I will try to provide basic step by step guide, which can be used for implementing Performance testing in you project.
1 - Before you start testing you should know amount of physical memory and amount of memory allocated for JVM, or whatever. DB size collect as much metrics as possible for your current environment. Know you environment
2 - Next step would be to identify common DB production size and expected yearly growth. You will want to test how your application will behave after year, two, five etc.,
3 - Automate environment setup, this is will help you a lot in future for regression testing and defect fix validation. So you need to have DB dumps for your tests. With current (baseline), one year, five year volume.
4 - Once you're done if gathering basic information - Think about monitoring your servers under load, maybe you already have some monitoring solution like http://newrelic.com/ this will help you to identify cause of performance degradation (CPU/Mem/Amount of threads etc.,) Some performance testing tools do have built in monitoring systems.
At this you are ready to move with tooling and load selection, there is already provided materials on how to do that so I will skip part with workload selection.
5 - Select tool I think that JMeter + http://blazemeter.com/ is what you need at this point, both do have a lot nice articles and education materials, for your script recording I would recommend to use blazemeters Chrom Extension instead of inbuilt JMeters solution. If you still think that you do lack knowledge on how things are done in JMeter I recommend to get this book - Performance Testing With JMeter 2.9 by Bayo Erinle
6 - Analyze results, review test plan and take corresponding actions.