English 中文(简体)
Comparison of Outputs
  • 时间:2024-03-25 07:33:55

Apache Bench - Comparison of Outputs


Previous Page Next Page  

在本章中,我们将对产出与无国旗进行比较。 让我们看看,如何使用适当的旗帜来提高你网络应用的绩效。 在此之前,我们需要理解,如果你的申请简单,那么你可能不会注意到这种区别。 就像我们简单的应用一样,有旗帜和无旗帜。 然后,我们将以进行同样的测试。 URL, and see the differences.

Testing our Apppcation without Flags

在本节中,我们将理解如何在没有旗帜的情况下检验我们的申请。

$ ab -n 100 -c 10 http://127.0.0.1:8000/

Output

This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient).....done


Server Software:        Rocket
Server Hostname:        127.0.0.1
Server Port:            8000

Document Path:          /
Document Length:        Variable

Concurrency Level:      10
Time taken for tests:   0.244 seconds
Complete requests:      100
Failed requests:        0
Non-2xx responses:      100
Keep-Apve requests:    0
Total transferred:      27700 bytes
HTML transferred:       6600 bytes
Requests per second:    2208.77 [#/sec] (mean)
Time per request:       4.527 [ms] (mean)
Time per request:       0.453 [ms] (mean, across all concurrent requests)
Transfer rate:          597.49 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        1    2   0.7      2       3
Processing:     0    2   0.7      2       4
Waiting:        0    2   1.0      2       3
Total:          4    4   0.3      4       5

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

Testing our Apppcation with Flags

在这一节中,我们将理解如何用旗子检验我们的申请。

$ ab -l -r -n 100 -c 10 -k -H "Accept-Encoding: gzip, deflate"  http://127.0.0.1:8000/

Output

...
Requests per second:    2277.07 [#/sec] (mean)
Time per request:       4.392 [ms] (mean)
Time per request:       0.439 [ms] (mean, across all concurrent requests)
Transfer rate:          615.97 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        1    2   0.7      2       3
Processing:     0    2   0.7      2       4
Waiting:        0    2   1.0      2       3
Total:          4    4   0.2      4       5

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

我们可以简单地指出,产出统计之间没有多大差别。

Testing Apache Organisation Website without Flags

我们现在看看如何在没有旗帜的情况下测试阿帕奇组织网站。

$ ab -n 100 -c 10 http://www.apache.org/

Output

This is ApacheBench, Version 2.3 <$Revision: 1604373 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.apache.org (be patient).....done

Server Software:        Apache/2.4.7
Server Hostname:        www.apache.org
Server Port:            80

Document Path:          /
Document Length:        58433 bytes

Concurrency Level:      10
Time taken for tests:   1.498 seconds
Complete requests:      100
Failed requests:        0
Total transferred:      5877500 bytes
HTML transferred:       5843300 bytes
Requests per second:    66.74 [#/sec] (mean)
Time per request:       149.840 [ms] (mean)
Time per request:       14.984 [ms] (mean, across all concurrent requests)
Transfer rate:          3830.58 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       12  110 295.2     12    1012
Processing:    37   38   0.5     38      39
Waiting:       12   13   0.3     13      15
Total:         49  147 295.4     50    1051

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

Testing Apache Organisation Website with Flags

我们现在用旗帜测试阿帕奇组织网站。

$ ab -l -r -n 100 -c 10 -k -H "Accept-Encoding: gzip, deflate"  http://www.apache.org/

Output

...
Document Length:        Variable

Concurrency Level:      10
Time taken for tests:   0.357 seconds
Complete requests:      100
Failed requests:        0
Keep-Apve requests:    100
Total transferred:      1358510 bytes
HTML transferred:       1317700 bytes
Requests per second:    280.28 [#/sec] (mean)
Time per request:       35.678 [ms] (mean)
Time per request:       3.568 [ms] (mean, across all concurrent requests)
Transfer rate:          3718.41 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   3.7      0      12
Processing:    14   17  21.3     15     227
Waiting:       14   17  21.3     14     227
Total:         14   18  21.5     15     227

Percentage of the requests served within a certain time (ms)
  50%     15
  66%     15
  75%     15
  80%     15
  90%     27
  95%     28
  98%     29
  99%    227
 100%    227 (longest request)

你可以简单地指出,通过使用旗帜,每二次请求是如何增加的。 在本案中,这尤其因为使用了-H“Accept-Encoding: gzip,因为这一旗帜指阿帕奇服务器在gzipped格式中服务。

Considering the Apache Bench Results

在讨论阿帕奇科小组的成果时,需要考虑几个要点。 这将有助于我们制定总体战略,消除我们应用中的瓶颈,并改进其业绩。

我们需要第二批。 这使我们想到我们网络服务器的建立工作做得如何;数量越大,业绩越好。 然后是《联系时报》和所接到要求的百分比。 您可能不得不 t击你的网络服务器的环境,以改变这些衡量标准,使其达到预期的业绩。

如果阿帕奇的或使用的网络服务器错误记录或(一般)记录有错误,则进行检查。 随着你增加负荷,事情将开始cho:记忆问题将开始出现。 如果不写上一致的文字,许多文字就开始坠毁。

你们需要找到贵国网络服务器坠毁和(或)停机上的关键一致价值是什么? 通常,这种情况应在相当高的一致程度发生。 如果这种价值很低,那是错的,你需要调整这些环境,降低/提高。

Conclusion

在这一理论中,我们学会了阿帕奇科法官如何用来装载任何网站或网络应用的测试。 阿帕奇科法官可以成为一个非常宝贵的工具,用来确定如何改进你的网络应用服务器的设置,以减少瓶颈,提高业绩。 既然你熟悉阿帕奇科法官的基本使用情况,你可以首先制定新的测试计划,以衡量你在不同情况下的运用情况。

Advertisements