SlideShare a Scribd company logo
Turning the web stack upside down
Rethinking how data flows through systems
By Paolo Negri
Paolo Negri
CTO & co-founder, Contentful
@hungryblank
linkedin.com/in/panegri
Before we talk
about data flows...
Let’s talk about online gaming
Traditional architecture
Everything is driven by a request
Game
App
server
Persistent
datastore
@hungryblank
Advantages
● Simple to reason about
● Stateless app servers are
very easy to operate and
scale
● Data is always up to date
in database
Disadvantages
● Difficult to scale
horizontally
● Heavy load on the
database server
● Heavy load on app servers
continuously loading and
writing data to DB
Trade-offs
We turned it upside down
● On startup, load all game state
from the database
● All state kept in memory
● Events modify the in-memory state
● Periodically snapshot the current
state into the database
● If player is inactive for a while,
snapshot the state and take it out
of memory
Gaming
upside-
down stack
Wooga’s upside-down stack
Game
Data layer
App server
Persistent
datastore
@hungryblank
Advantages
● Easier to scale
● 2-3 orders of magnitude
fewer interactions with
database
● Game logic entirely testable
without DB attached
Disadvantages
● Must use a runtime that
works well with long lived
state (we used erlang)
● Might experience data loss
by design (one snapshot
time unit)
Trade-offs
● State can live out of Database
● There’s a time and place for the
runtime
● There might be a third way: Normal
form, denormalized and data
artifacts
● You can reduce your computation
needs by a factor of 1000 if you are
mindful of your computation
○ What data you process
○ Why
○ When
○ Where
What we
learned
But
you’re probably not building games...
...and these days neither am I
Don’t let a CMS get in the way
of shipping software
Contentful provides a content infrastructure that enables
teams to power content in any digital product
@hungryblank
Contentful allows customers
to create all kinds of experiences
@hungryblank
More often than not, it’s a website
@hungryblank
More often than not, it’s a website
@hungryblank
More often than not, it’s a website
@hungryblank
More often than not, it’s a website
@hungryblank
More often than not, it’s a website
@hungryblank
More often than not, it’s a website
@hungryblank
Traditional web architecture
Everything is driven by a request
Browser
App
server
Database
@hungryblank
Is there an upside-down stack
for the web?
Static site generators
@hungryblank
Static site generators
Browser Static site
host
Build
server
SCM
Developers
Editors
@hungryblank
Events in a static site generator
Browser Static site
host
Build
server
SCM
Developers
Editors
Request
Build
completed
Code
changed
@hungryblank
Advantages
● Trivial to scale for high
traffic
● Very reliable: operations are
simple
● Failure results in stale
content, not downtime
● Small security surface
Disadvantages
● Less intuitive editing
experience for
editors/marketeers
● Every update similar to a
software release
● Latency until new content
appears depends on build
process
Trade-offs
Static site generators with services
Browser Static site host Build server
SCM Developers
Editors
AWS Lambda
Algolia
SendGrid
Content infrastructure
StripeCommerce
layer
@hungryblank
Events in a static site generator
Browser Static site host Build server
SCM Developers
Editors
AWS Lambda
Algolia
Commerce
layer
SendGrid
Content infrastructure
Stripe
User request
Build complete
Content
changed
Code
changed
@hungryblank
Static sites are an
upside-down stack for the web
Events drive the system
Requests are just another event
Most of the work happens when
code or data changes
Work in a static site generator
Browser Static site host Build server
SCM Developers
Editors
AWS Lambda
Algolia
SendGrid
Content infrastructure
Stripe
Most
work
here
Commerce
layer
@hungryblank
User requests are cheap
Events in a static site generator
Browser Static site host Build server
SCM Developers
Editors
AWS Lambda
Algolia
SendGrid
Content infrastructure
StripeCommerce
layer
@hungryblank
Advantages
● Easy to scale
● Easy to integrate third party
services
● Easy to gracefully degrade
● Better general performance
Disadvantages
● Requires thinking out of the
request/response box
● If not architected carefully
at risk of exploding
complexity
● It’s a distributed system and
requires understanding of
the topic
Trade-offs
Four things
to consider
O N E
Build driven or
reactive?
@hungryblank
● Must classify how you want to handle events
○ Events that build artifacts
○ Events that trigger instant reaction (login, ecommerce purchase)
● Writing applications in both paradigms might be needed, but not a
must
O N E
@hungryblank
T W O
Do work only on
meaningful events
@hungryblank
● Take advantage of pre-built artifacts
● No more “current state” rebuild
● Events build their new state into artifacts
● Artifacts are used in place of what is currently computation
T W O
@hungryblank
T H R E E
Data = code
(They move through the system in the same way)
@hungryblank
T H R E E
● In this pattern, data and code follow the same lifecycle
● Every update in data or code is very much like a deployment
● Continuous delivery becomes quite literally continuous
@hungryblank
F O U R
Your domain model
needs strong tooling
@hungryblank
F O U R
● In this pattern, the architecture is fundamentally distributed, so
you need strong tooling tomode events and data.
● Events and data model can be directly mapped to
domain-driven design.
@hungryblank
F O U R
● The GraphQL ecosystem is a very promising solution to all
this, as it helps in defining clear contracts across services (own
or third party).
@hungryblank
1. Reframe: Request/Response as events
2. Investigate: What are events that happen
outside of request/response?
Example: Deployments are events
3. Document all the above
4. Extract: Move computation to meaningful
events
Example: Re-build data during an external
event — easiest during deployments
How do I
even start?
Thank you
twitter: @hungryblank
linkedin.com/in/panegri

More Related Content

PDF
Walmart pagespeed-slide
PPTX
Dynamic Rendering for SEO by Nati Elimelech
PPTX
Intro to the Data Grid
PPTX
Build your own analytics power tools
PPTX
Velocity NY - How to Measure Revenue in Milliseconds
PPTX
Using Processes and Timers for Long-Running Asynchronous Tasks
PPTX
Mobile Synchronization Patterns for Large Volumes of Data
PDF
Mastering Migration - How to Manage a Move From Another CMS to WordPress with...
Walmart pagespeed-slide
Dynamic Rendering for SEO by Nati Elimelech
Intro to the Data Grid
Build your own analytics power tools
Velocity NY - How to Measure Revenue in Milliseconds
Using Processes and Timers for Long-Running Asynchronous Tasks
Mobile Synchronization Patterns for Large Volumes of Data
Mastering Migration - How to Manage a Move From Another CMS to WordPress with...

What's hot (8)

PPTX
Microservices Coordination using Saga
PDF
Synthetic and RUM - Best of bo
PPTX
Measure Customer Experience of Your OutSystems Web and Mobile Applications
PPTX
When the connection fails
PDF
Client side production monitoring using - SyncApp Tool
PPTX
PowerPoint and Airtable Integration
PPTX
No API? No Problem! Let the Robot Do Your Work! Web Scraping and Automation W...
PDF
Digital Gaggle 2017 - Mobile Index
Microservices Coordination using Saga
Synthetic and RUM - Best of bo
Measure Customer Experience of Your OutSystems Web and Mobile Applications
When the connection fails
Client side production monitoring using - SyncApp Tool
PowerPoint and Airtable Integration
No API? No Problem! Let the Robot Do Your Work! Web Scraping and Automation W...
Digital Gaggle 2017 - Mobile Index
Ad

Similar to Turning the web stack upside down rethinking how data flows through systems (20)

PPTX
The Big Data Stack
PPTX
Event Storming & Event Sourcing with Lagom
PDF
All the DataOps, all the paradigms .
PDF
Lessons from Highly Scalable Architectures at Social Networking Sites
PDF
Reactive Java Robotics IoT - jPrime 2016
PDF
What Should I Do? Choosing SQL, NoSQL or Both for Scalable Web Applications
PPTX
Flashback: QCon San Francisco 2012
PDF
OutSystsems User Group Netherlands September 2024.pdf
PDF
OSDC 2018 | From Monolith to Microservices by Paul Puschmann_
PDF
Making Machine Learning Easy with H2O and WebFlux
PPTX
Using Event Streams in Serverless Applications
PDF
Data Infrastructure for a World of Music
PDF
Large Scale Architecture -- The Unreasonable Effectiveness of Simplicity
PPTX
Events & Microservices
PDF
Reactive Business Applications
 
