That one side project you've been working on for years has finally taken off and now you need to think about load balancing. To handle the additional load you scale from 1 to 4 servers. Your servers have different specs so they can each handle a different amount of requests. You realize you need some load balancing software to handle this so you set off to build some.
Server 1: 357 requests Server 2: 651 requests Server 3: 101 requests Server 4: 230 requests
Requests always fill based on which server is most empty (current requests/total capacity). You can decide how to handle ties. Unfortunately, since today is April Fool's Day, someone introduced a bug into your code which is causing an issue with removing requests from each servers' queue. A request is removed from a random server after every 10 requests made to the load balencer. Eventually you won't be able to handle all the traffic you're getting and when this happens simply print out "Happy April Fools" and you're done.
Comments:
Daniel - 10 years, 9 months ago
My entry in C# using the same function I created to get the smallest integer a week or so ago. With a bit of debug code to watch to the process.
reply permalink
Pyro - 10 years, 9 months ago
My solution in python!
reply permalink
Anonymous - 10 years, 9 months ago
reply permalink
Hueho - 10 years, 9 months ago
Nobody will ever know!
reply permalink
Greg - 10 years, 9 months ago
Okay, gonna try this formatting thing again today...
reply permalink
Jt - 10 years, 9 months ago
C#, here's what I came up with
reply permalink
Daniel - 10 years, 9 months ago
I like the use of Linq in this one. Although I'd have never thought to throw an exception to print "Happy April Fools". Nice work. :)
reply permalink
Hueho - 10 years, 9 months ago
reply permalink