Suppose we have the following pages and their portion weight:
Page1 50% Page2 20% Page3 15% Page4 15%
What would be a simple formula for serving pages based on their weight? I am using Ruby.
This is how I think.
actual_pct = Weightage tot_hits = Total hits against the URL served_pct = Served percentage for each page based on tot_hits served_to_actual_pct = served_pct x 100 / actual_pct
Above will provide me with an array of pages with their served_to_actual_pct . Suppose that I will serve pages based on their create timestamp when no pages are served yet or more than one page has the same served_to_actual_pct .
Based on this assumption, I can sort this array by create timestamp and then by served_to_actual_pct . At this point, the first page in the array will be the page that will be served.
source share