NGINX压力测试

简介: 目录 1    硬件配置    3 1.1    型号    3 1.2    CPU    3 1.3    内存    3 2    软件环境    3 2.1    操作系统    3 2.

 

1    硬件配置    3

1.1    型号    3

1.2    CPU    3

1.3    内存    3

2    软件环境    3

2.1    操作系统    3

2.2    服务版本    3

2.3    测试软件    3

3    并发测试    3

3.1    1000并发    4

3.2    2000并发    5

3.3    3000并发    6

4    测试总结    8

4.1    数据汇总    8

4.2    数据分析    8

 

  1. 硬件配置

  1. 型号

    # dmidecode | grep "Product Name"

    Product Name: VMware Virtual Platform

    Product Name: 440BX Desktop Reference Platform

  2. CPU

    # cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq

    Intel(R) Xeon(R) CPU E5-2660 v4 @ 2.00GHz

  3. 内存

    # dmidecode|grep -P -A5 "Memory\s+Device" | grep Size |grep -v Range | cat -n

    1        Size: 16384 MB

    2        Size: 4096 MB

    1. 软件环境

  4. 操作系统

    # cat /etc/redhat-release

    CentOS Linux release 7.2.1511 (Core)

  5. 服务版本

    # /usr/local/openresty/nginx/sbin/nginx -v

    nginx version: openresty/1.11.2.4

  6. 测试软件

    # ab -V

    This is ApacheBench, Version 2.3 <$Revision: 1430300 $>

    1. 并发测试

    说明:测试基于Linux系统。

  7. 1000并发

    测试1000并发,处理10000请求:

           # ab -c 1000 -n 10000 http://10.27.88.50/index.html

    Benchmarking 10.27.88.50 (be patient)
    
    Completed 1000 requests
    
    Completed 2000 requests
    
    Completed 3000 requests
    
    Completed 4000 requests
    
    Completed 5000 requests
    
    Completed 6000 requests
    
    Completed 7000 requests
    
    Completed 8000 requests
    
    Completed 9000 requests
    
    Completed 10000 requests
    
    Finished 10000 requests
    
     
    
     
    
    Server Software: openresty/1.11.2.4
    
    Server Hostname: 10.27.88.50
    
    Server Port: 80
    
     
    
    Document Path: /index.html
    
    Document Length: 612 bytes
    
     
    
    Concurrency Level: 1000
    
    Time taken for tests: 0.874 seconds
    
    Complete requests: 10000
    
    Failed requests: 0
    
    Write errors: 0
    
    Total transferred: 8510000 bytes
    
    HTML transferred: 6120000 bytes
    
    Requests per second: 11437.38 [#/sec] (mean)
    
    Time per request: 87.433 [ms] (mean)
    
    Time per request: 0.087 [ms] (mean, across all concurrent requests)
    
    Transfer rate: 9505.09 [Kbytes/sec] received
    
     
    
    Connection Times (ms)
    
    min mean[+/-sd] median max
    
    Connect: 0 2 5.9 0 27
    
    Processing: 4 12 27.8 7 801
    
    Waiting: 0 11 27.7 7 801
    
    Total: 5 14 29.9 7 807
    
     
    
    Percentage of the requests served within a certain time (ms)
    
    50% 7
    
    66% 8
    
    75% 8
    
    80% 8
    
    90% 38
    
    95% 59
    
    98% 61
    
    99% 62
    
    100% 807 (longest request)
    View Code
  8. 2000并发

    测试2000并发,处理50000请求:

           # ab -c 2000 -n 50000 http://10.27.88.50/index.html

    Benchmarking 10.27.88.50 (be patient)
    
    Completed 5000 requests
    
    Completed 10000 requests
    
    Completed 15000 requests
    
    Completed 20000 requests
    
    Completed 25000 requests
    
    Completed 30000 requests
    
    Completed 35000 requests
    
    Completed 40000 requests
    
    Completed 45000 requests
    
    Completed 50000 requests
    
    Finished 50000 requests
    
     
    
     
    
    Server Software: openresty/1.11.2.4
    
    Server Hostname: 10.27.88.50
    
    Server Port: 80
    
     
    
    Document Path: /index.html
    
    Document Length: 612 bytes
    
     
    
    Concurrency Level: 2000
    
    Time taken for tests: 2.689 seconds
    
    Complete requests: 50000
    
    Failed requests: 1
    
    (Connect: 0, Receive: 0, Length: 1, Exceptions: 0)
    
    Write errors: 0
    
    Non-2xx responses: 1
    
    Total transferred: 42549516 bytes
    
    HTML transferred: 30599587 bytes
    
    Requests per second: 18593.35 [#/sec] (mean)
    
    Time per request: 107.565 [ms] (mean)
    
    Time per request: 0.054 [ms] (mean, across all concurrent requests)
    
    Transfer rate: 15451.92 [Kbytes/sec] received
    
     
    
    Connection Times (ms)
    
    min mean[+/-sd] median max
    
    Connect: 0 20 137.3 0 1004
    
    Processing: 1 18 121.7 4 1605
    
    Waiting: 0 18 121.7 4 1605
    
    Total: 2 38 236.7 5 2608
    
     
    
    Percentage of the requests served within a certain time (ms)
    
    50% 5
    
    66% 5
    
    75% 5
    
    80% 5
    
    90% 8
    
    95% 8
    
    98% 404
    
    99% 1406
    
    100% 2608 (longest request)
    View Code
  9. 3000并发

    测试3000并发,处理100000请求:

    # ab -c 3000 -n 100000 http://10.27.88.50/index.html

    Benchmarking 10.27.88.50 (be patient)
    
    Completed 10000 requests
    
    Completed 20000 requests
    
    Completed 30000 requests
    
    Completed 40000 requests
    
    Completed 50000 requests
    
    Completed 60000 requests
    
    Completed 70000 requests
    
    Completed 80000 requests
    
    Completed 90000 requests
    
    Completed 100000 requests
    
    Finished 100000 requests
    
     
    
     
    
    Server Software: openresty/1.11.2.4
    
    Server Hostname: 10.27.88.50
    
    Server Port: 80
    
     
    
    Document Path: /index.html
    
    Document Length: 612 bytes
    
     
    
    Concurrency Level: 3000
    
    Time taken for tests: 5.065 seconds
    
    Complete requests: 100000
    
    Failed requests: 2
    
    (Connect: 0, Receive: 0, Length: 2, Exceptions: 0)
    
    Write errors: 0
    
    Non-2xx responses: 2
    
    Total transferred: 85099032 bytes
    
    HTML transferred: 61199174 bytes
    
    Requests per second: 19744.76 [#/sec] (mean)
    
    Time per request: 151.939 [ms] (mean)
    
    Time per request: 0.051 [ms] (mean, across all concurrent requests)
    
    Transfer rate: 16408.79 [Kbytes/sec] received
    
     
    
    Connection Times (ms)
    
    min mean[+/-sd] median max
    
    Connect: 0 55 329.4 0 3008
    
    Processing: 2 25 185.9 4 3224
    
    Waiting: 1 25 185.9 4 3224
    
    Total: 3 81 433.0 4 4223
    
     
    
    Percentage of the requests served within a certain time (ms)
    
    50% 4
    
    66% 4
    
    75% 6
    
    80% 6
    
    90% 25
    
    95% 116
    
    98% 1206
    
    99% 3011
    
    100% 4223 (longest request)
    View Code
    1. 测试总结

  10. 数据汇总

    请求连接数

    并发数

    请求失败数

    每秒处理请求数

    一次并发数请求响应时间(ms)

    全体请求完成时间(s)

    请求成功率

    10000

    1000

    11437

    87.43

    0.874

    100.00%

    50000

    2000

    1

    18593

    107.57

    2.689

    99.998%

    100000

    3000

    2

    19744

    151.94

    5.065

    99.998%

     

  11. 数据分析    

    通过测试结果可得如下分析:

    1.Nginx的每秒请求处理能力是10000+,满足需求标准;

    2.随着并发数的增大,一次并发请求的响应时间相应增大,满足需求标准;

    3.随着请求连接数的增加,相应的总体请求完成时间也增加,当请求连接数从50k增加至100k时,总体请求时间增加至2倍,具有一定的稳定性和速度性,满足需求标准;

    4.当请求连接数和并发数依次递增时,出现偶尔的请求失败数,全部请求成功率大于99.99%,满足需求标准;

    5.单台服务器支持3000并发正常,满足需求标准。

          

     

-------------------------------------------------------------

作者: 罗穆瑞

转载请保留此段声明,且在文章页面明显位置给出原文链接,谢谢!

------------------------------------------------------------------------------

如果觉得这篇文章对你有小小的帮助的话,记得在右下角点个“推荐”哦,博主在此感谢!

------------------------------------------------------------------------------

目录
相关文章
|
应用服务中间件 Linux nginx
Linux系列——Nginx的安装、测试详解以及关于Nginx的常用命令介绍
Linux系列——Nginx的安装、测试详解以及关于Nginx的常用命令介绍
|
6月前
|
负载均衡 应用服务中间件 nginx
nginx-tomcat反向代理以及负载均衡测试
nginx-tomcat反向代理以及负载均衡测试
|
1月前
|
前端开发 JavaScript 应用服务中间件
linux安装nginx和前端部署vue项目(实际测试react项目也可以)
本文是一篇详细的教程,介绍了如何在Linux系统上安装和配置nginx,以及如何将打包好的前端项目(如Vue或React)上传和部署到服务器上,包括了常见的错误处理方法。
266 0
linux安装nginx和前端部署vue项目(实际测试react项目也可以)
|
6月前
|
网络协议 应用服务中间件 Apache
Nginx直播服务器搭建及推拉流测试
Nginx直播服务器搭建及推拉流测试
251 2
|
6月前
|
应用服务中间件 nginx
nginx中的定时器源码分析与测试
nginx中的定时器源码分析与测试
55 0
|
应用服务中间件 API nginx
通过 docker 学习 nginx,附全部配置及 API 测试,使用 apifox 直接打开
本篇文章以前端的视角,介绍下 nginx 的常见配置,并通过 docker 的方式学习 nginx,这保证所有实例配置都能正常运行。
|
Ubuntu 前端开发 测试技术
Nginx-性能优化-ab压力测试工具
Apache Benchmark(简称ab) 是Apache安装包中自带的压力测试工具 ,简单易用。
919 0
Nginx-性能优化-ab压力测试工具
|
测试技术 应用服务中间件 nginx
nginx实现的测试环境请求复制到本地,并进行debug调试
nginx实现的测试环境请求复制到本地,并进行debug调试
213 0
|
缓存 前端开发 应用服务中间件
Nginx开启Gzip压缩功能(附详细解释)+测试是否开启了压缩
Nginx实现资源压缩的原理是通过ngx_http_gzip_module模块拦截请求,并对需要做gzip的类型做gzip,ngx_http_gzip_module是Nginx默认集成的,不需要重新编译,直接开启即可。
2899 1
Nginx开启Gzip压缩功能(附详细解释)+测试是否开启了压缩
|
应用服务中间件 网络安全 PHP
测试nginx
测试nginx
785 0