1

I'd like to check the performance of a php framework, Lumen. So I use ab to have this test. But two very different results came from the following two commads:

ab -n 100 -c 20 http://local.lumen.com/login/

and

ab -n 100 -c 20 http://local.lumen.com/login

the first one is way much faster than the second one. QPS is like 7000+ vs 40+. My question is why, and which one should I trust.

If I visit these two URLs on browser, both of them leads to the same page, which is http://local.lumen.com/login. This page doesn't have much things except a captcha. I tried this test on another framework Laravel. The difference is still there.

P.S. Environment: win7 x86_64, wampserver 2.5

4

1 回答 1

1

我不确定ab命令究竟是如何工作的,但我确信服务器(apache)会启动并执行 301 重定向,因此 PHP 本身根本不会被命中。

ab -n 100 -c 20 http://local.lumen.com/login/

example.com/login/--- [301] --- 到example.com/login

ab测量重定向本身

当你这样做时

ab -n 100 -c 20 http://local.lumen.com/login

ab测量 PHP 执行时间


这完全是因为 Apache Benchmark 不遵循此处讨论的重定向https://stackoverflow.com/a/22164728/1564365

这是关于 ab 的更多信息,我发现有点用处https://www.rsreese.com/benchmarking-websites-with-ab-and-tsung/

于 2015-05-27T09:01:30.887 回答