ContainerDayVietnam2016: Serverless & Current Trends

19

Click here to load reader

Transcript of ContainerDayVietnam2016: Serverless & Current Trends

Page 1: ContainerDayVietnam2016: Serverless & Current Trends

Serverless & current trends VIETPH

Page 2: ContainerDayVietnam2016: Serverless & Current Trends

Outline

Some History Background

What is Serverless

Serverless in AWS

Why serverless?

How serverless?

Prediction: Future is (mostly) serverless

Page 3: ContainerDayVietnam2016: Serverless & Current Trends

*** as a service

Container as a Service

Provide container as a service

(Or running container on top of IaaS)

Function as a Service

Provide function as a service

IaaS

Provide VM as a service PaaS

Provide Platform as a service

SaaS

Provide Software as a service Traditional

Cloud

When we

add

Container

DevOps,

Microservice

When we

add

Function

NoLessOps,

Nanoservice

Page 4: ContainerDayVietnam2016: Serverless & Current Trends

How serverless was born

People ask AWS: “I use S3 to store image files and

generate icons. Do I need to manage a cluster of virtual

machines for that? We just want some place to run

code”

AWS: “OK, we give you Lambda”. And serverless is born.

Every big public cloud now has their own serverless

offering: IBM OpenWhisk, AWS Lambda, Azure Function,

Google Cloud Function

Page 5: ContainerDayVietnam2016: Serverless & Current Trends

How serverless was born

Pet vs Cattle vs Herd

Hardware becomes invisible, there’s only the

application.

Page 6: ContainerDayVietnam2016: Serverless & Current Trends

What is Serverless?

Serverless means “No server”

Serverless is a software architecture style

In serverless, you write applications that run without

any traditional servers or VMs

Serverless code can be triggered to run from

service events (e.g. a Lambda code which run

every time a new file is inserted into S3 bucket)

Page 7: ContainerDayVietnam2016: Serverless & Current Trends

Serverless as the “glue”

Serverless has two main purposes

Act as glues to stick together other public cloud service

A place to quickly run your code in a elastic, scalable, highly available way

Serverless is applicable for many scenarios: Serverless web site, back end processing

Page 8: ContainerDayVietnam2016: Serverless & Current Trends

Is serverless the same as PaaS?

PaaS: Run code without managing underlying server

Microsoft Azure: Web Role and Worker Role

Google App Engine

Heroku

Traditional PaaS was not serverless

Unit of execution

Complexity

Pricing

Page 9: ContainerDayVietnam2016: Serverless & Current Trends

Normal web application with EC2

Web Server ELB Dynamo

DB Route53

Static Content

AutoScaling Group

Browser

Is it perfect?

Page 10: ContainerDayVietnam2016: Serverless & Current Trends

Normal web application with EC2

Web Server ELB Dynamo

DB Route53

Static Content

AutoScaling Group

Browser

No it is not perfect!

• Needs at least

two instances to

ensure 99.95%

availability

• Lower utilization

• Must manage

server, OS

(monitoring,

patching,

logging,…)

Page 11: ContainerDayVietnam2016: Serverless & Current Trends

How about that?

• ECS runs in EC2

• Still needs at

least two

instances to

ensure 99.95%

availability

• Better utilization

• Must still manage

server, OS

(monitoring,

patching,

logging,…), but

less work with

Docker

Web Server

ECS ELB Dynamo

DB Route53

Static Content

AutoScaling Group

Browser

With ECS

Page 12: ContainerDayVietnam2016: Serverless & Current Trends

With Lambda

Dynamo

DB

API

Gateway

Static Content

Browser Lambda

• Automatically

triggered – No

need to maintain

two EC2s running

all time

• Best utilization

• Cheaper in many

circumstances

(e.g. rarely visited

web site)

Page 13: ContainerDayVietnam2016: Serverless & Current Trends

Sample Code

Page 14: ContainerDayVietnam2016: Serverless & Current Trends

So why serverless?

Advantages:

To maintain no server is easier than to maintain some

servers

Less thing to manage is generally a good thing

Higher utilization

Lower cost (in many circumstances)

Simpler design due to integration with other cloud

services

Modern best practice: Micro/nanoservice, DevOps…

Page 15: ContainerDayVietnam2016: Serverless & Current Trends

So why (not) serverless?

Disadvantages:

Lock-in (somewhat remediated by framework such as

Serverless)

Limits (e.g. 5 minute processing time, only natively

support Go)

New technology, so the ecosystem around serverless is

not mature

Page 16: ContainerDayVietnam2016: Serverless & Current Trends

How do we apply serverless?

Design an application to use cloud backend as a

services (e.g. Kinesis, Aurora,…)

Use cloud function as a services to glue those backend

together

Large number of serverless functions will require a

framework

Stateless, Microservice, Nanoservice, DevOps/NoOps

Page 17: ContainerDayVietnam2016: Serverless & Current Trends

How do we apply serverless? (cont.)

Serverless means stateless

Time is money precompile and optimize your code

Can leverage existing artifacts, but don’t count on their

existence

End graciously

Use alias and versioning

Page 18: ContainerDayVietnam2016: Serverless & Current Trends

Is the future serverless?

Yes

Page 19: ContainerDayVietnam2016: Serverless & Current Trends

Appendix

• http://docs.aws.amazon.com/l

ambda/latest/dg/getting-

started.html

• https://aws.amazon.com/blogs

/compute/category/aws-

lambda/

• http://www.allthingsdistributed.

com/2016/06/aws-lambda-

serverless-reference-

architectures.html