GNOME Bugzilla – Bug 708126
pulling over http very slow
Last modified: 2013-09-25 16:09:33 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.
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?
Filed #708591 against libsoup, profile data is not very useful though as it mostly shows a lot of time gets spent in mutex operations
committed 5f310868f778d3691fcd269718258a8680394a01
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.
Created attachment 255702 [details] [review] fetcher: Fix previous commit This patch deduplicates the queue processing bits too.
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 ?
Created attachment 255706 [details] [review] fetcher: Fix previous commit Updated for review comments
Review of attachment 255706 [details] [review]: looks good
Attachment 255706 [details] pushed as 7959ad9 - fetcher: Fix previous commit