Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

speeding up ajax requests - can gzip compression be applied?

I want to speed up my ajax requests, I'm returning large amounts of information from the requests and was wondering if any sort of compression could be applied here to speed things up a bit.

My ajax requests typically all send in JSON encoded objects such as objects and arrays which contain html elements and other stuff at times. My server sided code is php and I'm using the sajax library. Any ideas to speed things up would be greatly appreciated.

like image 546
Ali Avatar asked Jul 26 '10 08:07

Ali


1 Answers

Yes, just enable the zlib.output_compression config in you php.ini. If the client sends the Accept-Encoding header containing gzip, then the output is automatically gzipped and sent to the client.

Another option is to do it by manually calling the ob_gzhandler function.

like image 80
Anurag Avatar answered Oct 18 '22 19:10

Anurag