Slide 1

Slide 1 text

@MarcDuiker

Slide 2

Slide 2 text

@MarcDuiker 2 Marc Duiker Sr Developer Advocate

Slide 3

Slide 3 text

@MarcDuiker 3

Slide 4

Slide 4 text

@MarcDuiker

Slide 5

Slide 5 text

@MarcDuiker 5

Slide 6

Slide 6 text

@MarcDuiker 6

Slide 7

Slide 7 text

@MarcDuiker 7

Slide 8

Slide 8 text

@MarcDuiker 8

Slide 9

Slide 9 text

@MarcDuiker 9 https://en.wikipedia.org/wiki/Monolithic_application “In software engineering, a monolithic application describes a software application that is designed without modularity.”

Slide 10

Slide 10 text

@MarcDuiker 10 https://en.wikipedia.org/wiki/Modularity “…modularity is the degree to which a system's components may be separated and recombined, often with the benefit of flexibility and variety in use.”

Slide 11

Slide 11 text

@MarcDuiker 11 App Server DB Server

Slide 12

Slide 12 text

@MarcDuiker 12 Function App Function App Queue Storage

Slide 13

Slide 13 text

@MarcDuiker 13 Function App Function App Queue Storage

Slide 14

Slide 14 text

@MarcDuiker 14

Slide 15

Slide 15 text

@MarcDuiker 15

Slide 16

Slide 16 text

@MarcDuiker 16

Slide 17

Slide 17 text

@MarcDuiker

Slide 18

Slide 18 text

@MarcDuiker 18 https://martinfowler.com/articles/agileStory.html “We eventually agreed on "agile" as we felt that captured the adaptiveness and response to change which we felt was so important to our approach…”

Slide 19

Slide 19 text

@MarcDuiker 19

Slide 20

Slide 20 text

@MarcDuiker 20

Slide 21

Slide 21 text

@MarcDuiker 21

Slide 22

Slide 22 text

@MarcDuiker 22

Slide 23

Slide 23 text

@MarcDuiker

Slide 24

Slide 24 text

@MarcDuiker 24

Slide 25

Slide 25 text

@MarcDuiker 25 Task on backlog Work started Work completed

Slide 26

Slide 26 text

@MarcDuiker 26 https://www.atlassian.com/incident-management/kpis/common-metrics

Slide 27

Slide 27 text

@MarcDuiker 27 https://www.atlassian.com/incident-management/kpis/common-metrics

Slide 28

Slide 28 text

@MarcDuiker 28 https://www.atlassian.com/incident-management/kpis/common-metrics

Slide 29

Slide 29 text

@MarcDuiker 29

Slide 30

Slide 30 text

@MarcDuiker 30

Slide 31

Slide 31 text

@MarcDuiker 31 https://learn.microsoft.com/en-us/azure/azure-functions/functions-host-json

Slide 32

Slide 32 text

@MarcDuiker 32

Slide 33

Slide 33 text

@MarcDuiker 33 https://learn.microsoft.com/en-us/azure/azure-functions/functions-deployment-slots

Slide 34

Slide 34 text

@MarcDuiker 34 Function App Website Queue

Slide 35

Slide 35 text

@MarcDuiker 35

Slide 36

Slide 36 text

@MarcDuiker

Slide 37

Slide 37 text

@MarcDuiker 37 Caused by the nature of the (business) problem. Can’t be easily reduced. Caused by decisions we make related to architecture, frameworks, packages, code style etc. Can be reduced. https://en.wikipedia.org/wiki/Programming_complexity

Slide 38

Slide 38 text

@MarcDuiker 38 https://en.wikipedia.org/wiki/Programming_complexity Caused by decisions we make related to architecture, frameworks, packages, code style etc. Can be reduced. Caused by the nature of the (business) problem. Can’t be easily reduced.

Slide 39

Slide 39 text

@MarcDuiker 39

Slide 40

Slide 40 text

@MarcDuiker 40

Slide 41

Slide 41 text

@MarcDuiker 41

Slide 42

Slide 42 text

@MarcDuiker 42

Slide 43

Slide 43 text

@MarcDuiker 43

Slide 44

Slide 44 text

@MarcDuiker 44

Slide 45

Slide 45 text

@MarcDuiker 45

Slide 46

Slide 46 text

@MarcDuiker 46

Slide 47

Slide 47 text

@MarcDuiker 47

Slide 48

Slide 48 text

@MarcDuiker 48

Slide 49

Slide 49 text

@MarcDuiker 49 public static class ChainingExample { [FunctionName(nameof(ChainingExample))] public static async Task RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context) { var resultA = await context.CallActivityAsync( nameof(ActivityFunctionA), null); var resultB = await context.CallActivityAsync( nameof(ActivityFunctionB), resultA); var resultC = await context.CallActivityAsync( nameof(ActivityFunctionC), resultB); return resultC; } }

Slide 50

Slide 50 text

