We've got a Flex/Java application using BlazeDS and we're investigating reducing the size of the payloads being passed between our server and the client.
Since AMF is a binary format and supposed to be fairly compact, is there any benefit to turning on GZip compression? Has anyone else done this before and did you see any significant gains from using compression?
UPDATE
I just performed a simple test to determine what kind of compression ratios we might expect if we were to enable gzipping. I just captured the AMF payloads in some files and just gzipped them using the Linux command line version. I didn't specify the level of compression, just the default i.e. 'normal'. It appears that on average there is a 9% reduction in the payload size, with some payloads getting as much as 61%. Can anyone see a flaw in this method and what level of compression can be used in HTTP gzipping?
Why Do We Use GZIP Compression? GZIP is effective, but it's not the only compression method out there. In fact, it's not even the best method in terms of size reduction. GZIP can reduce the amount of data by up to 70%.
However, in practice, GZIP performs best on text-based content, often achieving compression rates of as high as 70-90% for larger files, whereas running GZIP on assets that are already compressed via alternative algorithms (for example, most image formats) yields little to no improvement.
Gzip is a fast and easy way to improve page speed performance while still delivering a high-quality experience to your users. See if your website supports gzip by running a free speed test, and sign up for a free trial for more insights into your website's performance.
Since Brotli was designed to compress streams on the fly, it is faster at both compressing content on the server and decompressing it in the browser than in gzip. In some cases the overall front-end decompression is up to 64% faster than gzip.
We have recently switched some client-server communication from SOAP to AMF, and we also compared impact of compression. We focused on one particular service which returns some big responses. These were our results, returning the same data (serialized with xfire+aegis for SOAP, and BlazeDS for AMF):
Our conclusion is gzipping is definitely worth it. The binary AMF can be compressed almost as good as XML (SOAP). Of course your mileage may vary depending on the kind of data you are returning.
It depends on the data. If you have lots of highly structured data, then typically it uses only a fraction of the bits of actual information. Then compression will make sense.
e.g. a record with a category field which is one of 6 possibilities might take 32-bit if it is encoded as a GUID, but you can represent it with 3 bits. Compression will see these patterns as very frequent and reduce them.
Similar for non repeating strings.
AMF has some optimizations for small integers and repeating strings, but not really compression. See this discusion.
Do some benchmarks and decide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With