Evolving Applications to
Serverless
25-April-2020
Ankit Sheth
I am Ankit Sheth
Founder, Datavizz
Hello!
@shethankkit
What is
serverless?
Build and run applications without
thinking about servers
Let’s look at the evolution of computing
Physical servers
in
data centers
Virtual
servers in
data centers
Virtual
servers in
the cloud
Each progressive step was better
Physical servers
data centers
Virtual servers
data centers
• Higher utilization
• Faster provisioning speed
• Improved uptime
• Disaster recovery
• Hardware independence
• Trade CAPEX for OPEX
• More scale
• Elastic resources
• Faster speed and agility
• Reduced maintenance
• Better availability and fault
tolerance
Virtual servers
in the cloud
But there are still limitations
Physical servers
data centers
Virtual servers
data centers
• Trade CAPEX for OPEX
• More scale
• Elastic resources
• Faster speed and agility
• Reduced maintenance
• Better availability and fault
tolerance
• Still need to administer
virtual servers
• Still need to manage
capacity and utilization
• Still need to size
workloads
• Still need to manage
availability, fault tolerance
• Still expensive to run
intermittent jobs
Virtual servers
in the cloud
Evolving
to serverless
SERVERLESS
Virtualservers
in the cloud
Physical servers
in data centers
Virtualservers
in data centers
Serverless changes how you deliver
Speeds
up time to
market
Dedicated
time to
innovation
Increases developer
productivity
Eliminates
operational complexity
Chatbots
• Powering
chatbot logic
• Alexa Skills for
Amazon Echo
Common use cases
Web applications
• Static
websites
• Dynamic
web apps
• Packages for
Flask and
Express
Backends
• Apps &
services
• Mobile
• IoT
</>
Media &
Log Processing
• Real-time data
• Streaming
data
Big Data
• MapReduce
• Batch
How to migrate
to serverless?
Monolith Applications
Monolith V/S Microservices
vs
Straightforward Migration?
Webserver
Data AccessService
App service
Visualization
Service
Lambda
function
How do we get there?
Deploy
Develop
Design
Visualization
Service
App Service
Database
Amazon
S3
Amazon
DynamoDB
AWS
Lambda
AmazonAPI
Gateway
• State?
• Compute?
• API?
• Storage?
• Security?
• Managed?
• Estimatedscale?
• Others
Where do we start? Design
Data Access
Service
Web Service
Rough Architecture - Design
Data stored
in Amazon
DynamoDB
Dynamic
content in
AWS Lambda
Amazon
API Gate
way
Browser
Amazon
CloudFront
Amazon
S3
Steps to Follow - Design
• Create a mind map of services
• Start with low risk, non-business critical modules
• Migrate incrementally to a newer stack with enough time for stability
• Services should have clear bounderies
• Every service should have its own data to work upon
How to Develop?
• How to manage codebase?
• Which tools to use?
How to manage codebase?
• Should I have one repo/ one service?
• Or should I have one repo for all my services?
How to start development?
Which tools/frameworks to use?
Steps to Follow - Develop
• Stick to the language you have in-house expertise upon
• Equip the developers with Microservices mindset
• Standardise the tools that you would be using for development
• Stick to one framework and evolve your expretise in it.
• Keep the functions simple and "Single-Purposed"
How to Deploy?
Aspects to cover
• Deployment Framework
• CI Tools
• Monitoring
Deployment Frameworks
CI Tools
Monitoring Tools
Tier Spec Monthly Cost
Load
Balancer
1x $18.30
Application
Server
1 X t2 micro $9.52
Database
Server
1 X t2 micro
100 GB
$23.95
Total Monthly $51.77
Tier Spec Monthly Cost
Load
Balancer
1x $18.30
Application
Server
2 X m4 large $121.18
Database
Server
2 X m4 large
100 GB
$198.93
Total Monthly $320.11
“DevelopmentGrade” Stack “Production Grade” Stack
What Does it cost now?
What Does it cost with
Serverless?
Assumption Unit
TotalPages/Day 10
Avg. Size of Page 200 kb
API
Requests/Page
5
Avg. Size of API
Req.
4 Kb
DB Ops Per Req 2 1r/1w
Storage (per
month)
500 kb
Tier Monthly Cost
Cloud Front Data Transfer 0.0051$
Cloud Front Request Pricing 0.0003
S3 Request Pricing 0.00102$
S3 DataTransfer 0.004345$
API GW DataTransfer 0.00054$
Lambda Request Pricing 0.0003
Lambda Duration Cost 0.000312
Dynamo DB IO Pricing 0
Dynamo DB Storage 0.000125
Total Monthly Cost/User $0.017282
Imagine the following daily customer
usage pattern:
Cost Per User/Month:
Thanks!
Any Questions?
You can find us at ahmedabad@serverlessdays.io

