Add response compression to replicator - #6106
Open
lacklacklack wants to merge 1 commit into
Open
Conversation
nickva
requested changes
Sep 9, 2026
Contributor
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 |
Contributor
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. |
Contributor
There was a problem hiding this comment.
minor nit: _revs_diff and _bulk_docs calls are for the target
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Adds gzip compression for outbound HTTP responses when the client sends
Accept-Encoding: gzip.The replicator now sends
Accept-Encoding: gzipon outbound requests(
_bulk_docs,_revs_diff,_bulk_get) and automatically decompressesgzip responses received from the remote server.
Testing recommendations
Run a replication and check the stats:
Automated tests:
couch_replicator_compression_testsinsrc/couch_replicator/test/eunit/.Related Issues or Pull Requests
Add request compression to replicator - #6013
Checklist
rel/overlay/etc/default.inisrc/docsfolder