domain design Commons: 4/5

Serverless Computing

Also known as: Function as a Service, FaaS

1. Overview (150-300 words)

Serverless computing is a cloud computing execution model in which the cloud provider runs the server and dynamically manages the allocation of machine resources. Pricing is based on the actual amount of resources consumed by an application, rather than on pre-purchased units of capacity. It is a form of utility computing.

Serverless computing does not mean that there are no servers. It means that the developers and organizations using the serverless platform do not have to manage the servers themselves. This abstraction allows developers to focus on writing code and building applications without worrying about the underlying infrastructure. The core problem that serverless computing solves is the operational overhead of managing servers, including provisioning, scaling, and maintenance. By offloading these responsibilities to a cloud provider, teams can accelerate their development cycles and reduce costs.

The origin of serverless computing can be traced back to the early days of cloud computing. While the concept of abstracting infrastructure has been around for a while, the modern serverless movement gained significant momentum with the launch of Google App Engine in 2008 and was further popularized by the introduction of AWS Lambda in 2014. These platforms provided a new way to build and deploy applications, where code is executed in response to events, and resources are allocated on demand. This event-driven, function-based approach has become a hallmark of serverless computing and has led to the rise of Function-as-a-Service (FaaS) as a dominant serverless model.

2. Core Principles (3-7 principles, 200-400 words)

  1. Abstract Away Servers: The most fundamental principle of serverless computing is the complete abstraction of the underlying server infrastructure. Developers are freed from the tasks of server provisioning, maintenance, and scaling. This allows them to focus solely on writing application code, leading to increased productivity and faster development cycles. The cloud provider is responsible for all aspects of the infrastructure, including operating system updates, security patches, and hardware management.

  2. Event-Driven Execution: Serverless architectures are inherently event-driven. Functions are executed in response to specific triggers or events, such as an HTTP request, a new file being uploaded to storage, a message in a queue, or a change in a database. This asynchronous, event-based model enables the creation of highly decoupled and scalable systems.

  3. Pay-per-Use Billing: With serverless computing, you only pay for the resources you consume. Billing is based on the number of function executions and the duration of their execution, often measured in milliseconds. This pay-per-use model can lead to significant cost savings compared to traditional cloud computing models, where you pay for pre-provisioned resources, even when they are idle.

  4. Automatic and Elastic Scaling: Serverless platforms automatically scale your application in response to demand. If a function needs to handle a large number of concurrent requests, the platform will automatically spin up multiple instances of the function to handle the load. This elastic scaling ensures that your application can handle unpredictable traffic patterns without any manual intervention.

  5. Stateless Functions: Serverless functions are typically designed to be stateless. This means that they do not store any data from one execution to the next. Any persistent data needs to be stored in an external service, such as a database or a storage bucket. This stateless nature is crucial for enabling the automatic scaling and fault tolerance of serverless applications.

3. Key Practices (5-10 practices, 300-600 words)

  1. Function as a Service (FaaS): This is the most common implementation of serverless computing. FaaS allows you to deploy small, single-purpose functions that are triggered by events. Each function is a self-contained unit of code that performs a specific task. For example, a function could be triggered by an HTTP request to process an API call, or by a new image being uploaded to a storage bucket to resize it.

  2. Backend as a Service (BaaS): BaaS providers offer pre-built backend services, such as authentication, databases, and storage, that can be integrated into your applications. This allows you to build applications without having to write any backend code. For example, you could use a BaaS provider to handle user authentication and data storage for a mobile app.

  3. Single-Responsibility Functions: Each serverless function should have a single, well-defined responsibility. This makes the functions easier to understand, test, and maintain. It also promotes reusability, as functions can be composed together to create more complex workflows.

  4. Infrastructure as Code (IaC): Serverless applications should be defined and managed using Infrastructure as Code. This means that all of the resources for your application, such as functions, APIs, and databases, are defined in code. This makes it easy to version, replicate, and share your application’s infrastructure.

  5. API Gateway: An API Gateway acts as the front door for your serverless application. It receives all of the incoming API requests and routes them to the appropriate serverless functions. The API Gateway can also handle tasks such as authentication, rate limiting, and request/response transformation.

  6. Event Sourcing: Event sourcing is a pattern where all changes to an application’s state are stored as a sequence of events. This pattern is a natural fit for serverless architectures, as it allows you to build highly scalable and resilient systems. Each event can trigger a serverless function to update the application’s state.

  7. Distributed Tracing: In a serverless architecture, a single request can trigger a chain of multiple function executions. Distributed tracing allows you to trace the path of a request as it flows through your system. This is essential for debugging and performance monitoring.

4. Application Context (200-300 words)

Serverless computing is best applied in scenarios such as building scalable and cost-effective backends for web and mobile applications, where its event-driven nature excels at handling user requests and processing data in real-time. It is also highly effective for creating powerful data processing pipelines, such as processing data streamed into a data lake or performing ETL (Extract, Transform, Load) operations on large datasets. Furthermore, serverless is well-suited for real-time applications like chat applications, IoT dashboards, and live-streaming platforms, thanks to its low latency and high scalability. Finally, it is a natural fit for microservices-based architectures, as each microservice can be implemented as a set of serverless functions that can be developed, deployed, and scaled independently.

Conversely, serverless computing is not suitable for long-running, stateful applications that require persistent processes, for which a traditional server-based architecture is a better fit. It is also less ideal for applications with predictable, high-volume traffic, as the pay-per-use model can become more expensive than a provisioned server model in those cases.

The pattern can be applied at any scale, from individual developers to multi-organizational ecosystems. It is being used across a wide range of industries, including technology, finance, healthcare, and media. Any industry that is looking to build scalable, cost-effective, and agile applications can benefit from serverless computing.

5. Implementation (400-600 words)

To begin with serverless computing, several prerequisites are necessary. A cloud provider account with a service like AWS, Google Cloud, or Microsoft Azure is required. You must also select a programming language and runtime supported by the chosen platform, with options including Node.js, Python, Go, and Java. Finally, a development environment must be set up with tools for building and deploying serverless applications, such as a code editor, a CLI for the serverless platform, and a management framework like the Serverless Framework or AWS SAM.

Getting started with serverless involves a few key steps. First, choose a serverless platform that aligns with your needs, considering factors like pricing, supported languages, and available services. Next, write a simple “Hello, World!” function to understand the basic concepts of serverless development and deployment, including functions, events, and triggers. Then, use an Infrastructure as Code (IaC) framework to define your application’s resources, such as functions, APIs, and databases, which allows for easy versioning and replication. Finally, deploy your application to the chosen platform using a CLI or a CI/CD pipeline and test it by invoking your functions and APIs.

Several common challenges exist when implementing serverless architectures. Cold starts, the latency that occurs when a function is invoked after a period of inactivity, can be an issue for low-latency applications. This can be mitigated with techniques like provisioned concurrency. Monitoring and debugging are also complex due to the distributed, event-driven nature of serverless applications, but can be addressed with tools like distributed tracing and centralized logging. Vendor lock-in is another concern, as applications can become tightly coupled to a specific cloud provider’s services. This can be mitigated by using open-source frameworks and standards like the Serverless Framework and CloudEvents.

Success with serverless computing depends on several factors. Embracing a “serverless mindset” is crucial, which involves thinking in terms of events, functions, and services rather than servers and infrastructure. It is also advisable to start small and iterate, building a simple application first to learn the fundamentals and avoid common pitfalls. Finally, leveraging managed services for tasks like authentication, databases, and storage can save significant time and effort, allowing developers to focus on core application features.

6. Evidence & Impact (300-500 words)

Several notable companies have successfully adopted serverless computing. Netflix uses it for a wide range of tasks, including media processing, encoding, and security automation, allowing them to handle a massive volume of content and scale their services on demand. Coca-Cola developed a serverless-powered mobile application for their Freestyle soda fountains, enabling touchless ordering and personalized experiences, which resulted in significant cost savings and improved customer engagement. iRobot migrated their IoT platform to a serverless architecture to support their connected Roomba vacuum cleaners, allowing them to scale their platform to handle millions of devices and reduce their operational costs. The Financial Industry Regulatory Authority (FINRA) uses serverless to process and analyze massive volumes of financial market data, enabling them to detect and prevent fraudulent activities in real-time. Major League Baseball (MLB) powers their Statcast player-tracking system with serverless computing, allowing them to deliver real-time statistics and analytics to fans, broadcasters, and teams.

The adoption of serverless computing has led to several documented outcomes. Companies have reported significant cost savings, with Coca-Cola, for example, reducing their annual operational costs by 66% after moving to a serverless architecture. Serverless also enables increased agility, as teams can develop and deploy applications faster by focusing on code rather than infrastructure. Furthermore, serverless applications offer improved scalability, automatically scaling to handle any amount of traffic, which makes them ideal for applications with unpredictable traffic patterns.

Numerous studies and research support the benefits of serverless computing. For instance, a report by MarketsandMarkets predicts that the serverless computing market will grow from $7.6 billion in 2020 to $21.1 billion by 2025. Academic research has also explored the economic and architectural impact of serverless computing, with many studies highlighting its potential to reduce costs and improve developer productivity.

7. Cognitive Era Considerations (200-400 words)

The synergy between serverless computing and artificial intelligence (AI) presents a powerful force for cognitive augmentation. Serverless architectures offer an ideal environment for deploying and scaling AI models, especially for inference tasks. The event-driven nature of serverless enables AI models to be invoked on demand, responding to real-time data streams. This facilitates the creation of intelligent applications that can augment human decision-making across various domains, from healthcare to finance.

In the context of serverless computing, a delicate human-machine balance is essential. While AI and automation can manage many repetitive and data-intensive tasks, the human element remains crucial. Developers are still responsible for designing the overall architecture, writing the business logic, and training the AI models. The developer’s role is evolving from infrastructure management to a focus on data science and application innovation. This collaborative balance allows AI to augment human capabilities, leading to the creation of more intelligent and sophisticated applications.

The evolution outlook for serverless computing points toward greater abstraction and intelligence. We can anticipate the emergence of new serverless platforms tailored for AI and machine learning workloads, with built-in support for tasks like model training, deployment, and monitoring. The rise of “serverless AI” as a new paradigm will likely blur the lines between application code and AI models, further simplifying the development of intelligent applications.

8. Commons Alignment Assessment (v2.0)

1. Stakeholder Architecture: This pattern primarily defines Rights and Responsibilities between the cloud provider (machine/organization) and the developer (human/organization). The provider is responsible for managing the underlying infrastructure, while the developer is responsible for the application code. The rights of other stakeholders like end-users or the environment are not explicitly defined within the pattern, though they are impacted by its implementation.

2. Value Creation Capability: Serverless computing strongly enables collective value creation by abstracting away infrastructure management, allowing developers to focus on innovation and rapid prototyping (knowledge value). It generates significant economic value through its pay-per-use model and operational efficiencies. While the primary focus is on technical and economic value, this efficiency can free up resources to pursue social or ecological goals.

3. Resilience & Adaptability: The pattern is designed for resilience and adaptability, allowing systems to thrive on change. Automatic scaling and the event-driven nature of functions enable applications to handle unpredictable loads and maintain coherence under stress. This inherent elasticity allows systems to adapt to complexity without manual intervention, making them more resilient to changing conditions.

4. Ownership Architecture: Ownership is defined by access and usage rights rather than direct equity in the underlying hardware. The cloud provider owns the physical servers, while the customer has the right to execute functions and process data. This shifts the concept of ownership from capital assets to computational capability, but it does not fundamentally redefine ownership as a broad set of Rights and Responsibilities beyond the service agreement.

