SlideShare a Scribd company logo
Shaping Serverless
Architecture with
Domain-Driven Design
Patterns
Asher Sterkin
asher.sterkin@gmail.com
PyWeb IL Meetup
03/05/2018, Google Campus
About Myself
● Software technologist/architect
● Former VP Technology @ NDS and Distinguished Engineer @ Cisco
● Currently CTO @ IRKI
● C-level mentoring on software strategy
● Cross-discipline approach (connecting the dots):
○ (Strategic) Domain-Driven Design
○ Serverless Architecture
○ Cynefin
○ Wardley Maps
○ Lean Startup
○ Promise Theory
○ ...
What is Serverless Architecture?
● No server management (pure on-demand computing)
● Flexible scaling (automatic or throttled)
● Highly available (AWS services are always on)
● Two flavors:
○ AWS Lambda - no pay for idle (ideal for spiky, unpredictable workloads)
○ AWS Fargate - log running containers (for stable latency and/or full control over run-time)
○ Could be combined
● More details
● Serverless computing is a tectonic shift in software industry
○ S. Wardley “Why the fuss about serverless?”
Serverless 3-tier Web Application
Credit: Boaz Ziniman, “Serverless Use Cases with AWS Lambda”
Data Store in
Amazon
DynamoDB
Amazon S3
(static content)
Amazon
CloudFront
Amazon API
Gateway
AWS Lambda
(dynamic content)
How many Lambda Functions
and DynamoDB Tables are
required to implement this?
Why Bother?
Just throw in as many Lambdas as you wish
It Grows Rather Quickly
Yan Cui, “Yubl’s Road to Serverless Architecture”
Serverless
The danger is to come up with
Need Some Organizing Principles
Serverless Application Structure Factors
● Scalability
● Resource Utilization
● Access Control
● Productivity
● See also
Detour
Documenting AWS Serverless Architecture
AWS Icons are Hopelessly Inconsistent
When to use this?
And when this?
And when that?
What Does this Mean?
AWS Service?
SAM Template?
AWS Lambda Deployment?
Running Instance?
AWS Service?
SAM Template?
DynamoDB Schema?
DynamoDB Table Deployment?
DynamoDB Table Instance?
SDK Function Call?
Data Flow?
Address Reference?
Access Rights?
4+1 View of Software Architecture
Conceptual Physical
Process View Deployment View
Logical View
Use-Case View
Implementation View
End-user
Functionality
Programmers
Software management
Performance
Scalability
Throughput
System integrators
System topology
Delivery, installation
communication
System engineering
Analysts/Designers
Structure
...
...
P. Krutchen, “Architectural Blueprints - The “4+1” View Model of Software Architecture
Let’s Do It Again: No Lambda
mysite.com
mySiteData
table instance
crud
bucket instance
Evaluation?
address reference
MySite_Users
MySite_Identies
get
AWS Cognito
User Pool
AWS Cognito
Identity Pool
Front-end Service
mysite.com
mySiteData
crud
Evaluation?
address reference
MySite_Users
MySite_Identies
get
mySiteRequestHandler
running instance(s)
invoke
Lambda Python3 “Hello World”
import json
print('Loading function')
def lambda_handler(event, context):
#print("Received event: " + json.dumps(event, indent=2))
print("value1 = " + event['key1'])
print("value2 = " + event['key2'])
print("value3 = " + event['key3'])
return event['key1'] # Echo back the first key value
#raise Exception('Something went wrong')
Front-end Service + API Gateway
mysite.com
mySiteData
crud
Evaluation?
address reference
MySite_Users
MySite_Identies
get
mySiteRequestHandler
invoke
api.mysite.com
/
API Gateway instance
API resource
Separate Application and Domain Services
mysite.com
api.mysite.com
DomainService_Data
/
mySiteWebFrontendService
smartPhone
mySiteSmartPhoneFrontendService
DomainService
DDD Focus is Here
crud
Ref: Netflix API
Server-side Rendering
Evaluation?mysite.iot.com mySiteThermostatFrontendService
Domain-Driven Design at a Glance
Language
Model
Boundaries
Nesting
Today’s focus
An introductory presentation
could be found here. Look at the
end for recommended materials.
Introducing Bounded Context
● Maintaining “one-size fits all” domain model is seldom practical
● Any non-trivial software system usually needs multiple models
○ Highly cohesive inside (Bounded Context)
○ Loosely coupled outside (Context Map)
○ Good candidates for Microservices (E. Evans, “DDD and Microservices: At Last, Some
Boundaries!”)
Bounded Context A
Strong Semantic
Consistency Insides
Bounded Context B
Strong Semantic
Consistency Inside
Loose Coupling Outside
Context Map
Examples?
Bounded Context Services
DomainServiceA_DataDomainServiceA
DomainServiceB DomainServiceB_Data
crud
crud
Contains sensitive data!
Copy of publicly available data
Evaluation?
mySiteWebFrontendService
Bounded Context Services + Context Map
DomainServiceA_DataDomainServiceA
DomainServiceB DomainServiceB_Data
crud
crud
Evaluation?
mySiteWebFrontendService
DomainServiceB_DataStreams
DomainServiceB_EventHandler
trigger
put
Introducing Aggregate and Repository
Strong Transaction
Consistency + Invariant
<<Aggregate Root>>
Entity
Entity Value
Value
Eventual
Transaction
Consistency
aggregate storage
store/retrieve requests -->
command/query requests -->
update/query method call -->
● Data integrity boundaries
● Strong transactional consistency inside
● Eventual consistency outside
● Inner parts are accessible only via Aggregate Root
● Inside Aggregate some form of invariant is maintained
● Aggregates of the same type are stored within Repository
Command/query
Request Processor
Aggregate
Repository
Aggregate
Example?
Aggregate, Repository, Command/Query Handler
DomainServiceA_
AggregateX_Data
DomainServiceA
_AggregateX
DomainServiceA
_AggregateY DomainServiceA_
AggregateY_Data
crud
crud
Evaluation?
mySiteWebFrontendService
command/query requests
DomainServiceA
AggregateY_EventHandler
Introducing CQRS
● Stands for Command/Query Request Segregation
● Was first proposed by Greg Yung
● Based on Command-Query Separation advocated by Bertrand Meyer:
○ Each method should either return something and leave object state intact
○ Or change the object state and return nothing (declared void)
● Interesting Aggregates usually justify separate Command/Query interfaces
and data models
Query
Model
Aggregate A
State
Aggregate B
State
Command interface Query interface
Example?
CQRS
DomainServiceA_
AggregateX_StateData
DomainServiceA
_AggregateX_CommandHandler
DomainServiceA
_AggregateY_CommandHandler DomainServiceA_
AggregateY_StateData
get/put/delete
get/put/delete
Evaluation?
mySiteWebFrontendService
DomainServiceA_
View
DomainServiceA
_ViewBuilder
queries put/delete
get
get
commands
commands
Not Covered Here
● Separate Functions per Method/Event (easy, but needs justification)
● Event Sourcing (less easy, needs justification)
● Computation Services (not hard)
● Distributed Transactions (Saga)
● Fine-grained integration with API Gateway
● Support for WebSockets (abusing IoT Gateway)
● Integration with AppSync (GraphQL)
● IoT Scalability
● Integration with specialized AWS services (e.g. AWS Comprehend)
● Custom Machine Learning in Event/Command Handlers
● Integration with Blockchain
Interim Conclusions
● Serverless Architecture is a new beast to tame:
○ Gojko Adzic, “Designing for the Serverless Age”
● “4+1 View” approach helps with removing clutter from diagrams
○ Could used for Lightweight Architecture Decision Records
● Domain-Driven Design suggests a set of useful organizing principles
● Different options are valid under different circumstances
● It’s mostly about price/performance optimization
● Objective validation criteria:
○ Organizational structure (E. Evans, “DDD and Microservices: At Last, Some Boundaries!”)
○ Consistency tolerance (E. Evans “Acknowledging CAP at the Root - in the Domain Model”)
○ Security guidelines
○ Scalability needs
○ SOLID architecture principles
“Consensus is poisonous
for innovation”
D. Snowden

More Related Content

What's hot

Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
Archana Krushnan
 
AWS Summit London 2019 - Containers on AWS
AWS Summit London 2019 - Containers on AWSAWS Summit London 2019 - Containers on AWS
AWS Summit London 2019 - Containers on AWS
Massimo Ferre'
 
Back to the Basics - 1 - Introduction to Web Development
Back to the Basics - 1 - Introduction to Web DevelopmentBack to the Basics - 1 - Introduction to Web Development
Back to the Basics - 1 - Introduction to Web Development
Clint LaForest
 
Power BI Architecture
Power BI ArchitecturePower BI Architecture
Power BI Architecture
Arthur Graus
 
Application Load Balancer and the integration with AutoScaling and ECS - Pop-...
Application Load Balancer and the integration with AutoScaling and ECS - Pop-...Application Load Balancer and the integration with AutoScaling and ECS - Pop-...
Application Load Balancer and the integration with AutoScaling and ECS - Pop-...
Amazon Web Services
 
What's new in selenium 4
What's new in selenium 4What's new in selenium 4
What's new in selenium 4
Knoldus Inc.
 
Mainframe Modernization with AWS: Patterns and Best Practices (GPSTEC305) - A...
Mainframe Modernization with AWS: Patterns and Best Practices (GPSTEC305) - A...Mainframe Modernization with AWS: Patterns and Best Practices (GPSTEC305) - A...
Mainframe Modernization with AWS: Patterns and Best Practices (GPSTEC305) - A...
Amazon Web Services
 
Tableau Software - Business Analytics and Data Visualization
Tableau Software - Business Analytics and Data VisualizationTableau Software - Business Analytics and Data Visualization
Tableau Software - Business Analytics and Data Visualization
lesterathayde
 
sales-training-deck-apex-cloud-services-compute-hci-offers.pptx
sales-training-deck-apex-cloud-services-compute-hci-offers.pptxsales-training-deck-apex-cloud-services-compute-hci-offers.pptx
sales-training-deck-apex-cloud-services-compute-hci-offers.pptx
Aamir Ilyas
 
NEW LAUNCH! Introducing Amazon MQ Managed Message Broker Service for ActiveMQ...
NEW LAUNCH! Introducing Amazon MQ Managed Message Broker Service for ActiveMQ...NEW LAUNCH! Introducing Amazon MQ Managed Message Broker Service for ActiveMQ...
NEW LAUNCH! Introducing Amazon MQ Managed Message Broker Service for ActiveMQ...
Amazon Web Services
 
Introduction to Automation Testing and Selenium overiew
Introduction to Automation Testing and Selenium overiewIntroduction to Automation Testing and Selenium overiew
Introduction to Automation Testing and Selenium overiew
Disha Srivastava
 
Low code with Flowable
Low code with FlowableLow code with Flowable
Low code with Flowable
Flowable
 
Getting Started with AWS Database Migration Service
Getting Started with AWS Database Migration ServiceGetting Started with AWS Database Migration Service
Getting Started with AWS Database Migration Service
Amazon Web Services
 
Introduction to WebSockets Presentation
Introduction to WebSockets PresentationIntroduction to WebSockets Presentation
Introduction to WebSockets Presentation
Julien LaPointe
 
Event Report - SAP TechEd 2022 - Key Takeaways
Event Report - SAP TechEd 2022 - Key TakeawaysEvent Report - SAP TechEd 2022 - Key Takeaways
Event Report - SAP TechEd 2022 - Key Takeaways
Holger Mueller
 
Service-Oriented Architecture (SOA)
Service-Oriented Architecture (SOA)Service-Oriented Architecture (SOA)
Service-Oriented Architecture (SOA)
WSO2
 
Serverless Framework Intro
Serverless Framework IntroServerless Framework Intro
Serverless Framework Intro
Nikolaus Graf
 
Introducing Power BI Embedded
Introducing Power BI EmbeddedIntroducing Power BI Embedded
Introducing Power BI Embedded
Mostafa
 
Web development
Web developmentWeb development
Web development
Sunil Moolchandani
 

What's hot (20)

Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
 
AWS Summit London 2019 - Containers on AWS
AWS Summit London 2019 - Containers on AWSAWS Summit London 2019 - Containers on AWS
AWS Summit London 2019 - Containers on AWS
 
Back to the Basics - 1 - Introduction to Web Development
Back to the Basics - 1 - Introduction to Web DevelopmentBack to the Basics - 1 - Introduction to Web Development
Back to the Basics - 1 - Introduction to Web Development
 
Power BI Architecture
Power BI ArchitecturePower BI Architecture
Power BI Architecture
 
Application Load Balancer and the integration with AutoScaling and ECS - Pop-...
Application Load Balancer and the integration with AutoScaling and ECS - Pop-...Application Load Balancer and the integration with AutoScaling and ECS - Pop-...
Application Load Balancer and the integration with AutoScaling and ECS - Pop-...
 
What's new in selenium 4
What's new in selenium 4What's new in selenium 4
What's new in selenium 4
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Mainframe Modernization with AWS: Patterns and Best Practices (GPSTEC305) - A...
Mainframe Modernization with AWS: Patterns and Best Practices (GPSTEC305) - A...Mainframe Modernization with AWS: Patterns and Best Practices (GPSTEC305) - A...
Mainframe Modernization with AWS: Patterns and Best Practices (GPSTEC305) - A...
 
Tableau Software - Business Analytics and Data Visualization
Tableau Software - Business Analytics and Data VisualizationTableau Software - Business Analytics and Data Visualization
Tableau Software - Business Analytics and Data Visualization
 
sales-training-deck-apex-cloud-services-compute-hci-offers.pptx
sales-training-deck-apex-cloud-services-compute-hci-offers.pptxsales-training-deck-apex-cloud-services-compute-hci-offers.pptx
sales-training-deck-apex-cloud-services-compute-hci-offers.pptx
 
NEW LAUNCH! Introducing Amazon MQ Managed Message Broker Service for ActiveMQ...
NEW LAUNCH! Introducing Amazon MQ Managed Message Broker Service for ActiveMQ...NEW LAUNCH! Introducing Amazon MQ Managed Message Broker Service for ActiveMQ...
NEW LAUNCH! Introducing Amazon MQ Managed Message Broker Service for ActiveMQ...
 
Introduction to Automation Testing and Selenium overiew
Introduction to Automation Testing and Selenium overiewIntroduction to Automation Testing and Selenium overiew
Introduction to Automation Testing and Selenium overiew
 
Low code with Flowable
Low code with FlowableLow code with Flowable
Low code with Flowable
 
Getting Started with AWS Database Migration Service
Getting Started with AWS Database Migration ServiceGetting Started with AWS Database Migration Service
Getting Started with AWS Database Migration Service
 
Introduction to WebSockets Presentation
Introduction to WebSockets PresentationIntroduction to WebSockets Presentation
Introduction to WebSockets Presentation
 
Event Report - SAP TechEd 2022 - Key Takeaways
Event Report - SAP TechEd 2022 - Key TakeawaysEvent Report - SAP TechEd 2022 - Key Takeaways
Event Report - SAP TechEd 2022 - Key Takeaways
 
Service-Oriented Architecture (SOA)
Service-Oriented Architecture (SOA)Service-Oriented Architecture (SOA)
Service-Oriented Architecture (SOA)
 
Serverless Framework Intro
Serverless Framework IntroServerless Framework Intro
Serverless Framework Intro
 
Introducing Power BI Embedded
Introducing Power BI EmbeddedIntroducing Power BI Embedded
Introducing Power BI Embedded
 
Web development
Web developmentWeb development
Web development
 

Similar to Shaping serverless architecture with domain driven design patterns - py web-il

Shaping serverless architecture with domain driven design patterns
Shaping serverless architecture with domain driven design patternsShaping serverless architecture with domain driven design patterns
Shaping serverless architecture with domain driven design patterns
Asher Sterkin
 
Shaping serverless architecture with domain driven design patterns
Shaping serverless architecture with domain driven design patternsShaping serverless architecture with domain driven design patterns
Shaping serverless architecture with domain driven design patterns
Shimon Tolts
 
Sprint 45 review
Sprint 45 reviewSprint 45 review
Sprint 45 review
ManageIQ
 
Developing cloud serverless components in Python: DDD Perspective
Developing cloud serverless components in Python: DDD PerspectiveDeveloping cloud serverless components in Python: DDD Perspective
Developing cloud serverless components in Python: DDD Perspective
Asher Sterkin
 
Cqrs and event sourcing in azure
Cqrs and event sourcing in azureCqrs and event sourcing in azure
Cqrs and event sourcing in azure
Sergey Seletsky
 
Big Data Analytics from Azure Cloud to Power BI Mobile
Big Data Analytics from Azure Cloud to Power BI MobileBig Data Analytics from Azure Cloud to Power BI Mobile
Big Data Analytics from Azure Cloud to Power BI Mobile
Roy Kim
 
Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0
Bruce Johnson
 
GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...
GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...
GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...
James Anderson
 
Improving Apache Spark Downscaling
 Improving Apache Spark Downscaling Improving Apache Spark Downscaling
Improving Apache Spark Downscaling
Databricks
 
Serverless machine learning architectures at Helixa
Serverless machine learning architectures at HelixaServerless machine learning architectures at Helixa
Serverless machine learning architectures at Helixa
Data Science Milan
 
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB
 
A fresh look at Google’s Cloud by Mandy Waite
A fresh look at Google’s Cloud by Mandy Waite A fresh look at Google’s Cloud by Mandy Waite
A fresh look at Google’s Cloud by Mandy Waite
Codemotion
 
Apache Samza 1.0 - What's New, What's Next
Apache Samza 1.0 - What's New, What's NextApache Samza 1.0 - What's New, What's Next
Apache Samza 1.0 - What's New, What's Next
Prateek Maheshwari
 
Highway to heaven - Microservices Meetup Munich
Highway to heaven - Microservices Meetup MunichHighway to heaven - Microservices Meetup Munich
Highway to heaven - Microservices Meetup Munich
Christian Deger
 
Documenting serverless architectures could we do it better - o'reily sa con...
Documenting serverless architectures  could we do it better  - o'reily sa con...Documenting serverless architectures  could we do it better  - o'reily sa con...
Documenting serverless architectures could we do it better - o'reily sa con...
Asher Sterkin
 
Sky High With Azure
Sky High With AzureSky High With Azure
Sky High With Azure
Clint Edmonson
 
Airflow techtonic template
Airflow   techtonic templateAirflow   techtonic template
Airflow techtonic template
Sampath Kumar
 
Google Cloud Study Jam | GDSC NCU
Google Cloud Study Jam | GDSC NCUGoogle Cloud Study Jam | GDSC NCU
Google Cloud Study Jam | GDSC NCU
Shivam254129
 
Cloud Native Applications on OpenShift
Cloud Native Applications on OpenShiftCloud Native Applications on OpenShift
Cloud Native Applications on OpenShift
Serhat Dirik
 
Asp.Net_ Developer Resume Remotely
Asp.Net_ Developer Resume RemotelyAsp.Net_ Developer Resume Remotely
Asp.Net_ Developer Resume Remotely
SumitKumar2504
 

Similar to Shaping serverless architecture with domain driven design patterns - py web-il (20)

Shaping serverless architecture with domain driven design patterns
Shaping serverless architecture with domain driven design patternsShaping serverless architecture with domain driven design patterns
Shaping serverless architecture with domain driven design patterns
 
Shaping serverless architecture with domain driven design patterns
Shaping serverless architecture with domain driven design patternsShaping serverless architecture with domain driven design patterns
Shaping serverless architecture with domain driven design patterns
 
Sprint 45 review
Sprint 45 reviewSprint 45 review
Sprint 45 review
 
Developing cloud serverless components in Python: DDD Perspective
Developing cloud serverless components in Python: DDD PerspectiveDeveloping cloud serverless components in Python: DDD Perspective
Developing cloud serverless components in Python: DDD Perspective
 
Cqrs and event sourcing in azure
Cqrs and event sourcing in azureCqrs and event sourcing in azure
Cqrs and event sourcing in azure
 
Big Data Analytics from Azure Cloud to Power BI Mobile
Big Data Analytics from Azure Cloud to Power BI MobileBig Data Analytics from Azure Cloud to Power BI Mobile
Big Data Analytics from Azure Cloud to Power BI Mobile
 
Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0Overview of VS2010 and .NET 4.0
Overview of VS2010 and .NET 4.0
 
GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...
GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...
GDG Cloud Southlake #16: Priyanka Vergadia: Scalable Data Analytics in Google...
 
Improving Apache Spark Downscaling
 Improving Apache Spark Downscaling Improving Apache Spark Downscaling
Improving Apache Spark Downscaling
 
Serverless machine learning architectures at Helixa
Serverless machine learning architectures at HelixaServerless machine learning architectures at Helixa
Serverless machine learning architectures at Helixa
 
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
MongoDB World 2018: Ch-Ch-Ch-Ch-Changes: Taking Your Stitch Application to th...
 
A fresh look at Google’s Cloud by Mandy Waite
A fresh look at Google’s Cloud by Mandy Waite A fresh look at Google’s Cloud by Mandy Waite
A fresh look at Google’s Cloud by Mandy Waite
 
Apache Samza 1.0 - What's New, What's Next
Apache Samza 1.0 - What's New, What's NextApache Samza 1.0 - What's New, What's Next
Apache Samza 1.0 - What's New, What's Next
 
Highway to heaven - Microservices Meetup Munich
Highway to heaven - Microservices Meetup MunichHighway to heaven - Microservices Meetup Munich
Highway to heaven - Microservices Meetup Munich
 
Documenting serverless architectures could we do it better - o'reily sa con...
Documenting serverless architectures  could we do it better  - o'reily sa con...Documenting serverless architectures  could we do it better  - o'reily sa con...
Documenting serverless architectures could we do it better - o'reily sa con...
 
Sky High With Azure
Sky High With AzureSky High With Azure
Sky High With Azure
 
Airflow techtonic template
Airflow   techtonic templateAirflow   techtonic template
Airflow techtonic template
 
Google Cloud Study Jam | GDSC NCU
Google Cloud Study Jam | GDSC NCUGoogle Cloud Study Jam | GDSC NCU
Google Cloud Study Jam | GDSC NCU
 
Cloud Native Applications on OpenShift
Cloud Native Applications on OpenShiftCloud Native Applications on OpenShift
Cloud Native Applications on OpenShift
 
Asp.Net_ Developer Resume Remotely
Asp.Net_ Developer Resume RemotelyAsp.Net_ Developer Resume Remotely
Asp.Net_ Developer Resume Remotely
 

More from Asher Sterkin

Essence of Requirements Engineering: Pragmatic Insights for 2024
Essence of Requirements Engineering: Pragmatic Insights for 2024Essence of Requirements Engineering: Pragmatic Insights for 2024
Essence of Requirements Engineering: Pragmatic Insights for 2024
Asher Sterkin
 
Cloud Infrastructure from Python Code: PyCon DE-23
Cloud Infrastructure from Python Code: PyCon DE-23Cloud Infrastructure from Python Code: PyCon DE-23
Cloud Infrastructure from Python Code: PyCon DE-23
Asher Sterkin
 
PyCascades-23.pdf
PyCascades-23.pdfPyCascades-23.pdf
PyCascades-23.pdf
Asher Sterkin
 
PyConFR-23 Talk.pdf
PyConFR-23 Talk.pdfPyConFR-23 Talk.pdf
PyConFR-23 Talk.pdf
Asher Sterkin
 
pyjamas22_ generic composite in python.pdf
pyjamas22_ generic composite in python.pdfpyjamas22_ generic composite in python.pdf
pyjamas22_ generic composite in python.pdf
Asher Sterkin
 
If your computer is cloud what its Operating System look like?
If your computer is cloud what its Operating System look like?If your computer is cloud what its Operating System look like?
If your computer is cloud what its Operating System look like?
Asher Sterkin
 
