高性能mysql笔记(二)ab测试工具

主要是介绍一些压力测试和性能测试的工具,本文讲解一下ab和http_load在mac的用法。

测试前,前面先把系统的端口限制数改大,看看Mac下面的默认限制

ulimit -a

open files (-n) 2560

2000多的fd数是很小的,我们把他改大,当然我测试过了,也只能开10000而已,Linux可以开6W多,所以:

ulimit -n 10000

在用 ulimit -a 检查一下

open files (-n) 10000

ab

  1. Apache启动
    sudo apachectl start
    打开Safari浏览器地址栏输入 “http://localhost”,可以看到内容为“It works!”的页面

  2. 下载安装httpd最新版本
    下载链接:http://httpd.apache.org/download.cgi

  3. cd httpd-2.4.25/support/

    ab -c 100 -n 100 
    

    //-c并发数 -n请求数

结果

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

Benchmarking www.baidu.com (be patient).....done


Server Software:        BWS/1.1
Server Hostname:        www.baidu.com
Server Port:            80

Document Path:          /
Document Length:        101944 bytes

Concurrency Level:      100
Time taken for tests:   2.212 seconds ##共使用了多少时间 
Complete requests:      100
Failed requests:        96
   (Connect: 0, Receive: 0, Length: 96, Exceptions: 0)
Total transferred:      10310757 bytes
HTML transferred:       10214723 bytes
Requests per second:    45.20 [#/sec] (mean) ##每秒多少请求,这个是非常重要的参数数值,服务器的吞吐量 
Time per request:       2212.257 [ms] (mean) ##用户平均请求等待时间 
Time per request:       22.123 [ms] (mean, across all concurrent requests) ##服务器平均处理时间
Transfer rate:          4551.50 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       16  125  15.8    125     135
Processing:   347  954 297.0   1013    2075
Waiting:       42  319 188.5    391     929
Total:        472 1079 298.3   1138    2210

Percentage of the requests served within a certain time (ms)
  50%   1138   ## 50%的请求在1138ms内返回 
  66%   1294
  75%   1311
  80%   1322
  90%   1350
  95%   1392
  98%   1459
  99%   2210
 100%   2210 (longest request)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值