5. Design for Autonomy: Serverless computing is exceptionally well-suited for autonomous systems. Its event-driven, stateless, and low-coordination-overhead model is highly compatible with AI agents, DAOs, and other distributed systems. Functions can operate as independent, autonomous agents that respond to triggers from the environment, making it a key enabler for building autonomous value-creation systems.

6. Composability & Interoperability: The pattern is highly composable, as small, single-purpose functions can be combined to build complex applications and workflows. However, interoperability can be a significant challenge. Functions are often dependent on a specific cloud provider’s ecosystem, which can lead to vendor lock-in and make it difficult to combine services across different platforms.

7. Fractal Value Creation: The value-creation logic of serverless computing is fractal in nature. The core principle of executing code in response to events can be applied at various scales, from a single function processing a single event to a complex, globally distributed system handling millions of events. This allows the pattern’s value-creation capabilities to scale seamlessly from small to large systems.

Overall Score: 4 (Value Creation Enabler)

Rationale: Serverless computing is a powerful enabler of collective value creation, providing the architectural foundation for building resilient, adaptable, and autonomous systems. It significantly lowers the barrier to innovation by abstracting away complex infrastructure management, allowing creators to focus on delivering value. While it excels in enabling technical and economic value, its full potential is constrained by issues of vendor lock-in and a narrow definition of stakeholder rights.

Opportunities for Improvement:

  • Develop open standards and tools that promote interoperability between different serverless platforms to mitigate vendor lock-in.
  • Explicitly incorporate the rights and responsibilities of a wider range of stakeholders, including end-users and the environment, into the design of serverless applications.
  • Explore new ownership models that distribute the value created by serverless platforms more equitably among all participants in the ecosystem.

    9. Resources & References (200-400 words)

For those looking to deepen their understanding of serverless computing, several essential reading materials are available. “Serverless Computing: Principles and Paradigms” by Rajalakshmi Krishnamurthi and Paul Fremantle offers a comprehensive overview of the subject, suitable for both beginners and experienced practitioners. “Learn AWS Serverless Computing” by Scott Patterson provides a practical guide to building and deploying serverless applications on AWS, covering a wide range of topics from the basics of AWS Lambda to advanced concepts like security and observability. Additionally, “The Serverless Handbook” by The Serverless Team is a free e-book that offers best practices and real-world applications, making it a valuable resource for CTOs and tech leaders.

Several organizations and communities support the serverless ecosystem. Serverless, Inc., the company behind the popular Serverless Framework, offers a wealth of resources, including a blog, a forum, and a newsletter. The Cloud Native Computing Foundation (CNCF) has a Serverless Working Group dedicated to promoting the adoption of serverless computing and developing open standards.

A variety of tools and platforms are available for serverless development. The Serverless Framework is an open-source tool for building, deploying, and managing serverless applications across multiple cloud providers, including AWS, Azure, and Google Cloud. The AWS Serverless Application Model (SAM) is an open-source framework for building and deploying serverless applications on AWS, offering a simplified syntax for defining resources. Azure Functions is Microsoft’s serverless computing platform, allowing you to run event-triggered code without managing servers. Google Cloud Functions is Google’s serverless platform, enabling you to write and deploy small, single-purpose functions triggered by cloud events.

References

[1] Cloudflare. (n.d.). What is serverless computing?. Retrieved from https://www.cloudflare.com/learning/serverless/what-is-serverless/
[2] Wikipedia. (2023, October 26). Serverless computing. Retrieved from https://en.wikipedia.org/wiki/Serverless_computing
[3] Dashbird. (2021, June 6). History Of Serverless Computing: Where It Started. Retrieved from https://dashbird.io/blog/origin-of-serverless/
[4] AntStack. (2024, January 22). What is a Real-Life Example of Serverless Computing?. Retrieved from https://www.antstack.com/blog/what-is-a-real-life-example-of-serverless-computing/
[5] Amazon Web Services. (n.d.). Case studies - Optimizing Enterprise Economics with Serverless. Retrieved from https://docs.aws.amazon.com/whitepapers/latest/optimizing-enterprise-economics-with-serverless/case-studies.html