SlideShare uma empresa Scribd logo
1 de 40
Baixar para ler offline
MICROSERVICE
WEBSITES
Gustaf Nilsson Kotte
@gustaf_nk
Mobile devices
The problem
How can we develop a website with multiple teams?
Different business units need to make a website together
that should feel like “one website” for the end-user.
Example: Retail domain
Products, Shopping cart, Checkout, Recommendations, Reviews,
User profile, Editorial content, etc...
The problem
Decentralized services but centralized web?
Frontend
Bottleneck
Services should have their own frontend!
Stefan Tilkov et al, “Self-Contained Systems”
Frontend Frontend FrontendFrontend
Autonomy → Continuous delivery
Decentralized governance
An option for teams to choose different tools
→ heterogeneous/plural/diverse system
High rate of change on the frontend
Allows the system to evolve over time
James Lewis & Martin Fowler, “Microservices: Decentralized Governance”
Addy Osmani, “JavaScript Start-up Performance”
Mobile device performance
Constraints (need to support)
Continuous delivery
Decentralized governance
Good performance on mobile devices
Microservice Websites
Mobile devices
Analysis
INTEGRATION USE CASE
Shopping cart
How can we reuse the shopping cart between
different parts of the web site?
“Many-to-one”
Multiple teams – one shopping cart
INTEGRATION USE CASE
Landing page
The web site’s landing page is the page with the
most amount of traffic and many business units
want to be represented there.
“One-to-many”
Multiple teams – one landing page
Integrating on...
What (data/code/content)
When (build/run)
Where (client/server)
Cartesian product → 12 combinations
Let’s go through them!
Analysis
What × when × where
What? When? Where?
Data (APIs) Build Client
Server
Run Client
Server
Code (JavaScript, PHP, etc) Build Client
Server
Run Client
Server
Content (HTML) Build Client
Server
Run Client
Server
What × when × where
What × when × where
What? When? Where?
Data (APIs) Build Client No reuse at all, only API usage
Server
Run Client
Server
Code (JavaScript, PHP, etc) Build Client
Server
Run Client
Server
Content (HTML) Build Client
Server
Run Client
Server
What × when × where
What × when × where
What? When? Where?
Data (APIs) Build Client No reuse at all, only API usage
Server
Run Client
Server
Code (JavaScript, PHP, etc) Build Client No continuous delivery. No diversity + mobile performance.
Server
Run Client
Server
Content (HTML) Build Client
Server
Run Client
Server
What × when × where
What × when × where
What? When? Where?
Data (APIs) Build Client No reuse at all, only API usage
Server
Run Client
Server
Code (JavaScript, PHP, etc) Build Client No continuous delivery. No diversity + mobile performance.
Server
Run Client No diversity + mobile performance.
Server N/A
Content (HTML) Build Client
Server
Run Client
Server
What × when × where
What × when × where
What? When? Where?
Data (APIs) Build Client No reuse at all, only API usage
Server
Run Client
Server
Code (JavaScript, PHP, etc) Build Client No continuous delivery. No diversity + mobile performance.
Server
Run Client No diversity + mobile performance.
Server N/A
Content (HTML) Build Client
Server
Run Client
Server
What × when × where
What × when × where
What? When? Where?
Data (APIs) Build Client No reuse at all, only API usage
Server
Run Client
Server
Code (JavaScript, PHP, etc) Build Client No continuous delivery. No diversity + mobile performance
Server
Run Client No diversity + mobile performance.
Server N/A
Content (HTML) Build Client N/A
Server “Static page fragments” – ok, but limited amount of use cases
Run Client
Server
What × when × where
What × when × where
What? When? Where?
Data (APIs) Build Client No reuse at all, only API usage
Server
Run Client
Server
Code (JavaScript, PHP, etc) Build Client No continuous delivery. No diversity + mobile performance.
Server
Run Client No diversity + mobile performance.
Server N/A
Content (HTML) Build Client N/A
Server “Static page fragments” – ok, but limited amount of use cases
Run Client Client-side transclusion
Server Server-side transclusion
What × when × where
What? When? Where?
Data (APIs) Build Client No reuse at all, only API usage
Server
Run Client
Server
Code (JavaScript, PHP, etc) Build Client No continuous delivery. No diversity + mobile performance.
Server
Run Client No diversity + mobile performance.
Server N/A
Content (HTML) Build Client N/A
Server “Static page fragments” – ok, but limited amount of use cases
Run Client Client-side transclusion
Server Server-side transclusion
What × when × whereWhat × when × where
Mobile devices
Transclusion
Transclusion
“transclusion is the inclusion of part or all of an electronic document
into one or more other documents by hypertext reference” (Wikipedia: Transclusion)
Producer
Expose a fragment resource, "/retail/shopping-cart/"
Consumer
Include the fragment declaratively, similar to <img src="..." />
Transclusion can be used both on server and client
Examples: Edge-Side Includes (server) and <h-include> (client)
Edge Side Includes (server)
<-- Include the shopping cart component -->
<esi:include src="/retail/shopping-cart/" />
ESI 1.0 proposal submitted to W3C 2001
CDN support: Akamai, Fastly
On-premise support: Varnish, Squid, nodesi, etc
<h-include> (client)
<h-include src="/retail/shopping-cart/"></h-include>
Custom Elements version of hinclude.js (by Mark Nottingham, 2006)
Difference: interface and transitive includes
HTTP/2 → Bundles multiple xhr requests into one
Both support refresh()
ESI (server)
+ SEO
+ JS/CSS in responses works as usual
+ Initial performance
+ Cross-domain requests
- Extra infrastructure investment
- Dev perspective (+ i.e. nodesi)
- No streamed responses ⇒ blocking
- Performance sensitive (+ timeouts)
- No header forwarding (+ configuration)
Server transclusion vs client transclusion
h-include (client)
- No SEO
- No loading of JS/CSS in responses
- Delay before xhr requests arrive
- No cross-domain requests (unless CORS)
- If no initial width/height, page will “jump”
+ No extra infrastructure investment
+ No extra dev setup
+ Async ⇒ non-blocking
+ Responses are rendered when they arrive
+ Headers work as usual in browsers
ESI and h-include together (1)
// Refresh-only h-include
var proto = Object.create(HIncludeElement.prototype);
proto.attachedCallback = function() { /* do nothing */ };
document.registerElement('h-include-refresh-only', {
prototype: proto,
});
⇒ <h-include-refresh-only src="...">REFRESHABLE CONTENT HERE</h-include-refresh-only>
Allows us to wrap the ESI fragment response in an h-include-refresh-only
⇒ server-side initial content with client-side refreshes
ESI and h-include together (2)
// Lazy-loading with hunt.js
window.addEventListener('load', function() {
// For these elements...
hunt(document.getElementsByTagName('h-include-refresh-only'), {
// ...when they’re almost in the viewport...
offset: 400,
// ...load them!
in: function() {
this.refresh();
},
});
});
Constraints (need to support)
Continuous delivery
Decentralized governance
Good performance on mobile devices
Rules for integration
Transclude server-side resources
Microservice Websites
Mobile devices
Client-side
dependencies
Shopping cart HTML, check!
But, what about...
Additional client-side behavior? (JavaScript)
Design? (CSS)
How to import service dependencies
Still need cache busting (i.e. /retail/shopping-cart/scripts-aef419.js)
Server-side transclusion works well here
Client-side transclusion require either 1) HTTP redirects, or 2) “loaders” like little-loader for JS and loadCSS
for CSS. Both options are less performant than using server-side transclusion, because of extra client/server
roundtrips.
<head>
...
<!-- Include shopping cart resources (cache-busting-as-a-service) -->
<esi:include src="/retail/shopping-cart/stylesheets/" />
...
</head>
<body>
...
<-- Include the shopping cart component -->
<esi:include src="/retail/shopping-cart/" />
…
<esi:include src="/retail/shopping-cart/scripts/" />
</body>
Load dependencies (before transclusion)
<head>
...
<!-- Include shopping cart resources (cache-busting-as-a-service) -->
<link rel="stylesheet" src="/retail/shopping-cart/style-ffc864.css" />
...
</head>
<body>
...
<-- Include the shopping cart component -->
<div class="shopping-cart">Hello, shopping cart</div>
...
<script src="/retail/shopping-cart/scripts-aef419.js"></script>
</body>
Load dependencies (after transclusion)
Client-side dependencies: JavaScript
No assumptions of consuming services’ client-side dependencies
⇒ Vanilla JS + polyfills (neither are “free”, so use both with care)
Custom Elements simplifies the lifecycle of components
https://github.com/WebReflection/document-register-element (5 KB)
Client-side dependencies: CSS
Disclaimer: I’m not a CSS expert
Large-scale CSS development is hard (but what’s the alternative?)
Styleguide
Namespacing/components/responsive/flexible
Good news: others have this problem too (i.e. “multi-team SPAs”)
Small global dependency for resets and typography (optional)
Constraints (need to support)
Continuous delivery
Decentralized governance
Good performance on mobile devices
Rules for integration
Transclude server-side resources
No global client-side dependencies
Microservice Websites
Mobile devices
Summary
Services should have their own frontend!
Frontend Frontend FrontendFrontend
Integration: Transclusion
Constraints (need to support)
Continuous delivery
Decentralized governance (otherwise: “occasional” rewrites)
Good performance on mobile devices
Rules for integration (free to use JS frameworks internally, but not for exported fragments)
Transclude server-side resources
No global client-side dependencies
Microservice Websites
Further resources
Microservice Websites, Gustaf Nilsson Kotte
Microservices, James Lewis & Martin Fowler
Self-Contained Systems, Stefan Tilkov et al.
Architecture Without an End State, Michael Nygard
JavaScript Start-up Performance, Addi Osmani
Also, this is a great book:
I’ll happily chat on twitter: @gustaf_nk

