Serverless deployment uses the principle of deployment structure that hides any concept of servers. The infrastructure takes the service’s code and runs it. You are charged for each request based on the resources consumed. This pattern is highly used in microservices architecture.
AWS Lambda, Google Cloud Functions and Azure functions provide serverless deployment environments. To deploy the service, you package the code (e.g. ZIP file), upload it to the deployment infrastructure and describe the desired performance characteristics.
Why to use?
- It is elastic, can scale up or down to meet the required traffic.
- Pay for each request rather than provisioning resources that may be under utilized.
- Removes the management of low-level infrastructure. Developers can focus on code.
When not to use?
- Use cases when application must start quickly - Serverless deployment takes time to start up.
- Limited input sources - Serverless deployments environments are still developing and requests are limited to a set of input sources.
- Risk of high latency - Time for the infrastructure to provision an instance for your function and function to initialize might result in significant latency.