How To Speed Up OpenCart
Your customers are willing to pay significantly more to their Internet Service Provider per month for faster Internet speeds. This makes it clear that page load speed really matters to them. Of course, it's been known since the early days of the Internet that page load speed has a dramatic effect on users. It was often said that if a page takes longer than 5 seconds to load, most users will simply click "back" and go to a different result.
As Broadband speeds have increased, page load speed has become more, not less important for a couple of reasons:
- Google will now measure page speed and use it to rank websites. All other things being equal, if your competitor has a faster website than you, they'll appear higher in Search Results. You can see what Google thinks of your page speed here: https://developers.google.com/speed/pagespeed/insights/
- Why does Google care so much? Because its users *really* care. Google remains the leader in search because its goal is satisfied users and nothing irritates users more than slow web pages. In fact Amazon have done the research and found that if Amazon.com was just 1 second slower it would cost them $1.6 billion per year in lost sales! Yikes, that's an expensive second!
So what can you do to increase your OpenCart page speed?
We can split speed optimization in to two main parts: hardware and software.
Hardware
The hosting company you choose and the server they put you on will have a massive effect on speed. It's probably fair to say that if you're paying under £10/month for your hosting, you may be on a shared, underpowered server. If you're just starting out, trying to keep costs down and the site doesn't seem too slow, this may be okay initially but there will probably come a point where increased hosting costs will translate in to enough extra sales and profit to give you a positive ROI on the increase. This will be more of an issue if you have a large catalog of products and categories.
When you're looking at webservers, a popular, affordable and versatile option is the VPS or Virtual Private Server. Without getting too technical, this is usually a full operating system install and LAMP stack. It may run across a cluster of computers or on a dedciated hardware server. But that's more information that you needed. You just need to know that the specs of a VPS are measured pretty much the same way as PC you'd pick up in PC World. You have have RAM, Hard Disk Space, Processor Speed and Number of cores. Because running websites isn't as demanding as running desktop programs, you'll find that a fast server may have lower specs than you desktop PC. For example, I'm writing this on a octacore Intel i7 processor with 4GHz per core and 16GB of RAM but a relatively fast server might only have 4GB of RAM and a 2GHz quadcore processor.
It's important to go with a hosting company that understand how hardware and software interact. We've blogged before about Jeff Hunter's Increase Page Speed extension and we still think it's great. We'll come to other software items shortly but it's worth saying here that unless the server itself is set up properly, Increase Page Speed won't be able to use some advanced memory caching techniques that will really speed things up.
The last thing to mention about hosting here is about the network connection. Make sure that the web server is located in the country where the majority of your customers are from. You can prove this makes a big difference by trying to browse to a site you know is hosted on the opposite side of the world. For us in the UK that's most sites ending .com.au. Also consider the connection to the Internet that the web host has. You should be looking at a minimum connection of 1Gb/s which would be equivalent to a home Internet connection of 1,024Mb/s.
Software
Next there's OpenCart itself. Probably the quickest, easiest and best thing you can do to speed up OpenCart is install Increase Page Speed. Be careful to keep testing the site as you turn on and off the various optimization options. We've found that some of them, especially the CSS minification, can break the site. Although CSS minification is a factor that Google's PageSpeed Insights above tests, we're not that convinced that there's much extra performance to be gained here because the webserver should zip up all files before it sends them to the browser anyway and CSS being text should compress pretty well.
One of the most common causes of a slow OpenCart site, especially those with a large number of products and categories is where the number of products in a certain category are displayed. It's probably worth turning this off, the setting is here:
Further down on that same settings screen, there's an option called "Output Compression Level". By default this is set to 0, which means no compression. You should only set this to about 4 because there's a bit of a tradeoff here between byes of data sent and time taken to compress/decompress the data. A higher number means more compression, so less time sending the website, but more time zipping and unzipping the site at each end. It does this file by file.
Another input just below the compression option is "Error Log Filename". It's probably best to leave error logging turned on in case your developer needs to trouble-shoot an error with an order or payment but it's worth noting that when the error log grows too bit it will cause OpenCart to crash. This is likely to happen if you have lots of third party extensions installed or your web server has very strict or verbose error logging settings. You can find the error log file in /system/logs/error.txt and check its size. It's best if this is below a 1MB usually but we've seen it grow to over 1GB before crashing a server.
Most of the other software-based speed optimizations will be related to custom themes and extensions. If after going through all of the above, the site is still particularly slow, it could be worth disabling all vQmod extensions to see if that makes a difference. If it does then it'd be a case of enabling them one by one to see which it was that caused the issue.
It could also be worth temporarily switching back to the default theme. We have, unfortunately, come across a lot of very poorly coded themes that throw all sorts of errors behind the scenes, or are just doing things in very inefficient ways which slow the site down. Code should be as simple as possible so that it runs fast and is easy to maintain, less is more, that's what Antropy is all about.
It's definitely worth checking the results of a detailed website speed test like www.webpagetest.org and asking your developer to address as many of the issues that come up as possible. We've taken sites from straight Fs to straight As in as little as a day and increased sales as a result will keep on coming indefinitely, or until the next rebuild at least!
While we're nearly at the end of this article, we've saved one of the best tips to speed up your website for last. No discussion of website speed would be complete without discussing CDNs or Content Delivery Networks. Yet another confusing Internet acronym (initialism really) with a complex sounding name, but essentially it's just a very big distributed cache for your website's assets. The main one is called CloudFlare and has free plans which allows you to try it out. It's surprisingly easy to set up if you have access to edit the nameservers on your domain name and generally offers an instant and very impressive speed boost. In fact, it's hard to think of a reason not to use a CDN like CloudFlare, although having said that, we have seen some issues with cron jobs and remote APIs. These can of course be resolved by a competent developer.
Any questions on the above or other tips to speed up OpenCart? Just comment below!
blog comments powered by Disqus