Mysql Query Caching for magento website

Performance of magento website:
Magento website, performance should be high (or) speedup of loading website is one of the way to maintain the customers count head or create a new customer head count in a magento store.Lot of changes basically we will do for magento speedup purpose. It may high the speedup of magento store.Here another one way to improve the magento speedup your store.
Yes “Mysql Query Caching”.

Mysql Query Caching – Making mysql query caching also one of the way to improve the performance of website.For this, we need to allocate some memory for this caching.Using this query, some of the “SELECT” statement query has been stored into cache for reuse it later purpose. The same query instead of calling a new request, we can get it from the cache.

Step:1 How to Enable or configure the Mysql Cache:
First of all check whether the “Mysql Query cache” is available in your Mysql Database or not.How to check, yes use below is the query to check,
Mysql > show variables like ‘have_query_cache’;
Output of the query:

Mysql Query caching
Now a days, almost all the hosting providers, by default they will make “have_query_cache” is “YES” even if the mysql query caching is disabled.If not, try to make “YES”. Then only we can use mysql cache in your DB ( by default it is YES).

Step:2 System variables control
Similarly need to check, system variables control for query cache operation.Some of the system variables help to make a cache in mysql. We need to check those also here, run below query
Mysql > show variables like ‘query%’;
Output of the query:

Mysql Query caching

Once we run the above query need to check below system control,
(1) query_cache_size (2)query_cache_type

(1) query_cache_size : Check this value is 0 or not. By default its 0. We need to change (here if 0).0 mean, cache is disabled state. We need to make enalbe, for that need to allocate some memory for this.
Ex: We going to allocate 8MB to the cache to use 1024 * 1024 * 8 = 8388608 as the value.
Mysql > SET GLOBAL query_cache_size = 8388608;

(2) query_cache_type : Check, this value should be “ON” or “1”. Then only mysql query cache we can use.

Simillary need to set below system control’s. If already this values is present then no need to run below query, if else need to run.
SET GLOBAL query_cache_limit = 1048576;
SET GLOBAL query_cache_type = 1;

Step: 3 Check update:
Once above query had been run,need to check with below query
Mysql > SHOW STATUS LIKE ‘Qc%’;
With out running above (step:2) query, if run “SHOW STATUS LIKE ‘Qc%’;” query. It will show 0 for all the control’s
Ex:
SHOW STATUS LIKE ‘Qc%’; otherwise, the value will come with update memory details

Mysql Query caching

Step: 4 Warning message
query_cache_size : minimum size we need to set 40KB else you will get warning message.So please when you going to set, consider atleast min 40KB.

Step: 5  Yes its done.You can use
yes once above step are done,then mysql query cache is available in your DB.You can check with below query
Mysql > SHOW STATUS LIKE ‘Qc%’
It will list of allocated memory size, no.of hit,total block, free memory information.

2 thoughts on “Mysql Query Caching for magento website”

Leave a Reply