Gzip not applied in _changes(ChangeTracker.java )?

Hi Folks,

As per our testing the gzip headers is not applied in ChangeTracker.

POST /dbdata/_changes HTTP/1.1 (application/json)
Frame 8119: 420 bytes on wire (3360 bits), 420 bytes captured (3360 bits) on interface 0
Ethernet II, Src: HewlettP_b2:46:2a (a0:1d:48:b2:46:2a), Dst: ExtremeN_97:cb:7d (00:04:96:97:cb:7
Internet Protocol Version 4, Src: (, Dst: (
Transmission Control Protocol, Src Port: 13243 (13243), Dst Port: http-alt (8080), Seq: 1, Ack: 1
, Len: 366
Hypertext Transfer Protocol
POST /dbdata/_changes HTTP/1.1\r\n
[Expert Info (Chat/Sequence): POST /dbdata/_changes HTTP/1.1\r\n]
[Message: POST /dbdata/_changes HTTP/1.1\r\n]
[Severity level: Chat]
[Group: Sequence]
Request Method: POST
Request URI: /dbdata/_changes
Request Version: HTTP/1.1
Content-Type: application/json\r\n
User-Agent: CouchbaseLite/devbuild\r\n
Content-Length: 141\r\n
Connection: Keep-Alive\r\n
Authorization: Basic OTE5NDgwMTA5MzkwOmtvZGlhaw==\r\n
Credentials: xxxxx
[Full request URI:]
[HTTP request 1/1]
[Response in frame: 8221]
JavaScript Object Notation: application/json
Member Key: "limit"
Null value
Member Key: "style"
String value: all_docs
Member Key: "heartbeat"
Number value: 300000
Member Key: "channels"
String value: xxxxxxs
Member Key: "feed"
String value: normal
Member Key: "filter"
String value: sync_gateway/bychannel
No. Time Source Destination Protocol Length
while (running) {

            startTime = System.currentTimeMillis();

            URL url = getChangesFeedURL();
            if (usePOST) {
                HttpPost postRequest = new HttpPost(url.toString());
                postRequest.setHeader("Content-Type", "application/json");
                postRequest.addHeader("User-Agent", Manager.USER_AGENT);
                // TODO: why not apply gzip? iOS also does not apply gizp for /{db}/_changes

                StringEntity entity;
                try {
                    entity = new StringEntity(changesFeedPOSTBody());
                } catch (UnsupportedEncodingException e) {
                    throw new RuntimeException(e);
                request = postRequest;

            } else {
                request = new HttpGet(url.toString());

What is this TODO?

What the modules the gzip is supported in android?


Hi @nitz_couchbase,

Currently Android/Java does not apply gzip for /_changes because iOS implementation does not do it when I ported codes from iOS. According to iOS engineer, iOS does not apply gzip for /_changes because of its technical decision making.

If we can observe performance improvement by applying gzip for /_changes, we can implement gzip support for /_changes on Android/Java platform.


I think this would be a good idea. The changes feed can get pretty large on the first pull of a large database, and there’s a lot of redundant data in it.

This wasn’t done on iOS because for some complicated reasons we use a raw TCP socket to read the changes feed, instead of the higher level Cocoa NSURLConnection class that supports gzip automatically. It’s not impossible, just something we didn’t get around to.