SlideShare a Scribd company logo
www.autoscout24.com
www.autoscout24.com | www.thoughtworks.com
A High-Performance Solution
To Microservices UI Composition
NDC Oslo | June 8, 2016 | Arif Wider & Alexey Gravanov
AutoScout24
2
PL
S
RUS
UA
RO
CZ
D
NL
B
F
A
HR
I
E
BG
TR
17countries
2.4m+cars & motos
~3bpage impressions
per month
Motivation
Project Tatsu
4
Project Tatsu
From a .NET Monolith to AWS-hosted Microservices
Project Tatsu: Goals
5
• Reduce time to market
• Release new features quickly (for test or production)
• Enable teams to innovate independently
Autonomous Teams, Loosely Coupled Services
6
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
7
• Achieve PageSpeed Insights score of 95+
• Strive for low latency
• Benefit from caching whenever possible
tricky to combine with
high team autonomy
Breaking the Monolith
The API Gateway Pattern
8
API Gateway Pattern: AutoScout24 Homepage
9
API Gateway Pattern
10
Home
Header/
Footer
Ads
API Gateway
Mobile
apps
 Great for
page performance :)
API Gateway Pattern: Drawbacks
11
Home
Header/
Footer
Ads
API Gateway
Mobile
apps
no truly independent
vertical feature releases
because of “UI monolith“
 Bad for
team autonomy :(
Breaking the Monolith
The UI Composition Pattern
12
UI Composition Pattern
13
HomeAds
Header/Footer
one service =
one vertical slice
 Great for
team autonomy :)
Challenges of UI Composition
14
• Combine HTML
• Let services deliver their own styles and JavaScript
• Page structure must not break page performance
• Request latency needs to stay low
• Independent and integration testing of UI components
 Tricky for
