10 tips to speed up your ExpressionEngine sites

1. Cache
Cache, cache and cache. It’s the first step to make your site faster. It’s great news that expressionengine comes with excellent cache features – query cache, tag cache, template cache etc – turn them on. Its important for Expressionengine SEO too.

Query Cache – Query Caching caches the output of your database, saving each query as a text file. When your visitors access your web pages, the cache files are examined to see if the particular queries being requested exist in cached form. If they do, ExpressionEngine uses the cached data instead of querying your database. This provides a significant reduction in your overall database load. The query caching system is completely dynamic.
This feature is found under Admin>Weblog Administration > Global Weblog Preferences.
NOTE: Dynamic weblog query caching will cause weblog queries to not behave as expected when set to: orderby=”random”

Tag Cache – The Tag Caching system lets you cache the output of individual tags. This enables you to display sections of your pages completely dynamically while leaving others to display statically. When the time expires, the cache is automatically refreshed. To enable tag caching, add these two parameters to any tag:

cache="yes" refresh="10"

For example, to cache your weblog tag in 30 minute intervals you’ll do this:

{exp:weblog:entries cache="yes" refresh="30"}

Template Caching – Template Caching (or Dynamic Page Caching) lets you cache entire templates. To enable Template caching, click the “Preferences” link in your Templates page.
NOTE: Dynamic Page Caching will supersede Tag Caching. There is no increased benefit to using tag caching and page caching together. When page caching is on, no other caching setting matters.

Also, if you have any third party scripts with EE which take feeds from other site, use cache for them too.

2. Query Disabling – The disable= parameter is available in the {exp:weblog:entries} tag. It allows you to turn off aspects of the tag that you might not be using in order to improve performance. The weblog tag is designed to fetch a lot of information by default: Categories, custom fields, member data, etc. Depending on how you use the tag, some of this data may not be needed. Through the use of the “disable” parameter you can turn off aspects of the tag in order to make it more lightweight.
For example –

{exp:weblog:entries orderby="date" sort="desc" limit="10" disable="categories|custom_fields|member_data|pagination|trackbacks"}

On above example, you have turned off features such as categories, custom_fields, member_data, pagination, trackbacks – as you don’t needed them.

3. Enable Gzip Compression – GZIP compression saves as much as 70% of the size on a text-heavy webpage. You can turn on gzip compression for your expressionengine site from
Admin › System Preferences › Output and Debugging Preferences – Enable GZIP Output?

4. Data Pruning – ExpressionEngine has data pruning feature which allows you to “prune” or remove old weblog entries, comments, forum posts, etc. based on various criteria – which makes your database faster, clean and tidy.

5. Embed javascript/css properly – If possible, don’t use template for javascript and css, just drop them on folder and include them on your header. If you need to create javascript or css style template, don’t embed them like other template – that is include like

<link rel="stylesheet" href="{stylesheet=template_group/styles.css}"  type="text/css" media="screen, projection" /> 

rather than

<link rel="stylesheet" href="{path=template_group/styles.css}"  type="text/css" media="screen, projection" /> 

6. Don’t Save template as file – saving templates as files can marginally increase disk i/o as each template must be retrieved from disk in addition to the standard database query

7. Compress javascript if you have – if you have mootools, jquery, prototype, yui etc – use compressed version.

8. Disable tracking – If you have very large traffic, you can turn off few tracking things which might reduce database activity. You will find them in your config.php files which are

$conf['enable_online_user_tracking']
$conf['enable_hit_tracking']
$conf['enable_entry_view_tracking']
$conf['log_referrers']
$conf['dynamic_tracking_disabling']
$conf['disable_all_tracking']

9. Avoid template embedding – avoid to embedding template as much as possible.

10. Use cookie instead of session – Don’t run sessions. Use cookies only. You can find it from –
Admin › System Preferences › Security and Session Preferences

Beside these – there are many things to speed up your site such as lighter images(png version), lighter css, error free html code etc.

Advertisements

16 thoughts on “10 tips to speed up your ExpressionEngine sites

  1. You know, it’s posts like this that keep me and everyone else coming back for more. You really are an amazing blogger and the way you get your point/facts across is flawless.

  2. One thing. To clarify one the javascipt compression, minify the javascipt and do not pack it. Although packed files are a bit smaller, they are slower for the browser since the browser needs to unpack the file. Besides that, a minified file that is send to the client with gzip is sometimes smaller than a packed version with gzip (dont have a source right now). When you still work with 1.6.8 use the sl_combinator for automatic minification of your js and css files.

  3. In my opinion the automatic cache management feature of the {stylesheet=} tag outweighs the speed gains you might get by serving up regular static .css files. Using static files means you have to change the filename any time you make an update in order to guarantee that repeat visitors get the latest version.

  4. Paul, That’s(sl_combinator extension/plugin) a awesome. May be there are more plugins/extensions- we should keep search for. Thanks Paul.

    James, Developer will work on css or js while needed so that’s not a problem if use static file. Yes, caching can solve it easily, Thanks.

  5. I do agree with most of those however I think #9 defeats one of the best features of EE. Being able to cut up a template to make it easier to manage while also being able to send variables to that template is far too powerful to remove from the everyday workflow of site building. True, removing embedded templates will make the site faster, but when it comes time for maintenance, you’ll be kicking yourself for not.

    I would definitely have prefaced this list with the understanding that these settings will make EE faster, it may not make it better.

  6. Per #2, it is somewhat annoying to have to specifically turn of query searches on all {exp: …} tags. is there any other way? I’ve been working with EE2.0 lately and don’t see anything.

    Excellent post and advice. EE is gaining steam. I’m glad I’ve been a part of the ride!

  7. Great summary of tips – prior to launch I always do my best to run through a similar list. In particular, #9 has become my biggest concern – I’m starting to develop habits that limits my use of embeds down to just one to two MAX, and it really does wonders to keep my pages fast.

    Also, Shameless Plug: if you’re looking for an EE2 plugin that does the work of SL Combinator (automatically minify & compress your CSS and JS files), take a look at a plugin I’ve released called Minimee. The usage syntax is identical to SL Combinator, but it approaches it’s job a bit differently, and adds a few extra features:

    http://johndwells.com/software/minimee

    Cheers,
    John

  8. The only thing that made a huge difference in my site load time was uninstalling unused modules. Everything else had a nominal effect.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s