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 (43)

  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

    Reply
  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

    Reply
  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 (http://www.tinybrick.com/magento-modules/performance/improve-magentos-slow-performance.html/).

    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!

    Reply
  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:

    http://guides.tinybrick.com/magento/speed-testing

    Reply
  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 (http://guides.tinybrick.com/magento/lightspeed#tagging)
    - hole-punching for displaying selected dynamic content “punches” after a cached page loads (http://guides.tinybrick.com/magento/lightspeed#hole-punching)

    While I don’t have hard numbers on testing other than the benchmarks that are on the product page (http://www.tinybrick.com/improve-magentos-slow-performance.html#benchmarks), we’ve had several enterprise customers that have tried both and prefer our product.

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

    Instead of yslow try page speed extension from google:
    http://code.google.com/intl/nl/speed/page-speed/docs/extension.html

    We will try the apache mod if we have time:
    http://code.google.com/intl/nl/speed/page-speed/docs/rules_intro.html

    Reply
  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.

    Apc
    Memcached
    Apc

    Just posted the more complete config in a blog post.

    Reply
  8. Pete
    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?

    Thanks

    Pete.

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

    Great performance tips! :)

    Reply
  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.

    Reply
  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 :(

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

    unfortunatelly not work with 1.4.1 ;(

    Reply
  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
    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 ?

    Reply
  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.

    Reply
  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.

    Reply
  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

    Reply
  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/www.mysite.com/ramdrive
    mount -t tmpfs -o size=500M,mode=0744 tmpfs /var/www/www.mysite.com/ramdrive
    
    Reply
  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

    Reply
  20. Peggy
    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.

    Reply
  21. Thomas
    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 http://www.shopping-cart-diagnostics.com/blog/magento-store-performance-what-you-should-know/ do you think it’s worth giving a try?

    Reply
  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.

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

      @snh

      something like:

      Apc
      Memcached
      Apc

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

        grr (must read instructions)

        <cache>
        <backend>Apc</backend>
        <slow_backend>Memcached</slow_backend>
        <fast_backend>Apc</fast_backend>
        <slow_backend_options>
        <servers><!-- The code supports using more than 1 server but it seems to hurt performance -->
        <server>
        <host><![CDATA[127.0.0.1]]></host>
        <port><![CDATA[11211]]></port>
        <persistent><![CDATA[1]]></persistent>
        </server>
        </servers>
        <compression><![CDATA[]]></compression>
        <cache_dir><![CDATA[]]></cache_dir>
        <hashed_directory_level><![CDATA[]]></hashed_directory_level>
        <hashed_directory_umask><![CDATA[]]></hashed_directory_umask>
        <file_name_prefix><![CDATA[]]></file_name_prefix>
        </slow_backend_options>
        
        <memcached>
        <servers>
        <server>
        <host><![CDATA[127.0.0.1]]></host>
        <port><![CDATA[11211]]></port>
        <persistent><![CDATA[1]]></persistent>
        </server>
        </servers>
        <compression><![CDATA[]]></compression>
        <cache_dir><![CDATA[]]></cache_dir>
        <hashed_directory_level><![CDATA[]]></hashed_directory_level>
        <hashed_directory_umask><![CDATA[]]></hashed_directory_umask>
        <file_name_prefix><![CDATA[]]></file_name_prefix>
        </memcached>
        </cache>
        
        Reply
        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.

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

    Very detail learning, thank you

    Reply
  24. Sander
    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?

    Reply
  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…

    Reply

Add a Comment & Join the Discussion

Insert small snippets of code by using [code]{your_code_here}[/code]
For larger code blocks please use http://pastebin.com 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>