Bysoft China's Blog > Your e-commerce partner

Share Our Knowledge, Share Our Passion
  • rss
  • Home
  • About Us
  • SERVICES
  • WORKS
  • START ECOMMERCE WEBSITE
  • START CMS WEBSITE
  • CONTACT US

Varnish Cache tested on Magento

Lucas Liang | September 26, 2011

Varnish Cache is a web application accelerator, also known as a caching HTTP reverse proxy, which is designed for content-heavy dynamic web sites. And today, we have tried Varnish on a Magento default sample shop, to see how well Varnish helps on the loading speed, compared to the bare Magento install.

1          Varnish Features for Magento

1.1         Enable full page caching using Varnish.

For a sample Magento website, Varnish is enabled to cache most of the pages, like Home Page, and other Page Categories.

1.2         Varnish servers are configurable in Admin, under System / Configuration / General – Varnish Options

You can specify which Varnish server Magento website is using. If just use one server for hosting Magento website, we can install varnish on the same server and input the blank as 127.0.0.1:80 which is by default.

1.3         Automatically clears (only) cached pages when products, categories and CMS pages are saved.

For example, if you add a new product or update the parameters of the products, when you click the save button in the admin page, the website data which stored in Varnish will be automatically purged, so that you won’t read the old data in the Varnish Cache.

In the figure below, I modified the price of HTC Touch Diamond, when I click ‘Save’, the Data in the Varnish Cache is purged, so you can see the price of the product is up-to-date.

1.4         Adds a new cache type in Magento Admin, under System / Cache Management and offers the possibility to deactivate the cache and refresh the cache.

For example, if you finish adding a new category, you click ‘Save Category’, then you click on the Home Page, you won’t see the new category in the navigation bar, you need to manually refresh the Vanish cache in Magento Admin under System / Cache Management. You can see the picture below :

1.5         Notifies Admin users when a category navigation is saved and Varnish cache needs to be refreshed so that the menu will be updated for all pages.

You can see the green lines under the navigation bar.

1.6         Turns off varnish cache automatically for users that have products in the cart or are logged in, etc.)

Products in the cart and user logged in which are user-specific parts, which needs to interact with Apache directly, which can be passed from Varnish cache.

2          Varnish Installation

2.1         Prerequisites

it’s better running on a 64bit Linux.

wget http://download.fedora.redhat.com/pub/epel/5/x86_64/jemalloc-2.1.3-2.el5.x86_64.rpm
rpm -ivh jemalloc-2.1.3-2.el5.x86_64.rpm

Hardware Configuration for Magento + Varnish Server

  • Xen Server
  • CPU: Quad-Core Xeon  E5506  @ 2.13GHz
  • Memory: 4G

2.2         Install Varnish 2.1.5

wget http://repo.varnish-cache.org/source/varnish-2.1.5.tar.gz
tar zxf varnish-2.1.5.tar.gz
cd varnish-2.1.5
./configure
make && make install

2.3         Install Varnish Module

  • Download the latest version of Magento and install it
  • cd [magento root folder]
  • Create folder app/code/local/Varnish
  • Copy folders controllers/  etc/  Helpers/  Model/  under  app/code/local/Varnish/
  • Copy Magneto_Varnish.xml to app/etc/modules/
  • Copy varnish.vcl to /etc/varnish/

2.4         Install Modman

curl http://module-manager.googlecode.com/files/modman-1.1.5 > modman
chmod +x modman
mv modman /usr/bin

2.5         Install git

rpm  –ivh  http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
yum install git

2.6         Clone the git repository

cd [magento root folder]
modman init
env GIT_SSL_NO_VERIFY=true modman magneto-varnish clone https://github.com/madalinoprea/magneto-varnish.git

2.7         Apache Config

vim /etc/httpd/conf/httpd.conf
change Listen 80 to Listen 8080

2.8         Launch Varnish

We will use 1G for the cache storage. It depends on how much objects need to be cache, 1G is sufficient in most of the cases.

/usr/local/sbin/varnishd  -f /etc/varnish/varnish.vcl -s malloc,1G -T 127.0.0.1:2000

Now Varnish is ready for Magento.

3          Varnish tests for Magento (Magento Version 1.5.1)

3.1         Bench report for bare Magento and Magento + Varnish (Load testing tool : Funkload)

For the sample Home page of Magento, Figure 1 is without Varnish and Figure 2 is with Varnish. You can make the comparison.

In Figure 1, I made the load testing with concurrent users 2, 6, 10, 14, 18, 22. You can easily read from the table below the chart, The first column CUs means concurrent users, the third column Rating which is based on the response time of Home page of Magneto. You can find the response time for 14 CUs are becoming Good, and 18 CUs are becoming FAIR, 22 CUs are becoming POOR, which indicates that if the concurrent users are larger than 22, the performance of bare Magento will be POOR or UNACCPETABLE.

