• linux AB web 性能测试工具


    ab(选项)(参数)

    选项

    -A:指定连接服务器的基本的认证凭据;
    -c:指定一次向服务器发出请求数;
    -C:添加cookie;
    -g:将测试结果输出为“gnuolot”文件;
    -h:显示帮助信息;
    -H:为请求追加一个额外的头;
    -i:使用“head”请求方式;
    -k:激活HTTP中的“keepAlive”特性;
    -n:指定测试会话使用的请求数;
    -p:指定包含数据的文件;
    -q:不显示进度百分比;
    -T:使用POST数据时,设置内容类型头;
    -v:设置详细模式等级;
    -w:以HTML表格方式打印结果;
    -x:以表格方式输出时,设置表格的属性;
    -X:使用指定的代理服务器发送请求;
    -y:以表格方式输出时,设置表格属性。

    安装nginx 以及tomcat
    192.168.10.145 nginx
    192.168.10.135 tomcat

    [root@localhost 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  的test.html

     

    tomcat 的test.html

    nginx 性能测试

    Server Software: nginx/1.14.0  ##nginx 版本
    Server Hostname: 192.168.10.145  #IP
    Server Port: 80   #监听端口

    Document Path: /test.html  #请求源
    Document Length: 19 bytes  #文档返回的长度,不包括头部

    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   #传输速率

    移除nginx当前的test页面, 让nginx通过代理请求到tomcat的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

     这样就可以对比当前nginx所面临的压力,可以针对性的进行调优。

  • 相关阅读:
    b_bd_序列合并(k路归并思想)
    b_bd_完成括号匹配(记录左括号数)
    b_zj_用户喜好(逆向思维记录喜好值的下标+二分查找)
    Bean的自动装配 | 使用注解实现
    bean的作用域【spring基础】
    DI 依赖注入(Dependency Injection)【spring基础】
    Spring创建对象
    IoC 理论推导 与 解释【Spring基础】
    Spring简介
    【1s 最 简单解决】MyBatis错误 -1 字节的 UTF-8 序列的字节 1 无效
  • 原文地址:https://www.cnblogs.com/zoulixiang/p/9198488.html
Copyright © 2020-2023  润新知