[PATCH 4 of 4] changelog: disable delta chains
pierre-yves.david at ens-lyon.org
Tue Sep 27 10:52:01 EDT 2016
On 09/24/2016 09:37 PM, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1474745226 25200
> # Sat Sep 24 12:27:06 2016 -0700
> # Node ID db0073124b876cc8b8e1201ba1b867b56c8a0448
> # Parent 712281c3ab4b6e6e8ae109fa0673d4d6321d82fd
> changelog: disable delta chains
This patch seems overall surprising but great. I've some
question/feedback regarding the impact on changegroup generation, see
below for details.
> Delta chains are also used during changegroup generation. This
> operation essentially converts a series of revisions to one large
> delta chain. And changegroup generation is smart: if the delta in
> the revlog matches what the changegroup is emitting, it will reuse
> the delta instead of recalculating it. We can measure the impact
> removing changelog delta chains has on changegroup generation via
> `hg perfchangegroupchangelog`:
But changegroup version 2 and 3 are a bit smarter than just a plain
deltra chain as they support general delta. Therefore we can have
changegroup emit a non-delta chain for changelog (using 'nullid' as the
delta base for all entry).
> ! wall 1.589245 comb 1.590000 user 1.590000 sys 0.000000 (best of 7)
> ! wall 1.788060 comb 1.790000 user 1.790000 sys 0.000000 (best of 6)
> ! wall 17.382585 comb 17.380000 user 17.340000 sys 0.040000 (best of 3)
> ! wall 20.161357 comb 20.160000 user 20.120000 sys 0.040000 (best of 3)
> ! wall 18.722839 comb 18.720000 user 18.680000 sys 0.040000 (best of 3)
> ! wall 21.168075 comb 21.170000 user 21.130000 sys 0.040000 (best of 3)
> ! wall 4.828317 comb 4.830000 user 4.820000 sys 0.010000 (best of 3)
> ! wall 5.415455 comb 5.420000 user 5.410000 sys 0.010000 (best of 3)
> The data shows eliminating delta chains makes the changelog part of
> changegroup generation slower. This is expected since we now have to
> compute deltas for revisions where we could recycle the delta before.
> It is worth putting this regression into context of overall changegroup
> times. Here is the rough total CPU time spent in changegroup generation
> for various repos while using delta chains on the changelog:
> Repo CPU Time (s) CPU Time w/ compression
> hg 4.50 7.05
> mozilla-central 111.1 222.0
> pypy 28.68 75.5
> Before compression, removing delta chains from the changegroup adds
> ~4.4% overhead to hg changegroup generation, 1.3% to mozilla-central,
> and 2.0% to pypy. When you factor in zlib compression, these percentages
> are roughly divided by 2.
Even if the impact is small, it in the range of the performance gain we
win on local operation, so still kind of relevant (otherwise that whole
change would not be relevant). Can you experiment with a no-delta
changelog chain the changegroup and tell us how it looks like ?
> While the increased CPU usage for changegroup generation is unfortunate,
> I think it is acceptable because the percentage is small, server
> operators (those likely impacted most by this) have other mechanisms
> to mitigate CPU consumption (namely reducing zlib compression level and
> pre-generated clone bundles), and because there is room to optimize this
> in the future. For example, we could introduce a new changegroup format
> that allowed changelog entries to be represented differently so we don't
> have to compute deltas.
(So as pointed above, I believe the current format already supports what
you are looking for).
> Removing delta chains from the changelog also opens the door to future
> I just mentioned the possibility of a new changegroup representation for
> changelog data.
> Storing changelog entries as independent entities also enables more
> advanced storage options. We could refactor the changelog API to
> distinguish between a supported data access API and the internal
> mechanism for storing that data (much like the manifest API refactor
> currently under way). This would make it easier to swap in alternative
> storage backends for the changelog, such as SQLite or some such. This
> in turn would make it easier to support features like shallow clone,
> where changesets may arrive to local storage out of DAG order.
I remember Durham presenting related plan during the latest sprint in
Mozilla SF. I'm not too sure what the progress is as there is no wiki
page about it but I assume we'll know more about it at the coming sprint.
That said, this part of the description seems a bit too disconnect to
the actual change. I would advise for starting a mailing list thread
about that after that path gets in.
> Another possibility is enabling dictionary compression on revlogs.
> Currently, each entry is compressed in isolation. Now that we have a
> compressed representation of each revision and each revision has similar
> structure, we would likely see benefits by using dictionary compression.
> We can't do this with zlib. But it does enable easier experimentation
> with compression formats that do (fun fact: experimenting with zstd
> led me down a path that resulted in this patch).
> There is potentially room to add a revlog flag indicating whether not
> to store delta chains. This could potentially lead to more read path
> optimizations to skip delta chain computation. But I'm not convinced
> it is worthwhile and worth wasting a revlog flag bit on.
Same feedback, "interesting but should probably be on the list instead
of in that commit message.
More information about the Mercurial-devel