Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is GZip compression worthwhile with AMF

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?

like image 298
Fergal Avatar asked Oct 04 '10 06:10

Fergal


People also ask

Should I use gzip compression?

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%.

How efficient is gzip compression?

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.

Does gzip improve performance?

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.

Is Brotli better than gzip?

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.


2 Answers

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):

  • SOAP: uncompressed: 1000KB gzipped: 100KB (90% reduced)
  • AMF: uncompressed: 200KB gzipped: 30KB (85% reduced)

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.

like image 193
Wouter Coekaerts Avatar answered Oct 16 '22 03:10

Wouter Coekaerts


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.

like image 31
Peter Tillemans Avatar answered Oct 16 '22 01:10

Peter Tillemans