@MarcDuiker 50 public static class ChainingExample { [FunctionName(nameof(ChainingExample))] public static async Task RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context) { var resultA = await context.CallActivityAsync( nameof(ActivityFunctionA), null); var resultB = await context.CallActivityAsync( nameof(ActivityFunctionB), resultA); var resultC = await context.CallActivityAsync( nameof(ActivityFunctionC), resultB); return resultC; } }

Slide 51

Slide 51 text

@MarcDuiker 51 public static class ChainingExample { [FunctionName(nameof(ChainingExample))] public static async Task RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context) { var resultA = await context.CallActivityAsync( nameof(ActivityFunctionA), null); var resultB = await context.CallActivityAsync( nameof(ActivityFunctionB), resultA); var resultC = await context.CallActivityAsync( nameof(ActivityFunctionC), resultB); return resultC; } }

Slide 52

Slide 52 text

@MarcDuiker 52 public static class ChainingExample { [FunctionName(nameof(ChainingExample))] public static async Task RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context) { var resultA = await context.CallActivityAsync( nameof(ActivityFunctionA), null); var resultB = await context.CallActivityAsync( nameof(ActivityFunctionB), resultA); var resultC = await context.CallActivityAsync( nameof(ActivityFunctionC), resultB); return resultC; } }

Slide 53

Slide 53 text

@MarcDuiker 53 public static class ChainingExample { [FunctionName(nameof(ChainingExample))] public static async Task RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context) { var resultA = await context.CallActivityAsync( nameof(ActivityFunctionA), null); var resultB = await context.CallActivityAsync( nameof(ActivityFunctionB), resultA); var resultC = await context.CallActivityAsync( nameof(ActivityFunctionC), resultB); return resultC; } }

Slide 54

Slide 54 text

@MarcDuiker 54

Slide 55

Slide 55 text

@MarcDuiker 55 public static class FanOutFanInExample { [FunctionName(nameof(FanOutFanInExample))] public static async Task RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context) { var tasks = new List>(); tasks.Add(context.CallActivityAsync( nameof(ActivityFunctionA), null)); tasks.Add(context.CallActivityAsync( nameof(ActivityFunctionB), null)); tasks.Add(context.CallActivityAsync( nameof(ActivityFunctionC), null)); var results = await Task.WhenAll(tasks); return results; }

Slide 56

Slide 56 text

@MarcDuiker 56 public static class FanOutFanInExample { [FunctionName(nameof(FanOutFanInExample))] public static async Task RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context) { var tasks = new List>(); tasks.Add(context.CallActivityAsync( nameof(ActivityFunctionA), null)); tasks.Add(context.CallActivityAsync( nameof(ActivityFunctionB), null)); tasks.Add(context.CallActivityAsync( nameof(ActivityFunctionC), null)); var results = await Task.WhenAll(tasks); return results; }

Slide 57

Slide 57 text

@MarcDuiker 57 public static class FanOutFanInExample { [FunctionName(nameof(FanOutFanInExample))] public static async Task RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context) { var tasks = new List>(); tasks.Add(context.CallActivityAsync( nameof(ActivityFunctionA), null)); tasks.Add(context.CallActivityAsync( nameof(ActivityFunctionB), null)); tasks.Add(context.CallActivityAsync( nameof(ActivityFunctionC), null)); var results = await Task.WhenAll(tasks); return results; }

Slide 58

Slide 58 text

@MarcDuiker 58 public static class FanOutFanInExample { [FunctionName(nameof(FanOutFanInExample))] public static async Task RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context) { var tasks = new List>(); tasks.Add(context.CallActivityAsync( nameof(ActivityFunctionA), null)); tasks.Add(context.CallActivityAsync( nameof(ActivityFunctionB), null)); tasks.Add(context.CallActivityAsync( nameof(ActivityFunctionC), null)); var results = await Task.WhenAll(tasks); return results; }

Slide 59

Slide 59 text

@MarcDuiker 59 public static class FanOutFanInExample { [FunctionName(nameof(FanOutFanInExample))] public static async Task RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context) { var tasks = new List>(); tasks.Add(context.CallActivityAsync( nameof(ActivityFunctionA), null)); tasks.Add(context.CallActivityAsync( nameof(ActivityFunctionB), null)); tasks.Add(context.CallActivityAsync( nameof(ActivityFunctionC), null)); var results = await Task.WhenAll(tasks); return results; }

Slide 60

Slide 60 text

@MarcDuiker 60

Slide 61

Slide 61 text

@MarcDuiker 61 public static class SubOrchestratorExample { [FunctionName(nameof(SubOrchestratorExample))] public static async Task RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context) { var resultA = await context.CallSubOrchestratorAsync( nameof(SubOrchestratorA), null); var resultB = await context.CallSubOrchestratorAsync( nameof(SubOrchestratorB), resultA); var resultC = await context.CallSubOrchestratorAsync( nameof(SubOrchestratorC), resultC); return resultC; } }