PPTX
Raising ux bar with offline first design
PDF
Shaping serverless architecture with domain driven design patterns - py web-il
PPTX
Software architecture for data applications
PDF
Prototyping like it is 2022
PPTX
Reactive Fast Data & the Data Lake with Akka, Kafka, Spark
The Big Data Stack
Event Storming & Event Sourcing with Lagom
All the DataOps, all the paradigms .
Lessons from Highly Scalable Architectures at Social Networking Sites
Reactive Java Robotics IoT - jPrime 2016
What Should I Do? Choosing SQL, NoSQL or Both for Scalable Web Applications
Flashback: QCon San Francisco 2012
OutSystsems User Group Netherlands September 2024.pdf
OSDC 2018 | From Monolith to Microservices by Paul Puschmann_
Making Machine Learning Easy with H2O and WebFlux
Using Event Streams in Serverless Applications
Data Infrastructure for a World of Music
Large Scale Architecture -- The Unreasonable Effectiveness of Simplicity
Events & Microservices
Reactive Business Applications
 
Raising ux bar with offline first design
Shaping serverless architecture with domain driven design patterns - py web-il
Software architecture for data applications
Prototyping like it is 2022
Reactive Fast Data & the Data Lake with Akka, Kafka, Spark
Ad

More from Paolo Negri (12)

PDF
AWS Lambda in infrastructure
PDF
Erlang introduction geek2geek Berlin
PDF
Erlang as a cloud citizen, a fractal approach to throughput
PDF
Getting real with erlang
PDF
Erlang factory 2011 london
PDF
Erlang factory SF 2011 "Erlang and the big switch in social games"
PDF
Scaling Social Games
PDF
Mongrel2, a short introduction
PDF
RabbitMQ with python and ruby RuPy 2009
PDF
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
PDF
SimpleDb, an introduction
PDF
%w(map reduce).first - A Tale About Rabbits, Latency, and Slim Crontabs
AWS Lambda in infrastructure
Erlang introduction geek2geek Berlin
Erlang as a cloud citizen, a fractal approach to throughput
Getting real with erlang
Erlang factory 2011 london
Erlang factory SF 2011 "Erlang and the big switch in social games"
Scaling Social Games
Mongrel2, a short introduction
RabbitMQ with python and ruby RuPy 2009
Distributed and concurrent programming with RabbitMQ and EventMachine Rails U...
SimpleDb, an introduction
%w(map reduce).first - A Tale About Rabbits, Latency, and Slim Crontabs

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Electronic commerce courselecture one. Pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPT
Teaching material agriculture food technology
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
Digital-Transformation-Roadmap-for-Companies.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Review of recent advances in non-invasive hemoglobin estimation
Electronic commerce courselecture one. Pdf
Unlocking AI with Model Context Protocol (MCP)
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Teaching material agriculture food technology
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation theory and applications.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Encapsulation_ Review paper, used for researhc scholars
Advanced methodologies resolving dimensionality complications for autism neur...
Understanding_Digital_Forensics_Presentation.pptx
sap open course for s4hana steps from ECC to s4
Diabetes mellitus diagnosis method based random forest with bat algorithm