page performance!
First Attempt
Varnish & ESI
Varnish & ESI
16
ESI Include
17
<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
18
<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>
 Bad page speed :(
Multiple ESI Includes
19
<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
20
<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>
 Asset version inconsistency :(
Varnish & ESI: Issues
21
• Bad page performance because of page structure
• Attempts to optimize the page structure led to increased
complexity regarding the asset handling
• High burden on the content providing teams
• Combining assets with ESI adds complexity
• AWS ELB as Varnish backend wasn’t working
Requirements for a better solution
22
• 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
24
Request Flow
25
Request Flow
26
Request Flow
27
Request Flow
28
Request Flow
29
Pages
30
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
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>
<!--#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
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" />
</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
33
<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
34
<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
35
Page Performance of Composed Page
36
Caching
37
Recap
38
nginx Proxy Cache
39
• Caches responses from upstream services
• Respects cache headers from upstream services
• Supports cache key control via Vary Header
• AWS ElastiCache (memcached, via ngx_srcache module)
Pagespeed Cache
40
• Caches generated assets
• AWS ElastiCache (memcached)
• state is externalized to AWS
• allows for stateless web server machines
• no cache synchronization
• no cold cache
Jigsaw Caching of Assets
41
Jigsaw Caching of Documents
42
Jigsaw Caching of Documents with Vary Header
43
Testing
Local Testing
45
Local Testing
46
Jigsaw Header
Footer
Homepage
Development machine
HeaderJigsaw
Jigsaw Best Practice Analyzer
47
• Checks HTML code for anti-patterns
• defer async
• page barriers (inline scripts)
• CSS outside of <head>
• stylesheet refs with different attributes
• Can run in a deployment pipeline
Things yet to be solved
48
• Authentication
• Native mobile apps
Conclusion
Features of the UI Composition Solution
50
• Teams are in full control of their service's UI and do not need to
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
• It’s live and serves thousands of requests per second flawlessly :)
www.autoscout24.com
www.autoscout24.com | www.thoughtworks.com
Thank you!
Questions?
Contact:
awider@thoughtworks.com
agravanov@autoscout24.com (@gravanov)

More Related Content

What's hot (20)

PDF
Production optimization with React and Webpack
k88hudson
 
PDF
Node.js & Twitter Bootstrap Crash Course
Aaron Silverman
 
PPTX
DotNet MVC and webpack + Babel + react
Chen-Tien Tsai
 
PPTX
Demystifying HTML5
Sergejus Barinovas
 
PDF
Web Components
Nikolaus Graf
 
PPTX
Introduction to Vue.js DevStaff Meetup 13.02
Paul Bele
 
PDF
Bundle your modules with Webpack
Jake Peyser
 
PDF
Web Components Everywhere
Ilia Idakiev
 
PPTX
An Overview on Nuxt.js
Squash Apps Pvt Ltd
 
KEY
Flash And Dom
Mike Wilcox
 
PPTX
Introduction to require js
Ahmed Elharouny
 
PPTX
Architecting Windows Azure
Sergejus Barinovas
 
PDF
Node PDX: Intro to Sails.js
Mike McNeil
 
PPTX
Building single page applications
SC5.io
 
PPTX
Packing for the Web with Webpack
Thiago Temple
 
PPTX
Moving applications to the cloud
Sergejus Barinovas
 
PPTX
JavaScript front end performance optimizations
Chris Love
 
PDF
jQuery Keynote - Fall 2010
jeresig
 
PDF
Build Better Responsive websites. Hrvoje Jurišić
MeetMagentoNY2014
 
PDF
RESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff Norris
mfrancis
 
Production optimization with React and Webpack
k88hudson
 
Node.js & Twitter Bootstrap Crash Course
Aaron Silverman
 
DotNet MVC and webpack + Babel + react
Chen-Tien Tsai
 
Demystifying HTML5
Sergejus Barinovas
 
Web Components
Nikolaus Graf
 
Introduction to Vue.js DevStaff Meetup 13.02
Paul Bele
 
Bundle your modules with Webpack
Jake Peyser
 
Web Components Everywhere
Ilia Idakiev
 
An Overview on Nuxt.js
Squash Apps Pvt Ltd
 
Flash And Dom
Mike Wilcox
 
Introduction to require js
Ahmed Elharouny
 
Architecting Windows Azure
Sergejus Barinovas
 
Node PDX: Intro to Sails.js
Mike McNeil
 
Building single page applications
SC5.io
 
Packing for the Web with Webpack
Thiago Temple
 
Moving applications to the cloud
Sergejus Barinovas
 
JavaScript front end performance optimizations
Chris Love
 
jQuery Keynote - Fall 2010
jeresig
 
Build Better Responsive websites. Hrvoje Jurišić
MeetMagentoNY2014
 
RESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff Norris
mfrancis
 

Viewers also liked (20)

PPTX
Building a Web Frontend with Microservices and NGINX Plus
NGINX, Inc.
 
PPTX
Microservices and modern backends - Azure Meetup Frankfurt
Damir Dobric
 
PDF
Migrating a Monolithic App to Microservices on Cloud Foundry
Tony Erwin
 
ODP
micro services architecture (FrosCon2014)
smancke
 
PDF
Building microservices web application using scala & akka
Binh Nguyen
 
PPTX
Intro To Node.js
Chris Cowan
 
PDF
Webconf nodejs-production-architecture
Ben Lin
 
PDF
Building Scalable Web Applications Using Microservices Architecture and NodeJ...
NodejsFoundation
 
PDF
Developing applications with a microservice architecture (svcc)
Chris Richardson
 
PDF
Azure Microservices in Practice - Radu Vunvulea
ITCamp
 
PDF
Microsoft: Building a Massively Scalable System with DataStax and Microsoft's...
DataStax Academy
 
PPTX
Azure Service Fabric Overview
João Pedro Martins
 
PDF
Going Reactive in the Land of No
Lightbend
 
PDF
Modern UI Development With Node.js
Ryan Anklam
 
KEY
Enterprise Architectures with Ruby (and Rails)
Konstantin Gredeskoul
 
PDF
Anatomy of a Modern Node.js Application Architecture
AppDynamics
 
PDF
MicroService Architecture
Fred George
 
PDF
Node Foundation Membership Overview 20160907
NodejsFoundation
 
PDF
Journey to the Modern App with Containers, Microservices and Big Data
Lightbend
 
PPTX
Exploring microservices in a Microsoft landscape
Alex Thissen
 
Building a Web Frontend with Microservices and NGINX Plus
NGINX, Inc.
 
Microservices and modern backends - Azure Meetup Frankfurt
Damir Dobric
 
Migrating a Monolithic App to Microservices on Cloud Foundry
Tony Erwin
 
micro services architecture (FrosCon2014)
smancke
 
Building microservices web application using scala & akka
Binh Nguyen
 
Intro To Node.js
Chris Cowan
 
Webconf nodejs-production-architecture
Ben Lin
 
Building Scalable Web Applications Using Microservices Architecture and NodeJ...
NodejsFoundation
 
Developing applications with a microservice architecture (svcc)
Chris Richardson
 
Azure Microservices in Practice - Radu Vunvulea
ITCamp
 
Microsoft: Building a Massively Scalable System with DataStax and Microsoft's...
DataStax Academy
 
Azure Service Fabric Overview
João Pedro Martins
 
Going Reactive in the Land of No
Lightbend
 
Modern UI Development With Node.js
Ryan Anklam
 
Enterprise Architectures with Ruby (and Rails)
Konstantin Gredeskoul
 
Anatomy of a Modern Node.js Application Architecture
AppDynamics
 
MicroService Architecture
Fred George
 
Node Foundation Membership Overview 20160907
NodejsFoundation
 
Journey to the Modern App with Containers, Microservices and Big Data
Lightbend
 
Exploring microservices in a Microsoft landscape
Alex Thissen
 
Ad

Similar to A High-Performance Solution To Microservices UI Composition (20)

PDF
CSS framework By Palash
PalashBajpai
 
DOCX
Doctype html public
Eddy_TKJ
 
KEY
Slow kinda sucks
Tim Wright
 
DOCX
Master page
Paneliya Prince
 
PDF
Html5 - short intro
jeiseman
 
PPTX
Web Design Course - Lecture 18 - Boostrap, Gatting started, grid system, tables
Al-Mamun Sarkar
 
PDF
Bootstrap
Sarvesh Kushwaha
 
PDF
Odoo - Create themes for website
Odoo
 
ODP
HTML 5 Drupalcamp Ireland Dublin 2010
alanburke
 
PDF
JSP Web Technology Application on Road Transport Services
Mujeeb Rehman
 
PPTX
10 Tips to make your Website lightning-fast - SMX Stockholm 2012
Bastian Grimm
 
PPT
Web performance tuning
Sendhil Kumar Kannan
 
PPTX
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB
 
PDF
Website Development Guidelines
Amit Kute
 
PDF
Seo Cheat Sheet
Anchal Thakur
 
PDF
Seo cheat-sheet
Elena Michelle
 
PPTX
Enough with the JavaScript already!
Nicholas Zakas
 
PDF
Magento x codekit x sass x compass x skeleton responsive grid
Arush Sehgal
 
PPTX
Modelling Web Performance Optimization - FFSUx
Haribabu Nandyal Padmanaban
 
PDF
Highly Maintainable, Efficient, and Optimized CSS
Zoe Gillenwater
 
CSS framework By Palash
PalashBajpai
 
Doctype html public
Eddy_TKJ
 
Slow kinda sucks
Tim Wright
 
Master page
Paneliya Prince
 
Html5 - short intro
jeiseman
 
Web Design Course - Lecture 18 - Boostrap, Gatting started, grid system, tables
Al-Mamun Sarkar
 
Bootstrap
Sarvesh Kushwaha
 
Odoo - Create themes for website
Odoo
 
HTML 5 Drupalcamp Ireland Dublin 2010
alanburke
 
JSP Web Technology Application on Road Transport Services
Mujeeb Rehman
 
10 Tips to make your Website lightning-fast - SMX Stockholm 2012
Bastian Grimm
 
Web performance tuning
Sendhil Kumar Kannan
 
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB
 
Website Development Guidelines
Amit Kute
 
Seo Cheat Sheet
Anchal Thakur
 
Seo cheat-sheet
Elena Michelle
 
Enough with the JavaScript already!
Nicholas Zakas
 
Magento x codekit x sass x compass x skeleton responsive grid
Arush Sehgal
 
Modelling Web Performance Optimization - FFSUx
Haribabu Nandyal Padmanaban
 
Highly Maintainable, Efficient, and Optimized CSS
Zoe Gillenwater
 
Ad

Recently uploaded (20)

PDF
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
PDF
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
PDF
AI_MOD_1.pdf artificial intelligence notes
shreyarrce
 
PDF
Build Fast, Scale Faster: Milvus vs. Zilliz Cloud for Production-Ready AI
Zilliz
 
PDF
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
PPT
introduction to networking with basics coverage
RamananMuthukrishnan
 
PDF
Apple_Environmental_Progress_Report_2025.pdf
yiukwong
 
PPTX
internet básico presentacion es una red global
70965857
 
PPTX
Softuni - Psychology of entrepreneurship
Kalin Karakehayov
 
PPTX
sajflsajfljsdfljslfjslfsdfas;fdsfksadfjlsdflkjslgfs;lfjlsajfl;sajfasfd.pptx
theknightme
 
PPT
introductio to computers by arthur janry
RamananMuthukrishnan
 
PPTX
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
PPTX
原版西班牙莱昂大学毕业证(León毕业证书)如何办理
Taqyea
 
PPTX
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 
PPTX
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
PPTX
PE introd.pptxfrgfgfdgfdgfgrtretrt44t444
nepmithibai2024
 
PDF
BRKACI-1003 ACI Brownfield Migration - Real World Experiences and Best Practi...
fcesargonca
 
PPTX
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
PPTX
Optimization_Techniques_ML_Presentation.pptx
farispalayi
 
PPTX
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
AI_MOD_1.pdf artificial intelligence notes
shreyarrce
 
Build Fast, Scale Faster: Milvus vs. Zilliz Cloud for Production-Ready AI
Zilliz
 
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
introduction to networking with basics coverage
RamananMuthukrishnan
 
Apple_Environmental_Progress_Report_2025.pdf
yiukwong
 
internet básico presentacion es una red global
70965857
 
Softuni - Psychology of entrepreneurship
Kalin Karakehayov
 
sajflsajfljsdfljslfjslfsdfas;fdsfksadfjlsdflkjslgfs;lfjlsajfl;sajfasfd.pptx
theknightme
 
introductio to computers by arthur janry
RamananMuthukrishnan
 
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
原版西班牙莱昂大学毕业证(León毕业证书)如何办理
Taqyea
 
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
PE introd.pptxfrgfgfdgfdgfgrtretrt44t444
nepmithibai2024
 
BRKACI-1003 ACI Brownfield Migration - Real World Experiences and Best Practi...
fcesargonca
 
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
Optimization_Techniques_ML_Presentation.pptx
farispalayi
 
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 

A High-Performance Solution To Microservices UI Composition

  • 1. www.autoscout24.com www.autoscout24.com | www.thoughtworks.com A High-Performance Solution To Microservices UI Composition NDC Oslo | June 8, 2016 | Arif Wider & Alexey Gravanov
  • 4. 4 Project Tatsu From a .NET Monolith to AWS-hosted Microservices
  • 5. Project Tatsu: Goals 5 • Reduce time to market • Release new features quickly (for test or production) • Enable teams to innovate independently
  • 6. Autonomous Teams, Loosely Coupled Services 6 Allow for cross-functional teams that are able to independently create, improve, and run their services.  Avoid tight coupling as much as possible!
  • 7. Don't Compromise Page Performance 7 • Achieve PageSpeed Insights score of 95+ • Strive for low latency • Benefit from caching whenever possible tricky to combine with high team autonomy
  • 8. Breaking the Monolith The API Gateway Pattern 8
  • 9. API Gateway Pattern: AutoScout24 Homepage 9
  • 10. API Gateway Pattern 10 Home Header/ Footer Ads API Gateway Mobile apps  Great for page performance :)
  • 11. API Gateway Pattern: Drawbacks 11 Home Header/ Footer Ads API Gateway Mobile apps no truly independent vertical feature releases because of “UI monolith“  Bad for team autonomy :(
  • 12. Breaking the Monolith The UI Composition Pattern 12
  • 13. UI Composition Pattern 13 HomeAds Header/Footer one service = one vertical slice  Great for team autonomy :)
  • 14. Challenges of UI Composition 14 • Combine HTML • Let services deliver their own styles and JavaScript • Page structure must not break page performance • Request latency needs to stay low • Independent and integration testing of UI components  Tricky for page performance!
  • 17. ESI Include 17 <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>
  • 18. ESI Include Resolved 18 <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>  Bad page speed :(
  • 19. Multiple ESI Includes 19 <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>
  • 20. Multiple ESI Includes Resolved 20 <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>  Asset version inconsistency :(
  • 21. Varnish & ESI: Issues 21 • Bad page performance because of page structure • Attempts to optimize the page structure led to increased complexity regarding the asset handling • High burden on the content providing teams • Combining assets with ESI adds complexity • AWS ELB as Varnish backend wasn’t working
  • 22. Requirements for a better solution 22 • 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
  • 30. Pages 30 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
  • 31. SSI Include 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> <!--#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>
  • 32. SSI Include Resolved 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" /> </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>
  • 33. ngx_pagespeed: combine heads 33 <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>
  • 34. ngx_pagespeed: combine CSS & JS 34 <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>
  • 35. Page Performance of Composed Page 35
  • 36. Page Performance of Composed Page 36
  • 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 (memcached, via ngx_srcache module)
  • 40. Pagespeed Cache 40 • Caches generated assets • AWS ElastiCache (memcached) • state is externalized to AWS • allows for stateless web server machines • no cache synchronization • no cold cache
  • 41. Jigsaw Caching of Assets 41
  • 42. Jigsaw Caching of Documents 42
  • 43. Jigsaw Caching of Documents with Vary Header 43
  • 47. Jigsaw Best Practice Analyzer 47 • Checks HTML code for anti-patterns • defer async • page barriers (inline scripts) • CSS outside of <head> • stylesheet refs with different attributes • Can run in a deployment pipeline
  • 48. Things yet to be solved 48 • Authentication • Native mobile apps
  • 50. Features of the UI Composition Solution 50 • Teams are in full control of their service's UI and do not need to 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 • It’s live and serves thousands of requests per second flawlessly :)