Serverless
# Introduction
:::tip
Serverless architecture is a way to build, run applications and services without manage infrastructure. Your application still run on servers, but all server management (hardware and software, bandwidth) is done by service Provider.
:::
# Why use Serverless
# The Advantage and Disadvantage of Serverless
✏️ Reduced time to develop and quicker software release.
✏️ A smaller cost to scale. Developer don’t need to implement code to scale or admin do not need to upgrade existing servers or add additional ones.
✏️ Allow developers to focus on code and to deliver faster.
✏️ Fits with microservices, which can be implemented as functions.
✏️ Charge based on usage => lower prices.
✏️ No need to run at 24/7 (run when have request only).
✏️ Lower operational and development costs.
# The disadvantage of serverless:
✏️ Difficult for debug.
✏️ Performance may be affected.
✏️ Dependency the cloud provider (vender lock-in).
✏️ Limited about time, memories, …
✏️ Security issues.
# Serverless
Serverless divide into two type: BaaS (Backend as a Service) and FaaS (Function as a Service). Serverless is also known as FaaS if not specific.
# BaaS (Back end as a Service)
::: warning BaaS (Back end as a Service): the service that code logic is handles as the client side, the server-side can be use APIs from the third-party. :::
BaaS advantage:
Development speed
Development price
Outsource cloud infrastructure management
BaaS disadvantage:
Less flexibility in comparison to custom coding
Less secure
👉 BaaS use cases: Data management, multimedia, file storage, push notifications, …
# FaaS (Function as a Service)
::: warning Faas (Function as a service): the service that developer deploy code as a function, which can be called by RestAPI. :::
# FaaS advantages:
Do not need to manage server infrastructure
Developer focus more on code logic
Never pay for idle resource
Built in availability
# FaaS disadvantages:
Difficult for debug
Auto-scaling of function calls often means auto-scaling of cost. This can make it tough to gauge your business expenses.
Waiting time for handle higher
👉 FaaS use cases: Web Apps, Backends, Data/stream processing, Chatbots, Scheduled tasks, …
# Popular FaaS provider:
🔸 Azure Functions (Microsoft)
🔸 AWS Lambda Functions (Amazon)
🔸 Google Cloud Functions (Google)