Those of us that have built high traffic websites on ExpressionEngine know that you can’t just build the site, put it up on a server and hope it doesn’t buckle under the crush of visitors. All of us, I assume, implement some kind of caching in EE along with lean templates, as a way to keep the site nimble and quick. Well, we now have another tool at our disposal.
In the latest EE build, Ellis Lab has included a new feature: Tracking Preferences. There are four preferences for disabling some of the tracking that EE does on every page load: Online User Tracking, Template Hit Tracking, Weblog Entry View tracking and Referrer Tracking.
Derek Jones from Ellis Lab explains why these new preferences are so important:
MySQL’s default storage engine (MyISAM) is designed for efficiency with reading, which is good since ExpressionEngine is a read-heavy application in terms of database usage, not write-heavy. When writes are made to tables with the MyISAM storage engine, it must establish a lock on the entire table for the write to occur. ExpressionEngine has a few things that it tracks to provide bits of information to the site owner. How many times a template has been accessed. How many users are currently online. Where inbound links are coming from. How many times a particular entry has been viewed. On high traffic sites, or under extreme and unusual traffic events (i.e. Digg), these normally innocuous bits of tracking suddenly become a problem, as you have thousands of visitors hitting the site simultaneously, and for each one of those visitors, MySQL is locking the associated table to try to write to it. Before you know it, there’s a queue of table locks and MySQL just can’t keep up.
Unless you need these tracking features, you should disable them. You will save one query per feature disabled per page load. And while that doesn’t sound like a lot, multiply those queries times a large surge in traffic and it could mean the difference between a site that is up and one that crashes and burns. I’m pretty sure we’ve all had sites that have crashed and burned.
In my day-to-day use of EE, I’ve never used Template Hit Tracking or had a client use it, so it will be the first thing I disable on every project. I will also disable Referrer Tracking (although I’m guessing just uninstalling the module will have the same effect) since I and my clients normally use a third party website statistics system.