Multi server website
How could I optimize a large traffic website to do something like that to have a website work across multiple VPS's?
9 Replies
@Drakling:
Hello Linoders. I have a question for those of you with knowledge in this area. I'm sure that websites with large traffic like YouTube, Myspace, etc., can't be handled by just one server. Certainly they have multiple servers handling the website traffic, directing users to the server with the least load on it at the time.
How could I optimize a large traffic website to do something like that to have a website work across multiple VPS's?
True load balancing (load based) is best done with specialized hardware. There is likely little reason to use multiple VPS's in that case, instead just go up to a higher level.
Your example sites don't just use multiple servers, they use very large server farms.
VPS's are amazing examples of technology, but there's a point when sharing a physical box (which you don't have control of) with numerous neighbors (which you don't have control of) is a BAD idea.
That said, assuming you meant "larger then your typical personal/small organization blog" type large - then just split your Web engine from your database (i.e one VPS for Apache/Nginx and one VPS for your DB engine).
I guess I didn't communicate my need clearly enough to be understandable. It's not so much that I require more than one VPS to balance the load, which would be nice to be able to do it. My website's traffic comes from all over the world. Many have slow load times due to large distance from the server. I want to be able to route them to the quickest server for them at the instant they enter in my website's domain. Also, should for any reason, a network issue arise or a server crash, or if the server is getting too much traffic to handle, I'd like for another server to kick in and serve the webpages to any new incoming traffic as a backup until the primary server of that location is able to handle more traffic again. It's all about redundancy and availability.
I never tried and I don't know the reliability of the service, but
First
We need to get DNS setup as this is the cornerstone to any properly functioning website. You'll want something with failover and anycast so go with DNSMadeEasy (
Second
CDN Time. If you are planning on a lot of hits where users may be loading the same images/media/content over and over then this should definitely be off loaded to a CDN. Not only will it save you processing on your nodes/servers it will speed up the end users loading time (or should). You don't need hundreds of dollars to use a CDN as Softlayer resells Internap's CDN (which you can use as a caching CDN) at a pay as you go price (
The Setup
I prefer setting up DNS to do a round-robin/fail over approach with two application servers sitting at the front. This way you don't just have one server consuming space/power/money just in case of a fail over. These both have private ips along with your database server(s). On your app servers put whatever web front end things you need on them and anything that can help you use memory caching, if you can use memcached to limit database queries then more power to you.
Backups
Backup early and often, don't just trust linode's or anyone elses backups for that matter. And backups don't count if they are sitting on the same server or even in the same data center or using the same provider. Backups should be held offsite away from your primary provider.
If you do things properly there are many advantages to using a cloud/vps provider over using dedicated hardware.