Mais conteúdo relacionado

Mais procurados

Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2Christian Posta
 
ACTIVE SERVER PAGES BY SAIKIRAN PANJALA
ACTIVE SERVER PAGES BY SAIKIRAN PANJALAACTIVE SERVER PAGES BY SAIKIRAN PANJALA
ACTIVE SERVER PAGES BY SAIKIRAN PANJALASaikiran Panjala
 
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShiftReal-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShiftChristian Posta
 
Joomla! Scalable Enterprise Deployments with AWS
Joomla! Scalable Enterprise Deployments with AWSJoomla! Scalable Enterprise Deployments with AWS
Joomla! Scalable Enterprise Deployments with AWSJim Dolinski
 
Building Quality into the AEM Publication Workflow with Active Standards by D...
Building Quality into the AEM Publication Workflow with Active Standards by D...Building Quality into the AEM Publication Workflow with Active Standards by D...
Building Quality into the AEM Publication Workflow with Active Standards by D...AEM HUB
 
single page application
single page applicationsingle page application
single page applicationRavindra K
 
App fabric hybrid computing
App fabric   hybrid computingApp fabric   hybrid computing
App fabric hybrid computingHammad Rajjoub
 
Content migration for sitecore
Content migration for sitecoreContent migration for sitecore
Content migration for sitecoreSurendra Sharma
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web AppsKranthi Lakum
 
