viva
  • 主页
  • 开发
    • IDE环境
      • Vim
      • VSCode
        • code-server
        • theia
    • Golang手册
    • Ansible
    • SaltStack
      • salt-api
    • Python
      • Q&A
      • Hello,world!
      • 类型
        • 数字
        • 字符串
        • 列表
        • 元组
        • 集合
        • 字典
      • 语法
        • 流程控制
        • 循环
      • 工具
        • pip
        • pyenv
        • selenium
      • 示例
    • Shell
    • Vue
      • ant-design
      • vue-material
    • Java
  • 随笔
    • WSL2
    • Git
    • Markdown
      • mermaid
    • Linux
      • 时钟同步
      • 账号
      • 文件
      • SSH
      • systemd
      • TLS加密
        • Openssl
      • 存储
        • rsync
        • NFS
      • 路由
      • 日志采集
        • Journalctl
        • Fluentd
          • 根据字段匹配对日志进行结构化
        • Logstash
    • 虚拟化
      • Hyper-V
      • PXE
    • 命令行工具
      • zsh
    • Nexus3
    • 堡垒机
      • JumpServer
    • 测试工具
      • ioping
      • apache bench
      • dd
      • postman
    • 开源项目管理
      • Github
    • 软件包管理
    • 网络镜像源
    • 网关
      • Nginx
  • 存储
    • Ceph
      • 安装
      • 故障处理
    • Etcd
    • Mysql
  • 网络
    • Overlay网络
    • IPVS
    • 网络工具
      • tshark
      • tcpdump
    • 防火墙
      • nftables
      • firewalld
      • iptables
    • 域名解析
      • dig
      • nslookup
      • dnsmasq
    • 代理
      • Clash
      • Redsocks
      • Redsocks2
      • COW
      • Proxfier
  • 云原生
    • 容器
      • Docker
        • Dockerfile
        • docker-compose
      • Podman
      • 原理
        • Chroot
        • Namespace
        • Cgroup
    • 镜像仓库
      • Harbor
    • Kubernetes
      • 部署
        • Kind
        • Minikube
        • kubespray
      • CNI
        • Flannel
        • OVS
        • Calico
      • Operator
        • OperatorSDK
      • StorageClass
      • Q&A
    • Openshift
      • 集群部署
      • 快速使用
    • Prometheus
      • prometheus-operator
      • kube-prometheus
      • Thanos
        • 组件
          • Bucket
          • Check
          • Compact
          • Querier
          • Receiver
          • Ruler
          • Sidecar
          • Store
        • 参考资料
      • Cortex
        • 组件
          • Alertmanager
          • Config
          • Distributor
          • Ingester
          • Querier
          • Query Frontend
          • Ruler
        • 参考资料
      • Thanos与Cortex方案对比
      • 参考资料
      • Q&A
    • Skywalking
    • Rook
    • Helm
    • Istio
    • 应用部署
      • Nexus
      • RabbitMQ
    • 参考资料
  • DevOps
    • 开源DevOps平台
    • CICD
      • Jenkins
    • 参考资料
  • 机器学习
    • Kubeflow
      • 示例
由 GitBook 提供支持
在本页
  • 安装
  • 使用
  • 可用参数
  1. 随笔
  2. 测试工具

apache bench

apache bench,简称为ab

ab是apache自带的压力测试工具。ab非常实用,它不仅可以对apache服务器进行网站访问压力测试,也可以对或其它类型的服务器进行压力测试。比如nginx、tomcat、IIS等。

安装

centos环境

yum install httpd -y

ubuntu环境

apt install apache2-utils

使用

例子:以10个并发发送总共100条请求

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

可用参数

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 50000
    -s timeout      Seconds to max. wait for each response
                    Default is 30 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 150 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
                    (SSL2, TLS1, TLS1.1, TLS1.2 or ALL)
    -E certfile     Specify optional client certificate chain and private key
上一页ioping下一页dd

最后更新于4年前