Three Ways Drupal Can Help Handle Sudden Traffic Bursts

An increase in site traffic is a good thing – after all, the more people who visit your site, the more money you make, either through sales or advertising. However, what if something your business does goes viral? Or you find your page on the front page of a social site like Reddit? That burst of traffic can wind up bringing your server to its knees, effectively knocking your site offline. The more users that are trying to open up pages, load files, and query databases, the hard your server has to work. If your server is hit with a bunch of connections, it will deny any new connections that come in. Luckily there are ways that a page that uses Drupal can combat the effect of sudden traffic bursts.

1) Download and Install APC

APC, or alternative PHP cache, is a great way to pre-empt a burst in web traffic and keep your site running even if your server is suddenly swamped. Essentially, the APC caches intermediate PHP code, allowing your server to re-use compiled code, instead of having to comb through source files and re-compile them every time a page loads. All of that means your server is quickly able to spit out a page, and then move onto another request. Installing APC also has the added bonus of speeding up sites that use management systems with a large source code base, like Drupal. So not only is it a good idea to install in the event of a burst in traffic, it is a great, easy way to speed up your site.

2) Go easy on the Dynamic Content

Dynamic Content is any content that changes due to outside parameters, like those set by the computer accessing the system, or updates to a particular source. Typically your server is what has to handle that content, which in turn forces your server to use more resources to generate that dynamic content. If your site uses a lot of blocks or displays a lot of dynamic content, a burst in traffic will easily eat up your server’s memory and force it to reject new requests. Feeds that display real-time information, like from your twitter account or your blog, can also tie things up and, depending on how many users are trying to access the feed at one time, will either drag loading times to a crawl or take down your site. So when you do design your site, keep all of this in mind and try to use as little dynamic content as possible. It is perfectly fine to incorporate a bit into your design, but do not base your page around it.

3) Take advantage of Drupal’s modules

There is actually a module that is designed specifically to helping your web server handle surges in traffic and deal with congestion. The throttle module is a great way to protect your site from going down and, as it works automatically, it can keep things running even if you can’t access your computer right away. The throttle also talks to other modules, and can shut down dynamic content if it is tying up too much of your server’s resources. Pictures can be disabled, modules can be turned off, and the threshold of authenticated users can be adjusted based on your traffic expectations. Sadly the throttle module was discontinued in Drupal 7, but D7’s smarter caching methods can help avoid the issues associated with bursts of traffic that the throttle module used to take care of.

Drupal may not be able to solve the problem of unexpected bursts of traffic completely, but using its modules and built-in functionality can certainly help keep your site from going under. Of course some of these steps are simply part of designing your website smartly – loads of dynamic content, image galleries, and feeds will do you no favors. Remember that less is sometimes more, and a minimalist design can be just as good as one that favors a lot of flashy content. But, luckily, there are plenty of tools to help keep your page online when it isn’t enough to simply design with minimalism in mind.

Check out our post on Drupal Social Media Plug-ins to help drive more traffic to your website.