My idea for a smart fault tolerant assets / CDN balancer?

2 points by savr ↗ HN
My idea is to store assets on multiple networks/CDN providers. Label them assets-n1, assets-n2, etc. The user is given an roughly equal amount of assets to load from each network during the evaluation session. Load times are taken by javascript which are then sent back to the load balancer. Going forward the user is sent to the fastest/cheapest network through simple HTML markup. This allows the ability to add edge CDN nodes where the CDN provider is not located or is providing bad performance. This allows the automated routing around temporary bad performance.

I am a little inexperienced and wonder if I could get input for improvements from the HN community. Maybe you know someone who has implement something like this? Maybe you want to implement yourself and share it with everyone?

-- savr

4 comments

[ 2.3 ms ] story [ 20.4 ms ] thread
(comment deleted)
(comment deleted)
First, you probably don't want to serve all of your users the same CDN hosts - topological/geographical location will play a role: a user from US will see >100 msec latency from EU servers and vice versa. Second, the largest hit will be to users with empty caches - which will be further worsened by the evaluation session, so the first load will be at best mediocre for everyone. Third, getting a CDN which already does some sane load balancing (Amazon perhaps?) might be cheaper in the longer run than trying to DIY.
Professional CDN's do anycast so first load will be pretty sane. My problem is, areas like Australia are part of very few CDN networks. Most of them are a lot more expensive. For my Australian viewers it makes sense to use Akamai or have an Australian server. For my European viewers I am best having the assets served directly off my European servers. For other viewers I may be fine using a budget CDN like maxcdn or OVH's currently free in beta CDN.

This is my motive for such a solution. Plus I have the benefit of it being able to routing around problems with little manual effort.