1、使用httpd的ab压力测试
centos7 自带 httpd
查看httpd状态
$ systemctl status httpd.service
显示如下则表示服务未启动
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:httpd(8)
man:apachectl(8)
5月 09 12:17:45 cdh-dev4 systemd[1]: Starting The Apache HTTP Server...
5月 09 12:17:45 cdh-dev4 httpd[1859]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.32.136. Set the 'ServerName' directive globally to suppress this message
5月 09 12:17:45 cdh-dev4 systemd[1]: Started The Apache HTTP Server.
5月 09 12:22:53 cdh-dev4 systemd[1]: Stopping The Apache HTTP Server...
5月 09 12:22:54 cdh-dev4 systemd[1]: Stopped The Apache HTTP Server.
启动httpd
$ systemctl start httpd.service
查看httpd状态
$ systemctl status httpd.service
显示如下 则表示httpd启动成功
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since 三 2018-05-09 12:24:44 CST; 2s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 1962 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
├─1962 /usr/sbin/httpd -DFOREGROUND
├─1965 /usr/sbin/httpd -DFOREGROUND
├─1966 /usr/sbin/httpd -DFOREGROUND
├─1967 /usr/sbin/httpd -DFOREGROUND
├─1968 /usr/sbin/httpd -DFOREGROUND
└─1969 /usr/sbin/httpd -DFOREGROUND
5月 09 12:24:44 cdh-dev4 systemd[1]: Starting The Apache HTTP Server...
5月 09 12:24:44 cdh-dev4 httpd[1962]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.32.136. Set the 'ServerName' directive globally to suppress this message
5月 09 12:24:44 cdh-dev4 systemd[1]: Started The Apache HTTP Server.
###ab命令 -c 指定并发数 -n 指定请求数 对138上的nginx进行压力测试
$ ab -c 2000 -n 40000 http://192.168.32.138/
2000并发下40000次请求测试结果如下,nginx服务器硬件配置4g内存,单核双线程,centos7.
ab 压力测试
ab -n 10000 -c 100 -p "post.txt" -T "application/json" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: d6xxs-sdf-sdf09d" "http: