Self contained systems
in practice
PER ÖKVIST, @per_okvist
THEORY
WHAT IS SELF CONTAINED SYSTEMS?
Function Aggregate Bounded context
https://speakerdeck.com/stilkov/microservices-patterns-and-antipatterns-1?slide=40
https://www.youtube.com/watch?v=VaYmRe104HU
Stefan Tilkov - Microservices Patterns and Anti-patterns
Cohesion
“Focus on a separation of the functionality into many independent systems, making
the complete logical system a collaboration of many smaller software systems”
”We love monoliths – so let’s
build a lot of them!”
S. Tilkov.
Data
“Each SCS must include data and logic. To really implement any meaningful features
both are needed. An SCS should implement features by itself and must therefore
include both.”
Communication with other SCSs or 3rd party systems is asynchronous wherever possible.
scs-architecture.org
THINK – multiple web sites
Self Contained System.
The idea is to break a large system apart into several smaller self-contained
systems, or SCSs, that follow certain rules.
Multiple sites / Self Contained Systems
Products.YourSite.com Support.YourSite.com
Composition
Pages and
fragments
“Teams should publish a
catalog of their fragment
types and fragment
instances”.
Pages
Fragment
OWNS SHARES
Fragment
SCS /
Vertical
A Self-Contained-System
could be part of a larger
system, thus often
referred to as a Vertical
Pages
Fragment
Fragment
Backend(s)
Vertical
Transclusion
Compose pages by including fragments, on the server or on the client, enabling a greater cache strategy
as well.
SSI : Server side include – good for static content
CSI : Client side include – good for dynamic / personalized content
Transclusion is the inclusion of part or all of an electronic
document into one or more other documents by hypertext
reference.
The result of transclusion is a single integrated document made
of parts assembled dynamically from separate sources, possibly
stored on different computers in disparate places.
IN PRACTICE
Composition
<html>
{json}
Markup
iFrame
Link/Url
Data/Api
<esi>
Edge side includes
Transclusion - Context neutrality
http://microservice-websites.netlify.com/
<esi:include>
<h-include>
Gustaf Nilsson Kotte – Microservice web sites
Fragment
cart_fragment_styles.html
cart_fragment_scripts.html
cart_fragment.html
Pages
Layout Page
baseline
header
footer
Search Catalog Checkout
Multiple sites
A site made of sites.
/products /support
Gateway - YourSite.com
YourSite.com/products
/products /support
Gateway - YourSite.com
YourSite.com/products
CDN – With ESI support
Gateway - YourSite.com
CDN – With ESI support
Account My Pages Search Catalog
Product
Details
Checkout Support
Vertical/App
Catalog
Service
Service
Data
Caching
- Procedures
- Views
- Projections
- Composition
Read models
CDN – With ESI support
“infinite” Cache-Control: max-age=<seconds>
Time’s up!
Let’s summarize

Self contained systems - In practice