QCon 2018 Shanghai - Serverless and AWS Lambda Service

Below content is shared by QCon上海2018|全球软件开发大会
You can download the PPT from: 大会演讲PPT合集

To be honest, you can find everything in AWS Lambda home page:
AWS Lambda云计算服务介绍_如何使用AWS Lambda-AWS云服务

What is Serverless? Serverless let you run code without thinking about servers. You don’t need to manage your physical server anymore. You can easily have a good scalability, high availability and fault tolerance. And pay only for the compute time you consume. And this features let you.

Running code without thinking about servers

If you use AWS Lambda service, you don’t need to maintains your physical machine anymore. What you need to do, is to upload to code block(which we also call it lambda) to AWS, and AWS will run your code when a request comes in.

Scalability

A lambda is a piece of code than runs independently. So there is no double that you can scale up your service by running hundreds of, thousands of or billions of lambdas simultaneously, to serve your successful business. Scaling up/down is an automatic process therefore you only need focus on your own business.

High Availability and Fault Tolerance

Same reason as above, serverless gives your an architecture with high availability and fault tolerance.

Paying only for the compute time you consume

The money you pay depends on the duration your lambda runs. It significantly cuts down your cost. And you can manage your cost much clearly. You can understand which function consumes most of your money. And you can have the visibility to your code improvement. Because if you reduce your request processing time from 10s to 5s, you only need to pay half of the bill.

How a Lambda Run

Running a lambda in AWS is trivial. Write the code in your computer, upload to AWS, set a HTTP url, that’s it.

Event Driven

A lambda is triggered by every single HTTP request. This is a so-called event driven architecture. It also means the integration with other services is easy.

Step Function

Things can become complicated if your lambda workflow grows. Try to image that your service is constructed by 10 or 15 lambdas and there are 4 or 5 if-else logic. This would not be an easy job to develop and maintain.

This is the reason why we have AWS Step Function.
AWS Step Functions可视化工作流服务_分布式应用调节-AWS云服务

The weaknesses

First thing need to highlight here, is that severless is not prefect solution and you can’t really say serverless is the future. So above words introduces what’s good for serverless and now it’s time to tell you what serverless can’t do.

Firstly, a time-sensitive service can’t be served by serverless(as they’re driven by HTTP API).

Secondly, cold start issue. When the first time a lambda is called, AWS need to download your scripts, build the environment you need, then run it. So at this moment you have to warn up your service by ourselves if this is not acceptable for you or your business.

Thirdly, your lambda can’t run for long. It’s not a limitation and a technical issue for AWS Lambda Service. It’s about the cost performance. If your program need to run 24 hours, holding an EC2 instance costs you less.

And the last, we do need more a more third party services adapt to serverless which we don’t have right now.