有人可以解释一下这些ApacheBench结果是什么意思吗? [英] Can someone please explain what these ApacheBench results mean?

查看:151
本文介绍了有人可以解释一下这些ApacheBench结果是什么意思吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试弄清楚如何使用ApacheBench和对我的网站进行基准测试.我安装了默认的站点项目(它是ASP.NET MVC,但是如果您不是.NET的人,请不要停止阅读.)

i'm trying to figure out how to use ApacheBench and benchmark my website. I installed the default site project (it's ASP.NET MVC but please don't put stop reading if u're not a .NET person).

我什么都没改变.添加新项目.将配置设为释放".无需调试即可运行. (因此它处于LIVE模式).是的,这是内置的网络服务器提供的,而不是生产级的IIS或Apache或其他任何版本.

I didn't change anything. Add new project. Set confuration to RELEASE. Run without Debug. (so it's in LIVE mode). Yes, this is with the built in webserver, not the production grade IIS or Apache or whatever.

所以这是结果:-

C:\Temp>ab -n 1000 -c 1 http://localhost:50035/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        ASP.NET
Server Hostname:        localhost
Server Port:            50035

Document Path:          /
Document Length:        1204 bytes

Concurrency Level:      1
Time taken for tests:   2.371 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      1504000 bytes
HTML transferred:       1204000 bytes
Requests per second:    421.73 [#/sec] (mean)
Time per request:       2.371 [ms] (mean)
Time per request:       2.371 [ms] (mean, across all concurrent requests)
Transfer rate:          619.41 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   1.1      0      16
Processing:     0    2   5.5      0      16
Waiting:        0    2   5.1      0      16
Total:          0    2   5.6      0      16

Percentage of the requests served within a certain time (ms)
  50%      0
  66%      0
  75%      0
  80%      0
  90%     16
  95%     16
  98%     16
  99%     16
 100%     16 (longest request)

C:\Temp>

现在,我不确定我应该看什么.

Now, i'm not sure exactly what I should be looking at.

首先,我在请求数之后每秒.因此,如果我们要求处理300个请求/秒,那么这是否意味着它可以处理平均421个请求/秒?

Firstly, I after the number of requests a second. So if we have a requirement to handle 300 reqs/sec, then is this saying it handles and average of 421 req's a sec?

第二,添加更多并发的原因是什么?例如,如果我在1个并发上有1000次匹配,那与2个并发时有500个匹配有何不同?是否可以测试是否有任何代码阻止其他请求?

Secondly, what is the reason for adding more concurrent? As in, if i have 1000 hits on 1 concurrent, how does that differ to 500 on 2 concurrent? Is it to test if there's any code that blocks other requests?

最后,我要注意的结果中有什么我想不到的重要内容吗?

Lastly, is there anything important I've missed from the results which I should take note of?

谢谢:)

推荐答案

添加更多内容的原因是什么 同时?如,如果我有1000次点击 在1个并发上,有何不同 到500并发2?要测试吗 如果有任何代码阻止其他 请求?

what is the reason for adding more concurrent? As in, if i have 1000 hits on 1 concurrent, how does that differ to 500 on 2 concurrent? Is it to test if there's any code that blocks other requests?

关于这一点,是的:您的应用程序可能正在做并发会带来麻烦的事情.

It's a bit about that, yes : your application is probably doing things where concurrency can bring troubles.

几个例子:

  • 页面正在尝试访问文件-在该过程中将其锁定;这意味着如果另一个页面必须访问相同的文件,则必须等到第一页完成处理为止.
  • 对于数据库访问来说是相同的:如果一页正在写入数据库,则存在某种锁定机制(是基于表的,基于行的,还是其他取决于您的DBMS的)

以一个并发进行测试就可以了...只要您的网站永远不会同时有一个以上的用户;我希望这是不现实的.

Testing with a concurrency of one is OK... As long as your website will never have more than one user at the same time ; which is quite not realistic, I hope for you.


您必须考虑生产时同时在站点上有多少用户-并调整并发性;只要记住您的网站上同时有5个用户,并不意味着您必须使用ab并发测试5个用户:


You have to think about how many users will be on site at the same time, when it's in production -- and adjust the concurrency ; just remember that 5 users at the same time on your site doesn't mean you have to test with a concurrency of 5 with ab :

  • 实际用户将在每个请求之间等待几秒钟(阅读页面的时间,点击链接等)
  • ab根本不等待:每次加载页面(即请求完成)时,它都会启动另一个请求!


另外,还有两件事:


Also, two other things :

  • ab仅测试一页-实际用户将在整个网站上导航,这可能会导致并发问题,而您只需要测试一页就不会出现
  • ab仅加载一页:它不请求外部资源(请考虑CSS,图像,JS等);这意味着当您的网站投入生产时,您还会有很多其他要求,即使不是很昂贵.

作为旁注:您可能想看看其他工具,它们可以进行更全面的测试,例如包围 Jmeter

As a sidenote : you might want to take a look at other tools, which can do far more complete tests, like siege, Jmeter, or OpenSTA : ab is really nice when you want to measure if something you did is optimizing your page or not ; but if you want to simulate "real" usage of your site, those are far more adapted.

这篇关于有人可以解释一下这些ApacheBench结果是什么意思吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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