In Figure 2, I made the load testing with concurrent users 20, 40, 60, 80, 100, 120. The below test is also based on the sample home page of Magento. You can see even with Maximum 120 concurrent users, The Rating is still Excellent.

4          Testing Scenarios (Load testing tool: Jmeter)

The test scenarios below are tested under three platforms. The .cvs files are exported from the test results of Jmeters :

  • Magento
  • Magento + Varnish
  • Magento + Varnish + J2T_AJAXCART_LITE-1.1.3

Clarification of the following figures :

  • Column 1 : test pages sequence.
  • Column 2 : how many times the pages are being loaded.
  • Column 3 : the average time for loading the page.

4.1         Scenario 1 : Navigation

  • Home Page : http://192.168.0.38/magento3/
  • Page category A : http://192.168.0.38/magento3/furniture.html
  • Page category A_a : http://192.168.0.38/magento3/furniture/living-room.html
  • Product Page A_a_1 : http://192.168.0.38/magento3/furniture/living-room/ottoman.html
  • Page category B_b : http://192.168.0.38/magento3/electronics/cell-phones.html
  • Product Page C_c_2 : http://192.168.0.38/magento3/apparel/shoes/mens.html

4.2         Scenario 2 : Add to cart

  • Home Page : http://192.168.0.38/magento3/
  • Page category A : http://192.168.0.38/magento3/furniture.html
  • Page category A_a : http://192.168.0.38/magento3/furniture/living-room.html
  • Product Page A_a_1 + action add to cart : http://192.168.0.38/magento3/furniture/living-room/ottoman.html
  • Shopping cart page : http://192.168.0.38/magento/checkout/cart/

4.3         Scenario 3 : Customer / Checkout

  • Home Page : http://192.168.0.38/magento/
  • Login Page : http://192.168.0.38/magento/customer/account/login/
  • Create account page :
    • http://192.168.0.38/magento/customer/account/create/
    • http://192.168.0.38/magento/customer/account/createpost/
  • Add default adresse page :
    • http://192.168.0.38/magento/customer/address/
    • http://192.168.0.38/magento/customer/address/formPost/
  • Product Page A_a_1 + action add to cart :
    • http://192.168.0.38/magento/furniture/living-room.html
    • http://192.168.0.38/magento/furniture/living-room/ottoman.html
  • Shopping cart page : http://192.168.0.38/magento/checkout/onepage/saveOrder/
  • Checkout steps :
    • http://192.168.0.38/magento/checkout/cart/
    • http://192.168.0.38/magento/checkout/onepage/
    • http://192.168.0.38/magento/checkout/onepage/saveBilling/
    • http://192.168.0.38/magento/checkout/onepage/getAdditional/
    • http://192.168.0.38/magento/checkout/onepage/progress/
    • http://192.168.0.38/magento/checkout/onepage/saveShippingMethod/
    • http://192.168.0.38/magento/checkout/onepage/progress/
    • http://192.168.0.38/magento/checkout/onepage/savePayment/
    • http://192.168.0.38/magento/checkout/onepage/progress/
  • Checkout success : http://192.168.0.38/magento/checkout/onepage/success/

4.4         Conclusion

According to the above tests, for the static pages, Varnish performs great. For the customer specific settings, like login, logout, the cart, and https pages, Varnish will not cache these data, which will need to be directly processed by Apache, so the load average time of the customer specific pages can’t be seen any difference with or without Varnish. Varnish is a good tool for basic web page navigation.

Categories
Ecommerce, Magento, Web Technologies
Tags
Magento, speed, technical, tests, tips, website cache
Comments rss
Comments rss
Trackback
Trackback

« BysoftChina is now an Oracle Partner! The Newsletter Generator: A Module “Made In Bysoft” »

