Author - Robert Popovic

Founder and Technical Director of LERO9, a web agency specializing in Magento and WordPress design and development.

I launched Magebase in April, 2010 and am its editor and contributor. My main topics of interest are Magento development, customization and how to get the most out of Magento with the least amount of headache.

More Info » Follow me on Twitter »

Reader Comments (51)

  1. Gijs
    November 5, 2010 at 8:26 pm /

    Nice article, for people who have a socket to connect to use:

    < ![CDATA[unix:///var/spool/memcached/blabla.sock]]>

    0 0

  2. Gijs
    November 5, 2010 at 8:28 pm /

    Sorry xml doesn’t show, just put the socket url with unix:/// in the tag host and leave the port set to zero

  3. Chris Duncan
    November 10, 2010 at 5:02 am /

    Some great suggestions for using caching. We’ve successfully used memcache before in a federated configuration and it’s pretty powerful.

    If I could, something we built to go hand-in-hand with memcache is a whole-page caching tool called Lightspeed (

    Since it caches entire pages on the frontend (or whatever other pages you like), traffic can potentially completely avoid using magento all together when loading cached pages (which can dramatically increase page. Which is the pinnacle of caching for magento–only loading what parts of magento that you have to–that is.

    Happy caching!

  4. Chris Duncan
    November 10, 2010 at 6:34 am /

    Also, here’s a nicer (slightly less technical) Speed Test article that should help most users gauge how efficient their front-end and back-end are:

  5. Chris Duncan
    November 11, 2010 at 12:00 pm /

    Sure. Well other than the price ($500 once vs $13k/yearly), Lightspeed offers the similar performance as the EE whole-page caching module, but Lightspeed also offers:

    – advanced tagging which allows for more finite control over caches (
    – hole-punching for displaying selected dynamic content “punches” after a cached page loads (

    While I don’t have hard numbers on testing other than the benchmarks that are on the product page (, we’ve had several enterprise customers that have tried both and prefer our product.

  6. Gijs
    November 11, 2010 at 8:06 pm /

    Instead of yslow try page speed extension from google:

    We will try the apache mod if we have time:

  7. Matthew Goward
    November 14, 2010 at 8:59 am /

    If you are using disk with questionable speed (over commited cloud or shared hosting) and want to be certain it will never use files you can split the 2 cache parts between APC and memcached.


    Just posted the more complete config in a blog post.

  8. Pete
    November 19, 2010 at 5:18 am /

    I am seeing some “interesting” behaviour when multiple shops share the same memcache.What is the best way for several magento shops to share the same memcache, multiple instances of memcache on different ports? Is their a similar “prefix” option as you have mentioned with APC?



  9. oliver
    February 8, 2011 at 10:57 pm /

    Great performance tips! :)

  10. justcostume
    May 4, 2011 at 5:05 pm /

    Useful tips, thank you for sharing. I run magento at web hosting, it is so slow, then I upgrad it to VPS, then it is speeding up. I will also try this method. Thanks again.

  11. AtoZon Store
    June 17, 2011 at 4:00 am /

    Sorry for a silly question but where should I transfer the apc?I mean on what folder?I’m sorry,I’m totally newbie :(

  12. Karol
    July 22, 2011 at 7:51 am /

    unfortunatelly not work with 1.4.1 ;(

  13. Improving the File Cache Backend – Tutorials – Magebase

    […] Magento makes it easy to configure all this by the way – have a look at the file app/etc/local.xml.additional for further information. I will not go deeper into the setup here because we have already written about this. […]

  14. Karol
    August 11, 2011 at 12:10 am /

    hello. i have two stores on one installation. And i have this issue: stores are slow. But when i delete var/cache – stores speed up 200%. After few hours slow down again… and after deleting cache – speed up….. any ideas ?

  15. Brian McGilligan
    November 29, 2011 at 11:28 am /

    Memcached is a great tool, we’ve used it in multi web head deployments where we wanted to share the cache between a handful of machines. But wouldn’t recommend it if your on a single server. Since memcached has to hit the network stack for cache access, the APC object cache is going to be faster and a bit easier for most installations.

    We also recently release Brim’s Full Page Cache for Magento. It’s really easy to install and supports block updates for recently viewed products, compare products, shopping cart, etc. right out of the box.

  16. Magento eCommerce Development
    December 30, 2011 at 12:24 am /

    It’s great tips to enhance speed of Magento. Thanks for such nice post.

  17. gloopy
    February 6, 2012 at 6:24 am /

    we have just setup apc on our server and thanks to this post it works wonders :)

    many thanks

  18. Gijs
    March 1, 2012 at 3:50 am /

    If you really want speed on the cheap!

    Try memcached, with tmpfs and the BRIM fullpage caching module.

    mkdir -p /var/www/
    mount -t tmpfs -o size=500M,mode=0744 tmpfs /var/www/
  19. Al
    March 19, 2012 at 7:39 am /

    A very brief and descriptive comparison between XCache, Varnish, Boost, APC, and Memcached is shown at Brief Summary: XCache, Varnish, Boost, APC, and Memcached

  20. Peggy
    June 21, 2012 at 10:07 am /

    Did you mean sudo apt-get install php-apc instead of sudo apt-get install php5-apc? I get an “E: Unable to locate package php5-apc” when I run that command as it is written in this article.

  21. Thomas
    August 30, 2012 at 9:19 pm /

    Hi! Thanks for this detailed tutorial! I’m new to Magento and feel lost with all of the codes and stuf..
    I’d like an extension to do the optimissation for me…
    here’s a related article do you think it’s worth giving a try?

  22. snh
    September 17, 2012 at 10:55 pm /

    Hi, great article. But now comes the biggie.

    – How do I combine both APC and memcached? (we have both, something with slow/fast)

    And some small questions. Maybe we can exchange emails Robert?

    – Suppose I install Nitrogento or another FPC: will it save the cache on disk, or in the memcache?

    – Where is the /var/cache and /var/session stored in these examples? In the memcache, or still on disk.

    1. Andy
      November 30, 2012 at 5:48 am /


      something like:


      1. Andy
        November 30, 2012 at 5:50 am /

        grr (must read instructions)

        <servers><!-- The code supports using more than 1 server but it seems to hurt performance -->
        1. snh
          December 31, 2012 at 7:10 am /

          Thanks for that. Will try.

          Must say that I was advised recently to only activate APC (and not both).

          We installed Brim FPC that we are quite happy with. Although nothing made our site fly as the freeware code of Ezapps Zoom (but, het no support!).

          The problem now lies in our backend. Updating and setting up a new store is so cumbersome because of all the loading times.

  23. sofiny
    October 27, 2012 at 7:25 am /

    Very detail learning, thank you

  24. Sander
    December 17, 2012 at 11:15 pm /

    Hi, thanks for the good tutorial. I have a question about multistores. I have a vps with APC and it’s working fine with one magento install and 1 store. Now I have addes an extra store with a different URL. Now the second URL is very slow and I think it’s because APC Is not doing anything with it. Any idea how I can fix this?

  25. molli123
    March 8, 2014 at 12:27 am /

    Hi, could you please correct the apc.ini (using semicolon instead of hashes for comments). Took me a while to find this error…

  26. Andre Bellafronte
    October 11, 2014 at 6:39 am /

    Hello! Great post!

    You say to use APC with multiple sites, I need make a unique prefix for each site


    But I don´t understand how configure this for every site. How APC will know how prefix is for each site?

  27. SysIT
    October 23, 2014 at 3:00 pm /

    Great guide, very detailed and bookmarked!. I wanted to ask for some input if you got a moment..

    I have a single Magento install with multiple stores but all using ls links to the “root” store install folders /app /js /media /skin directories.

    I have APC in and it appears to be working as i see some info using the apc.php file.


    User Cache Information
    Cached Variables 74 ( 1.2 MBytes)
    Hits 198
    Misses 53

    but for

    File Cache Information
    Cached Files 0 ( 0.0 Bytes)
    Hits 1

    it does not seem to be caching any actual files….

    I have been playing with this for a while with no luck it seems and our magento is running fairly slow even thought it is on quad core server with NGINX and php-fpm and as optimized as i can get it (i run several other web servers hosting Kayako systems and other company websites that all fly!)

    I put in my local.xml various things




    store_* is the prefix for my store names. i presume it does not have to match what i have in my index files?

    example for one store:

    /* Store or website code */
    $mageRunCode = isset($_SERVER[‘MAGE_RUN_CODE’]) ? $_SERVER[‘MAGE_RUN_CODE’] : ‘store_true_en';

    /* Run store or run website */
    $mageRunType = isset($_SERVER[‘MAGE_RUN_TYPE’]) ? $_SERVER[‘MAGE_RUN_TYPE’] : ‘store';

    Any assistance as i am sure i missed something..

    This is running on CentOS 6.5 with PHP 5.4.28

  28. SysIT
    October 23, 2014 at 4:00 pm /

    Seem this may be the issue: I do use php-fpm

    1. The storage is always empty no matter how we are using it – for opcode, or just for cache.

    There is one common issue which can cause this situation. Most likely PHP on the server works in the Fast-CGI mode. In this mode parallel PHP processes don’t have access to each other’s data stored at APC. This is an old APC/PHP bug and there is no good solution for this problem: either change PHP mode or use other cache engine.

  29. Fix Magento Error Reporting Level Windows XP, Vista, 7, 8 [Solved]

    […] Speeding up Magento with APC or Memcached – … – There are quite a few discussions on the Magento forums and various blogs about Magento performance tuning and optimization. A few simple Google searches will …… […]

  30. Magecom
    September 1, 2015 at 12:31 am /

    Hi Robert,

    Very interesting article and useful tips!
    Are there new ways to speed up Magento?

  31. CDNsun
    September 8, 2015 at 8:38 pm /

    Great post! Enjoyed the reading and your tips.

  32. Life On Vape
    October 4, 2015 at 7:48 am /

    We have just implemented some of these tips.Thanks guys


Add a Comment & Join the Discussion

Insert small snippets of code by using [code]{your_code_here}[/code]
For larger code blocks please use and paste your link.

You may also use the following HTML in your comment: <a href="" title=""> <abbr title="">
<acronym title=""> <blockquote cite=""> <cite> <em> <strike> <strong>