该工具在Apache安装目录的bin目录里面。所以想要这个使用这个工具,只需要下载Apache即可。在Window环境下,推荐使用 PhpStudy 工具的集成环境。就可以轻松拥有Apache、ab压力测试工具了。
PhpStudy 集成工具下载地址:http://phpstudy.php.cn/
随手启动一个服务,这里使用Nodejs:
var http = require('http'); var server = http.createServer(function (req, rep) {
rep.writeHead(, {"Content-Type": "text/plain"});
console.log(, 'Hello');
rep.end("Hello World!!");
}) server.listen(, function (err) {
console.log('start');
});
启动服务: $ node index.js
开始 ab 压测
$ C:\Users\Lee\phpStudy\Apache\bin\ab.exe -c -n "http://localhost:3000/"
这里的意思是,并发为10,请求200次。
我们的 Node.js 服务也真实收到了请求,做出了反馈。