版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/millions_02/article/details/90475121
压测
- wrk
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
- AB
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
- QPS(TPS)= 并发数/平均响应时间