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:
- JSON response bodies from the Gateway (if the client sends an "Allow-Encoding: gzip" header, which pretty much everything does)
- JSON parts of MIME multipart responses from the Gateway (i.e. the document bodies in a GET-with-attachments or a _bulk_get)
- JSON request bodies sent by CBL/iOS, including _bulk_docs and _revs_diff
- 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.
—Jens