Speeding Up VirtueMart 2.0 & Joomla! E-commerce Site – Case Study
This article describes how to speed up Virtuemart 2.0 as we did on an e-commerce site www.inmotorsports.cz. It is a guide to increase the speed of your Virtuemart site and the speed of products loading.
Inmotorsport.cz is based on Joomla! 2.5 and VirtueMart 2.0.4. It contains more than 6000 products. Approximately half of them are imported using using one XML source via XML Product Import – Easy Parser. The other 2000 are imported from another source, again via XML Product Import. The rest of the products are managed manually. Products are also automatically added into parent VM categories via VirtueMart products in parent categorie plugin. This is very helpful feature, since the users do not have to click through all category levels to see the products - they simply see the products right after clicking on a parent category.
VirtueMart is connected to GoPay payment gateway which allows all the types of on-line payments.
As you know, VirtueMart 2.0.4. is very slow. We had the same problem. The speed of site before optimization was as follows:
Home page, which contains mainly VirtueMart modules (recommended products, new products, top sale products), Get HTML of home page = 7.62s, ready = 12.55s, load = 16.04s
As for the particular VirtuMart category view (browse page) it was: Get HTML = 3,9s, ready = 8,91s, load = 11,9s
It is obvious that with such speed no one would ever buy any product :-)
The first idea how to speed the site up was to turn global Joomla! cache on. Unfortunately, we found out that product filters did not work with the global cache on.
After some testing we have finally found out that the following configuration works:
- Joomla Global Cache = off
- Plugin System Cache = off
- Plugin JotCache = on
JotCache Component – exclude views = com_virtuemart: cart, user, orders, askquestion, invoice, pluginresponse, state.
The last part of configuration clearly says that the listed views are not cached, as well as loged-in users. The list of all cached URLs is handled by JotCache Component where they can also be managed.
This cache configuration brings the following speed.
Get HTML of home page = 250 ms, ready = 6,2s, load = 9,53
VirtueMart browse page GET HTML = 340 ms, ready = 8,91, load = 11,9.
From GET HTML point of view the site is 30 times faster than before the optimization. "Ready" and "Load" were still slow because of site size.
In the next part of optimization, we had to solve a problem: the first URL load (cache is not generated yet) was even slower than before the optimization.
We have therefore created a script which goes through the site map URLs and adds them to the cache list. This script is run by a CRON at 4 am – all the URLs are thus added in the cache with 24 hour period of renewal.