Many systems start with diagrams of boxes and arrows and the promise of high consistency and low coupling. The boxes are supposed to be loosely coupled components, but each arrow often results in a highly coupled dependency at runtime. What if we can do something about it… during deployment?
In this webinar, we’ll identify design decisions that influence your system’s behavior both at design-time and run-time. We’ll observe how changing your design during deployment gives you many opportunities for making trade-offs to improve function and performance and gives you the information you need to shape your system architecture.
Artificial intelligence in the post-deep learning era
Change your architecture during deployment
1. Dennis van der Stelt
Change your Architecture
During deployment
Dennis van der Stelt @ Particular Software
Makers of NServiceBus
@dvdstelt
dennis.vanderstelt@particular.net
https://bloggingabout.net/
https://calendly/dvdstelt/
5. Dennis van der Stelt
London
Southampton
Plymouth
Liverpool
Manchester
Glasgow
Edinburgh
Aberdeen
WHISKY
(neat)
WHISKEY
(on the rocks)
BOURBON
SCOTCH
7. Dennis van der Stelt
Everything we hear is an opinion,
not a fact. Everything we see is a
perspective, not the truth
Marcus Aurelius
8. Dennis van der Stelt
Services Microservices
LET’S TALK ABOUT PERSPECTIVE
Services aren’t necessarily microservices.But are microservices services?
9. Dennis van der Stelt
DIFFERENT VIEWS OF A SYSTEM
Which views can we distinguish in this diagram?
10. Dennis van der Stelt
C4 MODEL
Visualizing software architecture
Created by Simon Brown – https://c4model.com
11. Dennis van der Stelt
4+1 ARCHITECTURAL VIEW MODEL
Philippe Kruchten,1995
Scenarios
Logical
view
Development
view
Process
view
Physical
view
12. Dennis van der Stelt
4+1 ARCHITECTURAL VIEW MODEL
Philippe Kruchten,1995
Logical view
Explains how the system is structured
Usually contains services & components
Process view
Shows communication between services
Development view
Structure of the components & codebase
Usually inside an IDE, source-control repositories, etc.
Physical view
Shows how services are deployed
13. Dennis van der Stelt
4+1 VIEW MODEL – LOGICAL VIEW
This is an example. You probably shouldn’tdo services like this.
customer
service
order
service
inventory
service
product
service
email
service
14. Dennis van der Stelt
4+1 VIEW MODEL – PROCESS VIEW
Sequence diagrams are just a potential part of this view
inventory
service
product
service
order
service
some request
some request
some response
some response
15. Dennis van der Stelt
4+1 VIEW MODEL – PROCESS VIEW
When using NServiceBus, ServiceInsightcan provide great sequencediagrams on your message flow
16. Dennis van der Stelt
4+1 VIEW MODEL – DEVELOPMENT VIEW
More details about how projects are hosted, data storage, etc.
products inventory
orders
website
WebAPI WebAPI WebAPI
orders products inventory
17. Dennis van der Stelt
4+1 VIEW MODEL – DEVELOPMENT VIEW
Or decide to add a gateway
products inventory
orders
website
WebAPI
WebAPI
WebAPI
orders products inventory
Gateway
WebAPI
18. Dennis van der Stelt
4+1 VIEW MODEL – DEVELOPMENT VIEW
GitHub repositories and/or IDE projects
19. Dennis van der Stelt
4+1 VIEW MODEL – PHYSICAL VIEW
Remember, these are just examples
reversed
proxy
website
website
orders products inventory
inventory
container
products
container
orders
container
20. Dennis van der Stelt
4+1 VIEW MODEL
The same architecture, but different views
Logical View Physical View
reversed
proxy
website
website
orders products inventory
inventory
container
products
container
orders
container
customer
service
order
service
inventory
service
product
service
email
service
22. Dennis van der Stelt
✓Maximum of 30 lines of code
✓Highly maintainable and testable
✓Loosely coupled
✓Database per microservice
✓Independently deployable
✓Owned by a small team
WHAT ARE MICROSERVICES
Some random list, copied from a random website
23. Dennis van der Stelt
✓Maximum of 30 lines of code
✓Highly maintainable and testable
✓Loosely coupled
✓Database per microservice
✓Independently deployable
✓Owned by a small team
WHAT ARE MICROSERVICES
Some random list, copied from a random website
24. Dennis van der Stelt
✓Maximum of 30 lines of code
✓Highly maintainable and testable
✓Loosely coupled
✓Database per microservice
✓Independently deployable
✓Owned by a small team
WHAT ARE MICROSERVICES
Some random list, copied from a random website
25. Dennis van der Stelt
✓Maximum of 30 lines of code
✓Highly maintainable and testable
✓Loosely coupled
✓Database per microservice
✓Independently deployable
✓Owned by a small team
WHAT ARE MICROSERVICES
Some random list, copied from a random website
26. Dennis van der Stelt
✓Maximum of 30 lines of code
✓Highly maintainable and testable
✓Loosely coupled
✓Database per microservice
✓Independently deployable
✓Owned by a small team
WHAT ARE MICROSERVICES
Some random list, copied from a random website
27. Dennis van der Stelt
✓Maximum of 30 lines of code
✓Highly maintainable and testable
✓Loosely coupled
✓Database per microservice
✓Independently deployable
✓Owned by a small team
WHAT ARE MICROSERVICES
Some random list, copied from a random website
28. Dennis van der Stelt
4+1 VIEW MODEL – SHARED DATABASE
Can we share a database among (micro)services?
orders products inventory
inventory
container
Logical View Physical View
products inventory
orders
orders products inventory
products
container
orders
container
website
container
29. Dennis van der Stelt
4+1 VIEW MODEL – SHARED DATABASE
Can we share a database among (micro)services?
orders
schema
products
schema
inventory
schema
inventory
container
Logical View Physical View
products inventory
orders
orders products inventory
products
container
orders
container
website
container
This is nothing more than a schema
30. Dennis van der Stelt
4+1 VIEW MODEL – SHARED DATABASE
Can we share a database among (micro)services?
inventory
container
Logical View Physical View
products inventory
orders
orders products inventory
products
container
orders
container
website
container
orders
schema
products
schema
inventory
schema
31. Dennis van der Stelt
data ownership
is not about how the
data is hosted
32. Dennis van der Stelt
SHARED DATABASE
Can we share a database among (micro)services?
inventory
products
orders
website
MyServerSqlExpress
Databases
Orders
Products
Inventory
Tables
Orders
OrderLines
Products
Products
BackOrder
Reserved
Tables
Tables
orders
schema
products
schema
inventory
schema
33. Dennis van der Stelt
SHARED DATABASE
Can we share a database among (micro)services?
inventory
products
orders
website
orders
schema
products
schema
inventory
schema
MyServerSqlExpress
Databases
RetailShop
Tables
Orders
OrderLines
Products
Products
BackOrder
Reserved
34. Dennis van der Stelt
✓Maximum of 30 lines of code
✓Highly maintainable and testable
✓Loosely coupled
✓Database per microservice
✓Independently deployable
✓Owned by a small team
WHAT ARE MICROSERVICES
Some random list, copied from a random website
35. Dennis van der Stelt
✓Maximum of 30 lines of code
✓Highly maintainable and testable
✓Loosely coupled
✓Database per microservice
✓Independently deployable
✓Owned by a small team
WHAT ARE MICROSERVICES
Some random list, copied from a random website
this is about data ownership
not about how we physically deploy
36. Dennis van der Stelt
4+1 VIEW MODEL – SHARED DATABASES
Something we definitely don’t want!
inventory
container
Logical View Physical View
products inventory
orders
orders products inventory
products
container
orders
container
website
container
orders products inventory
37. Dennis van der Stelt
4+1 VIEW MODEL – SHARED DATABASES
Something we definitely don’t want!
inventory
container
Logical View Physical View
products inventory
orders
orders products inventory
products
container
orders
container
website
container
orders products inventory
39. Dennis van der Stelt
4+1 VIEW MODEL – SHARED DATA
Services querying each others’ data via RPC calls is much better
orders products inventory
inventory
Logical View Physical View
products inventory
orders
orders products inventory
products
orders
website
WebAPI WebAPI WebAPI
40. Dennis van der Stelt
4+1 VIEW MODEL – SHARED DATA
Services querying each others’ data via RPC calls is much better
orders products inventory
inventory
Logical View Physical View
products inventory
orders
orders products inventory
products
orders
website
WebAPI WebAPI WebAPI
Does the logical architecture
change if we do this?
41. Dennis van der Stelt
4+1 VIEW MODEL – SHARED DATA
Services querying each others’ data via RPC calls is much better </sarcasm>
orders products inventory
inventory
Logical View Physical View
products inventory
orders
orders products inventory
products
orders
website
WebAPI WebAPI WebAPI
42. Dennis van der Stelt
4+1 VIEW MODEL – SHARED DATA
Services querying each others’ data via RPC calls
orders products inventory
inventory
Bad, bad, baaaaaaaaaad solution The proposed alternative
products
orders
website
WebAPI WebAPI WebAPI
inventory
products
orders
website
orders products inventory
43. Dennis van der Stelt
can’t share data
via SQL API
but you can share data
via web API?
44. Dennis van der Stelt
how does that improve
data ownership
45. Dennis van der Stelt
https://go.particular.net/share-data
46. Dennis van der Stelt
https://go.particular.net/share-data
47. Dennis van der Stelt
✓Maximum of 30 lines of code
✓Highly maintainable and testable
✓Loosely coupled
✓Database per microservice
✓Independently deployable
✓Owned by a small team
WHAT ARE MICROSERVICES
Some random list, copied from a random website
48. Dennis van der Stelt
✓Maximum of 30 lines of code
✓Highly maintainable and testable
✓Loosely coupled
✓Database per microservice
✓Independently deployable
✓Owned by a small team
WHAT ARE MICROSERVICES
Some random list, copied from a random website
49. Dennis van der Stelt
INDEPENDENTLY DEPLOYABLE MICROSERVICES
Because the deployment makes them loosely coupled
Logical view Development view Physical view
50. Dennis van der Stelt
4+1 VIEW MODEL – DEPLOYING COMPONENTS
What we did with schemas, can we do that with more?
inventory
container
Logical View Physical View
products inventory
orders
orders products inventory
products
container
orders
container
website
container
orders
schema
products
schema
inventory
schema
51. Dennis van der Stelt
4+1 VIEW MODEL – DEPLOYING COMPONENTS
What we did with schemas, can we do that with more?
Logical View Physical View
products inventory
orders
orders products inventory
website
container
orders
schema
products
schema
inventory
schema
container
inventory
products
orders
52. Dennis van der Stelt
4+1 VIEW MODEL – DEPLOYING COMPONENTS
What we did with schemas, can we do that with more?
Logical View Physical View
products inventory
orders
orders products inventory
orders
schema
products
schema
inventory
schema
container
inventory
products
orders
website
61. Dennis van der Stelt
there are no solutions
only trade-offs
62. Dennis van der Stelt
data ownership
in the
user interface
63. Dennis van der Stelt
DATA OWNERSHIP
Let’s dive deeper into data ownership in the user interface
orders products inventory
inventory
Logical View Physical View
products inventory
orders
orders products inventory
products
orders
website
WebAPI WebAPI WebAPI
64. Dennis van der Stelt
LOGICAL BOUNDARIES
Let’s set the stage… Names are removed as we should not focus on names, but rather the colors!
Logical View Physical View
API
API API
API
API API
website
65. Dennis van der Stelt
LOGICAL BOUNDARIES
Let’s set the stage… Names are removed as we should not focus on names, but rather the colors!
Logical View Physical View
API
API API
API
API API
website
logical boundaries
physical boundaries
66. Dennis van der Stelt
LOGICAL BOUNDARIES
Composing data from our back-end
Logical View Physical View
API
API API
API
API API
website
composition
67. Dennis van der Stelt
DATA COMPOSITION
Composing data from our back-end, to fill in details in our UI
Patterns of Enterprise Application Architecture
42 customer reviews
Add to cart
$42.00
save $13.37
Kindle Hardcover
This item ships to Haifa, Israel
Others
with more on the way
https://www.amazon.com/peaa-martin/
Product
Catalog
Inventory
Finance
Shipping
Marketing
68. Dennis van der Stelt
LOGICAL BOUNDARIES
If we’re composing theuser interface, let’s make that visiblein our physical view
Logical View Physical View
API
API API
API
API API
composition
69. Dennis van der Stelt
LOGICAL BOUNDARIES
If we’re composing theuser interface, let’s make that visiblein our physical view
Logical View Physical View
API
API API
API
API API
70. Dennis van der Stelt
LOGICAL BOUNDARIES
Let’s reflect it also in our logical view
Logical View Physical View
API
API API
API
API API
71. Dennis van der Stelt
Gateway
LOGICAL BOUNDARIES
For several reasons we want to add a gateway
Logical View Physical View
API
API API
API
API API
Gateway
72. Dennis van der Stelt
Gateway
LOGICAL BOUNDARIES
Having an all-knowing gateway breaks data ownership again
Logical View Physical View
API
API API
API
API API
massive coupling
Gateway
73. Dennis van der Stelt
DEMO
ViewModel
Composition Gateway
using ASP.NET
74. Dennis van der Stelt
Gateway
LOGICAL BOUNDARIES
Having an all-knowing gateway breaks data ownership again
Logical View Physical View
API
API API
API
API API
massive coupling
Gateway
75. Dennis van der Stelt
LOGICAL BOUNDARIES
The solution
Logical View Physical View
API
API API
API
API API
appender
appender appender
Composition Gateway
Composition Gateway
76. Dennis van der Stelt
LOGICAL BOUNDARIES
Data ownership means no data sharing. Can 4+1 view models help?
Logical View Physical View
API
API API
Composition Gateway
appender appender appender
API
API API
Composition Gateway
appender
appender appender
77. Dennis van der Stelt
LOGICAL BOUNDARIES
Data ownership means no data sharing. Can 4+1 view models help?
Logical View Physical View
API
API API
Composition Gateway
appender appender appender
API
API API
Composition Gateway
appender
appender appender
physical boundaries
logical boundaries
78. Dennis van der Stelt
LOGICAL VS PHYSICAL
Let’s stretch the example even further
Physical View
API
Composition Gateway
appender
79. Dennis van der Stelt
LOGICAL VS PHYSICAL
Let’s stretch the example even further
Physical View
API
Composition Gateway
appender
rpc request
80. Dennis van der Stelt
LOGICAL VS PHYSICAL
Let’s stretch the example even further
Physical View
API
Composition Gateway
appender
Composition Gateway
appender
API
rpc request
81. Dennis van der Stelt
LOGICAL VS PHYSICAL
Let’s stretch the example even further
Physical View
API
Composition Gateway
appender
Composition Gateway
appender
API
rpc request
rpc request
82. Dennis van der Stelt
LOGICAL VS PHYSICAL
Let’s stretch the example even further
Physical View
API
Composition Gateway
appender
Composition Gateway
appender
API
also deploy
connectionstring
rpc request
rpc request
83. Dennis van der Stelt
LOGICAL VS PHYSICAL
Does our logical view change?
Logical View Physical View
Composition Gateway
appender
API
appender
API
appender
API
API
API API
Composition Gateway
appender
appender appender
84. Dennis van der Stelt
CONCLUSION
What have we (hopefully) learned?
Different views of your system architecture allow you to
alter the structure from design to development to deployment
Logical boundary != physical boundary
Sharing data over services breaks data ownership and autonomy!
Want to learn more? I’d love to share more details if you contact me!
It’s “Whisky”, not “Whiskey” ;-)
85. Dennis van der Stelt
https://go.particular.net/change-architecture
for links to code & more information
Free Offer
30-Minute Consultation
Question
86. Dennis van der Stelt
Dennis van der Stelt
dennis.vanderstelt@particular.net
@dvdstelt
linkedin.com/in/dvdstelt/
calendly.com/dvdstelt
https://particular.net/
Solution Architect at Particular Software, makers of NServiceBus