您的位置:首页 > 运维架构 > Nginx

Apache ab工具Nginx压力测试

2015-08-27 11:40 801 查看


Apache ab工具Nginx压力测试

测试工具安装

yum -y install httpd-tools

 

测试结果

ab -n 200000 -c 20000 http://192.168.20.1:1888/test.html
-n 200000:总请求数

-c 20000:并发数

TPS:2873.38

请求处理时间:69.605 seconds

执行命令

root@APP-DB-20:html# ab -n 200000 -c 20000 http://192.168.20.1:1888/test.html
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 192.168.20.1 (be patient)

Completed 20000 requests

Completed 40000 requests

Completed 60000 requests

Completed 80000 requests

Completed 100000 requests

Completed 120000 requests

Completed 140000 requests

Completed 160000 requests

Completed 180000 requests

Completed 200000 requests

Finished 200000 requests

S
4000
erver Software:        Flaginfo-Web

Server Hostname:        192.168.20.1

Server Port:            1888

Document Path:          /test.html

Document Length:        58368 bytes

Concurrency Level:      20000

Time taken for tests:   69.605 seconds

Complete requests:      200000

Failed requests:        0

Write errors:           0

Total transferred:      12051969231 bytes

HTML transferred:       12012659712 bytes

Requests per second:    2873.38 [#/sec] (mean)

Time per request:       6960.450 [ms] (mean)

Time per request:       0.348 [ms] (mean, across all concurrent
requests)

Transfer rate:          169091.09 [Kbytes/sec] received

Connection Times (ms)

              min  mean[+/-sd] median   max

Connect:      122 1266 537.1   1248    2510

Processing:   533 5511 1528.3   5902    7718

Waiting:       81 1195 561.3   1124    2940

Total:       1324 6776 1805.5   7412    8387

Percentage of the requests served within a certain time (ms)

  50%   7412

  66%   8101

  75%   8264

  80%   8315

  90%   8360

  95%   8365

  98%   8374

  99%   8374

 100%   8387 (longest request)

You have new mail in /var/spool/mail/root

结果参数

Server Software 表示被测试的Web服务器软件名称

Server Hostname 表示请求的URL主机名

Server Port 表示被测试的Web服务器软件的监听端口

Document Path 表示请求的URL中的根绝对路径,通过该文件的后缀名,我们一般可以了解该请求的类型

Document Length 表示HTTP响应数据的正文长度

Concurrency Level 表示并发用户数,这是我们设置的参数之一

Time taken for tests 表示所有这些请求被处理完成所花费的总时间

Complete requests 表示总请求数量,这是我们设置的参数之一

Failed requests 表示失败的请求数量,这里的失败是指请求在连接服务器、发送数据等环节发生异常,以及无响应后超时的情况。如果接收到的HTTP响应数据的头信息中含有2XX以外的状态码,则会在测试结果中显示另一个名为       “Non-2xx responses”的统计项,用于统计这部分请求数,这些请求并不算在失败的请求中。

Total transferred 表示所有请求的响应数据长度总和,包括每个HTTP响应数据的头信息和正文数据的长度。注意这里不包括HTTP请求数据的长度,仅仅为web服务器流向用户PC的应用层数据总长度。

HTML transferred 表示所有请求的响应数据中正文数据的总和,也就是减去了Total transferred中HTTP响应数据中的头信息的长度。

Requests per second 吞吐率,计算公式:Complete requests / Time taken for tests

Time per request 用户平均请求等待时间,计算公式:Time token for tests/(Complete requests/Concurrency Level)

Time per requet(across all concurrent request) 服务器平均请求等待时间,计算公式:Time taken for tests/Complete requests,正好是吞吐率的倒数。也可以这么统计:Time per request/Concurrency Level

Transfer rate 表示这些请求在单位时间内从服务器获取的数据长度,计算公式:Total trnasferred/ Time taken for tests,这个统计很好的说明服务器的处理能力达到极限时,其出口宽带的需求量。

Percentage of requests served within a certain time(ms) 这部分数据用于描述每个请求处理时间的分布情况,比如以上测试,80%的请求处理时间都不超过6ms,这个处理时间是指前面的Time per request,即对于单个用户而言,平均每个请求的处理时间。

==========================================================================================================================

socket: Too many open files (24)

root@QA-client-n:/home/azureuser# ab -n 200000 -c 20000 http://100.66.120.16/test.html
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 100.66.120.16 (be patient)

socket: Too many open files (24)
root@QA-client-n:/home/azureuser# ulimit -n 200000

root@QA-client-n:/home/azureuser# ab -n 200000 -c 20000 http://100.66.120.16/test.html
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 100.66.120.16 (be patient)

apr_socket_recv: Connection reset by peer (104)

===========================================================================

-H 设置硬资源限制.

-S 设置软资源限制.

-a 显示当前所有的资源限制.

-c size:设置core文件的最大值.单位:blocks

-d size:设置数据段的最大值.单位:kbytes

-f size:设置创建文件的最大值.单位:blocks

-l size:设置在内存中锁定进程的最大值.单位:kbytes

-m size:设置可以使用的常驻内存的最大值.单位:kbytes

-n size:设置内核可以同时打开的文件描述符的最大值.单位:n

-p size:设置管道缓冲区的最大值.单位:kbytes

-s size:设置堆栈的最大值.单位:kbytes

-t size:设置CPU使用时间的最大上限.单位:seconds

-v size:设置虚拟内存的最大值.单位:kbytes

-u <程序数目>  用户最多可开启的程序数目
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: