link: Architectural Patterns

Serverless Architecture Pattern

Diagram

Overview

Pay As You Go Serverless architecture, also known as Function-as-a-Service (FaaS), is a cloud computing execution model where the cloud provider dynamically manages the allocation and provisioning of servers. The developers write and deploy code in the form of functions, and the infrastructure concerns are handled by the cloud provider, enabling developers to focus solely on individual functions in their applications.

Key Features of Serverless Architecture

  • Event-Driven Pattern: Typically, applications are built around events, with the serverless provider executing the function code in response to requests or events.
  • Scalability: Automatic scaling is a cornerstone of serverless architecture. The function can scale automatically depending on the number of requests, from a few to several thousand without intervention.
  • Micro-billing: Users are charged based on the actual amount of resources consumed by an application, rather than pre-purchased capacity.

How Serverless Works

In serverless architectures, developers deploy small snippets of code (functions), which are executed in response to events such as HTTP requests, database events, queue operations, or file uploads. The serverless platform automatically handles the deployment, scaling, and management of the infrastructure required to execute the code.

Pros/Cons

Conclusion

Serverless architecture offers a compelling model for certain types of applications, particularly those with variable workloads and those that require rapid development. It can lead to significant cost savings and productivity gains but requires careful consideration of potential drawbacks such as vendor lock-in and testing complexity.