Serverless
( … ) Serverless
Serverless?
Not having to think about servers
Serverless is
• BaaS (Backend as a Service)
• FaaS (Function as a Service)
Serverless
Serverless was 1st used to describe
applications that significantly or fully depend
on 3rd party applications / services (‘in the
cloud’) to manage server-side logic and state.
BaaS
BaaS
• Analytics
• Cloud Messaging
• Authentication
• Realtime Database
• Cloud Storage
• Notification
BaaS : Firebase
AWS Mobile
Serverless can also mean applications where
some amount of server-side logic is still
written by the application developer
but unlike traditional architectures is run in
stateless compute containers that are event-
triggered, ephemeral(may only last for one
invocation), and fully managed by a 3rd party.
FaaS
running back end code without managing
your own server systems or your own server
applications.
FaaS
FaaS
BaaS & FaaS
BaaS & FaaS
Cloud evolution
What’s different?
Applications / Services
A lightweight, event-based, asynchronous compute
solution that allows you to create small, single-
purpose functions that respond to cloud events
without the need to manage a server or a runtime
environment.
Infrastructure
• Fully-managed by vendor
• Without managing server system / applications
• Functions
• AWS Lambda: JS, Python, JVM lang, C#
• Deploy
• BYOC: bring your own code. ZIP or code in console
• Scaling
• Request based automatically
• Trigger by events
• Defined by vendors: eg AWS S3, CloudWatch,
Message Queue
• Http/s requests: eg. API Gateway, Webtask
Traffic pattern
Architecture
• Stateless Function
• API gateway
• Event-driven Architecture
Stateless functions : 1st version
Stateless functions : 1st version
All 3 operations are scaled based on the overall load
across them, and state is transferred in-memory,
creating complication around caching and/or routing
sessions to instances in order to maintain state.
Stateless functions : 2nd version
Stateless functions : 2nd version
Each function scales individually and as-needed.
All state is in DynamoDB so there is no cluster
coordination of any sort, at the cost of a small
increase in latency.
Stateless functions
• Processes are stateless and share-nothing
• Any data that needs to persist must be stored
in a stateful backing service, typically a DB.
Stateless functions - Benefits
• Reduce operational costs
• Infrastructure cost: without pay as it is idle
• People cost: focus on function development
• Reduce development cost
• BaaS: eg. Firebase, Auth0
• Spend development time on business-specific
code
• Maximize iterations
• Minimize dependences: IT Ops, DBAs
• Easier Operational management
• Scaling benefits of FaaS
• Reduced packaging complexity
API Gateway
• HTTP server where routes / endpoints are
defined in configuration and each route is
associated with a FaaS function.
• perform authentication, input validation,
response code mapping, etc.
API Gateway
• Encapsulates the internal structure of the
application.
• Reduces the number of round trips between
the client and application.
• Simplifies the client
Event Driven Architecture
• Scale: it enables the implementation of
transactions that span multiple services and
provide eventual consistency.
• Materialized view: It enables an application to
maintain a data store that contains the result of
a query. It may be a join result or a summary
using an aggregate function.
CQRS
Command Query Responsibility Segregation
1. fabric
• 인프라 리소스가 환경에 따라 빠르게 동적으로 구성, 혹은 재배
치될 수 있도록 최적화된 서버, 네트워크, 스토리지의 묶음.
• RTI(Real-Time Infrastruncture)
• 개발자가 운영 신경 쓰지 않고 개발 코딩 자체에 집중.
2. framework
• 이벤트 기반 프로그래밍 모델에 기반한 코드 생성.
• 대량 입출력 애플리케이션(ex : IoT)에 적합
• 작성된 코드의 인과를 관리.
3. function layer
• 애플리케이션 조합/빌드를 위한 패키지, 패턴, 참조 아키텍처
제공.
• 원하는 출력을 얻기 위한 로직과 인텔리전스가 있는 곳.
Serverless Architecture
AWS Lambda 예
Cloud 비교(1)
Category AWS Lambda Azure Functions Google Cloud Functions
Version Production ready Preview - Beta Closed Alpha
Support Lang Nodejs, Python, Java, C# Nodejs, Python, PHP, F#, C# Javascript
Dependency
Management
Compile all external packages
and zip the source code
Using
package.json – node.js
project.json – F#, C#
Using package.json
Event Source S3, DynamoDB
Kinesis
Streams
SNS, SES
Cognito
Cloud Formation
Cloud Watch
Code Commit
Scheduled Events
Config
Echo
Alexa
API Gateway
Bindings/Triggers
Scheduler
Http(webhook)
Azure Storage
Events Hubs
Queues, Tables
DocumentDB(No-sql)
Notification Hub
Twilio
HTTP functions :
Http Triggers
Webhooks (drive, gmail, calend
ar)
Background functions :
Cloud Pub/Sub, Cloud Storage
Pub/Sub :
Cloud Logging
Gmail, Twilio
Architecture On top of Linux
Memory allocated per function
On top of Windows
Memory allocated per app service
Not Specified
Cloud 비교(2)
Category AWS Lambda Azure Functions Google Cloud Functions
Persistent Storage No persistent storage
Completely Stateless
Env variables can be set
in App services which can be
used in functions.
Not Specified
HTTP Endpoint API Gateway HTTP Webhooks HTTP Trigger
Maximum Execution
Time per request
300 seconds 300 sec max runtime per func
tion invocation
No limit
Deployment Zip upload to Lambda/s3, Server
less Framework
Git, dropbox, visual studio,
One drive, Kudu Console
Zip upload, Cloud Storage,
Cloud Source repositories,
Git
Maximum no. of
Functions
No limit Not Specified 20 functions per project
Concurrent executions 100 parallel executions
per account per region
but users can increase it
No limit No limit
Pricing Request Charges :
$0.20 / 1M requests
Compute Charges :
$0.00001667 / GB-s
Request Charges :
$0.20 / 1M requests
Compute Charges :
$0. 000008 / GB-s
Unknown until Open beta
Concurrent Executions 100 parallel Executions,
but Can be increased
10 instances which is several
100 executions
Not Specified
Reference
• Serverless: The next step in cloud computing’s evolution
• http://netformation.com/your-it-reality/serverless-the-next-step-
in-cloud-computings-evolution
• (번역) 서버리스 아키텍처
• http://blog.aliencube.org/ko/2016/06/23/serverless-
architectures/
• Serverless by Young Yang (Slideshare)
• https://www.slideshare.net/young.yang/serverless-
73008636Reduced packaging complexity
• 기타 볼만한 …
• Technical Introduction to AWS Lambda - Serverless
Compute on AWS
• https://www.youtube.com/watch?v=QzipnZzAQEk
• 개발자들이 말하는 AWS 기반 ‘서버 없는 아키텍처’
• https://aws.amazon.com/ko/blogs/korea/serverless-
architecture-by-korean-developers/

Serverless Architecture

  • 1.
  • 2.
    ( … )Serverless Serverless?
  • 3.
    Not having tothink about servers Serverless is
  • 4.
    • BaaS (Backendas a Service) • FaaS (Function as a Service) Serverless
  • 5.
    Serverless was 1stused to describe applications that significantly or fully depend on 3rd party applications / services (‘in the cloud’) to manage server-side logic and state. BaaS
  • 6.
  • 7.
    • Analytics • CloudMessaging • Authentication • Realtime Database • Cloud Storage • Notification BaaS : Firebase
  • 8.
  • 9.
    Serverless can alsomean applications where some amount of server-side logic is still written by the application developer but unlike traditional architectures is run in stateless compute containers that are event- triggered, ephemeral(may only last for one invocation), and fully managed by a 3rd party. FaaS
  • 10.
    running back endcode without managing your own server systems or your own server applications. FaaS
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
    Applications / Services Alightweight, event-based, asynchronous compute solution that allows you to create small, single- purpose functions that respond to cloud events without the need to manage a server or a runtime environment.
  • 17.
    Infrastructure • Fully-managed byvendor • Without managing server system / applications • Functions • AWS Lambda: JS, Python, JVM lang, C# • Deploy • BYOC: bring your own code. ZIP or code in console • Scaling • Request based automatically • Trigger by events • Defined by vendors: eg AWS S3, CloudWatch, Message Queue • Http/s requests: eg. API Gateway, Webtask
  • 18.
  • 19.
    Architecture • Stateless Function •API gateway • Event-driven Architecture
  • 20.
  • 21.
    Stateless functions :1st version All 3 operations are scaled based on the overall load across them, and state is transferred in-memory, creating complication around caching and/or routing sessions to instances in order to maintain state.
  • 22.
  • 23.
    Stateless functions :2nd version Each function scales individually and as-needed. All state is in DynamoDB so there is no cluster coordination of any sort, at the cost of a small increase in latency.
  • 24.
    Stateless functions • Processesare stateless and share-nothing • Any data that needs to persist must be stored in a stateful backing service, typically a DB.
  • 25.
    Stateless functions -Benefits • Reduce operational costs • Infrastructure cost: without pay as it is idle • People cost: focus on function development • Reduce development cost • BaaS: eg. Firebase, Auth0 • Spend development time on business-specific code • Maximize iterations • Minimize dependences: IT Ops, DBAs • Easier Operational management • Scaling benefits of FaaS • Reduced packaging complexity
  • 26.
    API Gateway • HTTPserver where routes / endpoints are defined in configuration and each route is associated with a FaaS function. • perform authentication, input validation, response code mapping, etc.
  • 27.
    API Gateway • Encapsulatesthe internal structure of the application. • Reduces the number of round trips between the client and application. • Simplifies the client
  • 28.
    Event Driven Architecture •Scale: it enables the implementation of transactions that span multiple services and provide eventual consistency. • Materialized view: It enables an application to maintain a data store that contains the result of a query. It may be a join result or a summary using an aggregate function.
  • 29.
  • 30.
    1. fabric • 인프라리소스가 환경에 따라 빠르게 동적으로 구성, 혹은 재배 치될 수 있도록 최적화된 서버, 네트워크, 스토리지의 묶음. • RTI(Real-Time Infrastruncture) • 개발자가 운영 신경 쓰지 않고 개발 코딩 자체에 집중. 2. framework • 이벤트 기반 프로그래밍 모델에 기반한 코드 생성. • 대량 입출력 애플리케이션(ex : IoT)에 적합 • 작성된 코드의 인과를 관리. 3. function layer • 애플리케이션 조합/빌드를 위한 패키지, 패턴, 참조 아키텍처 제공. • 원하는 출력을 얻기 위한 로직과 인텔리전스가 있는 곳. Serverless Architecture
  • 31.
  • 32.
    Cloud 비교(1) Category AWSLambda Azure Functions Google Cloud Functions Version Production ready Preview - Beta Closed Alpha Support Lang Nodejs, Python, Java, C# Nodejs, Python, PHP, F#, C# Javascript Dependency Management Compile all external packages and zip the source code Using package.json – node.js project.json – F#, C# Using package.json Event Source S3, DynamoDB Kinesis Streams SNS, SES Cognito Cloud Formation Cloud Watch Code Commit Scheduled Events Config Echo Alexa API Gateway Bindings/Triggers Scheduler Http(webhook) Azure Storage Events Hubs Queues, Tables DocumentDB(No-sql) Notification Hub Twilio HTTP functions : Http Triggers Webhooks (drive, gmail, calend ar) Background functions : Cloud Pub/Sub, Cloud Storage Pub/Sub : Cloud Logging Gmail, Twilio Architecture On top of Linux Memory allocated per function On top of Windows Memory allocated per app service Not Specified
  • 33.
    Cloud 비교(2) Category AWSLambda Azure Functions Google Cloud Functions Persistent Storage No persistent storage Completely Stateless Env variables can be set in App services which can be used in functions. Not Specified HTTP Endpoint API Gateway HTTP Webhooks HTTP Trigger Maximum Execution Time per request 300 seconds 300 sec max runtime per func tion invocation No limit Deployment Zip upload to Lambda/s3, Server less Framework Git, dropbox, visual studio, One drive, Kudu Console Zip upload, Cloud Storage, Cloud Source repositories, Git Maximum no. of Functions No limit Not Specified 20 functions per project Concurrent executions 100 parallel executions per account per region but users can increase it No limit No limit Pricing Request Charges : $0.20 / 1M requests Compute Charges : $0.00001667 / GB-s Request Charges : $0.20 / 1M requests Compute Charges : $0. 000008 / GB-s Unknown until Open beta Concurrent Executions 100 parallel Executions, but Can be increased 10 instances which is several 100 executions Not Specified
  • 34.
    Reference • Serverless: Thenext step in cloud computing’s evolution • http://netformation.com/your-it-reality/serverless-the-next-step- in-cloud-computings-evolution • (번역) 서버리스 아키텍처 • http://blog.aliencube.org/ko/2016/06/23/serverless- architectures/ • Serverless by Young Yang (Slideshare) • https://www.slideshare.net/young.yang/serverless- 73008636Reduced packaging complexity • 기타 볼만한 … • Technical Introduction to AWS Lambda - Serverless Compute on AWS • https://www.youtube.com/watch?v=QzipnZzAQEk • 개발자들이 말하는 AWS 기반 ‘서버 없는 아키텍처’ • https://aws.amazon.com/ko/blogs/korea/serverless- architecture-by-korean-developers/