[英]Why are clinic.js and Autocannon returning 0 2xx responses, 36164 non 2xx responses?
I've a nodejs webservice, which I want to use clinic.js to analyze it's performance ans find bottlenecks.我有一个 nodejs 网络服务,我想使用 Clinic.js 来分析它的性能并找到瓶颈。
So when I issue this command:所以当我发出这个命令时:
clinic doctor --on-port 'autocannon localhost:$PORT --connections 5 -m "POST" -i my-data.json -H "Authorization":"Bearer xxx" ' -- node ./dist/custom/index.js
I get the next logs:我得到下一个日志:
Running 10s test @ http://localhost:443
5 connections
┌─────────┬──────┬──────┬───────┬──────┬──────┬───────┬──────┐
│ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │
├─────────┼──────┼──────┼───────┼──────┼──────┼───────┼──────┤
│ Latency │ 0 ms │ 0 ms │ 0 ms │ 0 ms │ 0 ms │ 0 ms │ 0 ms │
└─────────┴──────┴──────┴───────┴──────┴──────┴───────┴──────┘
┌───────────┬─────┬──────┬─────┬───────┬─────┬───────┬─────┐
│ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │
├───────────┼─────┼──────┼─────┼───────┼─────┼───────┼─────┤
│ Req/Sec │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │ 0 │
├───────────┼─────┼──────┼─────┼───────┼─────┼───────┼─────┤
│ Bytes/Sec │ 0 B │ 0 B │ 0 B │ 0 B │ 0 B │ 0 B │ 0 B │
└───────────┴─────┴──────┴─────┴───────┴─────┴───────┴─────┘
Req/Bytes counts sampled once per second.
63k requests in 11.01s, 0 B read
63k errors (0 timeouts)
USMCDANCN2Z76AB:172542_alexa_skills_template xzxqdy$ clinic doctor --on-port 'autocannon localhost:$PORT --connections 5 -m "POST" -i my-data.json -H "Authorization":"Bearer xxx" ' -- node ./dist/custom/index.js
Running 10s test @ http://localhost:443
5 connections
running [ ] 0%
┌─────────┬──────┬──────┬───────┬──────┬─────────┬─────────┬───────┐
│ Stat │ 2.5% │ 50% │ 97.5% │ 99% │ Avg │ Stdev │ Max │
├─────────┼──────┼──────┼───────┼──────┼─────────┼─────────┼───────┤
│ Latency │ 1 ms │ 1 ms │ 2 ms │ 3 ms │ 1.07 ms │ 0.48 ms │ 20 ms │
└─────────┴──────┴──────┴───────┴──────┴─────────┴─────────┴───────┘
┌───────────┬─────────┬─────────┬─────────┬─────────┬─────────┬────────┬─────────┐
│ Stat │ 1% │ 2.5% │ 50% │ 97.5% │ Avg │ Stdev │ Min │
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼────────┼─────────┤
│ Req/Sec │ 2427 │ 2427 │ 3821 │ 3939 │ 3616.8 │ 440.53 │ 2427 │
├───────────┼─────────┼─────────┼─────────┼─────────┼─────────┼────────┼─────────┤
│ Bytes/Sec │ 2.14 MB │ 2.14 MB │ 3.36 MB │ 3.47 MB │ 3.18 MB │ 388 kB │ 2.14 MB │
└───────────┴─────────┴─────────┴─────────┴─────────┴─────────┴────────┴─────────┘
Req/Bytes counts sampled once per second.
0 2xx responses, 36164 non 2xx responses
36k requests in 10.01s, 31.8 MB read
Analysing data
Generated HTML file is
So why am I getting?: 0 2xx responses, 36164 non 2xx responses When I try it in postman with the same headers and body it returns 200.那么为什么我得到?:0 2xx 响应,36164 个非 2xx 响应当我在邮递员中尝试使用相同的标题和正文时,它返回 200。
Thanks in advance for your help在此先感谢您的帮助
Greetings你好
I am having the same problem.我有同样的问题。 It seems that the headers are not handled correctly when you run autocannon as an inner command.
当您将 autocannon 作为内部命令运行时,标题似乎没有正确处理。 I tried many different syntaxes.
我尝试了许多不同的语法。
What worked for me though: Running node clinic doctor/flame
and autocannon
in separate terminals什么对我
autocannon
在不同的终端中运行node clinic doctor/flame
和autocannon
First run in terminal A:首先在终端 A 中运行:
clinic doctor -- node ./dist/custom/index.js
In the second terminal B run:在第二个终端 B 中运行:
autocannon localhost:<YourPort> --connections 5 -m "POST" -i my-data.json -H "Authorization":"Bearer xxx"
As soon as autocannon has finished, go back to terminal A and end the clinic node process with CTRL+C. autocannon 完成后,立即返回终端 A 并使用 CTRL+C 结束诊所节点进程。 The data will be analyzed and the report printed.
将分析数据并打印报告。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.