18 Responses to “Varnish Cache tested on Magento”

  1. gamefly promo code on tv 2012 says:
    March 2, 2012 at 13:57

    I agree with your details , wonderful post.

  2. Nicholas says:
    March 3, 2012 at 01:01

    Iunderstand what you are saying and I agree with you

  3. mbt sko tilbud says:
    March 4, 2012 at 01:55

    After study a few of the weblog posts in your web site now, and I actually like your method of blogging. I bookmarked it to my bookmark website checklist and will likely be checking again soon. Pls take a look at my website online as properly and let me know what you think.

  4. Tomas says:
    March 4, 2012 at 05:30

    Hi Lucas,

    sorry for my stupid question, I don’t have a “Varnish Options” in my admin panel.

    Do you have installed some module to have this option listed in admin?

    Thank you for any help.

    Kind regards, Tomas

  5. gamefly coupon code discounts says:
    March 4, 2012 at 23:04

    Thanks for helping out, excellent info .

  6. Vince Tennessee says:
    March 5, 2012 at 00:12

    I figured I would reveal some information with everyone to contribute to the community, in hopes that more folks will share some of their methods. I’ve made exactly $11,978 in the last four months just by using http://Earn-1100-Weekly.info It’s a little gem of a software that pretty much allows me to live from my site. Have you seen it yet?

  7. fruit mocking party says:
    March 5, 2012 at 01:27

    Hello there! This is my first visit to your blog! We are a collection of volunteers and starting a new initiative in a community in the same niche. Your blog provided us useful information to work on. You have done a extraordinary job!

  8. new acoustic music says:
    March 5, 2012 at 07:15

    My spouse and I absolutely love your blog and find almost all of your post’s to be precisely what I’m looking for. Do you offer guest writers to write content for yourself? I wouldn’t mind creating a post or elaborating on a number of the subjects you write about here. Again, awesome blog!

  9. Forum Internet Marketing says:
    March 5, 2012 at 09:16

    Hey! I could have sworn I’ve been to this site before but after reading through some of the post I realized it’s new to me. Nonetheless, I’m definitely delighted I found it and I’ll be bookmarking and checking back often!

  10. how to pick up girls says:
    March 6, 2012 at 16:12

    I think one of your commercials triggered my browser to resize, you might want to put that on your blacklist. how to pick up girls

  11. roofing murfreesboro says:
    March 6, 2012 at 17:08

    Thank you, I’ve been seeking for details about this subject for ages and yours is the best I have discovered so far.

  12. Honda mobil says:
    March 7, 2012 at 08:08

    Hi there just wanted to give you a quick heads up and let you know a few of the pictures aren’t loading properly. I’m not sure why but I think its a linking issue. I’ve tried it in two different internet browsers and both show the same results.

  13. jump manual advice says:
    March 7, 2012 at 08:29

    Howdy just wanted to give you a quick heads up. The text in your content seem to be running off the screen in Chrome. I’m not sure if this is a formatting issue or something to do with internet browser compatibility but I figured I’d post to let you know. The design look great though! Hope you get the issue fixed soon. Many thanks

  14. hd televisions says:
    March 7, 2012 at 20:23

    Great post, I do believe blog owners should acquire so much from this web blog its really user friendly .

  15. Isabel Marant designer fashion says:
    March 8, 2012 at 03:22

    Sweet blog! I found it while searching on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there! Thank you

  16. Tatouage nuque says:
    March 8, 2012 at 08:14

    We absolutely love your blog and find nearly all of your post’s to be precisely what I’m looking for. can you offer guest writers to write content for you? I wouldn’t mind producing a post or elaborating on a few of the subjects you write in relation to here.

  17. Keila says:
    March 12, 2012 at 22:39

    Youre so cool! I dont suppose Ive read anything like this before. So good to seek out any person with some authentic thoughts on this subject. realy thanks for starting this up. this web site is one thing that is needed on the net, someone with a bit originality. useful job for bringing one thing new to the internet!

  18. Magento hosting says:
    March 28, 2012 at 05:57

    Nice guide and how, to be sure to check out varnish 3.0 :-)

Leave a Reply

Click here to cancel reply.

Recent Posts

  • BBS (Bulletin Board Systems) in China
  • How to buy online in China ? The payment gateway process (end-user perspective)
  • Groupon (Gaopeng) in China and Lashou, its direct competitor
  • Huaban or the Chinese Pinterest
  • Team Member’s interview : Stephanie web project manager
  • The new version 1.12 of Magento Enterprise
  • 2nd China eBusiness Entrepreneurship Conference
  • MD5 is dead : what to use now?
  • The constraints of the Chinese Internet
  • The Chinese Delivery Methods

Categories

  • Content Management (CMS)
  • Ecommerce
  • FAQ Shopmaker – Standard Ecommerce
  • Internet
  • Magento
  • News
  • PHP
  • References
  • Search Engine Marketing (SEM)
  • Search Engine Optimization (SEO)
  • Web Design
  • Web Development
  • Web Technologies
  • Webmarketing

Tags

api asia b2c Baidu business bysoft Bysoftchina c2c china CMS company cpc Design Ecommerce ecommerce navigation education ergonomics eZ publish Google integration interview japan Joomla! lecture Magento open source PHP php engineer ppc press programming sem seo shanghai shopmaker social media symfony tips tutorial web application Webmarketing website cache zend zend framework Zend PHP 5

Recent Comments

  • Taunya Bacak on Tips For A More Effective Paid Search Campaign
  • sildenafil on Case Study for Rio-Mints
  • blog IT on Baidu.com plans to launch an instant messaging service
  • appeftdormape on Greetings from Bysoft for the Year of the Ox
  • jennera on About Us

Pages

  • About Us

Archives

  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • October 2011
  • September 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • March 2011
  • February 2011
  • January 2011
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • June 2009
  • May 2009
  • February 2009
  • January 2009
  • October 2008
  • April 2008
  • March 2008
  • February 2008
  • December 2007
  • November 2007
  • August 2007

Bysoft China

  • Consulting
  • Content Management
  • E-Commerce
  • Graphic Design
  • Magento
  • Marketing Website
  • Programming
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox