comparison mercurial/bundle2.py @ 35787:a84dbc87dae9

exchange: send bundle2 stream clones uncompressed Stream clones don't compress well. And compression undermines a point of stream clones which is to trade significant CPU reductions by increasing size. Building upon our introduction of metadata to communicate bundle information back to callers of exchange.getbundlechunks(), we add an attribute to the bundler that communicates whether the bundle is best left uncompressed. We return this attribute as part of the bundle metadata. And the wire protocol honors it when determining whether to compress the wire protocol response. The added test demonstrates that the raw result from the wire protocol is not compressed. It also demonstrates that the server will serve stream responses when the feature isn't enabled. We'll address that in another commit. The effect of this change is that server-side CPU usage for bundle2 stream clones is significantly reduced by removing zstd compression. For the mozilla-unified repository: before: 37.69 user 8.01 system after: 27.38 user 7.34 system Assuming things are CPU bound, that ~10s reduction would translate to faster clones on the client. zstd can decompress at >1 GB/s. So the overhead from decompression on the client is small in the grand scheme of things. But if zlib compression were being used, the overhead would be much greater. Differential Revision: https://phab.mercurial-scm.org/D1926
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 22 Jan 2018 12:12:29 -0800
parents c97639ad6874
children b116a66bcc44
comparison
equal deleted inserted replaced
35786:8144f1b07e21 35787:a84dbc87dae9
597 self._params = [] 597 self._params = []
598 self._parts = [] 598 self._parts = []
599 self.capabilities = dict(capabilities) 599 self.capabilities = dict(capabilities)
600 self._compengine = util.compengines.forbundletype('UN') 600 self._compengine = util.compengines.forbundletype('UN')
601 self._compopts = None 601 self._compopts = None
602 # If compression is being handled by a consumer of the raw
603 # data (e.g. the wire protocol), unsetting this flag tells
604 # consumers that the bundle is best left uncompressed.
605 self.prefercompressed = True
602 606
603 def setcompression(self, alg, compopts=None): 607 def setcompression(self, alg, compopts=None):
604 """setup core part compression to <alg>""" 608 """setup core part compression to <alg>"""
605 if alg in (None, 'UN'): 609 if alg in (None, 'UN'):
606 return 610 return