Single page applications with backbone js
Single page applications with backbone jsSingle page applications with backbone js
Single page applications with backbone jsGil Fink
 
Integrating Microservices with Apache Camel
Integrating Microservices with Apache CamelIntegrating Microservices with Apache Camel
Integrating Microservices with Apache CamelChristian Posta
 
Powering GIS Operations with ColdFusion
Powering GIS Operations with ColdFusionPowering GIS Operations with ColdFusion
Powering GIS Operations with ColdFusionColdFusionConference
 
Active server pages
Active server pagesActive server pages
Active server pagesmcatahir947
 

Mais procurados (20)

Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2Microservices with Apache Camel, Docker and Fabric8 v2
Microservices with Apache Camel, Docker and Fabric8 v2
 
Kentico CMS
Kentico CMSKentico CMS
Kentico CMS
 
ACTIVE SERVER PAGES BY SAIKIRAN PANJALA
ACTIVE SERVER PAGES BY SAIKIRAN PANJALAACTIVE SERVER PAGES BY SAIKIRAN PANJALA
ACTIVE SERVER PAGES BY SAIKIRAN PANJALA
 
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShiftReal-world #microservices with Apache Camel, Fabric8, and OpenShift
Real-world #microservices with Apache Camel, Fabric8, and OpenShift
 
Asp
AspAsp
Asp
 
Joomla! Scalable Enterprise Deployments with AWS
Joomla! Scalable Enterprise Deployments with AWSJoomla! Scalable Enterprise Deployments with AWS
Joomla! Scalable Enterprise Deployments with AWS
 
ColdFusion in Transit action
ColdFusion in Transit actionColdFusion in Transit action
ColdFusion in Transit action
 
Introduction to ASP.NET MVC
Introduction to ASP.NET MVCIntroduction to ASP.NET MVC
Introduction to ASP.NET MVC
 
Ch. x web performance
Ch. x web performanceCh. x web performance
Ch. x web performance
 
Building Quality into the AEM Publication Workflow with Active Standards by D...
Building Quality into the AEM Publication Workflow with Active Standards by D...Building Quality into the AEM Publication Workflow with Active Standards by D...
Building Quality into the AEM Publication Workflow with Active Standards by D...
 
Introduction ASP
Introduction ASPIntroduction ASP
Introduction ASP
 
single page application
single page applicationsingle page application
single page application
 
App fabric hybrid computing
App fabric   hybrid computingApp fabric   hybrid computing
App fabric hybrid computing
 
Drive dam
Drive damDrive dam
Drive dam
 
Content migration for sitecore
Content migration for sitecoreContent migration for sitecore
Content migration for sitecore
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web Apps
 
Single page applications with backbone js
Single page applications with backbone jsSingle page applications with backbone js
Single page applications with backbone js
 
Integrating Microservices with Apache Camel
Integrating Microservices with Apache CamelIntegrating Microservices with Apache Camel
Integrating Microservices with Apache Camel
 
Powering GIS Operations with ColdFusion
Powering GIS Operations with ColdFusionPowering GIS Operations with ColdFusion
Powering GIS Operations with ColdFusion
 
Active server pages
Active server pagesActive server pages
Active server pages
 

Semelhante a Microservice Websites – Micro CPH

Workshop HTML5+PhoneGap by Ivano Malavolta
Workshop HTML5+PhoneGap by Ivano Malavolta Workshop HTML5+PhoneGap by Ivano Malavolta
Workshop HTML5+PhoneGap by Ivano Malavolta Commit University
 
Simpler Web Architectures Now! (At The Frontend 2016)
Simpler Web Architectures Now! (At The Frontend 2016)Simpler Web Architectures Now! (At The Frontend 2016)
Simpler Web Architectures Now! (At The Frontend 2016)Gustaf Nilsson Kotte
 
REST: So What's It All About? (SAP TechEd 2011, MOB107)
REST: So What's It All About? (SAP TechEd 2011, MOB107)REST: So What's It All About? (SAP TechEd 2011, MOB107)
REST: So What's It All About? (SAP TechEd 2011, MOB107)Sascha Wenninger
 
A Simpler Web App Architecture (jDays 2016)
A Simpler Web App Architecture (jDays 2016)A Simpler Web App Architecture (jDays 2016)
A Simpler Web App Architecture (jDays 2016)Gustaf Nilsson Kotte
 
Angular jS Introduction by Google
Angular jS Introduction by GoogleAngular jS Introduction by Google
Angular jS Introduction by GoogleASG
 
James Turner (Caplin) - Enterprise HTML5 Patterns
James Turner (Caplin) - Enterprise HTML5 PatternsJames Turner (Caplin) - Enterprise HTML5 Patterns
James Turner (Caplin) - Enterprise HTML5 Patternsakqaanoraks
 
POX to HATEOAS: Our Company's Journey Building a Hypermedia API
POX to HATEOAS: Our Company's Journey Building a Hypermedia APIPOX to HATEOAS: Our Company's Journey Building a Hypermedia API
POX to HATEOAS: Our Company's Journey Building a Hypermedia APILuke Stokes
 
State of modern web technologies: an introduction
State of modern web technologies: an introductionState of modern web technologies: an introduction
State of modern web technologies: an introductionMichael Ahearn
 
HTML5: the new frontier of the web
HTML5: the new frontier of the webHTML5: the new frontier of the web
HTML5: the new frontier of the webIvano Malavolta
 
The future of web development write once, run everywhere with angular js an...
The future of web development   write once, run everywhere with angular js an...The future of web development   write once, run everywhere with angular js an...
The future of web development write once, run everywhere with angular js an...Mark Leusink
 
The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...Mark Roden
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX DesignersAshlimarie
 
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
 
