A/B Testing
Problem statement : Write AB testing logic in java, which can route to branches based on the percentage given. Example : A 25 B 75 In this case, 25% of traffic has to go to "A" and 75% to "B" Solution: Step 1: Find GCD of the percentages 25 and 75. GCD is 25 Divide them by the GCD which results in 1 and 3 is the converted percentage. Step 2: Build request lookup map for the sum of converted percentage. Have a counter map for each branches, for each request the selected lowest percentage branch counter will be incremented. Request Count Counter Map Converted Percentage Lowest Percentage A B A(1)...