简体   繁体   English

如何对apache / nginx设置进行基准测试

[英]How to benchmark apache/nginx setup

I am planning to setup nginx as reverse proxy. 我打算将nginx设置为反向代理。 I will have apache to deliver my dynamic content, and nginx will deliver the static content. 我将使用apache来提供动态内容,nginx将提供静态内容。

My configuration i have now is just Apache with fastCGI. 我现在的配置只是带有fastCGI的Apache。 This gives me no configuration problems and runs great. 这给了我没有配置问题,并且运行良好。

After I have set up nginx I want to run some benchmarks to see if I really got some performance increases, else i will switch back. 在我设置nginx后,我想运行一些基准测试,看看我是否真的有一些性能提升,否则我会切换回来。

Does anyone know how I can benchmark this type of setup? 有谁知道如何对这种类型的设置进行基准测试? Or maybe someone did this already and have some canned results, I will be glad to hear them. 或者也许某人已经这样做并且有一些预制结果,我很乐意听到他们。

PS. PS。 I know this is more a serverfault type of question, but i have seen numerous posts about apache and nginx so i thought i give it a try 我知道这更像是一个服务器故障类型的问题,但我看过很多关于apache和nginx的帖子所以我想我试一试

Better solution? 好的解决方案 Siege . 围攻

More accurate benchmarking tool than ab 比ab更准确的基准测试工具

A few things: 一些东西:

  1. Don't use ab. 不要用ab。 It's single-threaded and you will probably end up benchmarking ab rather than your HTTP server. 它是单线程的,您可能最终会对ab而不是HTTP服务器进行基准测试。

  2. Don't run whatever stress tool you use on the same system as the server. 不要在与服务器相同的系统上运行您使用的任何压力工具。 The HTTP server will be competing with the tool for CPU and other resources. HTTP服务器将与CPU和其他资源的工具竞争。 Plus localhost's idealized version of a network doesn't tell the whole picture (see point 4). 再加上localhost理想化版本的网络并不能说明整体情况(见第4点)。

  3. Pay attention to memory and CPU utilization during the tests. 在测试期间注意内存和CPU利用率。 So many people never consider this factor. 很多人从不考虑这个因素。 Even if both setups perform equally, if one uses a fraction of the RAM/CPU, then you have a winner. 即使两个设置都表现相同,如果使用一小部分RAM / CPU,那么你就有了胜利者。

  4. RPS isn't the only meaningful metric. RPS不是唯一有意义的指标。 Things like slow clients (3G smartphones, congested networks, slow PC's) can have a distinctly negative impact on threaded servers. 像慢客户端(3G智能手机,拥挤网络,慢速PC)这样的东西会对线程服务器产生明显的负面影响。 The idealized lab setup (localhost or isolated switch) won't reflect this. 理想化的实验室设置(localhost或隔离开关)不会反映这一点。

  5. Your FCGI script will be the bottleneck for either server. 您的FCGI脚本将成为任一服务器的瓶颈。 I'd suggest using a tool that can pull multiple resources (ideally an entire page, including static content) so you can get a complete picture of page load times. 我建议使用一个可以提取多个资源的工具(理想情况是整个页面,包括静态内容),这样您就可以全面了解页面加载时间。

You might consider using one of the "cloud-based" testing tools, such as browsermob.com or loadimpact.com. 您可以考虑使用“基于云”的测试工具之一,例如browsermob.com或loadimpact.com。

一个字: ab

http://curl-loader.sourceforge.net/ http://curl-loader.sourceforge.net/

a bit harder to config, but works great 有点难以配置,但效果很好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM