![Page 1: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/1.jpg)
How serverless
impacts designhttps://gojko.net/assets/dddeu20.pdf
Gojko Adzic | gojko.net | @gojkoadzic | [email protected]
![Page 2: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/2.jpg)
"Modelling"
—wait, a shipping container has LEGS?
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 3: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/3.jpg)
"Design"
—itinerary service
—shipping containers repository
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 4: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/4.jpg)
"Deployment"
—itinerary service scaled to 5 web servers
—container repository synced to DB
—itinerary requests pushed to message queue
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 5: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/5.jpg)
"Server"
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 6: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/6.jpg)
![Page 7: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/7.jpg)
Serverless Socketlesspublic class LambdaMain implements RequestHandler<Event, Response> {
public Response handleRequest(Event request, Context context){
// do something useful with the event
};
};
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 8: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/8.jpg)
https://www.cncf.io/blog/2018/08/29/cncf-survey-use-of-cloud-native-technologies-in-production-has-grown-over-200-percent/
![Page 9: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/9.jpg)
https://atlassian.com/forge
![Page 10: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/10.jpg)
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 11: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/11.jpg)
Serverless Distractionless
—Generic: hire from the cloud provider
—Supporting: customise provider services
—Core: more time left for this
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 12: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/12.jpg)
Deliver on demand, never pay for idle
— AWS re:Invent 2016, Tim Wagner
https://www.slideshare.net/AmazonWebServices/aws-reinvent-2016-the-state-of-serverless-computing-svr311
![Page 13: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/13.jpg)
Serverless Reservationless
provider 1m requests Free CPU Time
512MB,100ms
AWS 0.2 1m .000000834
Azure 0.2 1m .0000008
GCP 0.4 2m .000000925
Lambda US-east-1; Azure, central US; https://aws.amazon.com/lambda/pricing/; https://cloud.google.com/functions/pricing; https://azure.microsoft.com/
en-us/pricing/details/functions/
![Page 14: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/14.jpg)
Paying for utilisation—not capacity
—not environments
—not instances
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 15: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/15.jpg)
Serverless financially rewards good design
(instantly, not at some potential distant future)
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 16: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/16.jpg)
MindMup.com
Heroku February 2016 Lambda February 2017
~ -50% operational costs
~ +50% active users
~ 66% estimated savingsGojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 17: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/17.jpg)
"lowered five-year operating costs by 60% and were 89% faster at compute deployment"
— IDC white paper on AWS Serverless
https://pages.awscloud.com/Gated_IDC_Generating_Value_Through_IT_Agility.html
![Page 18: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/18.jpg)
Caroline Rennie, Product Lead, Comic Relief: https://www.youtube.com/watch?v=Kb2Qk3vAkJI
![Page 19: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/19.jpg)
Apps ⇒ Taskssingle critical "CORE" ⇒ many tiny "kernels"
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 20: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/20.jpg)
Good news: very forgiving regarding design mistakes
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 21: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/21.jpg)
Apps Tasks
bounded contexts
around teams, products
each "task" a potential
context?
conceptual consistency security/access
anti-corruption layers
carefully planned
change blast radius
inherently small
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 22: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/22.jpg)
Bad news: "hello world" is highly distributed
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 23: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/23.jpg)
https://martinfowler.com/bliki/FirstLaw.html
![Page 24: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/24.jpg)
Don't
https://martinfowler.com/bliki/FirstLaw.html
![Page 25: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/25.jpg)
Don't distribute your objects
https://martinfowler.com/bliki/FirstLaw.html
![Page 26: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/26.jpg)
Time=money, very literally
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 27: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/27.jpg)
Time=money, very literally
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 28: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/28.jpg)
Traditional Serverless
Model ⇒ Design ⇒
Deployment
(Model ⇄ Deployment)
⇒ Design
long-lived objects short-lived tasks
Data transfer synthetic,
based on aggregates
Data transfer key to the
model
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 29: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/29.jpg)
Events become
"mini-aggregates"
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 30: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/30.jpg)
Traditional Serverless
Focus on the core,
design it well
Design the protocol,
other stuff is fixable later
push ugliness to
boundaries
focus on the boundaries
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 31: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/31.jpg)
RPC / invocations Events / messaging
pretend network does
not exist
assume network exists
requests intent/facts
"shared kernel" / tight
coupling
"open host" / don't care
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 32: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/32.jpg)
Key challenge for "protocol" design
Design events complete enough to avoid chattiness, but still generic enough to allow decoupling and reuseGojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 33: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/33.jpg)
![Page 34: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/34.jpg)
![Page 35: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/35.jpg)
Groups of tasks end up as bounded contexts...
use runtime security needs as a hint about context boundaries!
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 36: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/36.jpg)
Traditional Serverless
Infrastructure is stateful
or stateless
Infrastructure is
transient
Reserved capacity Utilised capacity
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 37: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/37.jpg)
![Page 38: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/38.jpg)
Model changes over time, but consistent at any point in time
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 39: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/39.jpg)
Model changes over time, may be inconsistent at single point in time
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 40: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/40.jpg)
Traditional Serverless
Infrastructure is stateful
or stateless
Infrastructure is
transient
Reserved capacity Utilised capacity
Model Universe Model Multiverse
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 41: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/41.jpg)
Version-tolerant design
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020
![Page 42: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/42.jpg)
![Page 43: How serverless impacts design · Traditional Serverless Model 㱺 Design 㱺 Deployment (Model ⇄ Deployment) 㱺 Design long-lived objects short-lived tasks Data transfer synthetic,](https://reader033.vdocuments.us/reader033/viewer/2022042303/5ece31a06bbfcd259117929e/html5/thumbnails/43.jpg)
http://leanpub.com/running-serverless/c/dddeu
50% off this week
Gojko Adzic | gojko.net | @gojkoadzic | https://gojko.net/assets/dddeu20.pdf | DDD Europe 2020