Proxy压力测试
# install ncat
sudo apt install ncat socat
# port forwarding
ncat -v -k -l 18888 -e '/usr/bin/ncat www.baidu.com 443'
ncat -v -k -l 28888 -e '/usr/bin/ncat --proxy 127.0.0.1:8888 www.baidu.com 443'
socat tcp-listen:38888,fork,reuseaddr PROXY:127.0.0.1:www.baidu.com:443,proxyport=8888
# test connectivity
curl https://www.baidu.com
curl -x 127.0.0.1:8888 https://www.baidu.com
curl -k -H 'Host: www.baidu.com' https://127.0.0.1:18888
curl -k -H 'Host: www.baidu.com' https://127.0.0.1:28888
curl -k -H 'Host: www.baidu.com' https://127.0.0.1:38888
run 50 clients for 1 minute
# install oha
$ wget https://github.com/hatoo/oha/releases/download/v0.4.7/oha-linux-amd64
$ sudo mv oha-linux-amd64 /usr/local/bin/oha
$ sudo chmod +x /usr/local/bin/oha
# test direct bandwidth
$ oha -c 50 -z 1m https://www.baidu.com
0.086 [1013] |■■■■■■■
0.171 [4247] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
0.257 [366] |■■
0.342 [2002] |■■■■■■■■■■■■■■■
0.428 [47] |
0.513 [320] |■■
0.599 [29] |
0.685 [2] |
0.770 [0] |
0.856 [0] |
0.941 [1] |
Status code distribution:
[200] 8027 responses
# test indirect bandwidth
$ oha --insecure -c 50 -z 1m --host www.baidu.com -- https://127.0.0.1:18888
0.087 [926] |■■■■■■
0.174 [4329] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
0.261 [220] |■
0.348 [2049] |■■■■■■■■■■■■■■■
0.435 [46] |
0.521 [301] |■■
0.608 [20] |
0.695 [5] |
0.782 [0] |
0.869 [0] |
0.956 [12] |
Status code distribution:
[200] 7908 responses
# test proxied bandwidth
$ oha --insecure -c 50 -z 1m --host www.baidu.com -- https://127.0.0.1:28888
0.093 [870] |■■■■■■■■■■
0.186 [2700] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
0.279 [1527] |■■■■■■■■■■■■■■■■■■
0.372 [1953] |■■■■■■■■■■■■■■■■■■■■■■■
0.465 [198] |■■
0.558 [155] |■
0.651 [18] |
0.744 [0] |
0.836 [0] |
0.929 [0] |
1.022 [2] |
Status code distribution:
[200] 7423 responses