Turning the web stack upside down rethinking how data flows through systems

  • 1. Turning the web stack upside down Rethinking how data flows through systems By Paolo Negri
  • 2. Paolo Negri CTO & co-founder, Contentful @hungryblank linkedin.com/in/panegri
  • 3. Before we talk about data flows...
  • 4. Let’s talk about online gaming
  • 5. Traditional architecture Everything is driven by a request Game App server Persistent datastore @hungryblank
  • 6. Advantages ● Simple to reason about ● Stateless app servers are very easy to operate and scale ● Data is always up to date in database Disadvantages ● Difficult to scale horizontally ● Heavy load on the database server ● Heavy load on app servers continuously loading and writing data to DB Trade-offs
  • 7. We turned it upside down
  • 8. ● On startup, load all game state from the database ● All state kept in memory ● Events modify the in-memory state ● Periodically snapshot the current state into the database ● If player is inactive for a while, snapshot the state and take it out of memory Gaming upside- down stack
  • 9. Wooga’s upside-down stack Game Data layer App server Persistent datastore @hungryblank
  • 10. Advantages ● Easier to scale ● 2-3 orders of magnitude fewer interactions with database ● Game logic entirely testable without DB attached Disadvantages ● Must use a runtime that works well with long lived state (we used erlang) ● Might experience data loss by design (one snapshot time unit) Trade-offs
  • 11. ● State can live out of Database ● There’s a time and place for the runtime ● There might be a third way: Normal form, denormalized and data artifacts ● You can reduce your computation needs by a factor of 1000 if you are mindful of your computation ○ What data you process ○ Why ○ When ○ Where What we learned
  • 12. But you’re probably not building games... ...and these days neither am I
  • 13. Don’t let a CMS get in the way of shipping software Contentful provides a content infrastructure that enables teams to power content in any digital product @hungryblank
  • 14. Contentful allows customers to create all kinds of experiences @hungryblank
  • 15. More often than not, it’s a website @hungryblank
  • 16. More often than not, it’s a website @hungryblank
  • 17. More often than not, it’s a website @hungryblank
  • 18. More often than not, it’s a website @hungryblank
  • 19. More often than not, it’s a website @hungryblank
  • 20. More often than not, it’s a website @hungryblank
  • 21. Traditional web architecture Everything is driven by a request Browser App server Database @hungryblank
  • 22. Is there an upside-down stack for the web?
  • 24. Static site generators Browser Static site host Build server SCM Developers Editors @hungryblank
  • 25. Events in a static site generator Browser Static site host Build server SCM Developers Editors Request Build completed Code changed @hungryblank
  • 26. Advantages ● Trivial to scale for high traffic ● Very reliable: operations are simple ● Failure results in stale content, not downtime ● Small security surface Disadvantages ● Less intuitive editing experience for editors/marketeers ● Every update similar to a software release ● Latency until new content appears depends on build process Trade-offs
  • 27. Static site generators with services Browser Static site host Build server SCM Developers Editors AWS Lambda Algolia SendGrid Content infrastructure StripeCommerce layer @hungryblank
  • 28. Events in a static site generator Browser Static site host Build server SCM Developers Editors AWS Lambda Algolia Commerce layer SendGrid Content infrastructure Stripe User request Build complete Content changed Code changed @hungryblank
  • 29. Static sites are an upside-down stack for the web
  • 30. Events drive the system Requests are just another event
  • 31. Most of the work happens when code or data changes
  • 32. Work in a static site generator Browser Static site host Build server SCM Developers Editors AWS Lambda Algolia SendGrid Content infrastructure Stripe Most work here Commerce layer @hungryblank
  • 34. Events in a static site generator Browser Static site host Build server SCM Developers Editors AWS Lambda Algolia SendGrid Content infrastructure StripeCommerce layer @hungryblank
  • 35. Advantages ● Easy to scale ● Easy to integrate third party services ● Easy to gracefully degrade ● Better general performance Disadvantages ● Requires thinking out of the request/response box ● If not architected carefully at risk of exploding complexity ● It’s a distributed system and requires understanding of the topic Trade-offs
  • 37. O N E Build driven or reactive? @hungryblank
  • 38. ● Must classify how you want to handle events ○ Events that build artifacts ○ Events that trigger instant reaction (login, ecommerce purchase) ● Writing applications in both paradigms might be needed, but not a must O N E @hungryblank
  • 39. T W O Do work only on meaningful events @hungryblank
  • 40. ● Take advantage of pre-built artifacts ● No more “current state” rebuild ● Events build their new state into artifacts ● Artifacts are used in place of what is currently computation T W O @hungryblank
  • 41. T H R E E Data = code (They move through the system in the same way) @hungryblank
  • 42. T H R E E ● In this pattern, data and code follow the same lifecycle ● Every update in data or code is very much like a deployment ● Continuous delivery becomes quite literally continuous @hungryblank
  • 43. F O U R Your domain model needs strong tooling @hungryblank
  • 44. F O U R ● In this pattern, the architecture is fundamentally distributed, so you need strong tooling tomode events and data. ● Events and data model can be directly mapped to domain-driven design. @hungryblank
  • 45. F O U R ● The GraphQL ecosystem is a very promising solution to all this, as it helps in defining clear contracts across services (own or third party). @hungryblank
  • 46. 1. Reframe: Request/Response as events 2. Investigate: What are events that happen outside of request/response? Example: Deployments are events 3. Document all the above 4. Extract: Move computation to meaningful events Example: Re-build data during an external event — easiest during deployments How do I even start?