After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 708126 - pulling over http very slow
pulling over http very slow
Status: RESOLVED FIXED
Product: ostree
Classification: Infrastructure
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: OSTree maintainer(s)
OSTree maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-09-15 21:05 UTC by Sjoerd Simons
Modified: 2013-09-25 16:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (4.60 KB, patch)
2013-09-15 21:05 UTC, Sjoerd Simons
reviewed Details | Review
fetcher: Fix previous commit (3.31 KB, patch)
2013-09-24 18:12 UTC, Colin Walters
none Details | Review
fetcher: Fix previous commit (3.58 KB, patch)
2013-09-25 15:34 UTC, Colin Walters
needs-work Details | Review
fetcher: Fix previous commit (3.56 KB, patch)
2013-09-25 16:01 UTC, Colin Walters
committed Details | Review

Description Sjoerd Simons 2013-09-15 21:05:07 UTC
Created attachment 254991 [details] [review]
proposed patch

On a large ostree repository pulling over http slows to a crawl. Pulling
from localhost results in:
 5944 metadata, 63734 content objects fetched; 850509 KiB transferred in 1106 seconds
In other words about 800KiB/s. Some profiling shows that essentially
all of the CPU goes into libsoup doing its request bookkeeping instead
of into the actual downloading.

Adding a simple queue to limit to number of active request sent into
libsoup makes for a dramatic improvement:
 5944 metadata, 63734 content objects fetched; 850509 KiB transferred in 89 seconds
So around 9450 KiB/s.


Ideally libsoup would handle this situation better, but until that time this seems a reasonable workaround.
Comment 1 Colin Walters 2013-09-15 21:41:08 UTC
Review of attachment 254991 [details] [review]:

Two minor things, otherwise looks good, and please commit after fixes:

Thanks for profiling this!

::: src/libostree/ostree-fetcher.c
@@ +150,3 @@
+  gint max_conns;
+
+  g_queue_init (&self->pending_queue);

Also needs g_queue_clear() in finalize.

@@ +161,1 @@
 

Can you file a libsoup bug with the profile data, and then link to it here in a comment so it's easy to discover later why we're doing our own queuing?
Comment 2 Sjoerd Simons 2013-09-22 21:37:26 UTC
Filed #708591 against libsoup, profile data is not very useful though as it mostly shows a lot of time gets spent in mutex operations
Comment 3 Sjoerd Simons 2013-09-22 21:43:19 UTC
committed 5f310868f778d3691fcd269718258a8680394a01
Comment 4 Colin Walters 2013-09-24 18:12:57 UTC
Created attachment 255647 [details] [review]
fetcher: Fix previous commit

I was getting hangs in the test suite, and looking at the previous
commit, we were calling the async completion functions out of the
finalizer for the URI, which is weird.  I didn't analyze what's going
wrong, but what we really should be doing is processing our internal
queue after we've downloaded a file, and the request is about to be
finalized.

I suspect doing queue management from the finalizer created a circular
reference type situation.
Comment 5 Colin Walters 2013-09-25 15:34:38 UTC
Created attachment 255702 [details] [review]
fetcher: Fix previous commit

This patch deduplicates the queue processing bits too.
Comment 6 Sjoerd Simons 2013-09-25 15:42:12 UTC
Review of attachment 255702 [details] [review]:

::: src/libostree/ostree-fetcher.c
@@ +191,2 @@
+  next = g_queue_pop_head (&self->pending_queue);
+  while (next != NULL && self->outstanding < self->max_outstanding)

When self->outstanding hits the maximum this will drop the next uri you already popped of ?
Comment 7 Colin Walters 2013-09-25 16:01:20 UTC
Created attachment 255706 [details] [review]
fetcher: Fix previous commit

Updated for review comments
Comment 8 Sjoerd Simons 2013-09-25 16:05:52 UTC
Review of attachment 255706 [details] [review]:

looks good
Comment 9 Colin Walters 2013-09-25 16:09:30 UTC
Attachment 255706 [details] pushed as 7959ad9 - fetcher: Fix previous commit