serverless applications
TRANSCRIPT
SERVERLESSAPPLICATIONSWHERE HAVE ALL THE SERVERS GONE?
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.
WE JUST WANT TO CODE!
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
KEY BENEFITS OF SERVERLESS APPROACH
Zero administration
Noprovisioning
Focus onbusiness
value
Allows rapid innovation
Reduced time to market
Seamlessscaling
Reductionof running
cost
Highavailability
MONOLITHIC ARCHITECTURE
Presentation tier Business logic tier Database tier
MICROSERVICES ARCHITECTURE
Fleet of microservices
!
!
!
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
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...
CLOUD MAKES IT POSSIBLE!
Data store Caching
Networking
Contentdelivery
Compute
Security Monitoringand logging
Messagingand queues
Streaming
SERVERLESS BUILDING BLOCKS
API Gateway
Lambda
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
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
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
EXAMPLE #1 (Serverless backend)
Back end
Users
EXAMPLE #1 (Serverless backend)
Back end logic Back end dataUsers
EXAMPLE #1 (Serverless backend)
Back end logic Back end data
Web clients
Mobile clients
Services
HTTP / REST
EXAMPLE #1 (Serverless backend)
Web clients
Mobile clients
Services
AWS API Gateway
AWSLambda
AWSDynamoDB
AWS CloudFront
EXAMPLE #1 (Serverless backend)
Web clients
Mobile clients
Services
AWS API Gateway
AWSLambda
AWSDynamoDB
AWS CloudFront
AWSS3
EXAMPLE #1 (Serverless backend)
Web clients
Mobile clients
Services
AWS API Gateway
AWSLambda
AWSDynamoDB
AWS CloudFront
AWSS3
AWSS3
AWSSNS
EXAMPLE #1 (Serverless backend)
Services
AWS API Gateway
AWSLambda
AWSDynamoDB
AWS CloudFront
AWSS3
AWSS3
AWSSNS
EXAMPLE #2 (Hybrid backend)
Web clients
Mobile clients
Services
AWS API Gateway
AWSLambda
AWSDynamoDB
AWS CloudFront
AWS EC2 AWS EC2
EXAMPLE #3 (Serverless stream processing)
Mobile clients AWS Kinesis Streams
AWSDynamoDB
AWSS3
AWSEMR
AWSLambda
AWSRedshift
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?
MICROSERVICES UTOPIA
MICROSERVICES UTOPIA
“ If you can’t build a modular monolith,what makes you think microservicesis the answer?
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
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!
THANK YOU!