Serverless flow programming a new perspective (py web meetup, sept 2nd, 2019...
Serverless flow programming  a new perspective (py web meetup, sept 2nd, 2019...Serverless flow programming  a new perspective (py web meetup, sept 2nd, 2019...
Serverless flow programming a new perspective (py web meetup, sept 2nd, 2019...
Asher Sterkin
 
Domain driven design: a gentle introduction
Domain driven design:  a gentle introductionDomain driven design:  a gentle introduction
Domain driven design: a gentle introduction
Asher Sterkin
 
Strategy toolbox for startsups
Strategy toolbox for startsupsStrategy toolbox for startsups
Strategy toolbox for startsups
Asher Sterkin
 
AI as a service
AI as a serviceAI as a service
AI as a service
Asher Sterkin
 
Serverless ddd
Serverless dddServerless ddd
Serverless ddd
Asher Sterkin
 
Software strategy for startups
Software strategy for startupsSoftware strategy for startups
Software strategy for startups
Asher Sterkin
 
What is exactly anti fragile in dev ops - v3
What is exactly anti fragile in dev ops - v3What is exactly anti fragile in dev ops - v3
What is exactly anti fragile in dev ops - v3Asher Sterkin
 

More from Asher Sterkin (13)

Essence of Requirements Engineering: Pragmatic Insights for 2024
Essence of Requirements Engineering: Pragmatic Insights for 2024Essence of Requirements Engineering: Pragmatic Insights for 2024
Essence of Requirements Engineering: Pragmatic Insights for 2024
 
Cloud Infrastructure from Python Code: PyCon DE-23
Cloud Infrastructure from Python Code: PyCon DE-23Cloud Infrastructure from Python Code: PyCon DE-23
Cloud Infrastructure from Python Code: PyCon DE-23
 
PyCascades-23.pdf
PyCascades-23.pdfPyCascades-23.pdf
PyCascades-23.pdf
 
PyConFR-23 Talk.pdf
PyConFR-23 Talk.pdfPyConFR-23 Talk.pdf
PyConFR-23 Talk.pdf
 
pyjamas22_ generic composite in python.pdf
pyjamas22_ generic composite in python.pdfpyjamas22_ generic composite in python.pdf
pyjamas22_ generic composite in python.pdf
 
If your computer is cloud what its Operating System look like?
If your computer is cloud what its Operating System look like?If your computer is cloud what its Operating System look like?
If your computer is cloud what its Operating System look like?
 
Serverless flow programming a new perspective (py web meetup, sept 2nd, 2019...
Serverless flow programming  a new perspective (py web meetup, sept 2nd, 2019...Serverless flow programming  a new perspective (py web meetup, sept 2nd, 2019...
Serverless flow programming a new perspective (py web meetup, sept 2nd, 2019...
 
Domain driven design: a gentle introduction
Domain driven design:  a gentle introductionDomain driven design:  a gentle introduction
Domain driven design: a gentle introduction
 
Strategy toolbox for startsups
Strategy toolbox for startsupsStrategy toolbox for startsups
Strategy toolbox for startsups
 
AI as a service
AI as a serviceAI as a service
AI as a service
 
Serverless ddd
Serverless dddServerless ddd
Serverless ddd
 
Software strategy for startups
Software strategy for startupsSoftware strategy for startups
Software strategy for startups
 
What is exactly anti fragile in dev ops - v3
What is exactly anti fragile in dev ops - v3What is exactly anti fragile in dev ops - v3
What is exactly anti fragile in dev ops - v3
 

Recently uploaded

A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Crescat
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
Hornet Dynamics
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Neo4j
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
Google
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
Aftab Hussain
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
Rakesh Kumar R
 

Recently uploaded (20)

A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
Introducing Crescat - Event Management Software for Venues, Festivals and Eve...
 
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket ManagementUtilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
Utilocate provides Smarter, Better, Faster, Safer Locate Ticket Management
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
E-commerce Application Development Company.pdf
E-commerce Application Development Company.pdfE-commerce Application Development Company.pdf
E-commerce Application Development Company.pdf
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Atelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissancesAtelier - Innover avec l’IA Générative et les graphes de connaissances
Atelier - Innover avec l’IA Générative et les graphes de connaissances
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI AppAI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
AI Fusion Buddy Review: Brand New, Groundbreaking Gemini-Powered AI App
 
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of CodeA Study of Variable-Role-based Feature Enrichment in Neural Models of Code
A Study of Variable-Role-based Feature Enrichment in Neural Models of Code
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Fundamentals of Programming and Language Processors
Fundamentals of Programming and Language ProcessorsFundamentals of Programming and Language Processors
Fundamentals of Programming and Language Processors
 

Shaping serverless architecture with domain driven design patterns - py web-il

  • 1. Shaping Serverless Architecture with Domain-Driven Design Patterns Asher Sterkin asher.sterkin@gmail.com PyWeb IL Meetup 03/05/2018, Google Campus
  • 2. About Myself ● Software technologist/architect ● Former VP Technology @ NDS and Distinguished Engineer @ Cisco ● Currently CTO @ IRKI ● C-level mentoring on software strategy ● Cross-discipline approach (connecting the dots): ○ (Strategic) Domain-Driven Design ○ Serverless Architecture ○ Cynefin ○ Wardley Maps ○ Lean Startup ○ Promise Theory ○ ...
  • 3. What is Serverless Architecture? ● No server management (pure on-demand computing) ● Flexible scaling (automatic or throttled) ● Highly available (AWS services are always on) ● Two flavors: ○ AWS Lambda - no pay for idle (ideal for spiky, unpredictable workloads) ○ AWS Fargate - log running containers (for stable latency and/or full control over run-time) ○ Could be combined ● More details ● Serverless computing is a tectonic shift in software industry ○ S. Wardley “Why the fuss about serverless?”
  • 4. Serverless 3-tier Web Application Credit: Boaz Ziniman, “Serverless Use Cases with AWS Lambda” Data Store in Amazon DynamoDB Amazon S3 (static content) Amazon CloudFront Amazon API Gateway AWS Lambda (dynamic content) How many Lambda Functions and DynamoDB Tables are required to implement this?
  • 5. Why Bother? Just throw in as many Lambdas as you wish
  • 6. It Grows Rather Quickly Yan Cui, “Yubl’s Road to Serverless Architecture”
  • 7. Serverless The danger is to come up with
  • 8. Need Some Organizing Principles
  • 9. Serverless Application Structure Factors ● Scalability ● Resource Utilization ● Access Control ● Productivity ● See also
  • 11. AWS Icons are Hopelessly Inconsistent When to use this? And when this? And when that?
  • 12. What Does this Mean? AWS Service? SAM Template? AWS Lambda Deployment? Running Instance? AWS Service? SAM Template? DynamoDB Schema? DynamoDB Table Deployment? DynamoDB Table Instance? SDK Function Call? Data Flow? Address Reference? Access Rights?
  • 13. 4+1 View of Software Architecture Conceptual Physical Process View Deployment View Logical View Use-Case View Implementation View End-user Functionality Programmers Software management Performance Scalability Throughput System integrators System topology Delivery, installation communication System engineering Analysts/Designers Structure ... ... P. Krutchen, “Architectural Blueprints - The “4+1” View Model of Software Architecture
  • 14. Let’s Do It Again: No Lambda mysite.com mySiteData table instance crud bucket instance Evaluation? address reference MySite_Users MySite_Identies get AWS Cognito User Pool AWS Cognito Identity Pool
  • 16. Lambda Python3 “Hello World” import json print('Loading function') def lambda_handler(event, context): #print("Received event: " + json.dumps(event, indent=2)) print("value1 = " + event['key1']) print("value2 = " + event['key2']) print("value3 = " + event['key3']) return event['key1'] # Echo back the first key value #raise Exception('Something went wrong')
  • 17. Front-end Service + API Gateway mysite.com mySiteData crud Evaluation? address reference MySite_Users MySite_Identies get mySiteRequestHandler invoke api.mysite.com / API Gateway instance API resource
  • 18. Separate Application and Domain Services mysite.com api.mysite.com DomainService_Data / mySiteWebFrontendService smartPhone mySiteSmartPhoneFrontendService DomainService DDD Focus is Here crud Ref: Netflix API Server-side Rendering Evaluation?mysite.iot.com mySiteThermostatFrontendService
  • 19. Domain-Driven Design at a Glance Language Model Boundaries Nesting Today’s focus An introductory presentation could be found here. Look at the end for recommended materials.
  • 20. Introducing Bounded Context ● Maintaining “one-size fits all” domain model is seldom practical ● Any non-trivial software system usually needs multiple models ○ Highly cohesive inside (Bounded Context) ○ Loosely coupled outside (Context Map) ○ Good candidates for Microservices (E. Evans, “DDD and Microservices: At Last, Some Boundaries!”) Bounded Context A Strong Semantic Consistency Insides Bounded Context B Strong Semantic Consistency Inside Loose Coupling Outside Context Map Examples?
  • 21. Bounded Context Services DomainServiceA_DataDomainServiceA DomainServiceB DomainServiceB_Data crud crud Contains sensitive data! Copy of publicly available data Evaluation? mySiteWebFrontendService
  • 22. Bounded Context Services + Context Map DomainServiceA_DataDomainServiceA DomainServiceB DomainServiceB_Data crud crud Evaluation? mySiteWebFrontendService DomainServiceB_DataStreams DomainServiceB_EventHandler trigger put
  • 23. Introducing Aggregate and Repository Strong Transaction Consistency + Invariant <<Aggregate Root>> Entity Entity Value Value Eventual Transaction Consistency aggregate storage store/retrieve requests --> command/query requests --> update/query method call --> ● Data integrity boundaries ● Strong transactional consistency inside ● Eventual consistency outside ● Inner parts are accessible only via Aggregate Root ● Inside Aggregate some form of invariant is maintained ● Aggregates of the same type are stored within Repository Command/query Request Processor Aggregate Repository Aggregate Example?
  • 24. Aggregate, Repository, Command/Query Handler DomainServiceA_ AggregateX_Data DomainServiceA _AggregateX DomainServiceA _AggregateY DomainServiceA_ AggregateY_Data crud crud Evaluation? mySiteWebFrontendService command/query requests DomainServiceA AggregateY_EventHandler
  • 25. Introducing CQRS ● Stands for Command/Query Request Segregation ● Was first proposed by Greg Yung ● Based on Command-Query Separation advocated by Bertrand Meyer: ○ Each method should either return something and leave object state intact ○ Or change the object state and return nothing (declared void) ● Interesting Aggregates usually justify separate Command/Query interfaces and data models Query Model Aggregate A State Aggregate B State Command interface Query interface Example?
  • 27. Not Covered Here ● Separate Functions per Method/Event (easy, but needs justification) ● Event Sourcing (less easy, needs justification) ● Computation Services (not hard) ● Distributed Transactions (Saga) ● Fine-grained integration with API Gateway ● Support for WebSockets (abusing IoT Gateway) ● Integration with AppSync (GraphQL) ● IoT Scalability ● Integration with specialized AWS services (e.g. AWS Comprehend) ● Custom Machine Learning in Event/Command Handlers ● Integration with Blockchain
  • 28. Interim Conclusions ● Serverless Architecture is a new beast to tame: ○ Gojko Adzic, “Designing for the Serverless Age” ● “4+1 View” approach helps with removing clutter from diagrams ○ Could used for Lightweight Architecture Decision Records ● Domain-Driven Design suggests a set of useful organizing principles ● Different options are valid under different circumstances ● It’s mostly about price/performance optimization ● Objective validation criteria: ○ Organizational structure (E. Evans, “DDD and Microservices: At Last, Some Boundaries!”) ○ Consistency tolerance (E. Evans “Acknowledging CAP at the Root - in the Domain Model”) ○ Security guidelines ○ Scalability needs ○ SOLID architecture principles
  • 29. “Consensus is poisonous for innovation” D. Snowden