Slide 1

Slide 1 text

Orchestration VS Choreography in Serverless AWS User Group - Torino, 23/11/2023

Slide 2

Slide 2 text

Microservices anyone?

Slide 3

Slide 3 text

of organizations use microservices 85% Sources: CNCF Cloud Native Survey 2021, DORA State of DevOps 2021 reduction in mean time to recovery 60%

Slide 4

Slide 4 text

󰗞 I am Francesco Lerro Cloud and Serverless computing expert, based in Turin (Italy) Currently riding the Software Architect elevator at I love solving the Rubikʼs cube and eating buffalo mozzarella Linkedin profile

Slide 5

Slide 5 text

Microservices collaboration A central coordinator controls the execution flow and the interactions between the various services ORCHESTRATION CHOREOGRAPHY Decentralised approach, each service may be asynchronously triggered by the operation of other services

Slide 6

Slide 6 text

Orchestration implementation

Slide 7

Slide 7 text

Choreography implementation

Slide 8

Slide 8 text

Letʼs try it live!

Slide 9

Slide 9 text

Orchestration VS Choreography ■ Business process control ■ Operation coupling ■ Service failure and error handling

Slide 10

Slide 10 text

What about serverless?

Slide 11

Slide 11 text

Choreography, everywhere

Slide 12

Slide 12 text

Events, unexpected Sync invocation

Slide 13

Slide 13 text

How to mitigate choreography downsides?

Slide 14

Slide 14 text

Adopt distributed tracing

Slide 15

Slide 15 text

A service map in AWS X-Ray

Slide 16

Slide 16 text

Design for failure On Success On Error SQS Queue DynamoDB For example, leveraging Lambda Destinations

Slide 17

Slide 17 text

Use idempotency FTW! INVOCATION RETRY BEHAVIOUR API GATEWAY Synch None – returns error AMAZON S3 Asynch Until configured timeout, 2 times AMAZON SNS Asynch In case of unavailability DYNAMODB STREAMS Synch (from Poller) Until data expiration (24h) KINESIS Synch (from Poller) Until data expiration (24h-7d) SQS Synch (from Poller) Until retention period exp. or DLQ

Slide 18

Slide 18 text

What about orchestration in serverless?

Slide 19

Slide 19 text

Letʼs use Lambda…

Slide 20

Slide 20 text

Letʼs use Lambda… Please donʼt. Cost, tight coupling, error handling….

Slide 21

Slide 21 text

Letʼs use Lambda… Please donʼt. Try Step Functions, instead!

Slide 22

Slide 22 text

Coordinated transactions via AWS Step Functions Let’s start with the first set of slides Credits: Yan Cui, The SAGA pattern

Slide 23

Slide 23 text

Let’s start with the first set of slides Booking SAGA The happy path

Slide 24

Slide 24 text

Booking SAGA Error handling Let’s start with the first set of slides

Slide 25

Slide 25 text

Orchestration or Choreography?

Slide 26

Slide 26 text

THANKS! Any questions? Francesco Lerro