too many http requests with 2a fetches

Bug #402114 reported by Robert Collins
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bazaar
Invalid
Critical
Unassigned

Bug Description

bzr branch http://bazaar.launchpad.net/~launchpad-pqm/launchpad/devel
watch the requests. Weep. That is all.

 affects bzr
 importance critical
 status triaged

-Rob

--

Revision history for this message
John A Meinel (jameinel) wrote :

So we don't get away from having to read the index files and that repository has 18 pack files, for 18*5=90 index files that we have to probe to find revisions that we are looking for.
(I would expect 'bzr pack' to make a fairly significant difference on http download times from that repository)

Going further, the group fetch code doesn't buffer/request more than one group at a time. This could certainly be improved, though we want to avoid the place we were at before, where we tried to buffer everything at once.

Though according to some other reports we may be buffering more than we realize given the memory consumption numbers.

Revision history for this message
John A Meinel (jameinel) wrote :
Download full text (9.8 KiB)

I'm uploading an attachment of the debug log with -Dhttp

The overall download did take ~60 minutes. I see that in the first 1 minute we are just probing indices (this could be the revision ancestry graph search) before we start downloading any actual .pack content.

After that, I see a lot of reads where we are grabbing the first 40 bytes (the pack header) and then ~540 bytes further on in the file.
It does look like we are at least reading new data each time. I don't understand why the data is all discrete. Perhaps each revision, etc is in its own group, and thus each one averages approximately the same size (small, of course).

I might poke at it a bit, but I'm guessing it is just that we read one group at a time, while we could be buffering a bit more than that. (The trick is figuring out how to make a bigger request without overflowing the LRUCache, etc.)

I also don't understand how we could get that many groups in a single pack file without them being collapsed together. Perhaps the autopack code isn't properly grouping revision texts? (I'm assuming it is revs because it is the first item being read.)

Note that we spend from approx 75s to 160s just accessing 585 byte chunks from:
   http readv of 1d0252d21c3632af79515b5e8c497c15.pack

It does take us until 350s (~6min) until we start looking at the .iix, and then it takes until 556s before we start reading .cix, and 2063s before we start reading .tix.

   3.5 finish reading format, etc files and start reading .rix
  73.9 start reading revision texts
 353.3 start reading .iix
 380.2 read inventory .pack data
 555.9 start reading root .cix
 627.9 reading chk .pack data
 907.1 read layer 2 .cix
1828.5 read layer 3 .cix
1911.2 .cix
2046.8 .cix
2063.4 read .tix
2247.8 read .pack
3651.8 finished reading text content, reading branch.conf and tags
3683.5 finished

I'm also seeing this, which seems a bit disconcerting:

384.270 creating new compressed block on-the-fly in 0.000s 11139 bytes => 365 bytes
384.271 stripping trailing bytes from groupcompress block 11046 => 275
384.274 creating new compressed block on-the-fly in 0.001s 11139 bytes => 2757 bytes
384.277 creating new compressed block on-the-fly in 0.000s 11046 bytes => 269 bytes
384.278 creating new compressed block on-the-fly in 0.000s 11139 bytes => 917 bytes
384.281 creating new compressed block on-the-fly in 0.001s 11046 bytes => 2832 bytes
384.298 creating new compressed block on-the-fly in 0.003s 11139 bytes => 5331 bytes
384.306 creating new compressed block on-the-fly in 0.000s 11046 bytes => 782 bytes
384.309 creating new compressed block on-the-fly in 0.002s 11139 bytes => 2386 bytes
384.313 http readv of 0ca910916f100de2c571f97d71c6bf9f.pack offsets => 2 collapsed 2
384.314 > GET /~launchpad-pqm/launchpad/devel/.bzr/repository/packs/0ca910916f100de2c571f97d71c6bf9f.pack

Basically, it seems to be taking two modest sized groups (11kb) and splitting
them back up into fairly small groups. Perhaps this is a 'groupcompress sort
order' issue. That because we think the optimal order is slightly different
than what was previously on disk, we think we need to break up the groups on
the fly.
Though we shou...

Revision history for this message
John A Meinel (jameinel) wrote :

Note that I also think the fragmentation issue is affecting regular fetch. As my 'size-on-disk' after running 'bzr pack' is 106MB of .pack files. But the largest .pack in the launchpad repo is 160MB, which is already 60% too large.

Now, doing 'bzr branch' with a loosely packed repository will generate a new repository that has a single .pack file, but has the *same size* as the loosely packed repo. Which means that we won't notice that we really do need to repack this repo, because while the groups themselves are too loose, they are all sitting in a single .pack file.

Revision history for this message
John A Meinel (jameinel) wrote :

I'm splitting some of the findings out into separate bugs:
  bug #402623 .cix thrashing causes us to re-download the whole index multiple times
  bug #402645 fetch for --2a formats seems to be fragmenting
  bug #402652 smart fetch for --2a does not opportunistically combine groups
  bug #402656 revision texts do not seem to be properly combined into groups
  bug #402657 2a fetch over dumb transport reads one group at a time
  bug #402662 chk groups possibly need more clustering

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 402114] Re: too many http requests with 2a fetches

Thanks for digging into this John. Whats left in this bug that is
specific to it?

-Rob

Revision history for this message
John A Meinel (jameinel) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Collins wrote:
> Thanks for digging into this John. Whats left in this bug that is
> specific to it?
>
> -Rob
>

I don't think I left anything that was not covered in another more
focused bug. Mostly though I was leaving this around as a way to
aggregate it. (sort of the MASTER idea Martin had.)

John
=:->

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpmRIQACgkQJdeBCYSNAAOwQwCfVHEX7p1mSSTe8mengctYZZwW
uR4AnAtc2bIZ9hFreuDLnxClKXB8GKVJ
=u901
-----END PGP SIGNATURE-----

Revision history for this message
Robert Collins (lifeless) wrote :

I'd be inclined to close this bug then, as LP doesn't have bug
dependencies. The MASTER thing works for dealing with dupes quite
well :)

-Rob

Revision history for this message
Robert Collins (lifeless) wrote :

Closed as there is nothing more to do on this specific bug.

Changed in bzr:
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.