I'm planning on releasing an iOS app that downloads video from my server. If hundreds of people on the launch day try to do this, then my website and the services that my server provides will clearly go down. How do you host a website on multiple servers? When someone tries to access my site, how is their request passed to an available server? How do Apple and Google do it? Thanks for your help.
Well as for the big guys (Google, Apple, etc.) they have sophisticated, and expensive, hardware the routes traffic.
A simpler solution would be to setup your multiple hosts and have a single host that rotates the requests.
Say we have 5 servers for hosting the video, named VideoHostN and we have a single server separate from those that keeps track of them being used name RoutingHost.
The first iOS client requests the address to get the video from RoutingHost. RoutingHost returns the address on VideoHost1.
Second iOS client requests. RoutingHost replies with VideoHost2.
So on till it hits our hypothetical max, VideoHost5, and resets to VideoHost1.
Just need some simple server side code keep track of which VideoHost to use next and returns the address to it.
It's a cheap and easy way to spread users out. This doesn't guarantee that you won't get some users clogged up on any given VideoHost. It's random chance that several users with slow connections could all end up pulling from the same location, but it's a start.
You can do load balancing as per @PeeHaa's link to Wikipedia's article for info here. This requires some know how and money and time to setup. Large companies like Google and Apple use technology they have written for themselves and trying to mimic them is an expensive and an overkill solution. If you do load balancing you will want to use something much smaller than what they do.
Or you can use cloud servers to host your videos or other content. They are called Content Distribution Networks (CDNS) and they can do much more than simple file hosting now. The benefit of these sites is that they use technology like what Google has created to create load balancing and they sell you the service based off of exactly the amount of data or cycles you consume on their servers. This means your cost will grow at the same rate as you usage so as long as you have good revenue model you will always have funds to pay for the service. Some great companies for smaller users are:
They are many more than these three. Also, the other benefit of CDN is that you content is no on one server but on a network across the globe. The CDNs do this so that the content always comes from the server closest to the user. Setting up 2+ servers in one location will never give you the same delivery speed benefits that a CDN can.
For the record, I don't work for any of these companies. I have used Amazon's Web Services for video hosting on my companies website and it has been a huge benefit.
A free load balancer software such as ZenLoader would do the trick. It's an open source software, you only pay if you need support.
I hear it will cover your requirements if you already have purchased the servers.
I would use Scalr on ec2 to monitor your servers automatically, it's open source and works very well with AWS services. So if your app server starts to get hit with too much traffic Scalr will automatically bring up more servers and balance the load for you. It will also automatically backup your databases if one goes down bringing up slaves as masters. So your application servers and database servers are all monitored and scaled as needed.