wrk icon indicating copy to clipboard operation
wrk copied to clipboard

Question of Nginx CPU usage under wrk stress test

Open zhongweiy opened this issue 2 years ago • 2 comments

when doing Nginx stress test by running test cmd: wrk -t1 -c40 -d50s http://127.0.0.1:80, I find the worker process of Nginx is not using 100% CPU, it is only 70% (from top command). I have tried different wrk options like -t10 -c400, CPU usage can not pass 70%.

Do you have any suggestion to achieve 100% CPU usage under stressing test with wrk?

I also did a little bit more analysis. I was thinking the process was some how sheduled out due to some blocking call. But the bcc offcputime tool's offcpu time flame graph only has 1ms off cpu event for a 50 second record for the Nginx worker process. I expect there will be 30% * 50 sec = 15 sec offcput event. Am I missing something here?

zhongweiy avatar Nov 02 '23 21:11 zhongweiy

maybe,try it.

wrk -t 5 -c 10000 -d50s --header "Connection: close" --header "Cache-Control: no-cache" http://127.0.0.1:80/

gaowanlu avatar Apr 22 '24 08:04 gaowanlu

Adjust the '-t' based on CPU core count.

gaowanlu avatar Apr 22 '24 08:04 gaowanlu