Scaling Up: Picking The Right Setup
Out Of Date Warning
Languages change. Perspectives are different. Ideas move on. This article was published on March 30, 2009 which is more than two years ago. It may be out of date. You should verify that technical information in this article is still current before relying upon it for your own purposes.
Now that your application is running at peak performance and you’ve decided that it’s time to scale, let’s talk about the right setup.
The modern age has brought us lots of new ways to take a growing site and scale it. From Amazon Web Services to cloud computing and grid computing, to Mosso and Akamai, there are lots of options we should consider. This article won’t make a recommendation as to which you should pick; it will simply discuss what each service has to offer and leave it up to you.
The Old Fashioned Way: New Hardware
Your first option is the old standby, buying new hardware. This may be a viable and necessary option. For example, if the site is a local intranet, you may need to invest in hardware because you want to maintain the servers in house. You may also determine that your site needs new hardware regardless of how you scale in the cloud or on the grid. Adding your own hardware is probably your most expensive option, however, and requires a massive capital investment on your part. Still, it is an option that you may want to consider.
The New-Fashioned Way: Dedicated Hosted Servers
Joseph Scott pointed out a deficiency with this article, and that is that I failed to discuss dedicated hosted servers. I am correcting this deficiency, after his comment was posted. It is possible to rent dedicated servers that are hosted elsewhere. This has the benefit of the dedicated servers purchased above, but the added benefit of not having the capital expense associated with buying a new server. Many companies exist that do this, including two of the largest, Rackspace and MediaTemple.
A subset of the dedicated hosted server is the dedicated virtual server, which may offer the same performance for a bit less money. Rackspace’s subsidiary, Slicehost provides this sort of service, and hosts BrandonSavage.net with no trouble.
Dedicated hosted and virtual servers are great because you don’t have to worry about uptime (that’s handled for you) and, in many cases, the software is installed for you by the company that owns the server. Still you have full control over the system, with the ability to configure it, and the server is usually a dedicated box reserved just for you, meaning you get the full benefit of the processor, RAM, and storage. And if something goes wrong at 3 am it’s someone else’s responsibility to fix it – and you can usually call them for help.
There are some drawbacks to virtual or dedicated servers. Namely, in the long run it can cost more to host than to own your own servers, especially if you already have a data center (though when you factor in the costs of renting data center space, connecting the servers and paying a systems administrator this might not be true). Also, getting a second server set up can sometimes take some time – I remember a particular example where a company I worked for had a fast growing site that needed to scale immediately and was told by one company that it would take seven days to install a load balancer. “Seven days!” they exclaimed. “We need this in seven HOURS.” (The company was ultimately able to work with our timeframe.)
Using The Cloud: Amazon Web Services
Amazon has a number of new web services that allow you to create virtual servers almost on command. These servers can be started up and shut down at will, meaning they make it easier to scale up and down as needed. Amazon charges by the hour for these services, as well as by how much data you’re using and how much space you need. You can check out the full compliment of Amazon services by going to their website, http://aws.amazon.com/. Amazon offers virtual servers, a data store, and hosting in both the United States and Europe (for an additional charge).
The benefit of using Amazon’s web services is that you can scale up more quickly, your data is less prone to hardware failure, and you have the ability to create instances of servers on a whim while paying only for the time you actually use. The drawbacks are that your servers are hosted by someone else; the services can also be expensive if you have a high traffic site, and the servers do have some time to start up meaning you have to monitor load and anticipate additional needs. Also, Amazon does not yet provide an automatic load balancer, so you’ll still have to add new servers to your pool.
Automated Scaling: Services Like Mosso
It’s becoming popular now to use services that are capable of scaling on demand – that is, they can accept more traffic and allocate more resources to your site as they are needed. The obvious benefit is that your site will always be able to handle new traffic, but the drawback is that these services are somewhat expensive.
Mosso is one service that does this. They advertise that you’ll always have space, bandwidth and processors to handle traffic. Mosso is owned by Rackspace, who has a fantastic reputation amongst the development community and is well trusted. Some users at the DC PHP Developer’s Group reported that Mosso has some latency issues, however, from the database and PHP servers being different from the web servers, so this may be a concern to some users. Still, this option provides the ability to scale quickly and without monitoring.
Delivering Content: CDNs
Not using a Content Delivery Network (CDN)? Why not? CDNs are great for many things: delivering content that never changes (static pages), reducing server load, and reducing latency for people who are located around the world.
In short, a CDN is a service that distributes your content and delivers it to individuals based on their location. So someone in Asia sees your content on a server based in Asia, while someone in Brooklyn sees it on a server based in Upstate New York. CDNs also allow you to send your content to their servers to be cached, reducing the number of hits to your servers.
Akamai is probably one of the biggest CDNs around the world. Their rates are reasonable, and they have lots of servers. Some of their clients include Google and Myspace, so they’re well known and reliable. There are others, which you can find with a Google search.
The benefits of a CDN are that your files are delivered faster to people seeking your site and your traffic to your actual servers is reduced, as the CDN takes on much of the processing power required to serve pages. The drawback is that dynamic pages cannot be delivered very effectively by a CDN, meaning that for dynamic pages you’ll still have to send people to your site, for the most part. Still, in terms of delivering images, static content, and files, CDNs can be reliable and reasonable for reducing the load on your servers.
This is a lot of information to digest, and there’s a lot of different options out there for you to consider. You should pick the one (or combination of the ones) that suit your application and needs the best. Don’t try and implement everything, as you’ll never succeed; instead, study carefully, and invest well. You’ll be on your way to scaling your site in no time.
Write better object oriented PHP today.
Object oriented programming always leaves you with a headache. What if you could master it instead?Get the book now! »