Back to Blog

Magento Apc and Memcached Speed up Magento

July 14, 20153 min read0 comments
I hear a lot of time that people complaints about "Magento is very slow". In my opinion Magento is not a good solution if you are hosting it in a Shared environment, If you've a dedicated server then YES, use it otherwise just use baby e-commerce software available online. This article will focus on configuring and using APC and/or Memcached. I am sharing my local.xml file. Look for <cache>, But before you even do any of that, you need to make sure you've Memcached & Apc installed and configure. Revision Feb-15-2016 The (last) version 5.1.2 of APCu don't support PHP5 (only PHP7) so you need to set a specific version instead of beta tag :
sudo apt-get install php-pear php5-dev make libpcre3-dev php5 memcache memcached php-pear

pecl install apcu-4.0.10
&& echo extension=apcu.so > /usr/local/etc/php/conf.d/apcu.ini
<?xml version="1.0"?> <!-- /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE_AFL.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magento.com for more information. * * @category Mage * @package Mage_Core * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> <config> <global> <install> <date><!]></date> </install> <crypt> <key><!]></key> </crypt> <disable_local_modules>false</disable_local_modules> <resources> <db> <table_prefix><!]></table_prefix> </db> <span style="color: #ff0000;"><cache> <backend>memcached</backend> <memcached> <servers> <server> <host><!]></host> <port><!]></port> <persistent><!]></persistent> </server> </servers> <compression><!]></compression> <cache_dir><!]></cache_dir> <hashed_directory_level><!]></hashed_directory_level> <hashed_directory_umask><!]></hashed_directory_umask> <file_name_prefix><!]></file_name_prefix> </memcached> </cache></span> <default_setup> <connection> <host><!]></host> <username><!]></username> <password><!]></password> <dbname><!]></dbname> <initStatements><!]></initStatements> <model><!]></model> <type><!]></type> <pdoType><!]></pdoType> <active>1</active> </connection> </default_setup> </resources> <session_save><!]></session_save> <span style="color: #ff0000;"><cache> <backend>memcached</backend><!-- apc / memcached / empty=file --> <memcached><!-- memcached cache backend related config --> <servers><!-- any number of server nodes can be included --> <server> <host><!]></host> <port><!]></port> <persistent><!]></persistent> </server> </servers> <compression><!]></compression> <cache_dir><!]></cache_dir> <hashed_directory_level><!]></hashed_directory_level> <hashed_directory_umask><!]></hashed_directory_umask> <file_name_prefix><!]></file_name_prefix> </memcached> </cache> <cache> <backend>apc</backend> <slow_backend>database</slow_backend> <slow_backend_store_data>0</slow_backend_store_data> <auto_refresh_fast_cache>0</auto_refresh_fast_cache> <prefix>TTDINC_</prefix> </cache></span> </global> <admin> <routers> <adminhtml> <args> <frontName><!]></frontName> </args> </adminhtml> </routers> </admin> </config>
In my ubuntu environment my apcu.ini is located at /etc/php5/mods-available/apcu.ini
xtension=apc.so
extension=apcu.so
apc.enabled=1
apc.shm_size=512M
apc.num_files_hint=10000
apc.user_entries_hint=10000
apc.max_file_size=5M
apc.stat=0
apc.optimization=0
apc.shm_segments=1
apc.enable_cli=1
apc.cache_by_default=1

Enjoyed this article?

Show your appreciation with a clap

0claps
Share this article
SK
Written by

Sohaib Khan

View all posts

You might also like

View all

Comments (0)

No comments yet. Be the first to comment!