Opencart Performance Guide

At the end of last month, somebody calling me and said that he read my post on opencart forum on how to increase opencart performance. It was a post in 2015, and i am totally forgot about that post.

He ask me to help with his website which at that time only has 40k items. The website load very slow, measured with gtmetrix the statistic was terrible. He said that he want his website as fast as the website i manage which has more than 10 million items (www.booksbeyond.co.id)

The website he own load very slow, measured with gtmetrix.com the statistic was terrible.

I decide to help him to optimize the performance. The result measured again using gtmetrix.com:

What is the optimization? 

  1. Optimize your MySql database, sample from my.cnf setting
    • default-storage-engine=MyISAM
      innodb_file_per_table=1
      performance-schema=0
      max_allowed_packet=1073741824
      open_files_limit=50000
      query_cache_size=256M
      query_cache_type=1
      query_cache_limit=1M
      query_cache_min_res_unit=2K
      thread_cache_size=16K
      long_query_time=1
      tmp_table_size=128M
      max_heap_table_size=128M
      table_open_cache=2K
      table_definition_cache=4K
      key_buffer_size=128M
      slow_query_log = 1
      long_query_time = 1
      slow_query_log_file = /var/lib/mysql/mysql_slow_query.log
      log_queries_not_using_indexes
    • Please note, this setting are related to your server specification (Memory and CPU). 
  2. Install mod_pagespeed. Find more about page speed in https://developers.google.com/speed/pagespeed/module/
  3. Install page cache module on your opencart. I use free module from budgetneon (https://github.com/budgetneon/pagecache)
  4. Install Sphinx Search module on opencart (https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=18266&filter_search=sphinx)
  5. On opencart setting – server, make sure you set the gzip compression more than 0. 
  6. Make sure that there are no broken link on your website.
  7. Make sure you don’t resize image through css or html. If you want to display 200×200 px image, make the image file exactly 200×200 px.
  8. Minify your css and javascript. You can do it easily using gtmetrix recommendation. Expand the recommendation, click on the “See optimized version” and copy it to replace your original file.

Using my guideline, i can guarantee that your opencart performance will improve a lot. However if you need help, please contact me through ezrakurniadi@yahoo.com