How to speed up OpenCart 3
Posted: Wed Nov 27, 2019 5:02 am
I've recently been able to get back to trying to migrate to OpenCart. I started this project in the spring, but was short staffed during the summer so had to put everything on hold. My current store has been on Yahoo for 13 years now, and that's obviously not the place to be anymore. Anyway, I just wanted to post about some of the simple things that have made a HUGE difference in speed with OpenCart. I've got over 7,000 product pages and many categories.
I kicked up a CentOS 7 server on DigitalOcean for $5 a month. Nothing fancy, standard install. Apache 2.4.6 / MariaDB. 5.5.64 / PHP 5.4 with OpenCart 7
It's nice to have it on a small space, then open up a whole mess of pages at once to see what happens. Of course I'll move it to a bigger space once it goes live.
I use this to test page speed overall
https://developers.google.com/speed/pagespeed/insights/
Out of the box, the problem was clearly TTFB
First big gain was with Apache, you'll want to use it's compression by adding in this to the Apache config
Second big gain was upgrading PHP to 7.2 which is probably because opcache is installed by default in 7.2 I have not tested PHP 5.4 with opcache, and so far everything seems to be good with 7.2 so I don't think I'll go back.
Next was changing the DNS to cloudflare to use their CDN. This didn't make a huge difference, but it was simple. I also like that they can do something if the site goes under attack.
I also changed the database tables from myisam to innodb and played around with some indexes. It helped a little.
Hope this helps someone else.
I kicked up a CentOS 7 server on DigitalOcean for $5 a month. Nothing fancy, standard install. Apache 2.4.6 / MariaDB. 5.5.64 / PHP 5.4 with OpenCart 7
It's nice to have it on a small space, then open up a whole mess of pages at once to see what happens. Of course I'll move it to a bigger space once it goes live.
I use this to test page speed overall
https://developers.google.com/speed/pagespeed/insights/
Out of the box, the problem was clearly TTFB
First big gain was with Apache, you'll want to use it's compression by adding in this to the Apache config
Code: Select all
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>
Next was changing the DNS to cloudflare to use their CDN. This didn't make a huge difference, but it was simple. I also like that they can do something if the site goes under attack.
I also changed the database tables from myisam to innodb and played around with some indexes. It helped a little.
Hope this helps someone else.