The big game is fast approaching, and as much as I love watching the Super Bowl, one of the best parts of the night is the commercials. This year, a 30-second spot is going to run companies a whopping $4 million. Most commercials will have a companion website for potential customers to visit after viewing the commercial. Being able to further engage viewers is one way that companies justify the hefty price tag, but if they are going to spend that much money on a television spot, they better be ready for the traffic that is coming their way.
Whether it is the big game or another high traffic event, you can take steps to help ensure your website can survive a crushing amount of traffic. After all, no one likes going to a website that is down. Here are some tips to keep your site up and running in the cloud through a huge traffic spike.
Most content management systems, such as WordPress, render a unique page for every visitor to your site. Rather than having to build a page a million times, caching lets you build it once and save it, taking a significant load off of your configuration.
There are different strategies for caching content whether you are running a Windows or Linux server. Additionally, plugins on popular CMS platforms can help you cache as well. The point to takeaway is that it is always more efficient to serve cached content instead of having to go to the database each time, and Rackspace can help suggest strategies to best suite your needs.
If millions of people will be hitting your site at the same time, one way to make sure that they see something is to have a static landing page. By dynamically generating content for your homepage, you run into the situation of a server getting overwhelmed. However, if you take advantage of a static homepage and upload it to Cloud Files, it will be distributed over our Content Delivery Network (CDN). This results in your content being distributed on servers around the globe, allowing it to be served up to your visitor on a server that is physically closer to them and resulting in faster load times.
One of the amazing aspects of the cloud is how it can scale. But to prepare for the onslaught of traffic, you need to know the difference between vertical and horizontal scaling. Think of vertical scaling as simply clicking “resize server” in our control panel and selecting the next size up. This increases the allocated amount of virtual CPU, RAM and disk. The benefit is that it can be done with a click of a mouse, but the drawback is that there is downtime while the server resizes, something you probably don’t want during your high traffic event.
The other type, horizontal scaling, helps mitigate this by essentially adding additional servers to your configuration. By doing this, you increase the available pool of resources to handle your high traffic event, without having downtime to add another server to your line. One thing to consider is that you need to prepare your application to take advantage of this type of scaling in advance.
If you do plan on distributing your load across multiple servers, or plan to take advantage of horizontal scaling, you will want to set up a load balancer to help distribute the traffic to different nodes. You will want to do this in advance, because you will have to point the IP to the load balancer, which could result in some downtime while the DNS records update. The upside to a load balancer is huge, and you will definitely need one to help route the high volume of traffic.
When you have a high traffic event, there are going to be lots of reads from your database. If that database was to topple over, you risk losing functionality to your entire site. To prevent this from happening, you will want to consider a database replication strategy.
To do this, you have one “master” database and a pool of “slave” databases. All the write requests are sent to the master database and are then replicated out to the slave databases. The read requests have the ability to happen on any of the database nodes in your configuration. With database replication, if your master database begins getting overtaxed, you will want to promote a slave to become a new master. There are several Cloud Tools partners that can help you and your company with database replication, as well as the Rackspace Managed Databases team.
Those tips should help your website defend against the rush of traffic during a major event, like the Super Bowl, and enable you to sit back and enjoy the game instead of worrying about your site being sacked by a traffic blitz.
Want to learn more from the Cloud Zen Master? Check out Joseph Palumbo’s author page for all of his posts!