压测
const http = require('http');
const hostname = '127.0.0.1';
const port = 1337;
http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('Hello World\n');
}).listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
wrk -t24 -c140 -d20s http://127.0.0.1:1337
Running 20s test @ http://127.0.0.1:1337
24 threads and 140 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 4.97ms 628.84us 20.96ms 95.34%
Req/Sec 1.01k 47.70 1.32k 75.98%
483525 requests in 20.03s, 71.94MB read
Requests/sec: 24137.35
Transfer/sec: 3.59MB
bin>ab -k -n 2000 -c 2000 localhost:3000/a
// post
ab -n 100 -c 100 -p ./post.txt -T application/x-www-form-urlencoded "http://beatlegend.lol.qq.com/v3/select/hero"
./post文件内容格式 openUuid=YY0202&skinId=song_002&heroId=1