AB (option) (parameter)
Options
-A: Specify the basic authentication credentials of the connection server;-C: Specify the number of requests to the server;-c: Add cookie;-g: Output the test result as "Gnuolot" file;-H: Displays help information;-H: Appends an extra header to the request;-I: Use "head "Request mode;-K: Activates the" keepAlive "attribute in HTTP;-N: Specifies the number of requests that are used by the test session;-P: Specifies the file containing the data;-Q: Does not show the progress percentage;-T: Sets the content type header when using post data, and- V: Sets the verbose mode level; W: Prints the results in HTML form;-X: Sets the properties of the table when output is tabular,-X: Sends requests using the specified proxy server, and-y: Sets the table properties when output is tabular.
192.168.10.135 Tomcat
[Email protected] code]# cat/etc/nginx/conf.d/jsp.conf
server {
server_name local;
Listen 80;
Location/{
Root/soft/code;
Try_files $uri @java_page;
Index index.jsp index.html;
}
Location @java_page {
Proxy_pass http://192.168.10.135:8080;
}
}
Nginx's test.html
Tomcat's test.html
Nginx Performance Test
Server software:nginx/1.14.0 # #nginx version
Server hostname:192.168.10.145 #IP
Server port:80 #监听端口
Document Path:/test.html #请求源
Document length:19 bytes #文档返回的长度, excluding head
Concurrency level:1000 #并发个数
Time taken for tests:0.311 seconds #总请求时间
Complete requests:1000 #请求个数
Failed requests:0 #请求失败个数
Write errors:0
Total transferred:250000 bytes
HTML transferred:19000 bytes
Requests per second:3216.98 [#/sec] (mean) # #平均每秒的请求数
Time per request:310.851 [MS] (mean) #平均每个请求消耗的时间
Time per request:0.311 [MS] (mean, across all concurrent requests) #上面的请求除以并发数
Transfer rate:785.39 [Kbytes/sec] received #传输速率
Remove Nginx's current test page and let Nginx request to Tomcat via proxy test.html
Server software:nginx/1.14.0
Server hostname:192.168.10.145
Server port:80
Document Path:/test.html
Document length:27 bytes
Concurrency level:1000
Time taken for tests:3.398 seconds
Complete requests:1000
Failed requests:118
(connect:0, receive:0, length:118, exceptions:0)
Write errors:0
Non-2xx responses:118
Total transferred:275620 bytes
HTML transferred:46588 bytes
Requests per second:294.32 [#/sec] (mean)
Time per request:3397.638 [MS] (mean)
Time per request:3.398 [MS] (mean, across all concurrent requests)
Transfer rate:79.22 [Kbytes/sec] Received
This can be compared with the current nginx face pressure, can be targeted to adjust.
Linux AB Web Performance testing Tool