Slide 62

Slide 62 text

@MarcDuiker 62 https://github.com/marcduiker/durable-functions-use-cases

Slide 63

Slide 63 text

@MarcDuiker

Slide 64

Slide 64 text

@MarcDuiker 64

Slide 65

Slide 65 text

@MarcDuiker

Slide 66

Slide 66 text

@MarcDuiker 66 Domain Bounded Context Bounded Context Bounded Context Bounded Context https://thedomaindrivendesign.io/bounded-context/

Slide 67

Slide 67 text

@MarcDuiker 67 Ecommerce Product Catalog Pricing Billing Shopping Basket https://thedomaindrivendesign.io/bounded-context/

Slide 68

Slide 68 text

@MarcDuiker 68 “Ubiquitous language identifies the terms and concepts within a bounded context that are unambiguous and agreed upon by all stakeholders.” https://thedomaindrivendesign.io/what-is-strategic-design

Slide 69

Slide 69 text

@MarcDuiker 69 Billing Shopping Basket https://thedomaindrivendesign.io/what-is-strategic-design

Slide 70

Slide 70 text

@MarcDuiker 70

Slide 71

Slide 71 text

@MarcDuiker 71

Slide 72

Slide 72 text

@MarcDuiker 72

Slide 73

Slide 73 text

@MarcDuiker 73 Bounded Context Bounded Context

Slide 74

Slide 74 text

@MarcDuiker

Slide 75

Slide 75 text

@MarcDuiker 75 “Resilience is the ability to provide and maintain an acceptable level of service in the face of faults and challenges to normal operation.” https://en.wikipedia.org/wiki/Resilience_(network)

Slide 76

Slide 76 text

@MarcDuiker 76

Slide 77

Slide 77 text

@MarcDuiker 77 https://learn.microsoft.com/en-us/azure/architecture/patterns/

Slide 78

Slide 78 text

@MarcDuiker 78

Slide 79

Slide 79 text

@MarcDuiker 79

Slide 80

Slide 80 text

@MarcDuiker 80 Function App B Function App A Queue Storage

Slide 81

Slide 81 text

@MarcDuiker 81 public static class ChainingWithRetryExample { [FunctionName(nameof(ChainingWithRetryExample))] public static async Task RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context) { var resultA = await context.CallActivityWithRetryAsync( nameof(ActivityFunctionA), new RetryOptions(TimeSpan.FromSeconds(5), 3) { BackoffCoefficient = 2 }, null); var resultB = await context.CallActivityAsync( nameof(ActivityFunctionB), resultA); var resultC = await context.CallActivityAsync( nameof(ActivityFunctionC), resultB); return resultC; } }

Slide 82

Slide 82 text

@MarcDuiker 82 public static class ChainingWithRetryExample { [FunctionName(nameof(ChainingWithRetryExample))] public static async Task RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context) { var resultA = await context.CallActivityWithRetryAsync( nameof(ActivityFunctionA), new RetryOptions(TimeSpan.FromSeconds(5), 3) { BackoffCoefficient = 2 }, null); var resultB = await context.CallActivityAsync( nameof(ActivityFunctionB), resultA); var resultC = await context.CallActivityAsync( nameof(ActivityFunctionC), resultB); return resultC; } }

Slide 83

Slide 83 text

@MarcDuiker

Slide 84

Slide 84 text

@MarcDuiker 84 Increase number of (virtual) machines Increase CPU / memory of one machine

Slide 85

Slide 85 text

@MarcDuiker 85

Slide 86

Slide 86 text

@MarcDuiker 86

Slide 87

Slide 87 text

@MarcDuiker 87

Slide 88

Slide 88 text

@MarcDuiker 88 scale out scale out

Slide 89

Slide 89 text

@MarcDuiker 89 scale out scale out https://learn.microsoft.com/en-us/azure/azure-functions/functions-scale#scale Use dedicated resource to its fullest

Slide 90

Slide 90 text

@MarcDuiker 90 scale out scale out https://learn.microsoft.com/en-us/azure/azure-functions/functions-scale#scale Use higher tier / sku Use regular tier / sku

Slide 91

Slide 91 text

@MarcDuiker 91 App Settings: FUNCTIONS_WORKER_PROCESS_COUNT Function App resource property: functionAppScaleLimit https://learn.microsoft.com/en-us/azure/azure-functions/event-driven-scaling https://learn.microsoft.com/en-us/azure/azure-functions/functions-best-practices SCALE_CONTROLLER_LOGGING_ENABLED

Slide 92

Slide 92 text

@MarcDuiker - Monitor your agility! - Ask yourself these questions before adding any code: - Do *I* need to write this? - Is this a good fit with the rest of the app? - What is the impact regarding resilience/scalability of the app?

Slide 93

Slide 93 text

@MarcDuiker linktr.ee/marcduiker