Testable client side_mvc_apps_in_javascript
Testable client side_mvc_apps_in_javascriptTestable client side_mvc_apps_in_javascript
Testable client side_mvc_apps_in_javascriptTimothy Oxley
 
Progressive web apps
Progressive web appsProgressive web apps
Progressive web appsFastly
 
PHP on Windows and on Azure
PHP on Windows and on AzurePHP on Windows and on Azure
PHP on Windows and on AzureMaarten Balliauw
 
Making Of PHP Based Web Application
Making Of PHP Based Web ApplicationMaking Of PHP Based Web Application
Making Of PHP Based Web ApplicationSachin Walvekar
 
Wordcamp Toronto Presentation
Wordcamp Toronto PresentationWordcamp Toronto Presentation
Wordcamp Toronto PresentationRoy Sivan
 

Semelhante a Microservice Websites – Micro CPH (20)

Workshop HTML5+PhoneGap by Ivano Malavolta
Workshop HTML5+PhoneGap by Ivano Malavolta Workshop HTML5+PhoneGap by Ivano Malavolta
Workshop HTML5+PhoneGap by Ivano Malavolta
 
Simpler Web Architectures Now! (At The Frontend 2016)
Simpler Web Architectures Now! (At The Frontend 2016)Simpler Web Architectures Now! (At The Frontend 2016)
Simpler Web Architectures Now! (At The Frontend 2016)
 
REST: So What's It All About? (SAP TechEd 2011, MOB107)
REST: So What's It All About? (SAP TechEd 2011, MOB107)REST: So What's It All About? (SAP TechEd 2011, MOB107)
REST: So What's It All About? (SAP TechEd 2011, MOB107)
 
A Simpler Web App Architecture (jDays 2016)
A Simpler Web App Architecture (jDays 2016)A Simpler Web App Architecture (jDays 2016)
A Simpler Web App Architecture (jDays 2016)
 
Angular jS Introduction by Google
Angular jS Introduction by GoogleAngular jS Introduction by Google
Angular jS Introduction by Google
 
James Turner (Caplin) - Enterprise HTML5 Patterns
James Turner (Caplin) - Enterprise HTML5 PatternsJames Turner (Caplin) - Enterprise HTML5 Patterns
James Turner (Caplin) - Enterprise HTML5 Patterns
 
POX to HATEOAS: Our Company's Journey Building a Hypermedia API
POX to HATEOAS: Our Company's Journey Building a Hypermedia APIPOX to HATEOAS: Our Company's Journey Building a Hypermedia API
POX to HATEOAS: Our Company's Journey Building a Hypermedia API
 
State of modern web technologies: an introduction
State of modern web technologies: an introductionState of modern web technologies: an introduction
State of modern web technologies: an introduction
 
HTML5: the new frontier of the web
HTML5: the new frontier of the webHTML5: the new frontier of the web
HTML5: the new frontier of the web
 
The future of web development write once, run everywhere with angular js an...
The future of web development   write once, run everywhere with angular js an...The future of web development   write once, run everywhere with angular js an...
The future of web development write once, run everywhere with angular js an...
 
The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...
 
Web Development for UX Designers
Web Development for UX DesignersWeb Development for UX Designers
Web Development for UX Designers
 
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
 
Testable client side_mvc_apps_in_javascript
Testable client side_mvc_apps_in_javascriptTestable client side_mvc_apps_in_javascript
Testable client side_mvc_apps_in_javascript
 
Progressive web apps
Progressive web appsProgressive web apps
Progressive web apps
 
PHP on Windows and on Azure
PHP on Windows and on AzurePHP on Windows and on Azure
PHP on Windows and on Azure
 
Making Of PHP Based Web Application
Making Of PHP Based Web ApplicationMaking Of PHP Based Web Application
Making Of PHP Based Web Application
 
PHP on Windows
PHP on WindowsPHP on Windows
PHP on Windows
 
PHP on Windows
PHP on WindowsPHP on Windows
PHP on Windows
 
Wordcamp Toronto Presentation
Wordcamp Toronto PresentationWordcamp Toronto Presentation
Wordcamp Toronto Presentation
 

Mais de Gustaf Nilsson Kotte

HTML Hypermedia APIs and Adaptive Web Design - jDays 2013
HTML Hypermedia APIs and Adaptive Web Design - jDays 2013HTML Hypermedia APIs and Adaptive Web Design - jDays 2013
HTML Hypermedia APIs and Adaptive Web Design - jDays 2013Gustaf Nilsson Kotte
 
HTML Hypermedia APIs and Adaptive Web Design - RuPy
HTML Hypermedia APIs and Adaptive Web Design - RuPyHTML Hypermedia APIs and Adaptive Web Design - RuPy
HTML Hypermedia APIs and Adaptive Web Design - RuPyGustaf Nilsson Kotte
 
HTML Hypermedia APIs and Adaptive Web Design - reject.js
HTML Hypermedia APIs and Adaptive Web Design -  reject.js HTML Hypermedia APIs and Adaptive Web Design -  reject.js
HTML Hypermedia APIs and Adaptive Web Design - reject.js Gustaf Nilsson Kotte
 
HTML Hypermedia APIs and Adaptive Web Design - Nordic APIs
HTML Hypermedia APIs and Adaptive Web Design - Nordic APIsHTML Hypermedia APIs and Adaptive Web Design - Nordic APIs
HTML Hypermedia APIs and Adaptive Web Design - Nordic APIsGustaf Nilsson Kotte
 
Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013Gustaf Nilsson Kotte
 
Surviving the Zombie Apocalpyse of Connected Devices
Surviving the Zombie Apocalpyse of Connected DevicesSurviving the Zombie Apocalpyse of Connected Devices
Surviving the Zombie Apocalpyse of Connected DevicesGustaf Nilsson Kotte
 

Mais de Gustaf Nilsson Kotte (9)

Jayway Web Tech Radar 2015
Jayway Web Tech Radar 2015Jayway Web Tech Radar 2015
Jayway Web Tech Radar 2015
 
HTML Hypermedia APIs and Adaptive Web Design - jDays 2013
HTML Hypermedia APIs and Adaptive Web Design - jDays 2013HTML Hypermedia APIs and Adaptive Web Design - jDays 2013
HTML Hypermedia APIs and Adaptive Web Design - jDays 2013
 
Design Hypermedia APIs
Design Hypermedia APIsDesign Hypermedia APIs
Design Hypermedia APIs
 
HTML Hypermedia APIs and Adaptive Web Design - RuPy
HTML Hypermedia APIs and Adaptive Web Design - RuPyHTML Hypermedia APIs and Adaptive Web Design - RuPy
HTML Hypermedia APIs and Adaptive Web Design - RuPy
 
HTML Hypermedia APIs and Adaptive Web Design - reject.js
HTML Hypermedia APIs and Adaptive Web Design -  reject.js HTML Hypermedia APIs and Adaptive Web Design -  reject.js
HTML Hypermedia APIs and Adaptive Web Design - reject.js
 
HTML Hypermedia APIs and Adaptive Web Design - Nordic APIs
HTML Hypermedia APIs and Adaptive Web Design - Nordic APIsHTML Hypermedia APIs and Adaptive Web Design - Nordic APIs
HTML Hypermedia APIs and Adaptive Web Design - Nordic APIs
 
Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
Surviving the Zombie Apocalypse of Connected devices - Jfokus 2013
 
Surviving the Zombie Apocalpyse of Connected Devices
Surviving the Zombie Apocalpyse of Connected DevicesSurviving the Zombie Apocalpyse of Connected Devices
Surviving the Zombie Apocalpyse of Connected Devices
 
Windows 8 for Web Developers
Windows 8 for Web DevelopersWindows 8 for Web Developers
Windows 8 for Web Developers
 

Último

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 

Último (20)

Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

