SlideShare a Scribd company logo
1 of 25
Download to read offline
München Berlin Hamburg Köln Nürnberg Grenoble Prag
Ultra-performant dynamic websites with Varnish
Many customers, lots of transactions AND nevertheless fast?
Talk at OSDC, Nürnberg
Dr. Christian Winkler, mgm technology partners GmbH
25.04.2012
About…
Christian Winkler
● Working as enterprise architect
● Expertise in high performance, scalability
● Working for…
mgm technology partners
● Software development projects
● Large projects, lots of data, scalability
● Customers like Elster Online, LIDL, Hewlett Packard, GfK
1: MANY VISITORS
Performance problems of online shops
Problem of many online shops
Growing number of accesses
Growing number of visitors
Faster and faster Internet access
Less and less patience
Solution: buy more servers
 Not efficient
Expensive buying and maintaining
Always consider peak performance
 Most of the time idle
 Most pages are identical for all
 Especially true for homepage
 Sometimes little personalization
might be included
Different content for different visitors
 Differentiate between stateless
and stateful visitors
 Visitors with state get dynamic
page
 Stateless visitors get cached
static copy
Idea
Observation
Choosing a suitable cache
Requirements
Optimized hit rate
High performance and stability
Flexible configuration
Powerful cache management
Decision: Use Varnish
Super fast
Atomic cache management
Open Source Software for page caching
Extremely flexible, procedural configuration
Apache
httpd
Apache
Tomcat
JPG, GIF, JS,
CSS
JSP
AJP
HTTP
Varnish
Tasks for Varnish
HTTP access for all users
o Exposed in Internet (!)
o Directly behind Load Balancer
Distribution of HTTP accesses to backend systems
o Analyze requests
o Find out responsible system and route request correctly
o Maybe cache response
Maintain and expire cache
o Maximum size of cache
o Automatic and manual expiry, expiring data when cache is full
Write log files (!)
NOT part of Varnish‘s tasks
o Static content (web server‘s domain)
o SSL
Anatomy of a Varnish access (not cacheable)
HTTP
vcl_recv
vcl_
fetch
pass
vcl_
deliver
pass
Apache
httpd
Anatomy of a Varnish acces (cacheable)
HTTP
vcl_recv
Cache
vcl_
fetch
vcl_miss
vcl_
deliver
hit_for_pass Apache
httpd
Anatomy of a Varnish acces (in cache)
HTTP
vcl_recv
Cache
vcl_
deliver
Anatomy of a Varnish access (overview)
HTTP
vcl_recv
Cache
vcl_
fetch
pass
vcl_miss
vcl_
deliver
hit_for_pass
pass
Apache
httpd
Performance gain by caching
Example: Online shop
Naive Solution: many fatabase accesses
 100 rrequests/s
Improved solution: database cache
 500 requests/s
Using Varnish als HTML cache
 10.000 requests/s (Gbit-Limit)
Performance gain by caching
Why is Varnish so fast?
 Using virtual memory  delivering objects from RAM
 Compiled configuration  no bottlenecks for requests
High hit rate is essential
 Think very carefully before implementing
 Monitoring extremely important
Take client cache into account (Expires)
Improving the hit rate
Differentiate between different types of cookies
 Relevant  Use as index or skip cache
 Irrelevant  Ignore or delete in vcl_recv
 Partly relevant for caching  delete irrelevant parts
Normalize the headers
 Analyze which headers have an impact on content
 Avoid server side browser checks and content negotiation
 Don‘t use „Vary“ in the response
 Reduce to strictly necessary headers and content
 Use critical headers as index
Different compressions
 Internet Explorer: Accept-Encoding: deflate,gzip
andere: Accept-Encoding: gzip,deflate
 Can only achieve halt hit rate without normalization
Problems and solutions
Many websites are not stateless
o Cookie creation only when necessary
o State transition (sessions are needed suddenly)
Make as many requests stateless as possible
o Increase hit rate of cache
o Keep simple state on client side (e.g. personalization)
What can be cached?
o Only stateless content pages (GET)
o Be careful with transactions (workflows etc.)
How to handle content changes?
o Delete cache completely
o Selectively delete certain pages
o Cache-Control to tune time that objects can stay in cache
Further optimization
Welcome username to our website
Your
shoppi
ng cart
Teaser
(TTL:
2min)
Main navigation (TTL: 60min)
Side
navi-
gation
(TTL:
60min) Content
(TTL: 5 min)
Template
(TTL: 1d)
 Distributed cache
 Specialized service providers
 Cure for hardware limits (Gb)
Content Distribution Network (CDN)
 Differentiate between static and dynamic
elements of a page
 Cache all static elements
 Page assembly in Varnish via ESI
Edge Side Includes (ESI)
 Cache dynamic elements also (in RAM)
 Only POST requests make it to the
application server
 Page assembly in Varnish
Memcached or Redis
2: MANY TRANSACTIONS
Next challenge
Situation with many parallel orders
ERP system becomes bottleneck
● Many transactions
● All for the same product
 Locking kills you
Application server overloaded
● Threads used by ERP
● All threads waiting
● No pages are show
● Whole site not working
 (Dynamical) website down
● Frequently with special
campaigns
● Hurts as marketing budget
wasted
Order ERP
Any page
Order ERP
Order ERP
Order ERP
Solution: asynchronous (loose) coupling between shop and ERP
Grundsätzliche Idee
● Implement an asynchronous
interface to ERP (switch)
● Use ActiveMQ
● Transfer orders serially to ERP
in background
Restrictions
● Stock numbers in shop
● Slight risk of over-orders
● Asynchronouse error handling
is difficult and error-prone
● Not for permanent service
Result
● Several lakh  orders per hour
Any page
ERP1
ERP2
ERP3
Order
Order
ARCHITECTURE
Software-Komponenten nach Optimierung
© mgm technology partners GmbH 03.05.201122
Customer
Frontend
Application
Templates (JSP, JSTL, TagLibs)
Actions
Rendering HTML / CSS
JS
Web Server Static Resources / Security / Black List
Cache
Browser
Web Server
Cluster
App Server
Cluster
Transaction Management
Configuration
O/R-Mapping
Connection Pooling (c3p0)
PersistencyDB Server
Cluster
Fail Over (Oracle RAC/DG)
HTTP/S
Java API
JDBC (Oracle OCI)
Externe
Services
Such-
maschinen,
Store Locator,
etc.
ERP via
Web Cache
CDN n1 CDN n2 CDN n3
HTTP
HTTP
Should all of them
want to come…
…we are ready
References
Web site of LIDL
● http://www.lidl.de
More detailed information
● http://www.mgm-tp.com
● http://blog.mgm-tp.com/2012/01/varnish-web-cache/
Tomcat Application Server
● http://tomcat.apache.org/
Varnish Web Cache
● https://www.varnish-cache.org/
Edge Side Include (ESI)
● http://www.w3.org/TR/esi-lang
Memcached and Redis
● http://memcached.org/, http://redis.io/
ActiveMQ
● http://activemq.apache.org/
Innovation Implemented.
mgm technology partners GmbH
Holländischer Brook 2
20457 Hamburg
Tel.: +49 (0) 40 / 80 81 28 20-0
Fax: +49 (0) 40 / 80 81 28 20-388
http://www.mgm-tp.com
mgm technology partners GmbH
Frankfurter Ring 105a
80807 München
Tel.: +49 (0) 89 / 35 86 80-0
Fax: +49 (0) 89 / 35 86 80-288
http://www.mgm-tp.com
mgm technology partners s.r.o.
Letenské náměstí 4/157
170 00 Praha 7
Tel.: +420 239 005 108
Fax: +420 239 005 444
http://www.mgm-tp.com
mgm technology partners france eurl
30, Boulevard Gambetta
38000 Grenoble
Frankreich
Tel.: +33 (0) 4 80 80 75 14
http://www.mgm-tp.com
mgm technology partners GmbH
Vordere Cramergasse 11
90478 Nürnberg
Tel.: +49 (0) 911 / 210 6941
http://www.mgm-tp.com
mgm technology partners Köln GmbH
Hohenstaufenring 30-32
50674 Köln
Tel.: +49 (0) 221 / 35 53 73-10
Fax: +49 (0) 221 / 35 53 73-99
http://www.mgm-tp.com

More Related Content

What's hot

GemStone/S @ Vienna University
GemStone/S @ Vienna University GemStone/S @ Vienna University
GemStone/S @ Vienna University ESUG
 
Web Performance Part 3 "Server-side tips"
Web Performance Part 3  "Server-side tips"Web Performance Part 3  "Server-side tips"
Web Performance Part 3 "Server-side tips"Binary Studio
 
Netcentric: customer experience
Netcentric: customer experienceNetcentric: customer experience
Netcentric: customer experienceVarnish Software
 
JS Lab`16. Андрей Колодницкий: "Разработка REST сервисов на SailsJS"
JS Lab`16. Андрей Колодницкий: "Разработка REST сервисов на SailsJS"JS Lab`16. Андрей Колодницкий: "Разработка REST сервисов на SailsJS"
JS Lab`16. Андрей Колодницкий: "Разработка REST сервисов на SailsJS"GeeksLab Odessa
 
StripeEu Twistedbytes Presentation
StripeEu Twistedbytes PresentationStripeEu Twistedbytes Presentation
StripeEu Twistedbytes Presentationtwistedbytes
 
Using flash on the server side
Using flash on the server sideUsing flash on the server side
Using flash on the server sideHoward Marks
 
MongoDB SF Python
MongoDB SF PythonMongoDB SF Python
MongoDB SF PythonMike Dirolf
 
Caching: A Guided Tour - 10/12/2010
Caching: A Guided Tour - 10/12/2010Caching: A Guided Tour - 10/12/2010
Caching: A Guided Tour - 10/12/2010Jason Ragsdale
 
Simple server side cache for Express.js with Node.js
Simple server side cache for Express.js with Node.jsSimple server side cache for Express.js with Node.js
Simple server side cache for Express.js with Node.jsGokusen Newz
 
STON Media Delivery Server
STON Media Delivery ServerSTON Media Delivery Server
STON Media Delivery ServerWineSOFT
 
Tulsa tech fest 2010 - web speed and scalability
Tulsa tech fest 2010  - web speed and scalabilityTulsa tech fest 2010  - web speed and scalability
Tulsa tech fest 2010 - web speed and scalabilityJason Ragsdale
 
Wwc london-perf-apps
Wwc london-perf-appsWwc london-perf-apps
Wwc london-perf-appsClaire Tran
 
The Future of zHeap
The Future of zHeapThe Future of zHeap
The Future of zHeapEDB
 
Skalowalna architektura na przykładzie soccerway.com
Skalowalna architektura na przykładzie soccerway.comSkalowalna architektura na przykładzie soccerway.com
Skalowalna architektura na przykładzie soccerway.comSpodek 2.0
 
Web Application Cache (APC, Memcache)
Web Application Cache (APC, Memcache)Web Application Cache (APC, Memcache)
Web Application Cache (APC, Memcache)Vijay Kumbhar
 
Configuring Apache Servers for Better Web Perormance
Configuring Apache Servers for Better Web PerormanceConfiguring Apache Servers for Better Web Perormance
Configuring Apache Servers for Better Web PerormanceSpark::red
 

What's hot (20)

GemStone/S @ Vienna University
GemStone/S @ Vienna University GemStone/S @ Vienna University
GemStone/S @ Vienna University
 
Web Performance Part 3 "Server-side tips"
Web Performance Part 3  "Server-side tips"Web Performance Part 3  "Server-side tips"
Web Performance Part 3 "Server-side tips"
 
Netcentric: customer experience
Netcentric: customer experienceNetcentric: customer experience
Netcentric: customer experience
 
JS Lab`16. Андрей Колодницкий: "Разработка REST сервисов на SailsJS"
JS Lab`16. Андрей Колодницкий: "Разработка REST сервисов на SailsJS"JS Lab`16. Андрей Колодницкий: "Разработка REST сервисов на SailsJS"
JS Lab`16. Андрей Колодницкий: "Разработка REST сервисов на SailsJS"
 
StripeEu Twistedbytes Presentation
StripeEu Twistedbytes PresentationStripeEu Twistedbytes Presentation
StripeEu Twistedbytes Presentation
 
Using flash on the server side
Using flash on the server sideUsing flash on the server side
Using flash on the server side
 
MongoDB SF Python
MongoDB SF PythonMongoDB SF Python
MongoDB SF Python
 
Caching: A Guided Tour - 10/12/2010
Caching: A Guided Tour - 10/12/2010Caching: A Guided Tour - 10/12/2010
Caching: A Guided Tour - 10/12/2010
 
Platform Cache
Platform CachePlatform Cache
Platform Cache
 
Simple server side cache for Express.js with Node.js
Simple server side cache for Express.js with Node.jsSimple server side cache for Express.js with Node.js
Simple server side cache for Express.js with Node.js
 
STON Media Delivery Server
STON Media Delivery ServerSTON Media Delivery Server
STON Media Delivery Server
 
Platform Cache (DF15 session)
Platform Cache (DF15 session)Platform Cache (DF15 session)
Platform Cache (DF15 session)
 
Tulsa tech fest 2010 - web speed and scalability
Tulsa tech fest 2010  - web speed and scalabilityTulsa tech fest 2010  - web speed and scalability
Tulsa tech fest 2010 - web speed and scalability
 
Wwc london-perf-apps
Wwc london-perf-appsWwc london-perf-apps
Wwc london-perf-apps
 
A Bird and the Web
A Bird and the WebA Bird and the Web
A Bird and the Web
 
The Future of zHeap
The Future of zHeapThe Future of zHeap
The Future of zHeap
 
Handling scale on AWS
Handling scale on AWSHandling scale on AWS
Handling scale on AWS
 
Skalowalna architektura na przykładzie soccerway.com
Skalowalna architektura na przykładzie soccerway.comSkalowalna architektura na przykładzie soccerway.com
Skalowalna architektura na przykładzie soccerway.com
 
Web Application Cache (APC, Memcache)
Web Application Cache (APC, Memcache)Web Application Cache (APC, Memcache)
Web Application Cache (APC, Memcache)
 
Configuring Apache Servers for Better Web Perormance
Configuring Apache Servers for Better Web PerormanceConfiguring Apache Servers for Better Web Perormance
Configuring Apache Servers for Better Web Perormance
 

Similar to OSDC 2012 | Ultra-performant dynamic websites with Varnish by Dr. Chriatian Winkler

Making it fast: Zotonic & Performance
Making it fast: Zotonic & PerformanceMaking it fast: Zotonic & Performance
Making it fast: Zotonic & PerformanceArjan
 
Magento for-performance- v01
Magento for-performance- v01Magento for-performance- v01
Magento for-performance- v01Rajneesh Maurya
 
Server Monitoring (Scaling while bootstrapped)
Server Monitoring  (Scaling while bootstrapped)Server Monitoring  (Scaling while bootstrapped)
Server Monitoring (Scaling while bootstrapped)Ajibola Aiyedogbon
 
Tips for a Faster Website
Tips for a Faster WebsiteTips for a Faster Website
Tips for a Faster WebsiteRayed Alrashed
 
Web Speed And Scalability
Web Speed And ScalabilityWeb Speed And Scalability
Web Speed And ScalabilityJason Ragsdale
 
Varnish & Magento TechTalk @Lyracons
Varnish & Magento TechTalk @LyraconsVarnish & Magento TechTalk @Lyracons
Varnish & Magento TechTalk @LyraconsEzequiel Kupelian
 
Scaling wix.com to 100 million users
Scaling wix.com to 100 million users Scaling wix.com to 100 million users
Scaling wix.com to 100 million users Aviran Mordo
 
Caching fundamentals by Shrikant Vashishtha
Caching fundamentals by Shrikant VashishthaCaching fundamentals by Shrikant Vashishtha
Caching fundamentals by Shrikant VashishthaShriKant Vashishtha
 
01 - Web Programming Intro.pptx
01 - Web Programming Intro.pptx01 - Web Programming Intro.pptx
01 - Web Programming Intro.pptxKarina González
 
AJAX for Scalability
AJAX for ScalabilityAJAX for Scalability
AJAX for ScalabilityTuenti
 
Ajax For Scalability
Ajax For ScalabilityAjax For Scalability
Ajax For Scalabilityerikschultink
 
Web performance optimization - MercadoLibre
Web performance optimization - MercadoLibreWeb performance optimization - MercadoLibre
Web performance optimization - MercadoLibrePablo Moretti
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesExove
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sitesdrupalcampest
 
Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...
Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...
Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...nine
 
Joomla! Performance on Steroids
Joomla! Performance on SteroidsJoomla! Performance on Steroids
Joomla! Performance on SteroidsSiteGround.com
 
Magento performancenbs
Magento performancenbsMagento performancenbs
Magento performancenbsvarien
 
Application Scalability in Server Farms - NCache
Application Scalability in Server Farms - NCacheApplication Scalability in Server Farms - NCache
Application Scalability in Server Farms - NCacheAlachisoft
 

Similar to OSDC 2012 | Ultra-performant dynamic websites with Varnish by Dr. Chriatian Winkler (20)

Making it fast: Zotonic & Performance
Making it fast: Zotonic & PerformanceMaking it fast: Zotonic & Performance
Making it fast: Zotonic & Performance
 
Magento for-performance- v01
Magento for-performance- v01Magento for-performance- v01
Magento for-performance- v01
 
Server Monitoring (Scaling while bootstrapped)
Server Monitoring  (Scaling while bootstrapped)Server Monitoring  (Scaling while bootstrapped)
Server Monitoring (Scaling while bootstrapped)
 
Tips for a Faster Website
Tips for a Faster WebsiteTips for a Faster Website
Tips for a Faster Website
 
Web Speed And Scalability
Web Speed And ScalabilityWeb Speed And Scalability
Web Speed And Scalability
 
Varnish & Magento TechTalk @Lyracons
Varnish & Magento TechTalk @LyraconsVarnish & Magento TechTalk @Lyracons
Varnish & Magento TechTalk @Lyracons
 
Jax Ajax Architecture
Jax Ajax  ArchitectureJax Ajax  Architecture
Jax Ajax Architecture
 
Scaling wix.com to 100 million users
Scaling wix.com to 100 million users Scaling wix.com to 100 million users
Scaling wix.com to 100 million users
 
Velocity 2010 - ATS
Velocity 2010 - ATSVelocity 2010 - ATS
Velocity 2010 - ATS
 
Caching fundamentals by Shrikant Vashishtha
Caching fundamentals by Shrikant VashishthaCaching fundamentals by Shrikant Vashishtha
Caching fundamentals by Shrikant Vashishtha
 
01 - Web Programming Intro.pptx
01 - Web Programming Intro.pptx01 - Web Programming Intro.pptx
01 - Web Programming Intro.pptx
 
AJAX for Scalability
AJAX for ScalabilityAJAX for Scalability
AJAX for Scalability
 
Ajax For Scalability
Ajax For ScalabilityAjax For Scalability
Ajax For Scalability
 
Web performance optimization - MercadoLibre
Web performance optimization - MercadoLibreWeb performance optimization - MercadoLibre
Web performance optimization - MercadoLibre
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sites
 
Drupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance SitesDrupalcamp Estonia - High Performance Sites
Drupalcamp Estonia - High Performance Sites
 
Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...
Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...
Challenges behind the scenes of the large Swiss e-Commerce shop apfelkiste.ch...
 
Joomla! Performance on Steroids
Joomla! Performance on SteroidsJoomla! Performance on Steroids
Joomla! Performance on Steroids
 
Magento performancenbs
Magento performancenbsMagento performancenbs
Magento performancenbs
 
Application Scalability in Server Farms - NCache
Application Scalability in Server Farms - NCacheApplication Scalability in Server Farms - NCache
Application Scalability in Server Farms - NCache
 

