Varnish & Magento

2,905 views

Published on

Deze presentatie werd gegeven op de Magento User Group over Magento Caching (16 april 2013).

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,905
On SlideShare
0
From Embeds
0
Number of Embeds
1,730
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Varnish & Magento

  1. 1. Caching MagentoUsing Varnish to speed up Magento Maarten van Schaik - 16-4-2012
  2. 2. Who am I• Maarten van Schaik• Software developer at Byte Internet• Creates tools for hosting Magento shops
  3. 3. The issue• Magento is very extensive and complex• There are a lot of extensions of varying quality• This can cause shops to become too slow• Which impacts turnover
  4. 4. Possible solutions• Better hardware• Reduce number of extensions• Dont use Magento! :-)
  5. 5. Normal request GET /katten/kattenvoer 200 <html> ...• User makes request• Magento renders response• Response time: 0.5 - 3 seconds
  6. 6. Request through Varnish GET /katten/kattenvoer GET /katten/kattenvoer 200 <html> ... 200 <html> ...• User makes request• Varnish passes request to Magento• Varnish saves response in memory• And serves it to the user
  7. 7. Next time: Varnish cache hit GET /katten/kattenvoer 200 <html> ...• Varnish has response in memory so can immediately serve it to the user• Response time: <100 ms
  8. 8. Uncacheable pages GET /cart/checkout GET /cart/checkout Cache-control: no-cache 200 <html> ... 200 <html> ...• Magento instructs Varnish to exclude certain URLs from the cache
  9. 9. Personalized pages POST /account/Loginpost POST /account/Loginpost Set-Cookie: LOGGED_IN 200 <html> ... Set-Cookie: LOGGED_IN 200 <html> ...• Once a user logs in it gets a cookie that indicates to Varnish that requests have become uncacheable
  10. 10. User views personalized pages Cookie: LOGGED_IN GET /katten/kattenvoer Cookie: LOGGED_IN GET /katten/kattenvoer 200 <html> ... 200 <html> ...• As long as user has special cookie (logged in, stuff in basket), Varnish will not cache• Response time back to 0.5 - 3 seconds
  11. 11. Changing or removing catalog GET /admin/delete/id/324 GET /admin/delete/id/324 Purge /katten/kattenvoer Purge /katten .... 200 <html> ... 200 <html> ...• Magento tells Varnish to purge changed pages
  12. 12. So, what do I need?• Avoid extensions that offer personalization• Extension for Magento with matching Varnish configuration filehttp://connect20.magentocommerce.com/community/Varnish_Cachehttp://connect20.magentocommerce.com/community/Made_Cachehttps://github.com/fbrnc/Aoe_Statichttps://github.com/nexcess/magento-turpentinehttps://github.com/huguesalary/Magento-Varnish
  13. 13. Is Varnish caching for you?• Not all shops are fit for full-page caching• Will probably not work out of the box, so knowledge on inner workings of Magento might be needed• Balance between personalized shopping experience and caching• Probably mostly useful for (very) large-scale sites with high concurrency

×