[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: mirror.debian.net maintenance



Josip Rodin wrote:
>>From the looks of it, it sounds good, although I seem to see a few problems:
> * it might be a bit resource-intensive given that it constructs the
>   mirror-to-country mapping every time?

It reads the mirror file every time the script is initialized and stores
the mapping in an array, but PDNS keeps the pipe to the script open, so
it's not a big impact.

> * I'm not sure, but does it require one to update
>   /usr/local/share/GeoIP/GeoIP.dat somehow?

It would depend on the frequency with which this database gets updated
to a noticeable extent, but I guess yes, one should update it. AFAIK the
package geoip-bin provides a handy command for automating that, though...

> * I don't see how pick_best_mirror() ever does any load balancing, when
>   it will always return the same mirror (the one with the best score),
>   given the same input variables?

Actually I hadn't thought about this. My original idea was just
returning the right ftp.<cc>.d.o for the originating country, but now
that you mention it, we could merge our works in a much better way: We
can scrap a huge chunk from my script and just leave the functionality
to resolve and point to the mirror.d.n structure.
As you could see, my script isn't doing any incredible heuristics, just
some very simple scoring which I'm not even sure are of any help to
mirror admins (the whole prioritizing leafs over push-primaries thing),
so pointing to a big round-robin list of mirrors in that country should
be enough, and you've got that part easily set up.
Plus, we can benefit from your virtual host filtering! :)

> * you may wish to replace the wget invocation with one of the HTTP Perl
>   modules, it's really simple enough :)

That's actually leftover cruft, just to make sure it wouldn't be run
without a mirrors file. It was actually also being updated via cron.
But if you agree to the above suggestion, then this point is moot,
anyway! :)

>> That's precisely my intention, but since I'm currently using PDNS, I'm
>> afraid the DSA folks will have some sort of problem with it. But I guess
>> it can't hurt to ask! :)
> 
> I'm fine with pdns, so I can help you test and maybe convince them :)

Thanks, how can we kick this off then?


Tow last things:

I've included a patch for mirror_list.pl to generate a complete list of
mirrors for an entire arch, no matter the country (I inverted the ${cc}
and ${arch} order in the %zone_entries hash to be able to do it in the
same loop structure).
The idea is to use it as a last case default if the geomirror script
can't find the country, instead of hard-coding a default.
I'm not sure if it's a great idea since it duplicates the number of
entries, but if you think it's ok, I'd say it's better then the alternative.

Since the TTL on the mirrors is about 4 hours, couldn't the interval
between cron zone updates be lowered to perhaps twice a day, at least? I
figure it would lower the chances of people stumbling into dead mirrors
once they're temporarily - or otherwise - removed from the masterlist.


Cheers and thanks for the help!

-- 
Leo "costela" Antunes
[insert a witty retort here]
--- mirror_list.pl.orig	2008-03-28 21:34:47.000000000 +0100
+++ mirror_list.pl	2008-03-29 01:35:06.000000000 +0100
@@ -1350,9 +1350,9 @@
   # we later execute all the 'delete' statements unconditionally
   # (because we need to clear out any old data even if there's no
   # new data to add in - indeed, especially then)
-  foreach my $cc (@ccodes) {
-    foreach my $arch (keys %arches) {
-      $zone_entries{$cc}{$arch}{0} = 0;
+  foreach my $arch (keys %arches) {
+    foreach my $cc (@ccodes) {
+      $zone_entries{$arch}{$cc}{0} = 0;
     }
   }
 
@@ -1443,10 +1443,10 @@
 
     foreach my $arch (@site_arches) {
       foreach my $a (@site_ip_v4) {
-        $zone_entries{$cc}{$arch}{$a} = 1 unless exists $zone_entries{$cc}{$arch}{$a};
+        $zone_entries{$arch}{$cc}{$a} = 1 unless exists $zone_entries{$arch}{$cc}{$a};
       }
   #    foreach my $aaaa (@site_ip_v6) {
-  #      $zone_entries{$cc}{$arch}{$a} = 1 unless exists $zone_entries{$cc}{$arch}{$a};
+  #      $zone_entries{$arch}{$cc}{$a} = 1 unless exists $zone_entries{$arch}{$cc}{$a};
   #    }
     }
   }
@@ -1457,19 +1457,18 @@
   print "server samosa.debian.org\n";
   print "zone mirror.debian.net\n";
 
-  foreach my $cc (sort keys %zone_entries) {
-    foreach my $arch (sort keys %{$zone_entries{$cc}}) {
+  foreach my $arch (sort keys %zone_entries) {
+    print "update delete $arch.mirror.debian.net.\n";
+    foreach my $cc (sort keys %{$zone_entries{$arch}}) {
       # we need to do the 'update delete' in order to flush everything out,
       # because there is no old state (which would be used for a nice
       # incremental removal of old data)
       print "update delete $cc.$arch.mirror.debian.net.\n";
-      foreach my $a (sort keys %{$zone_entries{$cc}{$arch}}) {
+      foreach my $a (sort keys %{$zone_entries{$arch}{$cc}}) {
         next if ($a eq 0);
         # poor man's IPv6 detection :)
-        print "update add $cc.$arch.mirror.debian.net. 14400";
-        if ($a !~ /:/) { print " A "; }
-        else { print " AAAA "; }
-        print "$a\n";
+        print "update add $cc.$arch.mirror.debian.net. 14400".(($a !~ /:/)?" A ":" AAAA ")."$a\n";
+        print "update add $arch.mirror.debian.net. 14400".(($a !~ /:/)?" A ":" AAAA ")."$a\n";
       }
     }
     # we also need to 'send' more often than just once, because if we

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: