SlideShare a Scribd company logo
1 of 53
www.autoscout24.com
www.autoscout24.com
An Unexpected Solution To
Microservices UI Composition
Munich | 01/12/2016 | Johannes Müller and Arif Wider
Motivation
Project Tatsu
Project Tatsu:
From a .NET-Monolith to AWS-hosted Microservices
3
Project Tatsu: Goals
4
• Attract talent
• Reduce time to market
• Release new features quickly (for test or production)
• Enable teams to innovate independently
Autonomous Teams, Loosely Coupled Services
5
Allow for cross-functional teams that are able to
independently create, improve, and run their services.
 Avoid tight coupling as much as possible!
Don't Compromise Page Performance
6
• Achieve PageSpeed Insights score of 95+
• Strive for low latency
• Benefit from caching whereever possible
tricky to combine with
high team autonomy
Breaking the Monolith
The API Gateway Pattern
7
API Gateway Pattern
8
Home
Header/
Footer
Ads
API Gateway
Mobile
apps
API Gateway Pattern - Drawbacks
9
• No independent feature releases possible
• Web UI monolith
• API monolith
• Danger of adding more and more logic to the API layer
• Duplicated controller logic in the API gateway
Breaking the Monolith
The UI Composition Pattern
10
UI Composition Pattern
11
HomeAds
Header/Footer
Challenges of UI Composition
12
• Combine HTML
• Let services deliver their own styles and JavaScript
• HTML and asset versions must be consistent
• Page structure must not break page performance
• Request latency needs to stay low
• Independent and integration testing of UI components
First Attempt
Varnish & ESI
Varnish & ESI
14
ESI Include
15
<html>
<head>
<title>AutoScout24</title>
<!-- CSS of page -->
<link rel="stylesheet" href="/assets/home/ebacb8194-main.min.css" />
</head>
<body>
<!-- ESI include of header -->
<esi:include src="http://content.as24.com/fragment/header_de_DE" />
Lorem ipsum....
<!-- JavaScript of page -->
<script src="/assets/home/66ee72f9-main.min.js"></script>
</body>
</html>
ESI Include Resolved
16
<html>
<head>
<title>AutoScout24</title>
<!-- CSS of page -->
<link rel="stylesheet" href="/assets/home/ebacb8194-main.min.css" />
</head>
<body>
<!-- CSS of fragment -->
<link rel="stylesheet" href="http://content.as24.com/assets/08ffaf28-main.min.css" />
<ul><li>Home</li><li>Search</li><li>Sell</li></ul>
<!-- JavaScript of fragment -->
<script src="http://content.as24.com/assets/26ed612f-main.min.js"></script>
Lorem ipsum....
<!-- JavaScript of page -->
<script src="/assets/home/66ee72f9-main.min.js"></script>
</body>
</html>
Multiple ESI Includes
17
<html>
<head>
<title>AutoScout24</title>
<!-- CSS of page -->
<link rel="stylesheet" href="/assets/home/ebacb8194-main.min.css" />
<!-- ESI include for header CSS -->
<esi:include src="http://content.example.com/fragment/header_styles" />
</head>
<body>
<!-- ESI include for header -->
<esi:include src="http://content.example.com/fragment/header_de_DE" />
Lorem ipsum....
<!-- JavaScript for page -->
<script src="/assets/home/66ee72f9-main.min.js"></script>
<!-- ESI include for header JavaScript -->
<esi:include src="http://content.example.com/fragment/header_scripts" />
</body>
</html>
Multiple ESI Includes Resolved
18
<html>
<head>
<title>AutoScout24</title>
<!-- CSS for page -->
<link rel="stylesheet" href="/assets/home/ebacb8194-main.min.css" />
<!-- CSS for header -->
<link rel="stylesheet" href="http://content.example.com/assets/08ffaf28-main.css" />
</head>
<body>
<ul><li>Home</li><li>Search</li><li>Sell</li></ul>
Lorem ipsum....
<!-- JavaScript for page -->
<script src="/assets/home/66ee72f9-main.min.js"></script>
<!-- JavaScript for header -->
<script src="http://content.example.com/assets/26ed612f-main.js"></script>
</body>
</html>
Varnish & ESI
Composition Issues
19
• Bad page performance because of page structure
• Tries to optimize the page structure led to increased
complexity regarding the asset handling
• High burden on the content providing teams
Varnish & ESI
Additional Issues
20
• Combining assets with ESI adds lots of complexity
• Varnish cannot strong cache assets combined with ESI
• AWS ELB as Varnish backend wasn’t working (multiple
short-lived IPs)
Requirements for a better solution
21
• References to asset URIs need to be included in HTML
snippet
• Therefore post-processing of references is required
• Support for combined assets
• Support for inlining CSS/JS
• Support for shared cache between instances
Jigsaw
How to solve it
Jigsaw Components
23
Request Flow
24
Request Flow
25
Request Flow
26
Request Flow
27
Request Flow
28
Pages
29
are publicly accessible
get called from the client
include fragments
could be cacheable
define contracts
are parts of a page
get called from Nginx SSI
could include fragments
should be cacheable
adhere to contracts
Fragments
SSI Include
30
<html>
<head>
<title>AutoScout24</title>
<!-- Minified and combined css used by this page (not by the fragments) -->
<link rel="stylesheet" href="/assets/home/ebacb8194-main.min.css" />
</head>
<body>
<!--#include virtual="/headerservice/fragment/header_de_DE" -->
Lorem ipsum....
<!-- Minified and combined javascript used by this page -->
<script type="text/javascript" src="/assets/home/66ee72f9-main.min.js"></script>
</body>
</html>
SSI Include Resolved
31
<html>
<head>
<title>AutoScout24</title>
<!-- Minified and combined css used by this page (not by the fragments) -->
<link rel="stylesheet" href="/assets/home/ebacb8194-main.min.css" />
</head>
<body>
<head>
<!-- Minified and combined css used by this fragment -->
<link rel="stylesheet" href="/assets/headerservice/08ffaf28-main.min.css" />
</head>
<ul><li>Home</li><li>Search</li><li>Sell</li></ul>
<script type="text/javascript" src="/assets/headerservice/26ed612f-main.js"></script>
Lorem ipsum....
<!-- Minified and combined javascript used by this page -->
<script type="text/javascript" src="/assets/home/66ee72f9-main.min.js"></script>
</body>
</html>
ngx_pagespeed: combine heads
32
<html>
<head>
<title>AutoScout24</title>
<!-- Minified and combined css used by this page (not by the fragments) -->
<link rel="stylesheet" href="/assets/home/ebacb8194-main.min.css" />
<link rel="stylesheet" href="/assets/headerservice/08ffaf28-main.min.css" />
</head>
<body>
<ul><li>Home</li><li>Search</li><li>Sell</li></ul>
<script type="text/javascript" src="/assets/headerservice/26ed612f-main.js"></script>
Lorem ipsum....
<!-- Minified and combined javascript used by this page -->
<script type="text/javascript" src="/assets/home/66ee72f9-main.min.js"></script>
</body>
</html>
ngx_pagespeed: Combine CSS & JS
33
<html>
<head>
<title>AutoScout24</title>
<!-- Minified and combined css by pagespeed -->
<link rel="stylesheet" href="/assets/home,,_ebacb8194-main.min.css
+headerservice,,_08ffaf28-main.min.css" />
</head>
<body>
<ul><li>Home</li><li>Search</li><li>Sell</li></ul>
Lorem ipsum....
<!-- Minified and combined js by pagespeed -->
<script type="text/javascript" href="/assets/home,,_ebacb8194-main.min.js
+headerservice,,_08ffaf28-main.min.js" defer async />
</body>
</html>
Page Performance of Composed Page
34
Page Performance of Composed Page
35
Caching
36
Recap
37
Pagespeed Cache
38
• Caches generated assets
• memcached (ElastiCache on AWS)
• state is externalized to AWS
• allows for stateless web server machines
• no cache synchronization
• no cold cache
nginx Proxy Cache
39
• Caches responses from upstream services
• Respects cache headers from upstream services
• Supports cache key control via Vary Header
• AWS ElastiCache (via ngx_srcache module)
Jigsaw Caching of Assets
40
Jigsaw Caching of Assets
41
Jigsaw Caching of Documents
42
Jigsaw Caching of Documents
43
Jigsaw Caching of Documents with Vary Header
44
Testing
Local Testing
46
Jigsaw Docker Container
47
Jigsaw Best Practice Analyzer
48
• Checks HTML code for anti-patterns
• defer async
• page barriers (inline scripts)
• CSS outside of <head>
• stylesheet refs with different attributes
• Assets not located in /assets/
• Can run in a deployment pipeline
Things yet to be solved
49
• Authentication is not in scope yet
• A/B testing of fragments
• JavaScript integration / interaction
• Bootstrap fragment / common things
• Native mobile apps
Conclusion
Features of the UI Composition Solution
51
• Teams are in full control of their service's UI and do
not need rely on others when changing it
• Fragments have a simple structure with head, body
and script parts
• Page performance is not compromised
• Jigsaw serves as an effective cache layer
• Fragments can be tested in isolation, and in
integration with other pages or fragments
Learnings and Practices
52
• Try to keep composition layer as simple as possible!
• Stick to HTTP protocol use cases
• Allow services to control Jigsaw's caching behavior
• Isolate fragments by CSS and JS packages
• Try hard to have good documentation
www.autoscout24.com
www.autoscout24.com
Thank you!
Questions?
Contact:
jmueller@autoscout24.com
awider@thoughtworks.com

More Related Content

What's hot

From Monolithic to Microservices in 45 Minutes
From Monolithic to Microservices in 45 MinutesFrom Monolithic to Microservices in 45 Minutes
From Monolithic to Microservices in 45 MinutesMongoDB
 
Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture AppDynamics
 
Leapfrog into Serverless - a Deloitte-Amtrak Case Study | Serverless Confere...
Leapfrog into Serverless - a Deloitte-Amtrak Case Study | Serverless Confere...Leapfrog into Serverless - a Deloitte-Amtrak Case Study | Serverless Confere...
Leapfrog into Serverless - a Deloitte-Amtrak Case Study | Serverless Confere...Gary Arora
 
Patterns for Enterprise Integration Success
Patterns for Enterprise Integration Success Patterns for Enterprise Integration Success
Patterns for Enterprise Integration Success WSO2
 
Alfresco/Activiti Modeler Application - Andras Popovics - 2019
Alfresco/Activiti Modeler Application - Andras Popovics - 2019Alfresco/Activiti Modeler Application - Andras Popovics - 2019
Alfresco/Activiti Modeler Application - Andras Popovics - 2019András Popovics
 
Microservices Journey Summer 2017
Microservices Journey Summer 2017Microservices Journey Summer 2017
Microservices Journey Summer 2017Christian Posta
 
MS Insights Brazil 2015 containers and devops
MS Insights Brazil 2015   containers and devopsMS Insights Brazil 2015   containers and devops
MS Insights Brazil 2015 containers and devopsDamien Caro
 
Going MicroServices with Net
Going MicroServices with NetGoing MicroServices with Net
Going MicroServices with NetDavid Revoledo
 
Spring IO 2016 - Spring Cloud Microservices, a journey inside a financial entity
Spring IO 2016 - Spring Cloud Microservices, a journey inside a financial entitySpring IO 2016 - Spring Cloud Microservices, a journey inside a financial entity
Spring IO 2016 - Spring Cloud Microservices, a journey inside a financial entityToni Jara
 
API Microservices with Node.js and Docker
API Microservices with Node.js and DockerAPI Microservices with Node.js and Docker
API Microservices with Node.js and DockerApigee | Google Cloud
 
An introduction to Microservices
An introduction to MicroservicesAn introduction to Microservices
An introduction to MicroservicesCisco DevNet
 
MongoDB World 2019: Mastering MongoDB in Kubernetes
MongoDB World 2019: Mastering MongoDB in KubernetesMongoDB World 2019: Mastering MongoDB in Kubernetes
MongoDB World 2019: Mastering MongoDB in KubernetesMongoDB
 
THEFT-PROOF JAVA EE - SECURING YOUR JAVA EE APPLICATIONS
 THEFT-PROOF JAVA EE - SECURING YOUR JAVA EE APPLICATIONS THEFT-PROOF JAVA EE - SECURING YOUR JAVA EE APPLICATIONS
THEFT-PROOF JAVA EE - SECURING YOUR JAVA EE APPLICATIONSMarkus Eisele
 
How to deploy a Private Cloud based on WAP and Nutanix
How to deploy a Private Cloud based on WAP and NutanixHow to deploy a Private Cloud based on WAP and Nutanix
How to deploy a Private Cloud based on WAP and NutanixTom Van Gramberen
 
Microservices Journey NYC
Microservices Journey NYCMicroservices Journey NYC
Microservices Journey NYCChristian Posta
 
Continuous Delivery at Wix
Continuous Delivery at WixContinuous Delivery at Wix
Continuous Delivery at WixYoav Avrahami
 
Introduction to microservices (from rails monolith)
Introduction to microservices (from rails monolith)Introduction to microservices (from rails monolith)
Introduction to microservices (from rails monolith)Leandro Parazito
 
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)Red Hat Developers
 
Stay productive while slicing up the monolith
Stay productive while slicing up the monolith Stay productive while slicing up the monolith
Stay productive while slicing up the monolith Markus Eisele
 

What's hot (20)

From Monolithic to Microservices in 45 Minutes
From Monolithic to Microservices in 45 MinutesFrom Monolithic to Microservices in 45 Minutes
From Monolithic to Microservices in 45 Minutes
 
Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture Anatomy of a Modern Node.js Application Architecture
Anatomy of a Modern Node.js Application Architecture
 
Leapfrog into Serverless - a Deloitte-Amtrak Case Study | Serverless Confere...
Leapfrog into Serverless - a Deloitte-Amtrak Case Study | Serverless Confere...Leapfrog into Serverless - a Deloitte-Amtrak Case Study | Serverless Confere...
Leapfrog into Serverless - a Deloitte-Amtrak Case Study | Serverless Confere...
 
Patterns for Enterprise Integration Success
Patterns for Enterprise Integration Success Patterns for Enterprise Integration Success
Patterns for Enterprise Integration Success
 
Alfresco/Activiti Modeler Application - Andras Popovics - 2019
Alfresco/Activiti Modeler Application - Andras Popovics - 2019Alfresco/Activiti Modeler Application - Andras Popovics - 2019
Alfresco/Activiti Modeler Application - Andras Popovics - 2019
 
Microservices Journey Summer 2017
Microservices Journey Summer 2017Microservices Journey Summer 2017
Microservices Journey Summer 2017
 
MS Insights Brazil 2015 containers and devops
MS Insights Brazil 2015   containers and devopsMS Insights Brazil 2015   containers and devops
MS Insights Brazil 2015 containers and devops
 
Going MicroServices with Net
Going MicroServices with NetGoing MicroServices with Net
Going MicroServices with Net
 
Spring IO 2016 - Spring Cloud Microservices, a journey inside a financial entity
Spring IO 2016 - Spring Cloud Microservices, a journey inside a financial entitySpring IO 2016 - Spring Cloud Microservices, a journey inside a financial entity
Spring IO 2016 - Spring Cloud Microservices, a journey inside a financial entity
 
API Microservices with Node.js and Docker
API Microservices with Node.js and DockerAPI Microservices with Node.js and Docker
API Microservices with Node.js and Docker
 
An introduction to Microservices
An introduction to MicroservicesAn introduction to Microservices
An introduction to Microservices
 
MongoDB World 2019: Mastering MongoDB in Kubernetes
MongoDB World 2019: Mastering MongoDB in KubernetesMongoDB World 2019: Mastering MongoDB in Kubernetes
MongoDB World 2019: Mastering MongoDB in Kubernetes
 
THEFT-PROOF JAVA EE - SECURING YOUR JAVA EE APPLICATIONS
 THEFT-PROOF JAVA EE - SECURING YOUR JAVA EE APPLICATIONS THEFT-PROOF JAVA EE - SECURING YOUR JAVA EE APPLICATIONS
THEFT-PROOF JAVA EE - SECURING YOUR JAVA EE APPLICATIONS
 
How to deploy a Private Cloud based on WAP and Nutanix
How to deploy a Private Cloud based on WAP and NutanixHow to deploy a Private Cloud based on WAP and Nutanix
How to deploy a Private Cloud based on WAP and Nutanix
 
Microservices Journey NYC
Microservices Journey NYCMicroservices Journey NYC
Microservices Journey NYC
 
Continuous Delivery at Wix
Continuous Delivery at WixContinuous Delivery at Wix
Continuous Delivery at Wix
 
Introduction to microservices (from rails monolith)
Introduction to microservices (from rails monolith)Introduction to microservices (from rails monolith)
Introduction to microservices (from rails monolith)
 
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
IPaaS 2.0: Fuse Integration Services (Robert Davies & Keith Babo)
 
Whirlwind tour of Activiti 7 by Ryan Dawson
Whirlwind tour of Activiti 7 by Ryan DawsonWhirlwind tour of Activiti 7 by Ryan Dawson
Whirlwind tour of Activiti 7 by Ryan Dawson
 
Stay productive while slicing up the monolith
Stay productive while slicing up the monolith Stay productive while slicing up the monolith
Stay productive while slicing up the monolith
 

Similar to An Unexpected Solution to Microservices UI Composition

A High-Performance Solution To Microservices UI Composition
A High-Performance Solution To Microservices UI CompositionA High-Performance Solution To Microservices UI Composition
A High-Performance Solution To Microservices UI CompositionAlexey Gravanov
 
A High-Performance Solution to Microservice UI Composition @ XConf Hamburg
A High-Performance Solution to Microservice UI Composition @ XConf HamburgA High-Performance Solution to Microservice UI Composition @ XConf Hamburg
A High-Performance Solution to Microservice UI Composition @ XConf HamburgDr. Arif Wider
 
Highly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSHighly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSZoe Gillenwater
 
IWMW 2003: Content Management - Buy or Build?
IWMW 2003: Content Management - Buy or Build?IWMW 2003: Content Management - Buy or Build?
IWMW 2003: Content Management - Buy or Build?IWMW
 
Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011Timothy Fisher
 
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch TutorialMongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch TutorialMongoDB
 
Hdv309 - Real World Sandboxed Solutions
Hdv309 - Real World Sandboxed SolutionsHdv309 - Real World Sandboxed Solutions
Hdv309 - Real World Sandboxed Solutionswoutervugt
 
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...Anupam Ranku
 
Writing an extensible web testing framework ready for the cloud slide share
Writing an extensible web testing framework ready for the cloud   slide shareWriting an extensible web testing framework ready for the cloud   slide share
Writing an extensible web testing framework ready for the cloud slide shareMike Ensor
 
Web components - An Introduction
Web components - An IntroductionWeb components - An Introduction
Web components - An Introductioncherukumilli2
 
Website optimization with request reduce
Website optimization with request reduceWebsite optimization with request reduce
Website optimization with request reduceMatt Wrock
 
MVC 6 - Tag Helpers and View Components
MVC 6 - Tag Helpers and View ComponentsMVC 6 - Tag Helpers and View Components
MVC 6 - Tag Helpers and View ComponentsDavid Paquette
 
MongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch TutorialMongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch TutorialMongoDB
 
Intro to html5 Boilerplate
Intro to html5 BoilerplateIntro to html5 Boilerplate
Intro to html5 BoilerplateMichael Enslow
 
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch TutorialMongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch TutorialMongoDB
 
Asp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantAsp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantNitin Sawant
 
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...SPTechCon
 
Developing JavaScript Widgets
Developing JavaScript WidgetsDeveloping JavaScript Widgets
Developing JavaScript WidgetsBob German
 
DrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtDrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtNick Santamaria
 

Similar to An Unexpected Solution to Microservices UI Composition (20)

A High-Performance Solution To Microservices UI Composition
A High-Performance Solution To Microservices UI CompositionA High-Performance Solution To Microservices UI Composition
A High-Performance Solution To Microservices UI Composition
 
A High-Performance Solution to Microservice UI Composition @ XConf Hamburg
A High-Performance Solution to Microservice UI Composition @ XConf HamburgA High-Performance Solution to Microservice UI Composition @ XConf Hamburg
A High-Performance Solution to Microservice UI Composition @ XConf Hamburg
 
Highly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSSHighly Maintainable, Efficient, and Optimized CSS
Highly Maintainable, Efficient, and Optimized CSS
 
IWMW 2003: Content Management - Buy or Build?
IWMW 2003: Content Management - Buy or Build?IWMW 2003: Content Management - Buy or Build?
IWMW 2003: Content Management - Buy or Build?
 
Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011Developing High Performance Web Apps - CodeMash 2011
Developing High Performance Web Apps - CodeMash 2011
 
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch TutorialMongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
 
Hdv309 - Real World Sandboxed Solutions
Hdv309 - Real World Sandboxed SolutionsHdv309 - Real World Sandboxed Solutions
Hdv309 - Real World Sandboxed Solutions
 
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
 
Writing an extensible web testing framework ready for the cloud slide share
Writing an extensible web testing framework ready for the cloud   slide shareWriting an extensible web testing framework ready for the cloud   slide share
Writing an extensible web testing framework ready for the cloud slide share
 
Web components - An Introduction
Web components - An IntroductionWeb components - An Introduction
Web components - An Introduction
 
Website optimization with request reduce
Website optimization with request reduceWebsite optimization with request reduce
Website optimization with request reduce
 
MVC 6 - Tag Helpers and View Components
MVC 6 - Tag Helpers and View ComponentsMVC 6 - Tag Helpers and View Components
MVC 6 - Tag Helpers and View Components
 
MongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch TutorialMongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch Tutorial
 
Intro to html5 Boilerplate
Intro to html5 BoilerplateIntro to html5 Boilerplate
Intro to html5 Boilerplate
 
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch TutorialMongoDB.local Dallas 2019: MongoDB Stitch Tutorial
MongoDB.local Dallas 2019: MongoDB Stitch Tutorial
 
Asp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin SawantAsp.net mvc presentation by Nitin Sawant
Asp.net mvc presentation by Nitin Sawant
 
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
Popping the Hood: How to Create Custom SharePoint Branding by Randy Drisgill ...
 
Developing JavaScript Widgets
Developing JavaScript WidgetsDeveloping JavaScript Widgets
Developing JavaScript Widgets
 
Atomic design
Atomic designAtomic design
Atomic design
 
DrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtDrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an Afterthought
 

More from Dr. Arif Wider

Data Mesh - It's not about technology, it's about people
Data Mesh - It's not about technology, it's about peopleData Mesh - It's not about technology, it's about people
Data Mesh - It's not about technology, it's about peopleDr. Arif Wider
 
Data Mesh in Practice - How Europe's Leading Online Platform for Fashion Goes...
Data Mesh in Practice - How Europe's Leading Online Platform for Fashion Goes...Data Mesh in Practice - How Europe's Leading Online Platform for Fashion Goes...
Data Mesh in Practice - How Europe's Leading Online Platform for Fashion Goes...Dr. Arif Wider
 
Continuous Intelligence: Keeping your AI Application in Production
Continuous Intelligence: Keeping your AI Application in ProductionContinuous Intelligence: Keeping your AI Application in Production
Continuous Intelligence: Keeping your AI Application in ProductionDr. Arif Wider
 
Continuous Intelligence: Keeping Your AI Application in Production (NDC Sydne...
Continuous Intelligence: Keeping Your AI Application in Production (NDC Sydne...Continuous Intelligence: Keeping Your AI Application in Production (NDC Sydne...
Continuous Intelligence: Keeping Your AI Application in Production (NDC Sydne...Dr. Arif Wider
 
Continuous Intelligence: Moving Machine Learning into Production Reliably
Continuous Intelligence: Moving Machine Learning into Production ReliablyContinuous Intelligence: Moving Machine Learning into Production Reliably
Continuous Intelligence: Moving Machine Learning into Production ReliablyDr. Arif Wider
 
Continuous Intelligence: Keeping your AI Application in Production
Continuous Intelligence: Keeping your AI Application in ProductionContinuous Intelligence: Keeping your AI Application in Production
Continuous Intelligence: Keeping your AI Application in ProductionDr. Arif Wider
 
DataDevOps: A Manifesto for a DevOps-like Culture Shift in Data & Analytics
DataDevOps: A Manifesto for a DevOps-like Culture Shift in Data & AnalyticsDataDevOps: A Manifesto for a DevOps-like Culture Shift in Data & Analytics
DataDevOps: A Manifesto for a DevOps-like Culture Shift in Data & AnalyticsDr. Arif Wider
 
DataDevOps: A Manifesto for a DevOps-like Culture Shift in Data & Analytics
DataDevOps: A Manifesto for a DevOps-like Culture Shift in Data & AnalyticsDataDevOps: A Manifesto for a DevOps-like Culture Shift in Data & Analytics
DataDevOps: A Manifesto for a DevOps-like Culture Shift in Data & AnalyticsDr. Arif Wider
 
DataDevOps - A Manifesto on Shared Data Responsibility in Times of Microservices
DataDevOps - A Manifesto on Shared Data Responsibility in Times of MicroservicesDataDevOps - A Manifesto on Shared Data Responsibility in Times of Microservices
DataDevOps - A Manifesto on Shared Data Responsibility in Times of MicroservicesDr. Arif Wider
 
Predictive Analytics for Vehicle Price Prediction - Delivered Continuously at...
Predictive Analytics for Vehicle Price Prediction - Delivered Continuously at...Predictive Analytics for Vehicle Price Prediction - Delivered Continuously at...
Predictive Analytics for Vehicle Price Prediction - Delivered Continuously at...Dr. Arif Wider
 

More from Dr. Arif Wider (10)

Data Mesh - It's not about technology, it's about people
Data Mesh - It's not about technology, it's about peopleData Mesh - It's not about technology, it's about people
Data Mesh - It's not about technology, it's about people
 
Data Mesh in Practice - How Europe's Leading Online Platform for Fashion Goes...
Data Mesh in Practice - How Europe's Leading Online Platform for Fashion Goes...Data Mesh in Practice - How Europe's Leading Online Platform for Fashion Goes...
Data Mesh in Practice - How Europe's Leading Online Platform for Fashion Goes...
 
Continuous Intelligence: Keeping your AI Application in Production
Continuous Intelligence: Keeping your AI Application in ProductionContinuous Intelligence: Keeping your AI Application in Production
Continuous Intelligence: Keeping your AI Application in Production
 
Continuous Intelligence: Keeping Your AI Application in Production (NDC Sydne...
Continuous Intelligence: Keeping Your AI Application in Production (NDC Sydne...Continuous Intelligence: Keeping Your AI Application in Production (NDC Sydne...
Continuous Intelligence: Keeping Your AI Application in Production (NDC Sydne...
 
Continuous Intelligence: Moving Machine Learning into Production Reliably
Continuous Intelligence: Moving Machine Learning into Production ReliablyContinuous Intelligence: Moving Machine Learning into Production Reliably
Continuous Intelligence: Moving Machine Learning into Production Reliably
 
Continuous Intelligence: Keeping your AI Application in Production
Continuous Intelligence: Keeping your AI Application in ProductionContinuous Intelligence: Keeping your AI Application in Production
Continuous Intelligence: Keeping your AI Application in Production
 
DataDevOps: A Manifesto for a DevOps-like Culture Shift in Data & Analytics
DataDevOps: A Manifesto for a DevOps-like Culture Shift in Data & AnalyticsDataDevOps: A Manifesto for a DevOps-like Culture Shift in Data & Analytics
DataDevOps: A Manifesto for a DevOps-like Culture Shift in Data & Analytics
 
DataDevOps: A Manifesto for a DevOps-like Culture Shift in Data & Analytics
DataDevOps: A Manifesto for a DevOps-like Culture Shift in Data & AnalyticsDataDevOps: A Manifesto for a DevOps-like Culture Shift in Data & Analytics
DataDevOps: A Manifesto for a DevOps-like Culture Shift in Data & Analytics
 
DataDevOps - A Manifesto on Shared Data Responsibility in Times of Microservices
DataDevOps - A Manifesto on Shared Data Responsibility in Times of MicroservicesDataDevOps - A Manifesto on Shared Data Responsibility in Times of Microservices
DataDevOps - A Manifesto on Shared Data Responsibility in Times of Microservices
 
Predictive Analytics for Vehicle Price Prediction - Delivered Continuously at...
Predictive Analytics for Vehicle Price Prediction - Delivered Continuously at...Predictive Analytics for Vehicle Price Prediction - Delivered Continuously at...
Predictive Analytics for Vehicle Price Prediction - Delivered Continuously at...
 

Recently uploaded

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 

Recently uploaded (20)

WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 

An Unexpected Solution to Microservices UI Composition

  • 1. www.autoscout24.com www.autoscout24.com An Unexpected Solution To Microservices UI Composition Munich | 01/12/2016 | Johannes Müller and Arif Wider
  • 3. Project Tatsu: From a .NET-Monolith to AWS-hosted Microservices 3
  • 4. Project Tatsu: Goals 4 • Attract talent • Reduce time to market • Release new features quickly (for test or production) • Enable teams to innovate independently
  • 5. Autonomous Teams, Loosely Coupled Services 5 Allow for cross-functional teams that are able to independently create, improve, and run their services.  Avoid tight coupling as much as possible!
  • 6. Don't Compromise Page Performance 6 • Achieve PageSpeed Insights score of 95+ • Strive for low latency • Benefit from caching whereever possible tricky to combine with high team autonomy
  • 7. Breaking the Monolith The API Gateway Pattern 7
  • 9. API Gateway Pattern - Drawbacks 9 • No independent feature releases possible • Web UI monolith • API monolith • Danger of adding more and more logic to the API layer • Duplicated controller logic in the API gateway
  • 10. Breaking the Monolith The UI Composition Pattern 10
  • 12. Challenges of UI Composition 12 • Combine HTML • Let services deliver their own styles and JavaScript • HTML and asset versions must be consistent • Page structure must not break page performance • Request latency needs to stay low • Independent and integration testing of UI components
  • 15. ESI Include 15 <html> <head> <title>AutoScout24</title> <!-- CSS of page --> <link rel="stylesheet" href="/assets/home/ebacb8194-main.min.css" /> </head> <body> <!-- ESI include of header --> <esi:include src="http://content.as24.com/fragment/header_de_DE" /> Lorem ipsum.... <!-- JavaScript of page --> <script src="/assets/home/66ee72f9-main.min.js"></script> </body> </html>
  • 16. ESI Include Resolved 16 <html> <head> <title>AutoScout24</title> <!-- CSS of page --> <link rel="stylesheet" href="/assets/home/ebacb8194-main.min.css" /> </head> <body> <!-- CSS of fragment --> <link rel="stylesheet" href="http://content.as24.com/assets/08ffaf28-main.min.css" /> <ul><li>Home</li><li>Search</li><li>Sell</li></ul> <!-- JavaScript of fragment --> <script src="http://content.as24.com/assets/26ed612f-main.min.js"></script> Lorem ipsum.... <!-- JavaScript of page --> <script src="/assets/home/66ee72f9-main.min.js"></script> </body> </html>
  • 17. Multiple ESI Includes 17 <html> <head> <title>AutoScout24</title> <!-- CSS of page --> <link rel="stylesheet" href="/assets/home/ebacb8194-main.min.css" /> <!-- ESI include for header CSS --> <esi:include src="http://content.example.com/fragment/header_styles" /> </head> <body> <!-- ESI include for header --> <esi:include src="http://content.example.com/fragment/header_de_DE" /> Lorem ipsum.... <!-- JavaScript for page --> <script src="/assets/home/66ee72f9-main.min.js"></script> <!-- ESI include for header JavaScript --> <esi:include src="http://content.example.com/fragment/header_scripts" /> </body> </html>
  • 18. Multiple ESI Includes Resolved 18 <html> <head> <title>AutoScout24</title> <!-- CSS for page --> <link rel="stylesheet" href="/assets/home/ebacb8194-main.min.css" /> <!-- CSS for header --> <link rel="stylesheet" href="http://content.example.com/assets/08ffaf28-main.css" /> </head> <body> <ul><li>Home</li><li>Search</li><li>Sell</li></ul> Lorem ipsum.... <!-- JavaScript for page --> <script src="/assets/home/66ee72f9-main.min.js"></script> <!-- JavaScript for header --> <script src="http://content.example.com/assets/26ed612f-main.js"></script> </body> </html>
  • 19. Varnish & ESI Composition Issues 19 • Bad page performance because of page structure • Tries to optimize the page structure led to increased complexity regarding the asset handling • High burden on the content providing teams
  • 20. Varnish & ESI Additional Issues 20 • Combining assets with ESI adds lots of complexity • Varnish cannot strong cache assets combined with ESI • AWS ELB as Varnish backend wasn’t working (multiple short-lived IPs)
  • 21. Requirements for a better solution 21 • References to asset URIs need to be included in HTML snippet • Therefore post-processing of references is required • Support for combined assets • Support for inlining CSS/JS • Support for shared cache between instances
  • 29. Pages 29 are publicly accessible get called from the client include fragments could be cacheable define contracts are parts of a page get called from Nginx SSI could include fragments should be cacheable adhere to contracts Fragments
  • 30. SSI Include 30 <html> <head> <title>AutoScout24</title> <!-- Minified and combined css used by this page (not by the fragments) --> <link rel="stylesheet" href="/assets/home/ebacb8194-main.min.css" /> </head> <body> <!--#include virtual="/headerservice/fragment/header_de_DE" --> Lorem ipsum.... <!-- Minified and combined javascript used by this page --> <script type="text/javascript" src="/assets/home/66ee72f9-main.min.js"></script> </body> </html>
  • 31. SSI Include Resolved 31 <html> <head> <title>AutoScout24</title> <!-- Minified and combined css used by this page (not by the fragments) --> <link rel="stylesheet" href="/assets/home/ebacb8194-main.min.css" /> </head> <body> <head> <!-- Minified and combined css used by this fragment --> <link rel="stylesheet" href="/assets/headerservice/08ffaf28-main.min.css" /> </head> <ul><li>Home</li><li>Search</li><li>Sell</li></ul> <script type="text/javascript" src="/assets/headerservice/26ed612f-main.js"></script> Lorem ipsum.... <!-- Minified and combined javascript used by this page --> <script type="text/javascript" src="/assets/home/66ee72f9-main.min.js"></script> </body> </html>
  • 32. ngx_pagespeed: combine heads 32 <html> <head> <title>AutoScout24</title> <!-- Minified and combined css used by this page (not by the fragments) --> <link rel="stylesheet" href="/assets/home/ebacb8194-main.min.css" /> <link rel="stylesheet" href="/assets/headerservice/08ffaf28-main.min.css" /> </head> <body> <ul><li>Home</li><li>Search</li><li>Sell</li></ul> <script type="text/javascript" src="/assets/headerservice/26ed612f-main.js"></script> Lorem ipsum.... <!-- Minified and combined javascript used by this page --> <script type="text/javascript" src="/assets/home/66ee72f9-main.min.js"></script> </body> </html>
  • 33. ngx_pagespeed: Combine CSS & JS 33 <html> <head> <title>AutoScout24</title> <!-- Minified and combined css by pagespeed --> <link rel="stylesheet" href="/assets/home,,_ebacb8194-main.min.css +headerservice,,_08ffaf28-main.min.css" /> </head> <body> <ul><li>Home</li><li>Search</li><li>Sell</li></ul> Lorem ipsum.... <!-- Minified and combined js by pagespeed --> <script type="text/javascript" href="/assets/home,,_ebacb8194-main.min.js +headerservice,,_08ffaf28-main.min.js" defer async /> </body> </html>
  • 34. Page Performance of Composed Page 34
  • 35. Page Performance of Composed Page 35
  • 38. Pagespeed Cache 38 • Caches generated assets • memcached (ElastiCache on AWS) • state is externalized to AWS • allows for stateless web server machines • no cache synchronization • no cold cache
  • 39. nginx Proxy Cache 39 • Caches responses from upstream services • Respects cache headers from upstream services • Supports cache key control via Vary Header • AWS ElastiCache (via ngx_srcache module)
  • 40. Jigsaw Caching of Assets 40
  • 41. Jigsaw Caching of Assets 41
  • 42. Jigsaw Caching of Documents 42
  • 43. Jigsaw Caching of Documents 43
  • 44. Jigsaw Caching of Documents with Vary Header 44
  • 48. Jigsaw Best Practice Analyzer 48 • Checks HTML code for anti-patterns • defer async • page barriers (inline scripts) • CSS outside of <head> • stylesheet refs with different attributes • Assets not located in /assets/ • Can run in a deployment pipeline
  • 49. Things yet to be solved 49 • Authentication is not in scope yet • A/B testing of fragments • JavaScript integration / interaction • Bootstrap fragment / common things • Native mobile apps
  • 51. Features of the UI Composition Solution 51 • Teams are in full control of their service's UI and do not need rely on others when changing it • Fragments have a simple structure with head, body and script parts • Page performance is not compromised • Jigsaw serves as an effective cache layer • Fragments can be tested in isolation, and in integration with other pages or fragments
  • 52. Learnings and Practices 52 • Try to keep composition layer as simple as possible! • Stick to HTTP protocol use cases • Allow services to control Jigsaw's caching behavior • Isolate fragments by CSS and JS packages • Try hard to have good documentation

Editor's Notes

  1. > Arif Before we go into the topic of UI composition, I’d like to give you some background about our motivation and the context in which we developed our solution to UI composition. And that context is a project that we call Tatsu. Tatsu means dragon (logo), because the project is nothing less than a complete rewrite of the AS24 platform, which is live in 18 countries across Europe, and therefore we compare the project with a dangerous but powerful dragon.
  2. In this project, which started a bit more than a year ago, we are doing 5 things at the same time. We are breaking the old rather monolithic system into a set of independent microservices. We are moving from a self hosted system to a completely cloud hosted system, using Amazon Web Services. We are moving from a Microsoft .NET stack to a Linux- and JVM-based tech stack. Because that is not enough, we are also changing the organisational structure, so that it reflects the Microservice approach. That means, we move from multiple product engineering teams that rely on a few operations and platform teams to cross-functional, autonomous teams that have enough ops knowledge to run their own services. This is depicted by those gradients here. Finally, as we are rebuilding everything, we want to make sure that we come out of the whole process with a new shiny AS24 page that contains only those features that are actually useful. 
  3. Now, this whole project is obviously a huge effort, so why are we doing it? One of the reasons is to attract talented developers, which was harder with the old .NET tech stack However, the main reason is to reduce time to market, so that we can respond to user needs more quickly For this it is important, that new features can be released very quickly, also for being able to do lots of A/B testing to get early user feedback  The idea here is to be able to think in minutes for feature to be released instead of thinking in days Now for this to be possible, teams must be enabled to innovate independently
  4. We believe that a key to achieve this are autonomous teams, that are able to independently ... Therefore, we believe that it is crucial to avoid any form of tight coupling as much as possible If a team wants to improve their own service but must wait for another team to release something in order to be able to do so then there is no real autonomy.  In fact, we value this team autonomy so much, that we also accept certain trade-offs E.g., we often rather copy some code around than to create tight coupling by introducing a shared library or shared infrastructure
  5. At the same time, we do not want to compromise page performance. In case you do not know it, Pagespeed Insights is a tool by Google that analyzes the structure of a page in terms of how fast it can be rendered, in particular on a mobile browser. ...and the score goes up to 100, and is considered good from 85 upwards. This means, that we heavily rely on different cache layers and that our pages must not contain blocking content. In the context of Microservices, it is a bit tricky to achieve both high page speed and high team autonomy. To explain this, I am now going to present you two different ways how to generally approach this problem.  And then afterwards Johannes will go more into detail on how we actually tried to solve it. 
  6. The first one is the API Gateway pattern
  7. In this example you see that there are already several backend services such as... So the monolith is already broken down into several independent services at the back end However, in the frontend, there is still one single web application that takes care of the whole web UI, and talks to the different backend APIs.  E.g., this red UI component here displays some content that is provided by the homepage service, whereas this In order to avoid that the web app needs to start several separate requests to several backend services just to perform a single action, it is generally a good idea to introduce a gateway layer that aggregates those requests to backend services.  This way, the number of requests is reduced which is particularly important when using a mobile device to view the page. The API Gateway pattern is also particularly useful to deal with native mobile apps, however, those won't be in the focus of this talk today. Now, of course, in this scenario it is is also fairly easy to optimize the performance of the page because all the UI components belong to one application.
  8. However, there are some drawbacks of applying this pattern from which, for us, the most severe is that independent feature releases are no longer possible (as long as they contain UI changes) Instead, in the worst case three teams are involved and need to be coordinated when changing a feature: the backend service team, the API gateway layer team, and the web app team One could say that the API Gateway pattern one goes only half way to split the monolith, i.e., only in the backend There are other drawbacks such as... but because team autonomy is one of the main reasons we went for Microservices in the first place, this issue made the API Gateway pattern no option for us
  9. Instead we went for another pattern and that is the UI composition pattern
  10. This looks as follows: Each service delivers its own UI component, e.g., red home page Those UI components are later composed to a single web page This way, each team can change their backend and their UI independently We also often speak of vertical slices here, because there is no layered architecture anymore and each service can contain a backend, a UI, and everything in between
  11. However, there are quite few challenges that come with this approach ... each part of the page could compromise page performance by introducing render blocking content ... the loading time of the page depends on its slowest component
  12. Jo why are we telling you this -> to narrow down the topic to the core questions to solve
  13. Varnish test setup infrastructure Varnish in front of services no service registration, just loading content from referenced URLs
  14. Page, therefore HTML tag ESI include syntax styles and scripts already minified by service
  15. ESI resolved = include replaced with fragment (by Varnish) fragment has its own minified styles and scripts in there also its own script section at its bottom need to have full qualified references to assets very bad page speed
  16. One ESI include for header styles One ESI include for header fragment One ESI include for header scripts
  17. Multiple ESI resolved = include replaced with fragment (by Varnish) One ESI include for header styles One ESI include for header fragment One ESI include for header scripts better page speed, but still not perfect (no combination etc) big problem: TTL of cached includes are not synchronized. Version mismatches!
  18. > Arif So before showing an example how this actually looks in code I have to explain that we conceptually distinguish between what we call a page and what we call a fragment ...and does not know the original request ...and this team is responsible for the performance and the stability of the page So when this page includes fragments, this team has to define a contract with the providers of this fragment The fragment on the other hand needs to obey this contract and behave well
  19. Now let's look at a simple example page Page, therefore HTML tag+ head and body styles already minified by service SSI include syntax
  20. SSI resolved = include replaced with fragment (by Nginx) fragment has its own head, with its own minified styles in there also its own script section at its bottom very bad page speed as of now
  21. now comes mod pagespeed combine heads
  22. combine css combine js, defer its loading
  23. > Jo
  24. Example: personalized pages (different content based on visitor, makes no sense to cache it)
  25. > Jo
  26. 3 parts on home page let's assume you want to change header and test
  27. defer async stops pagespeed from combining page barrier = inline script, order important, cannot combine assets above and below barrier stylesheet --> for example media attribute
  28. authentication and a/b testing -> need to get cookies and headers to the fragments javascript integration / interaction -> window.event or something else?? Bootstrap: for example Fonts or javascript error logger etc.
  29. > Arif
  30. ...as long as they stay within the boundaries of their contracts