How to handle traffic spikes on a Drupal website without a dedicated hosting plan
https://www.zyxware.com/sites/default/files/styles/user_image/public/pictures/zyxlogo.png?itok=J9t-ZEoU
BY webmaster
10 years ago
Drupal-Technical
3 comments comment

The dream of every person starting out to build websites is to reach out to as many people as possible. Not very many actually make it to more than a few hundred visitors per month on a regular basis. But with the profusion of social bookmarking sites, there is a chance for some of these low traffic sites to get bursts of very high traffic once in a while, for ex: when they get slashdotted. The question is how to outlive such spikes in traffic, without burning large holes in your pocket

The problem with such burst traffic is that, a good hosting plan that can survive such spikes will be prohibitively expensive for the site to maintain during the regular traffic days. But you can never predict when 'your day' is going to be. So you either have to be willing to pay the hefty charges and lie in wait for 'your day' to arrive, or just be unprepared and let the burst traffic take your site and the hosting server down.

There is however a midway between these two extreme options. That is to make best use of your situation. Drupal gives you pretty good control over your sites performance through its caching mechanisms as well as its throttle mechanisms. You can tweak these two to ensure that your site is getting the best out of your hosting server capabilities.

Caching Settings

1) Make sure that you have turned on page caching and block caching.
2) Set your cache lifetime to the average interval between your site updates.
3) Enable compression of your Javascript and CSS files.

Throttle Settings

Go to Admin > Site Building > Modules and enable throttling for modules that you think can be disabled without drastically reducing the usability of your site for anonymous users. Make sure that when you set throttling for a module you should throttle its dependent modules as well. Be extremely careful when you set throttle so as to not throttle essential modules that can change site behavior or essential functionalities.

Once you have these settings your hosting plan will easily have effectively increased its capacity to handle traffic on to the same drupal site.

Now you have done your best to handle a spike as far as drupal is concerned. A normal shared server hosting will still go down if your site suddenly gets 10K visitors in a day. There is however one more hacky trick you can use to scale the capabilities of your hosting account one more notch. This is not the drupal way of doing things, but this will help you keep your site up longer and handle small spikes easily.

Hack to extend shared hosting capacity to survive spikes

Normally burst traffic would enter your site through a single URL which was bookmarked in a Social Bookmarking system like Slashdot or Digg. This page is going to be your weak point. The assumption is that you are going to get a hint of the burst traffic as it starts. Normally you can, if you monitor your site on a very regular basis. Read further only if you think you can get this hint somehow. One of our sites Ubuntu Manual got dugg one day and we got 13000 visits in a day. We had a person in charge of the site and he was able to identify the spike (and the source) as it grew.

If you can catch this in time then the hack is as follows. Note down the URL which is the floodgate. Carefully create the complete path structure of this URL in your hosting account. Log out from your site, browse to the URL being seiged and use your browser to view the source of the page and save this at the path mentioned above. If your path structure does not end with a file name, save the file as index.html and modify your .htaccess to use index.html along with index.php as your DirectoryIndex parameter.

This hack will take a heavy load off your server as it will not have to go through the drupal bootstrap process to serve that particular page. For the visitors who are going to visit other pages on your site through that page, they will be served through drupal, but the percentage of users who are going to do that are going to be few anyway, and your server should be able to handle that just like a normal day.

What we have here is only a solution to stretch your resources to the max. There will however still be a limit to the traffic any given server can handle given your spec. Now if you want infinite scalability you will want to look at some cloud based solution like Amazon Web Services.


RELATED ARTICLE

/themes/custom/zyxpro_light/images/placeholder.png
close

on 01st January 2008 / by webmaster
We have added a few new modules to our site recently. Drupal Technical StumbleThis Leave a reply Your email address will not be published. Required fields are marked * Sean (not verified) access_time 12 Jul 2020 - 16:07 Hi there, I uploaded the files, enabled the modules to use SU, and now I see the link, but there is no icon... How can I fix this? Thanks, Sean webmaster access_time 12 Jul 2020 - 16:07 In reply to Icon doesn't show by Sean (not verified) What do you see when you view the source? Search for stumblethis_button and you should be able to see the code for the image and the URL. Then you should be able to troubleshoot from there. Juicy Couture Addict (not verified) access_time 12 Jul 2020 - 16:07 thanks for the post. would love to hear more of you. by the way, drupal's really popular nowadays as it has easy and fast features. you agree with me? thanks. Add new comment
/themes/custom/zyxpro_light/images/placeholder.png
close

