Author: poeml Date: Thu Feb 13 03:59:32 2014 New Revision: 8479 URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8479&view=rev Log: docs/usecases: - w.i.p. - explain score values - thereby migrating content from the to-be-obsoleted FAQ file in svn Modified: trunk/FAQ trunk/docs/usecases.rst Modified: trunk/FAQ URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/FAQ?rev=8479&r1=8478&r2=8479&view=diff ============================================================================== --- trunk/FAQ (original) +++ trunk/FAQ Thu Feb 13 03:59:32 2014 _at_@ -2,57 +2,6 @@ http://mirrorbrain.org/faq/ has answers to some more general questions. - -Q: What is the effect of the score values? -A: Higher score means a greater chance of being picked. Some kind of - weighted randomization. In the end, it matters how it compares to the - other scores. i.e., if all server have a score of 30, there are picked - with the same frequency. If only one mirror has a given file, its score - is meaningless. - - This should give a picture how the score values behave (output captured from a - test program), comparing 3 scores: - - % ./rand.py 100000 100 100 100 - score: 100 count: 33279 (33%) - score: 100 count: 33378 (33%) - score: 100 count: 33343 (33%) - % ./rand.py 100000 100 50 50 - score: 100 count: 58148 (58%) - score: 50 count: 20893 (20%) - score: 50 count: 20959 (20%) - % ./rand.py 100000 100 200 10 - score: 100 count: 24359 (24%) - score: 200 count: 73588 (73%) - score: 10 count: 2053 (2%) - - % ./randint 100000 100 100 100 - score: 100 count: 33474 (33.47%) - score: 100 count: 33118 (33.12%) - score: 100 count: 33408 (33.41%) - (100.00%) - % ./randint 100000 100 50 50 - score: 100 count: 58301 (58.30%) - score: 50 count: 20840 (20.84%) - score: 50 count: 20859 (20.86%) - (100.00%) - % ./randint 100000 100 200 10 - score: 100 count: 24620 (24.62%) - score: 200 count: 73337 (73.34%) - score: 10 count: 2043 (2.04%) - (100.00%) - - - Or as a more real-life example, imagine that you have a mirror with - score=50, and other mirrors in the same country with the following scores: - 150, 100, 100, 100, 100, 50, 50, 30 -- then you can estimate: - - 50 / (150+100+100+100+100+50+50+30) = 0.7 - - Thus, about 7% of requests will routed to the mirror. - - (However, remeber that mirrors are not always "complete", so they might not - always be considered at all.) Q: How often does the scan take place? What I am wondering is; if I chose to Modified: trunk/docs/usecases.rst URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/docs/usecases.rst?rev=8479&r1=8478&r2=8479&view=diff ============================================================================== --- trunk/docs/usecases.rst (original) +++ trunk/docs/usecases.rst Thu Feb 13 03:59:32 2014 _at_@ -18,4 +18,97 @@ ... -More to come! + +Giving mirrors a different weight - balancing the load +------------------------------------------------------------------------- + +The main criterion for load balancing is of course the network proximity, and +(failing that) the geographic location (country/region); but sometimes there +are several matching mirrors that are in the same country or network. Then +there are two additional mechanisms for choosing the best mirror: + +1) influencing preference by an assigned "score" value +2) geographical distance + +These two mechanisms work together. Let's look at them in detail now. + +1) Score value +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +The ``score`` value that is assigned to each mirrir is a unitless number +where the absolute value doesn't matter, but the relative height in +comparison to other mirrors makes the difference. The default value is always +``100``. If mirrors have the same score, they are randomly used equally +often. Thus, the load is distributed equally. If the values differ, the +randomization becomes "weighted" towards the mirrors with higher scores. + +If there is only one mirror in a country, the value doesn't matter, because +country is the stronger criterion. When there are several mirrors per +country, you'll often simply stick to the default value of 100. However, if +there's a small mirror that can't take much traffic, you can assign it a e.g. +20 or 50, and it will get much less load. How much, depends on the number of +number of other mirrors available in the same country. If, on the other hand, +you have a particular powerful mirror, you could assign it a score of 200, for +instance. + +Here's an example with three mirrors in different combinations of score values:: + + score 100 100 100 + chance 33% 33% 33% + + score 100 50 50 + chance 60% 20% 20% + + score 100 200 10 + chance 25% 73% 2% + + +In real life, you might have more mirrors. The effect of score values can be +approximated with the following formula:: + + s1 + P1 = ---------------------------- * 100 + s1 + (s2 + s3 + s4 + ...) + + where + P1 = percentage of requests to a mirror + s1 = score of mirror + S2 ... = scores of the other mirrors + + +Imagine that you have a mirror with ``score=50``, and other +mirrors in the same country with the following scores: +``150, 100, 100, 100, 100, 50, 50, 30``. + + + + 50 / (50 + 150+100+100+100+100+50+50+30) = 0.06 + + +or, more general:: + + + + 50 + ----------------------------------- * 100 = 6% + 50 + 150+100+100+100+100+50+50+30 + +Thus, about 6% of requests will routed to that mirror. + +(However, also remeber that mirrors might not always be complete mirrors, so +if they don't have certain files, they are automatically left out from the +equation. The calculation is always file-based, and thus never static.) + + + + + + +.. /* the smaller, the smaller the effect of a raised prio in comparison to distance */ +.. /* 5000000 -> mirror in 200km distance is preferred already when it has prio 100 +.. * 1000000 -> mirror in 200km distance is preferred not before it has prio 300 +.. * (compared to 100 as normal priority for other mirrors, and tested in +.. * Germany, which is a small country with many mirrors) */ +.. #define DISTANCE_PRIO 2000000 + + _______________________________________________ mirrorbrain-commits mailing list Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/ Note: To remove yourself from this list, send a mail with the content unsubscribe to the address mirrorbrain-commits-request_at_mirrorbrain.orgReceived on Thu Feb 13 2014 - 02:59:37 GMT
This archive was generated by hypermail 2.3.0 : Thu Feb 13 2014 - 03:17:08 GMT