How to Run a Drupal Site on a Low-End Host like Hostmonster or Bluehost
November 25, 2013
Know your limits
There are some unavoidable limits when running something as complex as Drupal on low end hosts. Low-end hosts are best for brochure style sites, where Drupal can serve up relatively static content via cache to mostly anonymous users. If your site has lots of logged in users you should still implement the advice contained here, but it might not be as dramatic.
Know your host
This guide will be based on hostmonster and bluehost. We've attempted to run this site (bitcookie.com, Drupal 7) on Media Temple's Grid Hosting. It's more expensive so it should be better, right? Wrong. Performance was much worse than Bluehost or Hostmonster. We got mysterious 500 errors all the time with only 1 active user, so we gave up.
What makes you such an expert?
We run several Drupal sites on both hostmonster and bluehost.
- http://bitcookie.com (hostmonster, Drupal 7)
- http://brenthartmann.com (hostmonster, Drupal 7)
- http://lesliejune.com (hostmonster, Drupal 7)
- http://anti-agingm.com (bluehost, Drupal 7)
- http://ultherapy-treatment.com/ (bluehost, Drupal 7)
- http://www.testosteronereplacementtreatment.com/ (bluehost, Drupal 7)
- http://stemcellmedical.com/ (bluehost, Drupal 7)
You must use Boost!
This is the biggest factor in your site's overall performance. You absolutely must install and use the boost module for all your anonymous page requests. If you're running Mobile Tools you need to change the redirect method to be client side. See: http://bitcookie.com/blog/integrating-drupal-7s-boost-and-mobile-tools
Boost is a such a vital piece because it will completely bypass PHP for anonymous page requests. Drupal's built in page caching is not enough. Bluehost and hostmonster will throttle your account if you have more than 20 visitors per day. A throttled account means your site will be slow.
Even if you get throttled, using boost will ensure your anonymous page requests bypass that throttle, since they no longer need to be served up via PHP/MySQL like Drupal's traditional caching.
Set your maximum cache time as high as possible with Boost.
Enable all of drupal's other caching systems
Deal with your spambots
If you're getting slammed with spam on a form over and over again, that's consuming php/mysql resources, which will get your account throttled. We had to implement a custom solution to combat our onslaught of spammers, because the CAPTCHA module is no longer enough.
If you can't stop the spam, don't allow input. It's better to sacrifice a feature than to sacrifice visitors. Turn off blog commenting, user registration, etc.
It's unfortunate, but most spam bots originate in India, the Phillipines, Poland, and China (all of the spam bots that attack us, anyway). If you don't need traffic from those countries, block them, it will save you much agony.
Don't block them with Drupal's built in IP blocking system, then your site will need to spin up PHP and perform a MySQL query all the time. Instead, block them using your .htaccess file so the spammers never even touch your application. You can use this online tool to generate block ranges for specific countries: http://www.ip2location.com/free/visitor-blocker
Split up your cron jobs with Elysia Cron
Cron consumes CPU cycles and memory. The less frequently you run it, the better. You don't need cron to run every minute of every day, so turn that baby down.
We use a module called Elysia Cron, which lets you selectively determine which jobs run when. Some of our sites have cron jobs that need to run once per day, while other jobs only need to run once a year.
The less you can run cron, and the less cron jobs you need to run at once, the better.
Fix your slow queires and bottlenecks
I know, you're probably tired of hearing this one. Hostmonster and Bluehost provide slow query logs you can use to discover which parts of the site take too long to execute. Clearing this up will help with performance.
Don't use pointless modules
Eliminate useless modules that do things you could otherwise do manually.
Also, turn off update manager.
Keep your entire installation up to date, Drupal and contrib modules are being constantly updated. Consider installing Drush on your bluehost or hostmonster account, it's wonderful and will save you tons of time