ANN: HTTP gzip compression now enabled in Gateway, iOS

195 views
Skip to first unread message

Jens Alfke

unread,
Jan 16, 2014, 2:51:17 PM1/16/14
to mobile-c...@googlegroups.com
I've gotten GZip HTTP compression working for the Sync Gateway and the iOS Couchbase Lite. This should save quite a bit of bandwidth during replications, since JSON tends to compress to about half its size.

Here's what gets compressed:
  1. JSON response bodies from the Gateway (if the client sends an "Allow-Encoding: gzip" header, which pretty much everything does)
  2. JSON parts of MIME multipart responses from the Gateway (i.e. the document bodies in a GET-with-attachments or a _bulk_get)
  3. JSON request bodies sent by CBL/iOS, including _bulk_docs and _revs_diff
  4. JSON parts of MIME multipart document uploads from CBL/iOS

This should all Just Work, with no apparent change other than lower data usage, as long as you've got the latest master-branch bits from both repos.

Only #1 above is a well-supported standard feature. The others are still valid HTTP but not commonly supported on the receiving side, so they aren't enabled by default. To enable #2, CBL/iOS sends a special header "X-Accept-Part-Encoding: gzip" with the request, which the gateway checks for. To enable #3 and #4, CBL/iOS checks the server's "Server:" response header to see if it's Sync Gateway 0.92 or later. So I don't believe this will break interoperability with older versions of the Gateway, or earlier versions of CBL (or Android), or CouchDB.

(Android support will require implementing the equivalents of commits 7d54535f08d5afe611eecb27792d98. It's pretty straightforward.)

—Jens

Diogo Júnior

unread,
Jan 20, 2014, 6:02:31 AM1/20/14
to mobile-c...@googlegroups.com
I will be waiting for this to be implemented in Android Couchbase Lite.

Thanks.
Reply all
Reply to author
Forward
0 new messages