Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 235857 - app-portage/mirrorselect-1.2: timing is slightly faulty
Summary: app-portage/mirrorselect-1.2: timing is slightly faulty
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Portage Tools Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-27 05:43 UTC by Steven Noonan
Modified: 2009-01-01 01:16 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
resolve hostname before URL fetch (resolve-hostname-before-fetch.patch,790 bytes, patch)
2008-12-05 23:46 UTC, Steven Noonan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Noonan 2008-08-27 05:43:27 UTC
I quickly scanned through the mirrorselect code, and it seems that a particularly long DNS resolution or TCP negotiation during the timed fetch would muck up the timing results. I think perhaps the best way to get accurate timings is to get a quick dummy file (i.e. a 1 byte or 1K file) just to resolve the hostname and "wake up" the path between the local machine and the remote machine, and THEN proceed to do the timing. Am I making sense?


Reproducible: Always

Steps to Reproduce:
Comment 1 Wormo (RETIRED) gentoo-dev 2008-08-27 06:20:19 UTC
Timing after DNS lookup was cached makes sense to me... let's see what the maintainers think of the idea.
Comment 2 Steven Noonan 2008-10-13 07:44:55 UTC
Any developers going to pick {on,up} this idea or shall I write a patch myself, or what?


Comment 3 michael@smith-li.com 2008-10-14 00:01:32 UTC
(In reply to comment #2)
> Any developers going to pick {on,up} this idea or shall I write a patch myself,
> or what?

Patches are always welcome!
Comment 4 Zac Medico gentoo-dev 2008-12-05 22:04:23 UTC
We can use socket.getaddrinfo() to resolve the host names to ip addresses. There's an example in the rsync_protocol_scan.py script that's attached to bug 168646.

Also, as mentioned in bug #244997, comment #4, I'd like to convert the download timing code to use urllib instead of spawing a fetcher.
Comment 5 Steven Noonan 2008-12-05 23:46:27 UTC
Created attachment 174369 [details, diff]
resolve hostname before URL fetch

I had forgotten about this bug until Zac's comment. Anyway. In the past 5 minutes, I whipped up a quick patch. Hopefully this is acceptable until urllib usage is implemented.
Comment 6 Steven Noonan 2008-12-06 00:21:19 UTC
Also, another problem that I wasn't clear about in my initial description:

You might notice that if you ping a server that you haven't connected to recently, the first ping latency is much higher than the following ping replies. Same thing with HTTP requests. This isn't just DNS resolution. This is basically "waking up" the path. I can't explain the latency in precise terms as I normally would, but I suspect that servers between point A and point B take a while to realize they need to route something. Once the route is figured out, things go nicely.
Comment 7 Zac Medico gentoo-dev 2008-12-31 07:51:10 UTC
I suppose we can do the "wake up" by opening a connection to the file without actually downloading it. Then we'll open the connection a second time for the timed run.
Comment 8 Zac Medico gentoo-dev 2009-01-01 01:16:22 UTC
This is fixed in mirrorselect-1.4 (accounts for dns and routing 'wake up').