Recently uploaded

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 

Recently uploaded (20)

Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 

OSDC 2012 | Ultra-performant dynamic websites with Varnish by Dr. Chriatian Winkler

  • 1. München Berlin Hamburg Köln Nürnberg Grenoble Prag Ultra-performant dynamic websites with Varnish Many customers, lots of transactions AND nevertheless fast? Talk at OSDC, Nürnberg Dr. Christian Winkler, mgm technology partners GmbH 25.04.2012
  • 2. About… Christian Winkler ● Working as enterprise architect ● Expertise in high performance, scalability ● Working for… mgm technology partners ● Software development projects ● Large projects, lots of data, scalability ● Customers like Elster Online, LIDL, Hewlett Packard, GfK
  • 4. Performance problems of online shops Problem of many online shops Growing number of accesses Growing number of visitors Faster and faster Internet access Less and less patience Solution: buy more servers  Not efficient Expensive buying and maintaining Always consider peak performance  Most of the time idle
  • 5.  Most pages are identical for all  Especially true for homepage  Sometimes little personalization might be included Different content for different visitors  Differentiate between stateless and stateful visitors  Visitors with state get dynamic page  Stateless visitors get cached static copy Idea Observation
  • 6. Choosing a suitable cache Requirements Optimized hit rate High performance and stability Flexible configuration Powerful cache management Decision: Use Varnish Super fast Atomic cache management Open Source Software for page caching Extremely flexible, procedural configuration Apache httpd Apache Tomcat JPG, GIF, JS, CSS JSP AJP HTTP Varnish
  • 7. Tasks for Varnish HTTP access for all users o Exposed in Internet (!) o Directly behind Load Balancer Distribution of HTTP accesses to backend systems o Analyze requests o Find out responsible system and route request correctly o Maybe cache response Maintain and expire cache o Maximum size of cache o Automatic and manual expiry, expiring data when cache is full Write log files (!) NOT part of Varnish‘s tasks o Static content (web server‘s domain) o SSL
  • 8. Anatomy of a Varnish access (not cacheable) HTTP vcl_recv vcl_ fetch pass vcl_ deliver pass Apache httpd
  • 9. Anatomy of a Varnish acces (cacheable) HTTP vcl_recv Cache vcl_ fetch vcl_miss vcl_ deliver hit_for_pass Apache httpd
  • 10. Anatomy of a Varnish acces (in cache) HTTP vcl_recv Cache vcl_ deliver
  • 11. Anatomy of a Varnish access (overview) HTTP vcl_recv Cache vcl_ fetch pass vcl_miss vcl_ deliver hit_for_pass pass Apache httpd
  • 12. Performance gain by caching Example: Online shop Naive Solution: many fatabase accesses  100 rrequests/s Improved solution: database cache  500 requests/s Using Varnish als HTML cache  10.000 requests/s (Gbit-Limit)
  • 13. Performance gain by caching Why is Varnish so fast?  Using virtual memory  delivering objects from RAM  Compiled configuration  no bottlenecks for requests High hit rate is essential  Think very carefully before implementing  Monitoring extremely important
  • 14. Take client cache into account (Expires) Improving the hit rate Differentiate between different types of cookies  Relevant  Use as index or skip cache  Irrelevant  Ignore or delete in vcl_recv  Partly relevant for caching  delete irrelevant parts Normalize the headers  Analyze which headers have an impact on content  Avoid server side browser checks and content negotiation  Don‘t use „Vary“ in the response  Reduce to strictly necessary headers and content  Use critical headers as index Different compressions  Internet Explorer: Accept-Encoding: deflate,gzip andere: Accept-Encoding: gzip,deflate  Can only achieve halt hit rate without normalization
  • 15. Problems and solutions Many websites are not stateless o Cookie creation only when necessary o State transition (sessions are needed suddenly) Make as many requests stateless as possible o Increase hit rate of cache o Keep simple state on client side (e.g. personalization) What can be cached? o Only stateless content pages (GET) o Be careful with transactions (workflows etc.) How to handle content changes? o Delete cache completely o Selectively delete certain pages o Cache-Control to tune time that objects can stay in cache
  • 16. Further optimization Welcome username to our website Your shoppi ng cart Teaser (TTL: 2min) Main navigation (TTL: 60min) Side navi- gation (TTL: 60min) Content (TTL: 5 min) Template (TTL: 1d)  Distributed cache  Specialized service providers  Cure for hardware limits (Gb) Content Distribution Network (CDN)  Differentiate between static and dynamic elements of a page  Cache all static elements  Page assembly in Varnish via ESI Edge Side Includes (ESI)  Cache dynamic elements also (in RAM)  Only POST requests make it to the application server  Page assembly in Varnish Memcached or Redis
  • 19. Situation with many parallel orders ERP system becomes bottleneck ● Many transactions ● All for the same product  Locking kills you Application server overloaded ● Threads used by ERP ● All threads waiting ● No pages are show ● Whole site not working  (Dynamical) website down ● Frequently with special campaigns ● Hurts as marketing budget wasted Order ERP Any page Order ERP Order ERP Order ERP
  • 20. Solution: asynchronous (loose) coupling between shop and ERP Grundsätzliche Idee ● Implement an asynchronous interface to ERP (switch) ● Use ActiveMQ ● Transfer orders serially to ERP in background Restrictions ● Stock numbers in shop ● Slight risk of over-orders ● Asynchronouse error handling is difficult and error-prone ● Not for permanent service Result ● Several lakh  orders per hour Any page ERP1 ERP2 ERP3 Order Order
  • 22. Software-Komponenten nach Optimierung © mgm technology partners GmbH 03.05.201122 Customer Frontend Application Templates (JSP, JSTL, TagLibs) Actions Rendering HTML / CSS JS Web Server Static Resources / Security / Black List Cache Browser Web Server Cluster App Server Cluster Transaction Management Configuration O/R-Mapping Connection Pooling (c3p0) PersistencyDB Server Cluster Fail Over (Oracle RAC/DG) HTTP/S Java API JDBC (Oracle OCI) Externe Services Such- maschinen, Store Locator, etc. ERP via Web Cache CDN n1 CDN n2 CDN n3 HTTP HTTP
  • 23. Should all of them want to come… …we are ready
  • 24. References Web site of LIDL ● http://www.lidl.de More detailed information ● http://www.mgm-tp.com ● http://blog.mgm-tp.com/2012/01/varnish-web-cache/ Tomcat Application Server ● http://tomcat.apache.org/ Varnish Web Cache ● https://www.varnish-cache.org/ Edge Side Include (ESI) ● http://www.w3.org/TR/esi-lang Memcached and Redis ● http://memcached.org/, http://redis.io/ ActiveMQ ● http://activemq.apache.org/
  • 25. Innovation Implemented. mgm technology partners GmbH Holländischer Brook 2 20457 Hamburg Tel.: +49 (0) 40 / 80 81 28 20-0 Fax: +49 (0) 40 / 80 81 28 20-388 http://www.mgm-tp.com mgm technology partners GmbH Frankfurter Ring 105a 80807 München Tel.: +49 (0) 89 / 35 86 80-0 Fax: +49 (0) 89 / 35 86 80-288 http://www.mgm-tp.com mgm technology partners s.r.o. Letenské náměstí 4/157 170 00 Praha 7 Tel.: +420 239 005 108 Fax: +420 239 005 444 http://www.mgm-tp.com mgm technology partners france eurl 30, Boulevard Gambetta 38000 Grenoble Frankreich Tel.: +33 (0) 4 80 80 75 14 http://www.mgm-tp.com mgm technology partners GmbH Vordere Cramergasse 11 90478 Nürnberg Tel.: +49 (0) 911 / 210 6941 http://www.mgm-tp.com mgm technology partners Köln GmbH Hohenstaufenring 30-32 50674 Köln Tel.: +49 (0) 221 / 35 53 73-10 Fax: +49 (0) 221 / 35 53 73-99 http://www.mgm-tp.com