Repository navigation
Add response compression to replicator - #6106
lacklacklack wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
It's a good start! But I think we'll still need the main bits on the server that do the compression. To make things much easier for us mochiweb already includes options to compress responses both for chunks and one-shots.
Chunks may be neat to try but a bit tricky at first. Let's see if we can do one-shot ones at least.
| maybe_decompress_response(_Headers, <<>>) -> | ||
| <<>>; | ||
| maybe_decompress_response(Headers, Body) -> | ||
| case lists:keyfind("content-encoding", 1, [{string:to_lower(K), V} || {K, V} <- Headers]) of |
There was a problem hiding this comment.
See how we use mochiweb_header make/get_value that has a facility to fetch headers in a case insensitive way
| .. versionadded:: 3.6 | ||
|
|
||
| Decompress gzip-encoded inbound response bodies (``_bulk_docs``, | ||
| ``_revs_diff``, ``_bulk_get``) received from the replication source. |
There was a problem hiding this comment.
minor nit: _revs_diff and _bulk_docs calls are for the target
There was a problem hiding this comment.
Leaving this file alone now, will add the relevant test when server side compression is implemented (follow-up PR)
Overview
The replicator now sends Accept-Encoding: gzip on outbound requests and automatically decompresses gzip-encoded responses received from the remote server.
Note: the responses_decompressed stat counter will only increment if the remote CouchDB server is configured to send gzip-compressed responses (server-side response compression). A follow-up PR will add that capability to CouchDB's HTTP layer.
Testing recommendations
Run a replication and check the stats:
Automated tests will be added with the server-side implementation.
Related Issues or Pull Requests
Add request compression to replicator - #6013
Checklist
rel/overlay/etc/default.inisrc/docsfolder