首页 > 其他分享 >ab

ab

时间:2023-07-03 16:14:32浏览次数:26  
标签:ab http 请求 file attributes requests

ab

Apache服务器的性能测试工具

安装

若系统未安装,使用以下命令安装

# Ubuntu
sudo apt-get install apache2-utils

# Centos
yum install httpd-tools

补充说明

ab命令 是一个测试你 Apache http 服务器的工具,你可以通过这个工具,指定一个单位时间内向 apache 发出的请求数量来看看你的 Apache 和机器配合的性能如何。

语法

ab [ -A auth-username:password ] [ -c concurrency ] [ -C cookie-name=value
] [ -d ] [ -e csv-file ] [ -g gnuplot-file ] [ -h ] [ -H custom-header ] [
-i  ]  [  -k  ]  [  -n  requests  ] [ -p POST-file ] [ -P proxy-auth-user‐
name:password ] [ -q ] [ -s ] [ -S ] [ -t timelimit ] [ -T content-type  ]
[  -v verbosity] [ -V ] [ -w ] [ -x <table>-attributes ] [ -X proxy[:port]
]  [  -y  <tr>-attributes  ]  [  -z   <td>-attributes   ]   [http://]host‐
name[:port]/path

选项

-A auth-username:password
      #  支持基本的验证证书,用户名和密码之间使用"冒号"                    :
      # 分隔开,ab将以明文方式传送过去.不管服务器是不是需要
      # ,也就是说你的服务器需要支持401认证.

-c concurrency
      # 同时向服务器端发送的请求数目,默认状态下是一次 只执行一个http请求.

-C cookie-name=value
      # Add a Cookie: line to the request. The argument is typically in the
      # form of a name=value pair. This field is repeatable.

-d    #  Do not display  the  "percentage  served  within  XX  [ms]  table".
      # (legacy support).

-e csv-file
      # Write  a  Comma  separated value (CSV) file which contains for each
      # percentage (from 1% to 100%) the time (in milli seconds) it took to
      # serve  that percentage of the requests. This is usually more useful
      # than the 'gnuplot' file; as the results are already 'binned'.

-g gnuplot-file
      # Write all measured values out as a 'gnuplot' or TSV  (Tab  separate
      # values)  file.  This file can easily be imported into packages like
      # Gnuplot, IDL, Mathematica, Igor or even Excell. The labels  are  on
      # the first line of the file.
-h    # 显示使用说明
-H custom-header
      # 向请求包追加附加的标题字串.此参数应该是有效的标题         行(header
      # line)形式,通常使用冒号":"来分隔有效配对 (valid  pair)例如  'Accept-
      # Encoding: zip/zop;8 bit';

-i    # 使用一个 http 头(HEAD) 来替换 GET方法.不可以掺入POST 方法

-k    #  允许http      KeepAlive      ;也就是说执行多个请求在一个      http
      # 会话当中,默认是不允许的也就是no KeepAlive啦;)

-n requests
      # 执行一次测试会话的时候所发出的请求数目,默认是执行一个单一的请求
      # 当然了这样的测试结果也就没什么意义了

-p POST-file
      # 测试程序也就是ab,将向Apache server发送带有HTTP POST 的请求.

-P proxy-auth-username:password
      # 当需要通过代理测试一台 HTTP 服务器的时候而你的代理
      # 又需要用户名密码验证,这时你可以使用这个选项,同样
      # 用户名与密码之间使用冒号":"分隔开,ab将之以明文的方式
      # 发送出去,当然,前提是你的代理是处于407认证状态的

-q    #  When processing more than 150 requests, ab outputs a progress count
      # on  stderr  every  10% or 100 requests or so. The -q flag will sup‐
      # press these messages.

-s    #  When compiled in (ab -h will show you) use the SSL protected  https
      # rather  than  the  http  protocol. This feature is experimental and
      # very rudimentary. You probably do not want to use it.

-S    #  Do not display the median and standard deviation values,  nor  dis‐
      # play  the  warning/error  messages  when the average and median are
      # more than one or two times the standard deviation  apart.  And  de‐
      # fault to the min/avg/max values. (legacy support).

-t timelimit
      #  设置测试的时间的长短,使用这个选项ab将自动设置
      # 测试请求会话数目为50000,然后以你设置的时间为
      # 固定周期.默认状态下是没有时限的,也就是直到完成
      # 你所设置的请求数目为止.

-T content-type
      # 内容类型标头,使用在POST数据的时候.

-v verbosity
      # 设置冗余级别,4级打印出每个请求标头的详细信息,
      # 3级打印出回应代码(例如,404,200),2级打印出警告 信息和指示消息

-V    # 显示版本号并且退出
-w    # 打印输出结果到HTML表中. 默认的表是两列n行白底黑框

-x <table>-attributes
      # 使用字串来描述表的属性,该属性字串应该插入到<table 这里 >

-X proxy[:port]
      # Use a proxy server for the requests.

-y <tr>-attributes
      # 用于生成html表格每行的属性名 (<tr>)

-z <td>-attributes
      # 用于生成html表格每列的属性名 (<td>)

参数

主机:被测试主机。

实例

# 10个并发, 请求500次
ab -c 10 -n 500 https://www.qq.com/

标签:ab,http,请求,file,attributes,requests
From: https://www.cnblogs.com/linuxcmd/p/ab.html

相关文章

  • Profinet转EtherNet/IP网关连接AB PLC的应用案例
     西门子S7-1500PLC(profinet)与ABPLC以太网通讯(EtherNet/IP)。本文主要介绍捷米特JM-EIP-PN的Profinet转EtherNet/IP网关,连接西门子S7-1500PLC与ABPLC通讯的配置过程,供大家参考。 1,新建工程:运行RSLogix5000程序,选择菜单File->New,弹出对话框:2,在“Type”中选择控......
  • OGG-02912 Patch 17030189 is required on your Oracle mining database for trail fo
    Therewillbeascript"prvtlmpg.plb"undergghomedirectory[oracle@OGGR2-1ogg]$ls-lrtprvtlmpg.plb-rw-r-----1oracleoinstall9487May272015prvtlmpg.plb[oracle@OGGR2-1ogg]$pwd/ogg[oracle@OGGR2-1ogg]$Logintothedatabaseand......
  • MIT6.5840 lab2,3 记录
    参考链接课程地址如何Debug:没有它可怎么活,几万行的日志怎么看Students'GuidetoRaftraft算法可视化:直观展示raft可视化简单入门raft讲解视频:强烈推荐感想感觉理论+实践来学一个东西才学的深刻,特别是对于我这样对抽象理解不太行的,每次见识了一个算法或系统真正如何运行......
  • 云原生时代,如何通过 KubeSphere x 极狐GitLab 构建安全应用?
    本文整理自云原生Meetup杭州站上,极狐(GitLab)DevOps技术布道师马景贺的演讲。当听到云原生的时候,你会想起什么?可能很多人很自然地就会想到Kubernetes、容器、微服务、开源等等,这些关键词是我们接触云原生绕不开的话题。但是以上还少了一个关键词:安全。云原生从2013年出现,201......
  • react-native项目启动报错 Error: `fsevents` unavailable (this watcher can only be
    react-native项目启动报错——watchman安装问题(macpro) LookingforJSfilesin/Users/你的名称/Documents/project/文件夹名Loadingdependencygraph.../Users/你的名称/Documents/project/文件夹名/node_modules/metro/node_modules/sane/src/fsevents_watcher.js:37......
  • Databend v1.2 版本发布!Data + AI
    各位社区小伙伴们,Databend于2023年6月29日迎来了v1.2.0版本的正式发布!相较于v1.1.0版本,开发者们一共新增了600次commit,涉及3083个文件变更,约17万行代码修改。感谢各位社区伙伴的参与,以及每一个让Databend变得更好的你!在v1.2.0版本中,Databend新增了BIT......
  • 关于Linux系统下-zabbix-agent-的安装
    本文主要讲解关于Zabbix-Agent在Linux系统下的安装可以针对于如下一些系统AmazonLinux1/2 RedHatEnterpriseLinuxServerrelease6.XRedHatEnterpriseLinuxServerrelease7.X1、到Zabbix官方,下载并安装软件包(AmazonLinux1使用RHEL6的安装包,AmazonLinux2使......
  • ABAP MD5加密
    1.ABAPMD5加密標準函數(不區分大小寫)CALL FUNCTION 'MD5_CALCULATE_HASH_FOR_CHAR'    EXPORTING      data           = lv_string1    IMPORTING      hash           = lv_string2    EXCEPTIONS      no_data   ......
  • Matlab-对wav音频文件AM调制及解调
    1.读取wav音乐文件%读取音频文件filename='jay.wav';[sound_data,fs]=audioread(filename);%9507502x244100sound_data_1=sound_data(:,1);sound_data_1=sound_data_1';%转置sound_data有两列,因为此音乐文件有两个通道,音频采样率为44100;这......
  • Matlab对wav文件做fft分析
    1.代码%指定要读取的.wav文件路径filename='jay.wav';%使用audioread函数读取.wav文件[sound_data,sample_rate]=audioread(filename);sound_data=sound_data(:,1);%计算音频数据的长度sound_length=length(sound_data);%计算FFT的点数%fft_points=......