Evolving applications-to-serverless

  • 1.
  • 2.
    I am AnkitSheth Founder, Datavizz Hello! @shethankkit
  • 3.
    What is serverless? Build andrun applications without thinking about servers
  • 4.
    Let’s look atthe evolution of computing Physical servers in data centers Virtual servers in data centers Virtual servers in the cloud
  • 5.
    Each progressive stepwas better Physical servers data centers Virtual servers data centers • Higher utilization • Faster provisioning speed • Improved uptime • Disaster recovery • Hardware independence • Trade CAPEX for OPEX • More scale • Elastic resources • Faster speed and agility • Reduced maintenance • Better availability and fault tolerance Virtual servers in the cloud
  • 6.
    But there arestill limitations Physical servers data centers Virtual servers data centers • Trade CAPEX for OPEX • More scale • Elastic resources • Faster speed and agility • Reduced maintenance • Better availability and fault tolerance • Still need to administer virtual servers • Still need to manage capacity and utilization • Still need to size workloads • Still need to manage availability, fault tolerance • Still expensive to run intermittent jobs Virtual servers in the cloud
  • 7.
    Evolving to serverless SERVERLESS Virtualservers in thecloud Physical servers in data centers Virtualservers in data centers
  • 8.
    Serverless changes howyou deliver Speeds up time to market Dedicated time to innovation Increases developer productivity Eliminates operational complexity
  • 9.
    Chatbots • Powering chatbot logic •Alexa Skills for Amazon Echo Common use cases Web applications • Static websites • Dynamic web apps • Packages for Flask and Express Backends • Apps & services • Mobile • IoT </> Media & Log Processing • Real-time data • Streaming data Big Data • MapReduce • Batch
  • 10.
    How to migrate toserverless?
  • 11.
  • 12.
  • 13.
    Straightforward Migration? Webserver Data AccessService Appservice Visualization Service Lambda function
  • 14.
    How do weget there? Deploy Develop Design
  • 15.
    Visualization Service App Service Database Amazon S3 Amazon DynamoDB AWS Lambda AmazonAPI Gateway • State? •Compute? • API? • Storage? • Security? • Managed? • Estimatedscale? • Others Where do we start? Design Data Access Service Web Service
  • 16.
    Rough Architecture -Design Data stored in Amazon DynamoDB Dynamic content in AWS Lambda Amazon API Gate way Browser Amazon CloudFront Amazon S3
  • 17.
    Steps to Follow- Design • Create a mind map of services • Start with low risk, non-business critical modules • Migrate incrementally to a newer stack with enough time for stability • Services should have clear bounderies • Every service should have its own data to work upon
  • 18.
    How to Develop? •How to manage codebase? • Which tools to use?
  • 19.
    How to managecodebase? • Should I have one repo/ one service? • Or should I have one repo for all my services?
  • 20.
    How to startdevelopment?
  • 23.
  • 24.
    Steps to Follow- Develop • Stick to the language you have in-house expertise upon • Equip the developers with Microservices mindset • Standardise the tools that you would be using for development • Stick to one framework and evolve your expretise in it. • Keep the functions simple and "Single-Purposed"
  • 25.
  • 26.
    Aspects to cover •Deployment Framework • CI Tools • Monitoring
  • 27.
  • 28.
  • 29.
  • 30.
    Tier Spec MonthlyCost Load Balancer 1x $18.30 Application Server 1 X t2 micro $9.52 Database Server 1 X t2 micro 100 GB $23.95 Total Monthly $51.77 Tier Spec Monthly Cost Load Balancer 1x $18.30 Application Server 2 X m4 large $121.18 Database Server 2 X m4 large 100 GB $198.93 Total Monthly $320.11 “DevelopmentGrade” Stack “Production Grade” Stack What Does it cost now?
  • 31.
    What Does itcost with Serverless? Assumption Unit TotalPages/Day 10 Avg. Size of Page 200 kb API Requests/Page 5 Avg. Size of API Req. 4 Kb DB Ops Per Req 2 1r/1w Storage (per month) 500 kb Tier Monthly Cost Cloud Front Data Transfer 0.0051$ Cloud Front Request Pricing 0.0003 S3 Request Pricing 0.00102$ S3 DataTransfer 0.004345$ API GW DataTransfer 0.00054$ Lambda Request Pricing 0.0003 Lambda Duration Cost 0.000312 Dynamo DB IO Pricing 0 Dynamo DB Storage 0.000125 Total Monthly Cost/User $0.017282 Imagine the following daily customer usage pattern: Cost Per User/Month:
  • 32.
    Thanks! Any Questions? You canfind us at ahmedabad@serverlessdays.io