How to load test an IP rotation proxy
I usually use ab
for load testing servers. Recently I wanted to load test an IP rotation proxy.
IP rotation proxies are regular proxies that run every single request through a different IP.
It’s very easy to load test a proxy with ab
. Here is an example.
ab -c 100 -n 1000 -P <proxy-username>:<proxy-password> -X <proxy-hostname>:<proxy-port> https://api.ipify.org/
The downside of this method are:
ab
makes no distinction between failures dues to the proxy, and those dues to the target endpoint,ab
can’t collect the HTTP responses, so it’s impossible to check how the rotation is performing (how often IPs are repeating.)
It’s super simple however to do this with a for loop
for i in {1..1000}; do
curl -U <proxy-username>:<proxy-password> -x <proxy-hostname>:<proxy-port> https://api.ipify.org >> output.txt &
done
Then to check if there are any IP duplicates, simply run uniq
to produce a csv you can import in Excel and visualize as a chart:
sort output.txt | uniq -c > ouput.csv