serverless applications

30
SERVERLESS APPLICATIONS WHERE HAVE ALL THE SERVERS GONE?

Upload: mbaric

Post on 15-Apr-2017

99 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Serverless applications

SERVERLESSAPPLICATIONSWHERE HAVE ALL THE SERVERS GONE?

Page 2: Serverless applications

WHY?As a dev team, we should focus on delivering code, not maintaining the infrastructure to run that code.

Programmers bring value when they write code.

Page 3: Serverless applications

WE JUST WANT TO CODE!

Page 4: Serverless applications

PROBLEMS WITH MANAGING YOU OWN SERVERS

• Team needs to have skills to manage IT infrastructure• What server size? • Which OS version?• When do we patch OS? • How do we patch OS? downtime!• Tuning server performance• How much remaining capacity do we have?• Handling server failures• Servers are highly underutilized• Pay even if you’re not running any workload – pay for

time, not for the actual work

Page 5: Serverless applications

KEY BENEFITS OF SERVERLESS APPROACH

Zero administration

Noprovisioning

Focus onbusiness

value

Allows rapid innovation

Reduced time to market

Seamlessscaling

Reductionof running

cost

Highavailability

Page 6: Serverless applications

MONOLITHIC ARCHITECTURE

Presentation tier Business logic tier Database tier

Page 7: Serverless applications

MICROSERVICES ARCHITECTURE

Fleet of microservices

!

!

!

Page 8: Serverless applications

Monolithic

◦ Hard to make changes◦ Tight coupling between

components◦ Hard to understand

interdependencies◦ Partial deployments

impossible◦ Either all works or nothing

works◦ Shared data store◦ Shared codebase – teams

are overlapping

WHY MICROSERVICES?

Microservices

◦ Separation of responsibilites between components – easier to understand

◦ Individually deployable pieces

◦ Easier to test functionalities in isolation

◦ No sharing of code◦ No sharing of data◦ Graceful degradation of

service

Page 9: Serverless applications

What if we could just focus on solving the business problems and let someone else run the code and do all heavy lifting for us...

Page 10: Serverless applications

CLOUD MAKES IT POSSIBLE!

Data store Caching

Networking

Contentdelivery

Compute

Security Monitoringand logging

Messagingand queues

Streaming

Page 11: Serverless applications

SERVERLESS BUILDING BLOCKS

API Gateway

Lambda

Page 12: Serverless applications

AWS API GATEWAY

• Public API as a service• Handles authorization, access control, monitoring, API

version management• Highly scalable, highly resilient service• Scales dynamically to handle ANY load • Seamless integration with AWS services (like Lambda or

Kinesis) or any custom HTTP endpoint• Caching out of the box• Charging per million API calls ($3.50 per million API calls)

+ traffic out

Page 13: Serverless applications

AWS LAMBDA

• Function As A Service• Event-driven serverless compute service• Triggered by: API gateway call, SNS notification, Kinesis

stream, S3 object upload, CloudWatch alarm, Amazon Echo....

• Pay only for running time (in 100ms increments)• Never pay for idle!• Don’t worry about overprovisioning or underprovisioning• Automatically scales to handle ANY load• Supports Node.JS, Python, Java and C# from today!! • Your code is secured – encrypted at rest• Monitoring out of the box

Page 14: Serverless applications

AWS LAMBDA LIMITATIONS

• Functions must complete execution in 300 sec• Allocated memory from 128 MB up to 1.5 GB (in 64 MB

increment)• Available CPU power proportional to allocated memory• 500 MB of non-persistent disk space• Function size (with dependencies) less than 50 MB• Execution is stateless, but beware – containers are

reused!• Latency on first request

Page 15: Serverless applications

EXAMPLE #1 (Serverless backend)

Back end

Users

Page 16: Serverless applications

EXAMPLE #1 (Serverless backend)

Back end logic Back end dataUsers

Page 17: Serverless applications

EXAMPLE #1 (Serverless backend)

Back end logic Back end data

Web clients

Mobile clients

Services

HTTP / REST

Page 18: Serverless applications

EXAMPLE #1 (Serverless backend)

Web clients

Mobile clients

Services

AWS API Gateway

AWSLambda

AWSDynamoDB

AWS CloudFront

Page 19: Serverless applications

EXAMPLE #1 (Serverless backend)

Web clients

Mobile clients

Services

AWS API Gateway

AWSLambda

AWSDynamoDB

AWS CloudFront

AWSS3

Page 20: Serverless applications

EXAMPLE #1 (Serverless backend)

Web clients

Mobile clients

Services

AWS API Gateway

AWSLambda

AWSDynamoDB

AWS CloudFront

AWSS3

AWSS3

AWSSNS

Page 21: Serverless applications

EXAMPLE #1 (Serverless backend)

Services

AWS API Gateway

AWSLambda

AWSDynamoDB

AWS CloudFront

AWSS3

AWSS3

AWSSNS

Page 22: Serverless applications

EXAMPLE #2 (Hybrid backend)

Web clients

Mobile clients

Services

AWS API Gateway

AWSLambda

AWSDynamoDB

AWS CloudFront

AWS EC2 AWS EC2

Page 23: Serverless applications

EXAMPLE #3 (Serverless stream processing)

Mobile clients AWS Kinesis Streams

AWSDynamoDB

AWSS3

AWSEMR

AWSLambda

AWSRedshift

Page 24: Serverless applications

WHO IS SERVERLESS FOR?

• Do you need high performance at ANY scale?• Can you afford unpredictable running costs? • Do you need to individually deploy ony pieces of your

application?• Do you need to be able to experiment and iterate

quickly with parts of your application?• Are you building microservices?

Page 25: Serverless applications

MICROSERVICES UTOPIA

Page 26: Serverless applications

MICROSERVICES UTOPIA

Page 27: Serverless applications

“ If you can’t build a modular monolith,what makes you think microservicesis the answer?

Page 28: Serverless applications

WHAT’S THE CURRENT STATE?

• Technology not mature enough• No well-proven patterns to follow, everyone is still

experimenting• No mature frameworks to help us build and deploy• Still only few players in the game (AWS Lambda, Azure

Functions, Google Cloud Functions, IBM OpenWisk, Webtask.io....)

• Harder to develop and test locally• Do you really need this architecture?• In some cases it’s cheaper to run a fleet of EC2s

Page 29: Serverless applications

IT’S NOT ALWAYS CHEAPER

Lambda 10 x m3.large

Pricing model First million executions free, each additional million $0.20 $95 / month for each instace

Our monthly cost $2,162 $950

Our yearly cost $25,944 $11,400

• 100 exeucutions / sec• Each execution lasts 1 sec• Each execution is allocated 512 MB of memory

$14,500 difference per year!

Page 30: Serverless applications

THANK YOU!