How to Benchmarking : bandwidth improvement from using GZIP with cURL (PHP)
I am trying to benchmark the bandwidth saved from setting GZIP to active with cURL(PHP).
I did this by curl_setopt($ch, CURLOPT_ENCODING , 'Accept-Encoding: gzip');
Be开发者_如何学Clow is the documentation for CURLOPT_ENCODING :
The contents of the "Accept-Encoding: " header. This enables decoding of the response. Supported encodings are "identity", "deflate", and "gzip". If an empty string, "", is set, a header containing all supported encoding types is sent.
Now is there an easy & convenient for me to check the bandwidth used when I have GZIP ON and when I have it OFF ?
You need to get Curl to visit two different URLS, both with the same content, but one with Gzip enabled on the target server and the other without. Curl's function curl_getinfo()
provides a lot of information to do with the time it took to download and the content length, from that you may be able to get the information you want.
精彩评论