diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt --- a/mercurial/help/config.txt +++ b/mercurial/help/config.txt @@ -1557,6 +1557,21 @@ Controls generic server settings. repositories to the exchange format required by the bundle1 data format can consume a lot of CPU. +``zliblevel`` + Integer between ``-1`` and ``9`` that controls the zlib compression level + for wire protocol commands that send zlib compressed output (notably the + commands that send repository history data). + + The default (``-1``) uses the default zlib compression level, which is + likely equivalent to ``6``. ``0`` means no compression. ``9`` means + maximum compression. + + Setting this option allows server operators to make trade-offs between + bandwidth and CPU used. Lowering the compression lowers CPU utilization + but sends more bytes to clients. + + This option only impacts the HTTP server. + ``smtp`` -------- diff --git a/mercurial/hgweb/protocol.py b/mercurial/hgweb/protocol.py --- a/mercurial/hgweb/protocol.py +++ b/mercurial/hgweb/protocol.py @@ -74,7 +74,7 @@ class webproto(wireproto.abstractserverp self.ui.ferr, self.ui.fout = self.oldio return val def groupchunks(self, cg): - z = zlib.compressobj() + z = zlib.compressobj(self.ui.configint('server', 'zliblevel', -1)) while True: chunk = cg.read(4096) if not chunk: