drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.57k stars 1.12k forks source link

profile testing compare #1578

Closed babA409866 closed 6 months ago

babA409866 commented 1 year ago

i want to use httpClient parts to do a lots of request .

i use the drogon-press-tool command: dg_ctl press -n 3000 -t 150 -c 3000 https://www.baidu.com

request 1000 times ,use 150 thread ,max to 3000 connections. it takes a long time and won't stop.

and i reduce the values .

try like below:

dg_ctl press -n 1000 -t 200 -c 100 https://www.baidu.com

TOTALS: 100 connect, 1000 requests, 1000 success, 0 fail TRAFFIC: 60615 avg bytes, 18446744073650053 avg overhead, 60615711 bytes, 18446744073650053858 overhead TIMING: 6.811 seconds, 146 rps, 501.042 ms avg req time SPEED: download 164.142 kBps, upload 16.303 kBps

dg_ctl press -n 1000 -t 2000 -c 100 https://www.baidu.com TOTALS: 100 connect, 1000 requests, 1000 success, 0 fail TRAFFIC: 180675 avg bytes, 18446744073529601 avg overhead, 180675627 bytes, 18446744073529601206 overhead TIMING: 15.120 seconds, 66 rps, 1264.142 ms avg req time SPEED: download 47.964 kBps, upload 7.439 kBps

dg_ctl press -n 1000 -t 150 -c 150 https://www.baidu.com

TOTALS: 150 connect, 1000 requests, 1000 success, 0 fail TRAFFIC: 156660 avg bytes, 18446744073553696 avg overhead, 156660946 bytes, 18446744073553696803 overhead TIMING: 13.816 seconds, 72 rps, 1644.298 ms avg req time SPEED: download 58.349 kBps, upload 8.014 kBps

and i wrote a test tool by c11-thread and curl .in the same machine and network. it can reach to 600 ~ 700 rps. only success. same target url.

i just loop 3000 request to 150 thread each request 20 at the same time .

how to reach the closely result as curl .

by the way .i use Locust . an other press tools it seems can reach the similar speed.

is there other setting limit the speed ?

other info :

use wrk tool:

wrk -t28 -c3000 -d10s --latency https://www.baidu.com Running 10s test @ https://www.baidu.com 28 threads and 3000 connections Thread Stats Avg Stdev Max +/- Stdev Latency 177.06ms 111.16ms 1.36s 92.66% Req/Sec 42.05 30.83 151.00 61.41% Latency Distribution 50% 155.93ms 75% 184.20ms 90% 238.11ms 99% 642.15ms 6000 requests in 10.09s, 61.39MB read Socket errors: connect 2773, read 5037, write 0, timeout 3 Requests/sec: 594.60 Transfer/sec: 6.08MB

ave succes time : 333 per/s

hwc0919 commented 1 year ago

Pressing a public service like baidu doesn't make any sense. The latency is too high, and there will be traffic controls. You should press a service in private net.

The parameters are also awful. Drogon uses nonblocking IO, 150 threads will not be faster than 8 threads (will be much slower in fact) if your machine does not have that many cores.