基准测试curl vs wget vs python请求库

基准测试curl vs wget vs python请求库,curl,python-requests,wget,Curl,Python Requests,Wget,我在WebGoat上进行一些挑战,需要对服务器进行暴力请求攻击。我已经用bash(使用curl)编写了一个脚本。然而,我在网上发现了一个类似的脚本,它是用python编写的,当我运行它时,python脚本能够以更快的速度运行攻击 因此,我提出了一个小的基准测试实验。我将使用以下脚本向该容器发出请求,并使用time对性能进行基准测试 $cat测试\u #!/usr/bin/env bash 对于{1..1000}中的i;做 curl-s-o/dev/null'http://localhost:80

我在WebGoat上进行一些挑战,需要对服务器进行暴力请求攻击。我已经用bash(使用curl)编写了一个脚本。然而,我在网上发现了一个类似的脚本,它是用python编写的,当我运行它时,python脚本能够以更快的速度运行攻击

因此,我提出了一个小的基准测试实验。我将使用以下脚本向该容器发出请求,并使用
time
对性能进行基准测试

$cat测试\u
#!/usr/bin/env bash
对于{1..1000}中的i;做
curl-s-o/dev/null'http://localhost:8080/WebGoat/login'
完成
$cat测试\u wget
#!/usr/bin/env bash
对于{1..1000}中的i;做
wget-q-O/dev/null'http://localhost:8080/WebGoat/login'
完成
$cat测试请求
#!/usr/bin/env蟒蛇3
导入请求
对于范围(11001)内的i:
请求。获取('http://localhost:8080/WebGoat/login')
$time./test\u请求
实际0m4.240s
用户0m2.136s
sys 0m0.125s
$time./test\u wget
真正意义上的0m4.623s
用户0m1.752s
系统0m0.731s
$time./test\u
真正的0m17.907s
用户0m7.420s
系统0m3.692s
总之,当我提出很多请求时,我是否应该避免使用
curl
?看来,
python请求
在这里是赢家。有人能证实我的结论吗?我错过什么了吗

有人知道
curl
wget
中性能的巨大差异吗?
几年前,似乎在
curl
wget
之间进行了类似的实验。但在表现上仍然存在着明显的差异

奇怪的是,python在您的机器上比curl更快。 在我的macbook pro上:

time ./test_curl
./test_curl  15.78s user 8.04s system 39% cpu 1:00.09 total
time ./test_request
./test_request  39.26s user 2.58s system 10% cpu 6:29.79 total

奇怪的是,python在您的机器上比curl更快。 在我的macbook pro上:

time ./test_curl
./test_curl  15.78s user 8.04s system 39% cpu 1:00.09 total
time ./test_request
./test_request  39.26s user 2.58s system 10% cpu 6:29.79 total