Speeding up your Magento Store By Using the APC Cache



Speed issue in the Magento store is the Main factor we often here complaints about the page load and the poor performance of the Magento stores. In this post I am focusing on the speed optimization by using the APC Cache. Here in this post I will describe how to install the APC Cache on the server and the APC Cache integration with the Magento. Here I am assuming that you have the root or sudo privileges of the server so that you can install the APC Cache on the server.

Step 1. Installing the APC Cache on the server

For Installing the APC Cache, PHP modules on the server run the following command

Ubuntu Based Server :

sudo apt-get install php5-apc

The location of the APC configuration file apc.ini.

ls /etc/php5/conf.d/apc.ini

CentOS Server :

yum install php-pecl-apc

The location of the APC configuration file apc.ini.

ls /etc/php.d/apc.ini

If you want to read more about APC click here.

Step 2. Just restart your server

Step 3. Now look at your Magento Installation app/etc/local.xml.additional, you will get the element which is for specifiying which caching method you are using in the element.

<config>
    <global>
..........................
        <cache>
            <backend></backend><!-- apc / memcached / xcache / empty=file -->
	</cache>
.........................
	</global>
</config>

This can be
apc
memcached
xcache

Here we are working with the APC

<config>
<global>
...
    <cache>
        <backend>apc</backend>
        <prefix>WSS_</prefix>
    </cache>
...
</global>
</config>

Here is the

element containing WSS_, is simply a prefix to tell APC, what to use when it creates the cache. This is very important if you are running multiple Magento sites on the same web server. Step 4. Now Configuration into the APC file
extension = apc.so  
 
[APC]
apc.enabled = 1   
apc.optimization  = 0    
apc.shm_segments = 1    
apc.shm_size = 128  
apc.ttl = 7200
apc.user_ttl  = 7200
apc.num_files_hint = 1024
apc.mmap_file_mask = /tmp/apc.XXXXXX
apc.enable_cli = 1 # Allow command line php to function
apc.cache_by_default  = 1 # Enabled, 0 for filters
apc.max_file_size = 10M # Maximum cached file size
apc.stat = 1 # 1 for dev, 0 for production, whether the source file is checked for mod date
#apc.include_once_override = 1 # Use PHP5.3+ for include_once optimization

Now your APC Cache has been installed on the server with the Magento. Now enjoy the speed of the Magento.

Hope it helps, Thanks and enjoy the reading.