Microservice Websites – Micro CPH

  • 3. How can we develop a website with multiple teams? Different business units need to make a website together that should feel like “one website” for the end-user. Example: Retail domain Products, Shopping cart, Checkout, Recommendations, Reviews, User profile, Editorial content, etc... The problem
  • 4. Decentralized services but centralized web? Frontend Bottleneck
  • 5. Services should have their own frontend! Stefan Tilkov et al, “Self-Contained Systems” Frontend Frontend FrontendFrontend Autonomy → Continuous delivery
  • 6. Decentralized governance An option for teams to choose different tools → heterogeneous/plural/diverse system High rate of change on the frontend Allows the system to evolve over time James Lewis & Martin Fowler, “Microservices: Decentralized Governance”
  • 7. Addy Osmani, “JavaScript Start-up Performance” Mobile device performance
  • 8. Constraints (need to support) Continuous delivery Decentralized governance Good performance on mobile devices Microservice Websites
  • 10. INTEGRATION USE CASE Shopping cart How can we reuse the shopping cart between different parts of the web site? “Many-to-one” Multiple teams – one shopping cart
  • 11. INTEGRATION USE CASE Landing page The web site’s landing page is the page with the most amount of traffic and many business units want to be represented there. “One-to-many” Multiple teams – one landing page
  • 12. Integrating on... What (data/code/content) When (build/run) Where (client/server) Cartesian product → 12 combinations Let’s go through them! Analysis
  • 13. What × when × where What? When? Where? Data (APIs) Build Client Server Run Client Server Code (JavaScript, PHP, etc) Build Client Server Run Client Server Content (HTML) Build Client Server Run Client Server What × when × where
  • 14. What × when × where What? When? Where? Data (APIs) Build Client No reuse at all, only API usage Server Run Client Server Code (JavaScript, PHP, etc) Build Client Server Run Client Server Content (HTML) Build Client Server Run Client Server What × when × where
  • 15. What × when × where What? When? Where? Data (APIs) Build Client No reuse at all, only API usage Server Run Client Server Code (JavaScript, PHP, etc) Build Client No continuous delivery. No diversity + mobile performance. Server Run Client Server Content (HTML) Build Client Server Run Client Server What × when × where
  • 16. What × when × where What? When? Where? Data (APIs) Build Client No reuse at all, only API usage Server Run Client Server Code (JavaScript, PHP, etc) Build Client No continuous delivery. No diversity + mobile performance. Server Run Client No diversity + mobile performance. Server N/A Content (HTML) Build Client Server Run Client Server What × when × where
  • 17. What × when × where What? When? Where? Data (APIs) Build Client No reuse at all, only API usage Server Run Client Server Code (JavaScript, PHP, etc) Build Client No continuous delivery. No diversity + mobile performance. Server Run Client No diversity + mobile performance. Server N/A Content (HTML) Build Client Server Run Client Server What × when × where
  • 18. What × when × where What? When? Where? Data (APIs) Build Client No reuse at all, only API usage Server Run Client Server Code (JavaScript, PHP, etc) Build Client No continuous delivery. No diversity + mobile performance Server Run Client No diversity + mobile performance. Server N/A Content (HTML) Build Client N/A Server “Static page fragments” – ok, but limited amount of use cases Run Client Server What × when × where
  • 19. What × when × where What? When? Where? Data (APIs) Build Client No reuse at all, only API usage Server Run Client Server Code (JavaScript, PHP, etc) Build Client No continuous delivery. No diversity + mobile performance. Server Run Client No diversity + mobile performance. Server N/A Content (HTML) Build Client N/A Server “Static page fragments” – ok, but limited amount of use cases Run Client Client-side transclusion Server Server-side transclusion What × when × where
  • 20. What? When? Where? Data (APIs) Build Client No reuse at all, only API usage Server Run Client Server Code (JavaScript, PHP, etc) Build Client No continuous delivery. No diversity + mobile performance. Server Run Client No diversity + mobile performance. Server N/A Content (HTML) Build Client N/A Server “Static page fragments” – ok, but limited amount of use cases Run Client Client-side transclusion Server Server-side transclusion What × when × whereWhat × when × where
  • 22. Transclusion “transclusion is the inclusion of part or all of an electronic document into one or more other documents by hypertext reference” (Wikipedia: Transclusion) Producer Expose a fragment resource, "/retail/shopping-cart/" Consumer Include the fragment declaratively, similar to <img src="..." /> Transclusion can be used both on server and client Examples: Edge-Side Includes (server) and <h-include> (client)
  • 23. Edge Side Includes (server) <-- Include the shopping cart component --> <esi:include src="/retail/shopping-cart/" /> ESI 1.0 proposal submitted to W3C 2001 CDN support: Akamai, Fastly On-premise support: Varnish, Squid, nodesi, etc
  • 24. <h-include> (client) <h-include src="/retail/shopping-cart/"></h-include> Custom Elements version of hinclude.js (by Mark Nottingham, 2006) Difference: interface and transitive includes HTTP/2 → Bundles multiple xhr requests into one Both support refresh()
  • 25. ESI (server) + SEO + JS/CSS in responses works as usual + Initial performance + Cross-domain requests - Extra infrastructure investment - Dev perspective (+ i.e. nodesi) - No streamed responses ⇒ blocking - Performance sensitive (+ timeouts) - No header forwarding (+ configuration) Server transclusion vs client transclusion h-include (client) - No SEO - No loading of JS/CSS in responses - Delay before xhr requests arrive - No cross-domain requests (unless CORS) - If no initial width/height, page will “jump” + No extra infrastructure investment + No extra dev setup + Async ⇒ non-blocking + Responses are rendered when they arrive + Headers work as usual in browsers
  • 26. ESI and h-include together (1) // Refresh-only h-include var proto = Object.create(HIncludeElement.prototype); proto.attachedCallback = function() { /* do nothing */ }; document.registerElement('h-include-refresh-only', { prototype: proto, }); ⇒ <h-include-refresh-only src="...">REFRESHABLE CONTENT HERE</h-include-refresh-only> Allows us to wrap the ESI fragment response in an h-include-refresh-only ⇒ server-side initial content with client-side refreshes
  • 27. ESI and h-include together (2) // Lazy-loading with hunt.js window.addEventListener('load', function() { // For these elements... hunt(document.getElementsByTagName('h-include-refresh-only'), { // ...when they’re almost in the viewport... offset: 400, // ...load them! in: function() { this.refresh(); }, }); });
  • 28. Constraints (need to support) Continuous delivery Decentralized governance Good performance on mobile devices Rules for integration Transclude server-side resources Microservice Websites
  • 30. Shopping cart HTML, check! But, what about... Additional client-side behavior? (JavaScript) Design? (CSS)
  • 31. How to import service dependencies Still need cache busting (i.e. /retail/shopping-cart/scripts-aef419.js) Server-side transclusion works well here Client-side transclusion require either 1) HTTP redirects, or 2) “loaders” like little-loader for JS and loadCSS for CSS. Both options are less performant than using server-side transclusion, because of extra client/server roundtrips.
  • 32. <head> ... <!-- Include shopping cart resources (cache-busting-as-a-service) --> <esi:include src="/retail/shopping-cart/stylesheets/" /> ... </head> <body> ... <-- Include the shopping cart component --> <esi:include src="/retail/shopping-cart/" /> … <esi:include src="/retail/shopping-cart/scripts/" /> </body> Load dependencies (before transclusion)
  • 33. <head> ... <!-- Include shopping cart resources (cache-busting-as-a-service) --> <link rel="stylesheet" src="/retail/shopping-cart/style-ffc864.css" /> ... </head> <body> ... <-- Include the shopping cart component --> <div class="shopping-cart">Hello, shopping cart</div> ... <script src="/retail/shopping-cart/scripts-aef419.js"></script> </body> Load dependencies (after transclusion)
  • 34. Client-side dependencies: JavaScript No assumptions of consuming services’ client-side dependencies ⇒ Vanilla JS + polyfills (neither are “free”, so use both with care) Custom Elements simplifies the lifecycle of components https://github.com/WebReflection/document-register-element (5 KB)
  • 35. Client-side dependencies: CSS Disclaimer: I’m not a CSS expert Large-scale CSS development is hard (but what’s the alternative?) Styleguide Namespacing/components/responsive/flexible Good news: others have this problem too (i.e. “multi-team SPAs”) Small global dependency for resets and typography (optional)
  • 36. Constraints (need to support) Continuous delivery Decentralized governance Good performance on mobile devices Rules for integration Transclude server-side resources No global client-side dependencies Microservice Websites
  • 38. Services should have their own frontend! Frontend Frontend FrontendFrontend Integration: Transclusion
  • 39. Constraints (need to support) Continuous delivery Decentralized governance (otherwise: “occasional” rewrites) Good performance on mobile devices Rules for integration (free to use JS frameworks internally, but not for exported fragments) Transclude server-side resources No global client-side dependencies Microservice Websites
  • 40. Further resources Microservice Websites, Gustaf Nilsson Kotte Microservices, James Lewis & Martin Fowler Self-Contained Systems, Stefan Tilkov et al. Architecture Without an End State, Michael Nygard JavaScript Start-up Performance, Addi Osmani Also, this is a great book: I’ll happily chat on twitter: @gustaf_nk