You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by "Dan Mahoney, System Admin" <da...@prime.gushi.org> on 2013/03/24 05:57:49 UTC

Weighted MIRRORED.BY files?

Hey there.

The SA wiki says:

sa-update also uses a mirror file which lists all of the URLs where the 
update can be downloaded from, optionally including weights for different 
mirrors.

But there's no documentation or examples given for weighting.  Anyone 
closer to the code know what this would look like?

-Dan

-- 

--------Dan Mahoney--------
Techie,  Sysadmin,  WebGeek
Gushi on efnet/undernet IRC
ICQ: 13735144   AIM: LarpGM
Site:  http://www.gushi.org
---------------------------


Re: [sa-list] Re: Weighted MIRRORED.BY files?

Posted by "Dan Mahoney, System Admin" <da...@prime.gushi.org>.
On Sun, 24 Mar 2013, Mark Martinec wrote:

> On Sunday March 24 2013 05:57:49 Dan Mahoney, System Admin wrote:
>> sa-update also uses a mirror file which lists all of the URLs where the
>> update can be downloaded from, optionally including weights for different
>> mirrors.
>> But there's no documentation or examples given for weighting.  Anyone
>> closer to the code know what this would look like?
>
> $ curl http://spamassassin.apache.org/updates/MIRRORED.BY
> http://sa-update.dnswl.org/ weight=1
> http://www.sa-update.pccc.com/ weight=5
> http://sa-update.secnap.net/ weight=5
>
>
> sa-update has the following in its comments:
>
> # choose a random integer between 0 and the total weight of all mirrors
> # loop through the mirrors from largest to smallest weight
> # if random number is < largest weight, use it
> # otherwise, random number -= largest, remove mirror from list, try again
> # eventually, there'll just be 1 mirror left in $mirrors[0] and it'll be used
> #
> sub choose_mirror {
>  my($mirror_list) = @_;
> [...]

I'll add this on to the wiki.

-Dan

-- 

--------Dan Mahoney--------
Techie,  Sysadmin,  WebGeek
Gushi on efnet/undernet IRC
ICQ: 13735144   AIM: LarpGM
Site:  http://www.gushi.org
---------------------------


Re: Weighted MIRRORED.BY files?

Posted by Mark Martinec <Ma...@ijs.si>.
On Sunday March 24 2013 05:57:49 Dan Mahoney, System Admin wrote:
> sa-update also uses a mirror file which lists all of the URLs where the
> update can be downloaded from, optionally including weights for different
> mirrors.
> But there's no documentation or examples given for weighting.  Anyone
> closer to the code know what this would look like?

$ curl http://spamassassin.apache.org/updates/MIRRORED.BY
http://sa-update.dnswl.org/ weight=1
http://www.sa-update.pccc.com/ weight=5
http://sa-update.secnap.net/ weight=5


sa-update has the following in its comments:

# choose a random integer between 0 and the total weight of all mirrors
# loop through the mirrors from largest to smallest weight
# if random number is < largest weight, use it
# otherwise, random number -= largest, remove mirror from list, try again
# eventually, there'll just be 1 mirror left in $mirrors[0] and it'll be used
# 
sub choose_mirror {
  my($mirror_list) = @_;
[...]



Mark