使用Apache ab进行http性能测试
Mac自带了Apache环境
打开“终端(terminal)”,输入 sudo apachectl -v,(可能需要输入机器秘密)。如下显示Apache的版本

接着输入 sudo apachectl start,这样Apache就启动了。打开Safari浏览器地址栏输入 “http://localhost”,可以看到内容为“It works!”的页面。其位于“/Library(资源库)/WebServer/Documents/”下,这就是Apache的默认根目录。
Apache的安装目录在:/etc/apache2/,etc默认是隐藏的。有三种方式查看:
- dock下右键Finder,选择"前往文件夹",输入"/etc"
- 在finder下----》前往---》前往文件夹,然后输入/etc
- 可以在terminal 输入 "open /etc"
windows可以去http://httpd.apache.org/download.cgi下载,或者从命令行安装
1. 安装apache
sudo port install apache2
启动apache: sudo apachectl start
2. brew install pcre
3. wget http://ftp.yz.yamagata-u.ac.jp/pub/network/apache//httpd/httpd-2.4.4.tar.bz2
(1)解压
(2) ./configure
(3) make && make install
(4) sudo cp support/ab /usr/sbin
4. ab -n 1000 -c 10 http://localhost:3000/ 最后这个斜杠不能少
这个ab -n1000 -c10 http://localhost:3000/命令,在window系统下,需要先用cd命令定位到你的apache安装目录的bin文件夹。。。
ab的参数说明
-n 需要执行的请求次数
-c 并发的数量
-t 等待返回的最长时间
-b TCP收发缓冲区的大小,单位(byte)
-p 使用post (同时需要定义-T参数)
-u 使用put (同时需要定义-T参数)
-T content-type, 例如application/x-www-form-urlencoded, 默认为text/plain
-w 把结果打印在html的表格里
-x 表格的属性
-y tr行属性
-z td列属性
-C 设置cookie 例如Apach=1234
-H header行, 例如Accept-Encoding:gzip
-k 是否标示位HTTP Keep Alive
测试结果:
This is ApacheBench, Version 2.3 <$Revision: $>
Copyright Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient)
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Completed requests
Finished requests Server Software:
Server Hostname: localhost
Server Port: Document Path: /
Document Length: bytes Concurrency Level:
Time taken for tests: 0.323 seconds
Complete requests:
Failed requests:
Total transferred: bytes
HTML transferred: bytes
Requests per second: 3097.37 [#/sec] (mean)
Time per request: 3.229 [ms] (mean)
Time per request: 0.323 [ms] (mean, across all concurrent requests)
Transfer rate: 347.85 [Kbytes/sec] received Connection Times (ms)
min mean[+/-sd] median max
Connect: 0.1
Processing: 2.2
Waiting: 2.2
Total: 2.2 Percentage of the requests served within a certain time (ms)
%
%
%
%
%
%
%
%
% (longest request)
使用Apache ab进行http性能测试的更多相关文章
- Apache ab性能测试结果分析
Apache ab性能测试结果分析 测试场景:模拟10个用户,对某页发起总共100次请求. 测试命令: ab -n 100 -c 10 地址 测试报告: Server Software: 被测服务器软 ...
- 性能测试工具之Apache ab
一.apache ab简介 ab全称ApacheBench,是著名的Web服务器软件apache附带的一款非常简单的压力测试工具,它可以同时模拟多个并发请求,测试Web服务器最大承受压力.Apache ...
- apache ab性能测试实践
E:\developtools\apache ab\httpd-2.4.25-x86-vc14-r1\Apache24\bin>ab -n 15000 -c 600 "http://1 ...
- Apache ab压力测试时出现大量的错误原因分析
最近有一个测试任务,是测试nginx的并发请求到底能够达到多少的, 于是就用ab工具对其进行压力测试. 这压力测试一执行,问题就来了:发起10000次请求,并发100,错误的情况能达到30%--50% ...
- apache ab压力测试报错(apr_socket_recv: Connection reset by peer (104))
apache ab压力测试报错(apr_socket_recv: Connection reset by peer (104)) 今天用apache 自带的ab工具测试,当并发量达到1000多的时 ...
- 如何使用 Apache ab 以及 OneAPM 进行压力测试?
下一个 release 准备小长假后就要 go-live ,所有的测试 case 都 cover 过了,但还未进行过压力测试,有点不放心,刚好过节期间家人都回家去了,假期终于可以抽点时间压测一把. A ...
- Apache ab 测试工具使用(一)
简述: 试用apache ab测试工具 下载点 http://httpd.apache.org/download.cgi 参考: http://jingyan.baidu.com/article/e3 ...
- apache ab工具对网站进行压力测试
Apache -- ab工具主要测试网站的(并发性能) 这个工具非常的强大. 基本语法 : cmd>ab.exe –n 请求总次数 -c 并发数 请求页面的url 进入到ab.ex ...
- win7下使用apache ab 比较测试node与 tomcat
最近在研究node,都说node单线程.事件环机制,高并发效率高,亲测一下,一探究竟 apache ab 安装 进入:http://httpd.apache.org/download.cgi#apac ...
随机推荐
- 聊聊GISer的职业发展
一.前言 去年写了一篇名为<GISer们还有机会屌丝逆袭吗?>的博文,希望能和广大GISer一起探讨地理信息产业留给小团队和个人的机会.文章发布后,很多GISer通过网络和我进行了交流,其 ...
- ubuntu解决arm-linux-gcc no such file的问题
这种情况是因为你的操作系统是Ubuntu 64位的,而交叉编译工具链都是32位执行程序.要成功运行这些交叉编译工具链,需要与这些工具链相关的32位库.安装命令如下:sudo apt-get insta ...
- C标准库<ctype.h>实现
本文地址:http://www.cnblogs.com/archimedes/p/c-library-ctype.html,转载请注明源地址. 1.背景知识 ctype.h是C标准函数库中的头文件,定 ...
- C语言中的指针和内存泄漏
引言 对于任何使用C语言的人,如果问他们C语言的最大烦恼是什么,其中许多人可能会回答说是指针和内存泄漏.这些的确是消耗了开发人员大多数调试时间的事项.指针和内存泄漏对某些开发人员来说似乎令人畏惧,但是 ...
- Class org.apache.struts2.json.JSONWriter can not access a member of class org.springframework.aop.TruePointcut with modifiers "public"
Spring注入Action使用Json错误:org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: ...
- spring mvc4.1.6 + spring4.1.6 + hibernate4.3.11 + mysql5.5.25 开发环境搭建及相关说明
一.准备工作 开始之前,先参考上一篇: struts2.3.24 + spring4.1.6 + hibernate4.3.11 + mysql5.5.25 开发环境搭建及相关说明 struts2.3 ...
- javascripts 实习自动提交表单 onsubmit
html: <form id="formwb" onsubmit="return setPassword();"> <script> d ...
- 阶乘 求n!中质因数的个数
在n!中末尾有几个0 取决于n!中5的个数(2肯定比5多) 所以遍历从1到n的数,看总共有几个5即可 ..N do j = i; == ) ++ret; j /= ; end end 有个nb的方法: ...
- AFTER触发器与INSTEAD OF触发器
在对表进行操作时,总会产生 INSERTED 和(或)DELETED表,不管这个操作是否已经进行.这里的和/或,要看进行的什么操作,插入,产生 INSERTED 表,删除,产生DELETED表,而up ...
- JodaTime library not available - @DateTimeFormat not supported
使用spring的@DateTimeFormat来格式化Date类型时,报错: org.springframework.validation.BindException: org.springfram ...