on 16th January 2008 / by webmaster
Most webmasters do not realize this, but a lot of the content on lot of websites can be accessed from multiple URLs. A simple example would be where www.example.com and example.com leads to the same page. This is a fatal mistake in Search Engine Optimization and search engines penalize you for duplicate content. The correct configuration would be where the above two urls will lead you to the same page but example.com will redirect you to www.example.com with a 301 (Moved permanently) status which will not result in search engines penalizing the page. It is very easy to configure 301 redirects using Apache .htaccess file and the process is the same for a Drupal installation also. Drupal Technical Apache htaccess SEO Leave a reply Your email address will not be published. Required fields are marked * Anonymous (not verified) access_time 12 Jul 2020 - 16:07 Hello. I'm trying to make example.com show as www.example.com, and I'm running into difficulties. I'm on Apache 2.0 and using the following lines in my httpd.conf file: RewriteEngine on RewriteCond %{HTTP_HOST} ^xxxxxxxxxx\.com$ [NC] RewriteRule ^(.*)$ http://www.xxxxxxxxxx.com/$1 [L,R=301] When I go to http://xxxxxxxxxx.com, I get http://www.xxxxxxxxxx.com (as expected). However, when I go to http://xxxxxxxxxx.com/node/1 (it's a Drupal site), I get a 404 thrown and the URL changes to xxxxxxxxxx.com/var/www/drupal/node/1. Same thing with www.xxxxxxxxxx.com/node/1. Any suggestions? I want to run without Drupal's .htaccess file (instead incorporating these calls into my httpd.conf file). webmaster access_time 12 Jul 2020 - 16:07 In reply to Rewrite including filesystem path by Anonymous (not verified) I think the problem is with the base path which results in the redirection to /var/www/ part. The best approach I would think is to start with drupal htaccess and then strip out parts and move to httpd SNVC (not verified) access_time 12 Jul 2020 - 16:07 This is definitely a good guide. Thanks for this. wellyson access_time 12 Jul 2020 - 16:07 This is really nice and helpful. Add new comment
/themes/custom/zyxpro_light/images/placeholder.png
close

on 08th February 2008 / by webmaster
Attachment Size slashdotit.tar.gz 173.55 KB Similar to the StumbleThis module that we had created earlier we have created another bookmarking Drupal Technical Slashdotit Leave a reply Your email address will not be published. Required fields are marked * Shlomi Fish (not verified) access_time 12 Jul 2020 - 16:07 Hi! I'm interested in this module, but Drupal 6.2 complains that it's incompatible with it. Can you please update it or tell me how? Regards, Shlomi Fish shlomifish.org webmaster access_time 12 Jul 2020 - 16:07 In reply to Can you update it for Drupal-6.x? by Shlomi Fish (not verified) Sure we are working on this currently and will post an update soon. Also we will post this module on www.drupal.org as well Cheers Anoop John Team Zyxware Anonymous (not verified) access_time 12 Jul 2020 - 16:07 Hello! Nice Article very interesting, thanks Add new comment
Leave a reply
Your email address will not be published. Required fields are marked *

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type='1 A I'> <li> <dl> <dt> <dd> <h2 id='jump-*'> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
The content of this field is kept private and will not be shown publicly.
CAPTCHA This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

author-image
Term papers (not verified)
access_time 12 Jul 2020 - 22:06

Thanks for the tip !!! I will use it on my blog now...


author-image
David Brosseau (not verified)
access_time 12 Jul 2020 - 22:06

This is a great informational source. It clears up any confusion when trying to achieve online success in todays world!


author-image
Satta (not verified)
access_time 12 Jul 2020 - 22:06

Hi,

I faced similar issue and continue to face the same, I have a dedicated server hosting through hostgator who are still working to find the root cause.
Any help is much appreciated.

Regards,
Kumar