一、测试Get请求

1.每次并发请求10个,总共1000个请求

ab -n  -c  https://www.baidu.com/

2.指定Header参数

通过-H来指定

ab -n  -c  -H 'Accept-Encoding: gzip' -H 'storeId: 12' https://www.baidu.com/?a=1&b=2

二、测试Post请求

ab -n  -c   -p "post.txt" -T "application/json" -H "Content-Type: application/json"  https://www.baidu.com/

-n:总请求次数(最小默认为 1);
-c:并发次数(最小默认为 1 且不能大于总请求次数,例如:10 个请求,10 个并发,实际就是 1 人请求 1 次);
-p:post 参数文档路径(-p 和 -T 参数要配合使用);
-T:用于POST/PUT数据的内容类型头(即设置post.txt中的参数类型)

其他参数如下:
通过ab -help查看

➜  ~  ab -help
Usage: ab [options] [http[s]://]hostname[:port]/path
Options are:
-n requests Number of requests to perform
-c concurrency Number of multiple requests to make at a time
-t timelimit Seconds to max. to spend on benchmarking
This implies -n
-s timeout Seconds to max. wait for each response
Default is seconds
-b windowsize Size of TCP send/receive buffer, in bytes
-B address Address to bind to when making outgoing connections
-p postfile File containing data to POST. Remember also to set -T
-u putfile File containing data to PUT. Remember also to set -T
-T content-type Content-type header to use for POST/PUT data, eg.
'application/x-www-form-urlencoded'
Default is 'text/plain'
-v verbosity How much troubleshooting info to print
-w Print out results in HTML tables
-i Use HEAD instead of GET
-x attributes String to insert as table attributes
-y attributes String to insert as tr attributes
-z attributes String to insert as td or th attributes
-C attribute Add cookie, eg. 'Apache=1234'. (repeatable)
-H attribute Add Arbitrary header line, eg. 'Accept-Encoding: gzip'
Inserted after all normal header lines. (repeatable)
-A attribute Add Basic WWW Authentication, the attributes
are a colon separated username and password.
-P attribute Add Basic Proxy Authentication, the attributes
are a colon separated username and password.
-X proxy:port Proxyserver and port number to use
-V Print version number and exit
-k Use HTTP KeepAlive feature
-d Do not show percentiles served table.
-S Do not show confidence estimators and warnings.
-q Do not show progress when doing more than requests
-l Accept variable document length (use this for dynamic pages)
-g filename Output collected data to gnuplot format file.
-e filename Output CSV file with percentages served
-r Don't exit on socket receive errors.
-m method Method name
-h Display usage information (this message)
-I Disable TLS Server Name Indication (SNI) extension
-Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers)
-f protocol Specify SSL/TLS protocol
(TLS1, TLS1., TLS1. or ALL)

【Code Tools】AB性能测试工具(二)的更多相关文章

  1. Tools - 负载性能测试工具JMeter

    JMeter简介 HomePage:http://jmeter.apache.org/ Apache JMeter是Apache组织开发的基于Java的开源负载性能测试工具. 可以用于对服务器.网络应 ...

  2. 【Code Tools】AB性能测试工具(一)

    一.工具下载 yum -y install httpd-tools 二.AB工具使用 格式: ab [options] [http://]hostname[:port]/path 例如:ab -n - ...

  3. ab性能测试工具的使用

    一.什么是ab ab,即Apache Benchmark,是一种用于测试Apache超文本传输协议(HTTP)服务器的工具. ab命令会创建很多的并发访问线程,模拟多个访问者同时对某一URL地址进行访 ...

  4. ab性能测试工具

    Apache自带的压力测试工具——ab初体验 http://studiogang.blog.51cto.com/505887/386852 我们知道压力测试的软件确实很多,诸如微软的WAST,惠普的L ...

  5. Centos6.5安装Apache ab性能测试工具

    ab简洁: ab是apache自带的压力测试工具,ab是apachebench命令的缩写. ab不仅可以对apache服务器进行网站访问压力测试,也可以对或其它类型的服务器进行压力测试. ab是一个h ...

  6. ab 性能测试工具的使用(Web并发测试)

    1.下载 http://pan.baidu.com/s/1hrlAbI0 2.命令介绍 参数的介绍 n在测试会话中所执行的请求个数.默认时,仅执行一个请求. -c一次产生的请求个数.默认是一次一个. ...

  7. 转 Mac 使用ab性能测试工具

    Mac 使用ab命令进行压测 1.在Mac中配置Apache ①启动Apache,打开终端 sudo apachectl -v 如下显示Apache的版本 sudo apachectl start 这 ...

  8. Mac 使用ab性能测试工具

    Mac 使用ab命令进行压测 1.在Mac中配置Apache ①启动Apache,打开终端 sudo apachectl -v 如下显示Apache的版本 sudo apachectl start 这 ...

  9. 烂泥:apache性能测试工具ab的应用

    本文由秀依林枫提供友情赞助,首发于烂泥行天下. 网站性能压力测试是服务器网站性能调优过程中必不可缺少的一环.只有让服务器处在高压情况下,才能真正体现出软件.硬件等各种设置不当所暴露出的问题. 性能测试 ...

随机推荐

  1. python 使用 elasticsearch 常用方法(检索)

    #记录es查询等方法 #清楚数据 curl -XDELETE http://xx.xx.xx.xx:9200/test6 #初始化数据 curl -H "Content-Type: appl ...

  2. java日期格式转换大全

    public class DateFormatUtils { private static Log logger = LogFactory.getLog(DateFormatUtils.class); ...

  3. 为什么0x00400000是可执行文件的默认基址?EXE base address start with 400000H,Why is 0x00400000 the default base address for an executable?

    DLL的默认基址是0x10000000,但EXE的默认基址是0x00400000.为什么EXE特别值?4 兆字节有什么特别之处它与x86上单页目录条目映射的地址空间量和1987年的设计决策有关.对EX ...

  4. python中将函数赋值给变量时需要注意的一些问题

    python中将函数赋值给变量时需要注意的一些问题 变量赋值是我们在日常开发中经常会遇到的一个问题,本文主要给大家介绍的是关于python将函数赋值给变量时需要注意的一些问题,分享出来供大家参考学习, ...

  5. lnmp卸载删除多余的php版本

    /etc/init.d/php-fpm5.3 stoprm -rf /usr/local/php5.3rm -f /etc/init.d/php-fpm5.3rm -f /usr/local/ngin ...

  6. dva+umi+antd项目从搭建到使用

    先创建一个新项目,具体步骤请参考https://www.cnblogs.com/darkbluelove/p/11338309.html 一.添加document.ejs文件(参考文档:https:/ ...

  7. SaltStack 是一个服务器基础架构集中化管理平台

    SaltStack详细部署   一.基础介绍============================================================================== ...

  8. 图片懒加载--lazyload.js的用法

    这几天公司的项目已经完成的差不多了,只剩下各种优化问题.今天着重于图片加载的优化.当一个页面需要下拉很长而且又有过多的图片要加载时,就会发生很多http请求,就会拉慢网页加载速度,用户体验不友好.怎么 ...

  9. CSP(noip)中的简单对拍写法

    以a+b为例 这是随机数据 #include<iostream> #include<cstdio> #include<ctime> using namespace ...

  10. Django-11-Form组件

    1. 概述 Django的Form组件一般功能有: 验证用户输入 生成html代码 返回错误信息 创建Form类 from django.shortcuts import render, redire ...