How to implement a serverless architecture on Azure - Part 2

In the introduction to this series, we've used some technical buzzword; it's time now to delve into them a bit more.

Disclaimer

The definitions provided here are our own and are not at all official. We aim to offer interpretations that align with the context. Don't be concerned if some concepts don't precisely align with your usual understanding.

What is a cloud platform and what is Azure ?

A cloud platform, often referred to as a cloud computing platform, is a comprehensive and integrated environment for developing, deploying, and managing applications and services in the cloud. It provides a set of infrastructure, services, and tools that allow individuals and organizations to build, host, and scale software applications without the need to invest in and maintain physical hardware and data centers. These platforms emerged in the late 2000s and revolutionized software development by simplifying provisioning and resource deployment.

Key features of a cloud platform

  • Cloud platforms offer the ability to scale resources up or down as needed, ensuring applications can handle varying workloads efficiently.
  • Cloud platforms typically operate on a pay-as-you-go or subscription-based model, reducing the need for large upfront capital investments. Users pay only for the resources they consume.
  • Many cloud platforms have data centers and availability zones in multiple regions around the world, enabling global reach and low-latency access to users.
  • Cloud platforms offer a range of managed services, such as databases, AI/ML tools, content delivery networks (CDNs), and more, to simplify application development and management.
  • Cloud providers invest heavily in security and compliance measures, making it easier for users to build secure and compliant applications.

Azure from Microsoft is one of the most popular cloud platforms with Amazon Web Services (AWS), Google Cloud Platform (GCP), IBM Cloud, and others. Microsoft Azure is designed to support the development, deployment, and management of applications and services, providing scalable and flexible cloud computing resources and hence is a perfect candidate to implement a serverless architecture.

What is a traditional monolithic application ?

A traditional monolithic application is a software architecture design where an entire application is built as a single, self-contained unit. In such applications, all the components and functions are tightly integrated into a single codebase, and they share the same database and resources. Monolithic applications are often characterized by their lack of separation into smaller, independently deployable modules or services.

Key features of traditional monolithic applications

  • There is a single codebase: all the application's code, including user interfaces, business logic, and data access layers, resides in one place.
  • The database is shared: monolithic applications typically use a single, centralized database for storing all data, and this database is accessed by all parts of the application.
  • Coupling is quite tight: components and modules within the application are tightly coupled, meaning that changes in one part of the application can have ripple effects throughout the entire system.
  • Monolithic applications usually use a single technology stack, limiting the ability to use different programming languages or technologies for specific tasks.
  • Deployment can be a real challenge: large monolithic codebases can be incredibly hard to develop and maintain, and deploying updates or fixes is often risky, error-prone and time-consuming.

That’s being said and despite the derogatory name they are given, traditional monolithic applications still have their own set of advantages in certain scenarios. Here are some of them:

  • They are often simpler to develop and initially deploy. They require fewer moving parts, making them a suitable choice for smaller projects or when time-to-market is critical.
  • The single codebase and tightly coupled components can make it easier for developers to work on the application because they have a complete view of the entire system. This can lead to faster development in some cases.
  • Testing a monolithic application can be more straightforward since all components are closely integrated. This makes it easier to perform end-to-end testing and ensure the application works as a whole.
  • Debugging a monolithic application is often easier, as you can trace issues through the entire codebase without worrying about inter-service communication.
  • Having a single, centralized database can simplify data management and transactions, making it easier to maintain data consistency.

Nonetheless, while monolithic architectures were once the standard for software development, they have several drawbacks, especially in today's fast-paced, dynamic software landscape. As applications grow in complexity and scale, they can become difficult to manage and update. This led to the emergence of alternative architectural patterns, such as microservices and serverless, which offer more flexibility, scalability, and ease of maintenance by breaking down the application into smaller, independently deployable components.

The following picture can effectively illustrate a traditional monolithic architecture.

What is a monolithic architecture ?

What are microservices ?

Microservices are a software architectural approach that structures an application as a collection of small, independent, and loosely coupled services. Instead of building a monolithic application where all functionalities are tightly integrated into a single codebase, microservices break down the application into a set of discrete services that can run independently. Each microservice is responsible for a specific and well-defined piece of functionality, and they communicate with each other through APIs or other lightweight protocols.

Key features of microservices

  • Each microservice operates independently, with its own database (if needed) and development team. This independence allows for technology stack flexibility and makes it easier to scale and deploy individual services.
  • Microservices communicate through well-defined APIs, which promotes loose coupling between services. Changes in one service shouldn't impact others as long as the API remains consistent.
  • Because microservices are independent units, you can scale them individually based on their specific resource needs. This results in more efficient resource utilization.
  • Each microservice can be developed using the best-suited technology stack for its specific task. This flexibility allows for the use of different programming languages and databases within the same application.
  • Microservices are well-suited for continuous integration and continuous delivery (CI/CD) practices, which enable rapid development and deployment.
  • Microservices architecture is particularly popular in modern application development, as it aligns well with the demands of scalability, flexibility, and rapid development cycles. However, it also introduces challenges related to service orchestration, inter-service communication, and managing a larger number of services, which need to be addressed to fully realize its benefits.

The following picture is from the site https://microservices.io/patterns/microservices.html and effectively illustrates a microservices architecture.

What is a microservices architecture ?

What serverless really means ?

Microservices with containers and orchestrators

When architects work with microservices, they frequently discuss Docker containers and Kubernetes. A microservices architecture with Docker and Kubernetes combines the principles of microservices, containerization, and container orchestration to create a highly scalable, manageable, and flexible system.

  • Each microservice is packaged as a Docker container. A container is a lightweight, standalone, and executable software package that includes everything needed to run a piece of software, including the code, runtime, system tools, libraries, and settings.
  • Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications. It provides a set of powerful tools for orchestrating containers, ensuring high availability, and managing the lifecycle of microservices.

However, it also comes with some complexity, which may require expertise in containerization and orchestration:

  • Managing Kubernetes clusters can be complex and may require a learning curve.
  • While Kubernetes provides powerful orchestration, there's an overhead associated with its setup and maintenance.

That's why another paradigm has emerged, aiming to alleviate the burden of managing complex hardware, where developers can focus on writing code for individual functions or services. The underlying infrastructure, including server provisioning and scaling, is abstracted away. Enter a serverless architecture.

Microservices in a serverless fashion

In a serverless architecture, the cloud provider takes on the responsibility of provisioning, scaling, and maintaining the servers, allowing developers to focus solely on writing the code for their applications. Here are some key characteristics and components of a serverless architecture:

  • Serverless applications are typically event-driven, meaning they respond to specific events or triggers, such as HTTP requests, database updates, file uploads, or timers. When an event occurs, the corresponding function or code is executed.
  • Serverless applications are composed of small, granular functions or services. Each function is designed to perform a specific task and is invoked independently.
  • Serverless platforms automatically scale the execution environment to match the workload. If there are many incoming requests or events, the platform will allocate more resources to handle them, and as the load decreases, resources are scaled down, optimizing cost and performance.
  • Developers do not need to manage servers, virtual machines, or containers. The cloud provider abstracts the underlying infrastructure, handling server provisioning, maintenance, and security.
Important

Serverless doesn't imply the absence of servers; there are always servers involved in the background, but they are abstracted from the developer.

In this series of articles, we will explore various serverless Azure concepts, including Azure Functions and more.

But enough theory! Let's move on to practice and continue this exploration right now here.