Download presentation
Presentation is loading. Please wait.
1
Serverless CQRS in Azure!
Toon Vanhoutte
2
Nice to meet you Toon Vanhoutte Lead Architect @ Codit Belgium
Microsoft Azure MVP @toonvanhoutte toonvanhoutte.wordpress.com
3
159 Who we are worldwide 2000 Belgium 2004 France
2013 Portugal 2016 Switzerland 2016 UK 2016 The Netherlands 2017 Malta 159 worldwide Customers Entities
4
The thing we do
5
Agenda An Introduction to CQRS Serverless Technologies in Azure
Use Case: Optimize a Webshop Conclusion
6
An introduction to CQRS
7
Proven and simple design
CRUD Architecture Proven and simple design
8
Command Query Responsibility Segregation
Dealing with complex domain models From a DDD perspective, where the business complexity requires two separate models for read and write models. Eg one database with write against database tables and reads done based on views that are optimized for the UI
9
Command Query Responsibility Segregation
Dealing with high performing applications Improve performance, scalability and flexibility
10
Commands vs Queries Commands Queries Write Read Sync / Async Sync
Reliable Volatile Persistent In Memory Transactional Non Transactional Improve performance, scalability and flexibility Fast Fast
11
Different aspects of CQRS Multiple points of view
Event Sourcing (store ordered historic events) DDD (different models) Scalability & Performance (different stores) Improve performance, scalability and flexibility
12
Highly performing and scalable solutions Scalability & Performance
Focus of this session Highly performing and scalable solutions Event Sourcing (store ordered historic events) DDD (different models) Scalability & Performance (different stores) Improve performance, scalability and flexibility
13
Serverless in Azure
14
Pizza as a Service
15
Serverless Technology Options
Azure Functions “Code triggered by events” Azure Logic Apps “Workflows triggered by events” Azure Service Bus “Reliable messaging platform” Azure Event Grid “Serverless event routing service”
16
Azure Functions Azure Logic Apps
Developer experience Connectivity Exception Handling State Networking Deployment Runtime Monitoring Pricing Model Security
17
Azure Functions Azure Logic Apps
Preferred option for complex synchronous request/response calls. Preferred option for asynchronous fire-and-forget messaging. Azure Functions perfectly extends Azure Logic Apps.
18
Azure Service Bus Azure Event Grid Report Command Notification
Transfer Query Measurement Assignment Job Request Trace Update Handover © Clemens Vasters
19
Messaging Eventing Azure Service Bus Azure Event Grid Passing Intents
Reporting Facts Command Discrete Transfer Report Query Notification Messaging Eventing Handover Job Measurement Assignment Update Trace Request Series © Clemens Vasters
20
Messaging Eventing Azure Service Bus Azure Event Grid Passing Intents
Reporting Facts Discrete “PriceUpdated” “OpportunityWon” “InvoiceBooked” “CreateOrder” “BookHotel” “UpdateStock” Messaging Eventing Temperature stream Telemetry data Audit trail Series © Clemens Vasters
21
Use Case
22
Find out how CQRS will save Antonio’s business!
Pizza Antonio Find out how CQRS will save Antonio’s business!
23
Pizza Antonio Website € 10 € 12 € 11 Submit Query Command
24
Pizza Antonio Query SQL Database Command Very good pizza’s
GetProducts Command CreateOrder Very good pizza’s Customers get errors when ordering pizza during peak hours
25
Pizza Antonio Query SQL Database Command
GetProducts Command CreateOrder Customers don’t get any errors anymore The orders don’t make it to the database, so no pizza
26
Pizza Antonio Query SQL Database Command
GetProducts Command CreateOrder All orders make it to the database Polling during quiet hours is rather expensive, so more expensive pizza’s
27
Pizza Antonio Query SQL Database Command
GetProducts Command CreateOrder Cheaper polling mechanism, so again sharper prices No flexible way to send order confirmations through
28
Pizza Antonio Query SQL Database Command
GetProducts Command CreateOrder Flexible extension points for e.g. s Two different URL’s and security keys for the website
29
Pizza Antonio Query SQL Database Command Uniform API for website
Azure Function Proxy SQL Database GetProducts Command CreateOrder Uniform API for website Loading products on the website is extremely slow during peak hours
30
Pizza Antonio Query SQL Database Command
Azure Function Proxy SQL Database GetProducts Command CreateOrder Fast responsive times on the website No flexible way to update products on external food delivery services
31
Pizza Antonio Query SQL Database Command Azure Function Proxy
GetProducts Command CreateOrder
32
Pizza Antonio Query SQL Database Command Antonio happy Customers happy
Azure Function Proxy SQL Database GetProducts Command CreateOrder Antonio happy Customers happy
33
Conclusion
34
CQRS is a proven design pattern!
It exists in many different variations Azure Function Proxy SQL Database Query Command Sentinet SQL Database Query Command Azure API Mgmt SQL Database Query Command Cache
35
Lessons learned Azure Event Grid Azure Functions
Consumption plan results in cold starts, also for function proxies! Solution: Keep it warm (5 min) App Service Plan Pre-compiled functions Event Grid puts responsibility for sequencing at receive side! Solution: Use it wisely Consider Azure Service Bus if sequencing is required
36
Architectural Advise on CQRS
Do not overengineer! Advantages Challenges Disadvantages Performance Idempotence Complexity Scalability Eventual Consistency Monitoring Flexibility Resiliency Maintenance Apply CQRS carefully on specific parts of the solution!
37
Thank you! Keep in touch. @toonvanhoutte toonvanhoutte.wordpress.com
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.