This document discusses different approaches to designing a user interface for a microservices architecture. It begins by proposing a domain model decomposition with individual services owning pieces of product data. However, this poses issues for users who need an aggregated view. An alternative presented is to have individual services cache normalized data and compose a view model at the edge. Later approaches incorporate client-side messaging, hosting the composition engine in MVC, and using view components to give services more ownership over vertical slices of the UI. The key takeaways are that the UI structure can be defined at the edge while still keeping domain responsibilities clear across services.
10. @mauroservienti
What's the deal?
• It's a cache
•with no clear ownership
•with infrastructure maintenance cost
•with no easy way to (partially) invalidate it
• It’s the truth from the user perspective
•When scaled out instances need to be kept in sync
11. @mauroservienti
How to fulfill it?
• Pushing is not a solution
•At read time data are always in an unknown state
• Pulling is not a solution either
•Batch jobs, that can fail
•Unknown state is still an issue at read time
•Multiple owners competing on a single resource
19. @mauroservienti
Recap
•Responsibilities and ownership are clearly
defined
•Each service can cache using different strategies
•We can easily handle:
•Optional information
•Failures
•Sample is .NET Core: other options are available
24. @mauroservienti
client-side message broker
Component from
product-catalog
Component from
sales
Component from
marketing
View
model
Component from
product-catalog
Component from
sales
Component from
marketing
ProductNameA
€ 20.00
cover
image
A
Supplier A
ProductNameB
€ 20.00
cover
image
B
Supplier B
ProductNameC
€ 20.00
cover
image
C
Supplier C
ProductNameD
€ 20.00
cover
image
D
Supplier D
publish `RelatedProductsFound`
load related
products
receive event
/products/1
25. @mauroservienti
Component from
product-catalog
Component from
sales
Component from
marketing
View
model
Component from
product-catalog
Component from
sales
Component from
marketing
ProductNameA
€ 20.00
cover
image
A
Supplier A
ProductNameB
€ 20.00
cover
image
B
Supplier B
ProductNameC
€ 20.00
cover
image
C
Supplier C
ProductNameD
€ 20.00
cover
image
D
Supplier D
load related
products
/products/1
27. @mauroservienti
Recap
•One service owns the “ID list”
•Select N+1 is not (anymore) a concern
•# of requests will be “# of services”
•Or in worst case “# of services + 1”
•For SPA or devices we’re done :-)
•Or any remote client
28. @mauroservienti
Hurry up, take a picture ;-)
http://go.particular.net/meetcast17
Apply systems design with microservices
Get free access to lessons about services boundaries
from the Advanced Distributed Systems Design course
by Udi Dahan
32. @mauroservienti
Recap
•Composition engine MVC hosted
•UI structure is defined as a “monolith”
•Branding owns the UI structure
•the case when business drives all changes
•Interfaces can replace dynamic ViewModels
35. @mauroservienti
Recap
•Composition engine is still the same
•UI defines only high level structure
•Branding is less important
•The more “magic” the less Branding
•Services own the whole vertical slice
While showing ownership in overlay....Lots of components, or in SOA lingo services, each one owing different data. Otherwise it's a clear violation of responsibilities.