Drupal Speed - Little things you can do to reduce your load time
One of the most common questions we get is how to your Drupal site load faster. Your site's speed is important because it can effect your SEO ranking, your visitor's stay time, and the time it takes to manage the site.
Let's run through a few quick little wins you can achieve within the Drupal interface itself.
1. Enable Caching
This is the biggest "little" win you can achieve. Under Administration » Configuration » Development or http://www.[yoursite].com/admin/config/development/performance
You can check off everything you see here. The Caching section only applies to non-logged in users, so it's okay to set the minimum cache lifetime higher if you don't update your site that often. Caching blocks is a good thing because it prevents blocks from having to be rebuilt on every page load. Most sites I see have lots and lots of blocks. The only down side to caching is if you add or change some content, it won't be visible to non-logged in users for the minimum cache lifetime duration. The easy work around is to simply click the Clear All Cache button after you add or change something.
The Bandwidth Optimization section is utilized by both logged in and non-logged in users. The benefit to checking these off is it makes you site load faster by making the files smaller in size and merging them all together so your browser doesn't have to fetch as many files.
Compress cached pages is optional. In some cases your server may already be compressing your pages. If it is, then by checking this you could actually slow down your site because it will try to compress something that's already been compressed. If you don't know if your site is already being compressed by the server, use this GZIP testing tool to find out. First, disable "Compress cached pages" and run your site through the GZIP tool, if it results in "Web page compressed?" Yes, then leave "Compress cached pages" unchecked. Otherwise, it is says No, then check "Compress cached pages" and try the GZIP tool again - this time it will say Yes.
2. Disable Unnecessary modules
Did you know that on every Drupal page load, it has to check every single module to see if it's adding anything to the current page? This could be a huge "ouch" if you have 50+ modules enabled. Often times modules are enabled to add a simple and convenient piece of functionality, so it's a tradeoff sometimes. Do you want a faster site or a more convenient experience. Usually extra modules are added to enhance the administrative experience.
Here are some that you can disable to start seeing speed savings. Depending on your situation, you may not have all of these modules on your site.
- Update Manager *this can offer the mode savings because it checks back to drupal.org for updates to every single module
- Administration Development tools
- Devel node access
- Field UI
- Rules UI
- Views UI
- Module Filter
You can also disable some core functionality if it's not being used by your site like:
- Database Logging
- Tracker *This module can be pretty brutal to your speed since it's writing to your database on every pageload.
3. Enable views caching
If you have Views on your site (and if you haven't turned off the Views UI module yet), then you can enable views caching. A view is simply a way to grab a whole bunch of information from a database and display it in a nice way. Sometimes there is a lot of information a view has to look through to find the correct information. So every time a page with a view loads, it does the same look-up every time. Enter views caching, now a view can grab the information it wants one time, save it for a period of time and display it again and again over multiple pages loads without having to do a look-up every time. This can be a huge savings.
The Query results and Rendered output usually go hand-in-hand, so you can set them to the same value for as long as you think it will be before something in the view will change. For example if you update a piece of data that this view is going to show, then it will be 1hr (in the case of the screen shot above) before it will be displayed to BOTH logged in and non-logged in users.
4. Enable panels caching
A lot of Drupal sites are built using the Panels module. It's great for creating flexible layouts in Drupal, but can also really slow down a site's page load. Each Panel pane in your Panel can have it's own individual cache setting which is pretty awesome depending on your site's requirements for display data on a page.
Panel pane caching can be as simple as selecting a Lifetime duration. In more complicated situations where a panel is displaying information based on certain circumstances, then you may have to dig into the Granularity settings which is usually over the head of most average website owners.
I really wanted this post to focus on things you can do right now without having to install anything extra, but I have to mention the "Panels, Why so slow?" module. If you install and enable it, it will show on each panel pane how long it's taking to load while showing the really slow ones in red. This was a real eye opener for me and really helps you trial and error your settings to achieve a lower load time value.
5. Optimize your images
These days, large image slideshows and full page images are all the rage. These large images can seriously harbor your site's load time. Here are a few things you can do to make sure your site's images are compressed as best as possible. Just be careful not to compress your images so much that the quality depreciates.
Use a PNG optimizer
If your site uses lots of PNG graphics and those PNG graphics were created by Photoshop, then you will highly benefit from running them through a PNG optimizer. I personally use TinyPNG which is a free website that quickly squeezes your images. The savings I usually get is around 60% and the quality appears lossless.
Use a JPEG Compressor
JPG files are a bit trickier because you have to play with the compression settings before you can achieve a proper balance between filesize and acceptable quality. AN an easy to use online tool is CompressNow. It offers an easy compression amount slider and preview of the compressed image, so you can easily play with the settings. JPG files can take a while if you have a lot of them because each on can require a different setting.
Drupal Image Compression
If your images are running through ImageCache (Drupal 6) or Image Styles (Drupal 7), then there is a setting for adjusting how much compression your generated images should get. In your Media configuration settings under Image Toolkit (http://www.yoursite.com/admin/config/media/image-toolkit), there is a simple setting for how much you want to compress the images. A low setting will result in smaller images with less quality, which a higher setting will result in a larger image with higher quality. This is a one-size-fits-all Drupal solution, so you don't get the benefit of adjusting each image.
Summarizing Drupal speed
I've only scratched the surface of ways to improve Drupal load time and there are many more that I'll save those for future blog posts. You can spend countless hours digging into Drupal speed issues. The few major reasons why your site is running slow can boil down to these few key issues.
- Quality of your web host and/or hosting plan.
- Physical size of the site's files, images, and media.
- Amount of site files, images, and media
- Amount of modules enabled.
- Amount of external scripts running on the site.
If you have any questions about Drupal speed, please reply in the comments below. If you are interested in support with your Drupal site, check out our Drupal Aid Maintenance and Support plans.