Understanding Serverless Architecture Capabilities Available on Azure
For developers dedicated to building exceptional applications that cater to diverse business scenarios, the added responsibility of managing infrastructure, configuring networks, and applying OS/framework patches can be both distracting and frustrating. This challenge has driven the continuous evolution of platform improvements over the past few decades- to free up developers' time to focus on building applications.
Initially, we relied on on-premises infrastructure, requiring management from the ground up, including hardware and application code. Then came the cloud revolution, bringing a surge of platform and application service enhancements. Concepts like Infrastructure as a Service (IaaS) and Platform as a Service (PaaS) emerged, significantly reducing the burden of these responsibilities and allowing developers to focus more on what truly matters - writing code to bring ideas to life.
From 'on premise' to 'serverless'
(Image courtesy: https://stackify.com/function-as-a-service-serverless-architecture/)
The latest advancement in this evolution is the ‘serverless' application architecture. To clarify, ‘serverless’ doesn’t mean the absence of servers. Instead, it means that the underlying servers and infrastructure are managed by the service provider, freeing developers from the complexities and responsibilities of infrastructure management.
What is Serverless Computing?
Serverless computing allows you to build and run applications and services without thinking about servers. Serverless applications don’t require you to provision, scale, and manage any servers. You can build them for nearly any type of application or backend service, and everything required to run and scale your application with high availability is handled for you. (source)
As it might be evident by now, serverless architecture is essentially an abstraction of servers. But there’s more to it; it’s also an event-driven architecture. This means that when we deploy our code in Azure, we (or another component in the larger application or an internal/external event) need to specify when the code should run. The code is only triggered by an event. One of the major advantages of this model is that you are only charged for your exact usage, as resources are provisioned only for the required duration and there are no continuously running resources. This is known as ‘micro billing’.
Almost all major cloud service providers have their own implementation of serverless architecture concepts. In this article, we'll explore the various facilities available in Azure to support serverless applications.
Serverless Offerings on Azure
Azure provides a comprehensive suite of services to support serverless application development. These offerings can be categorized into direct implementations of serverless architecture, Backend as a Service (BaaS) functionalities, and supportive tools that enhance the serverless ecosystem.
In this article, we will focus on three of the major serverless offerings available on Azure: Azure Functions, Logic Apps and Event Grid. These services are at the forefront of Azure’s serverless capabilities and offer powerful tools for building scalable, event-driven applications.
Azure Functions: Allows you to run event-driven code without having to manage any infrastructure. It supports a variety of programming languages and can be triggered by events from numerous sources.
Azure Logic Apps: Enable you to automate workflows and integrate applications, data, and services with minimal coding.
Azure Event Grid: A fully managed event routing service that enables you to create event-based architectures.
These three services represent the core of Azure’s serverless offerings, each playing a unique role in simplifying development and operations, allowing you to focus on writing code and building functionality.
Azure Functions
Azure Functions are essentially small, discrete pieces of software stored and executed in the cloud. They represent Azure’s implementation of Function as a Service (FaaS), allowing developers to execute code in response to a wide range of application and platform events without the need to manage complex infrastructure.
In Azure Function apps, developers deploy their code to the cloud. They have the flexibility to choose from a variety of programming languages, including C#, JavaScript, Java, Python, and scripting languages like PowerShell (view the full list of supported languages). Azure Functions supports package management through NuGet and NPM, enabling easy integration of necessary dependencies. Additionally, developers can select their preferred environment — Windows or Linux — for running their functions.
These functions are designed to start within milliseconds upon receiving an event-triggered request. Each function instance handles a specific request and terminates once it completes its task. Notably, you are billed only for the time during which the function is actively running.
Azure Functions can be triggered by a diverse set of events, such as HTTP requests, timer events, generic webhooks.
Moreover, Azure Functions seamlessly integrate with various other Azure services. For instance, developers can directly connect to services like Cosmos DB, Event Hubs, Notification Hubs, GitHub, and Twilio through Azure Functions (see the full list of supported bindings).
Azure Logic Apps
When application logic spans across multiple microservices, third-party services, or serverless functions, it becomes crucial to integrate and orchestrate them effectively. Azure Logic Apps are designed precisely for this purpose, serving as a central orchestration mechanism and management platform for handling various event-driven services.
Azure Logic Apps simplifies how you build automated scalable workflows that integrate apps and data across cloud services and on-premises systems. — source
At its core, Azure Logic Apps enable the creation of complex workflows by orchestrating different events, triggers, and logic. These components can include custom-built functions or applications, as well as hundreds of pre-built connectors provided by Azure. These connectors offer built-in functionalities and can trigger events on their own.
The extensive connectivity options provided by Azure Logic Apps make it suitable for integrating on-premises, hybrid, and cloud applications seamlessly across different environments. This capability positions Logic Apps as an ideal solution for managing mission-critical and complex integration scenarios.
Similar to Azure Functions, Logic Apps operate based on triggers, and Azure automatically provisions the necessary resources only for the duration they are required. This serverless approach ensures efficient resource utilization and cost-effectiveness.
Logic Apps not only streamline the integration of disparate services but also enhance automation and operational efficiency by simplifying the orchestration of workflows across diverse platforms and systems.
Azure Event Grid
Event Grid, a single service for managing routing of all events from any source to any destination. Designed for high availability, consistent performance, and dynamic scale, Event Grid lets you focus on your app logic rather than infrastructure — source
Azure Event Grid is designed to facilitate the seamless connection between event sources and event handlers within a serverless computing environment. It is particularly adept at handling events originating from Azure services. For instance, you can develop an Azure Function to programmatically respond to events from services such as Service Bus, IoT Hub, Media Services, Storage Blob, or Resource Groups.
Event Grid provides a fully managed event routing service, which allows developers to link their serverless business logic to events raised by either Azure services or custom applications via custom topics. This flexibility makes it a powerful tool for building event-driven architectures.
Event Grid supports various event sources, including but not limited to:
Azure Services: Service Bus, IoT Hub, Media Services, Storage Blob, and Resource Groups.
Custom Applications: Developers can create custom topics to publish events from their applications.
In addition, Event Grid supports multiple event handlers, such as:
Azure Functions: For executing custom code in response to events.
Azure Logic Apps: For orchestrating workflows based on events.
Azure Automation: For automating tasks and processes.
Azure Stream Analytics: For real-time data processing and analysis.
Event Grid ensures high availability and reliability, delivering events in a timely and scalable manner. It also offers advanced filtering and routing capabilities, enabling developers to precisely control which events trigger which actions.
Following image shows the available event sources and handlers in Azure environment.
In a real-world scenario, Azure Event Grid can be used to notify Azure Automation when a blob is created or deleted in Azure Storage. For example, when a new blob is uploaded, Event Grid can trigger an Azure Automation runbook to process the file. Similarly, if there are active messages in a Queue with no receivers, Event Grid can notify relevant functions or services to scale out additional workers, ensuring timely processing.
Other Azure Resources with Serverless Options
In addition to the core serverless offerings, Azure provides several complementary services that enhance its serverless capabilities. These services include standard compute and storage resources that offer a serverless tier, where you are billed based on actual execution time.
Azure Durable Functions extends Azure Functions by allowing developers to create stateful functions within a serverless environment. This capability is especially useful for handling long-running operations, orchestrating complex workflows, and chaining functions together.
Azure App Service, although primarily a Platform-as-a-Service (PaaS) offering, offers serverless features through its Consumption plan. This allows developers to host web applications, RESTful APIs, and mobile backends without the need to manage underlying infrastructure.
Azure Kubernetes Service (AKS) with Virtual Nodes introduces serverless Kubernetes pods through Virtual Nodes, enabling seamless deployment of serverless containers alongside existing AKS clusters. This provides flexibility and scalability in managing containerized workloads.
Azure API Management (APIM) is another critical service that helps organizations manage and secure their APIs. When integrated with Azure Functions, APIM acts as a robust serverless API gateway that automatically scales to meet demand, ensuring reliable and efficient API operations.
These additional services broaden the scope of Azure’s serverless offerings, catering to diverse application requirements and enhancing development flexibility without compromising on scalability or management overhead.
Summary
Azure offers a comprehensive suite of services and components to support serverless computing, each designed with a specific and distinct purpose in mind. Azure Functions, Logic Apps, and Event Grid, among others, enable developers to build scalable and efficient applications without the burden of managing server infrastructure. These services seamlessly integrate and complement each other, allowing for the creation of complex and sophisticated workflows.
The key advantage of these serverless offerings is that they abstract away the underlying infrastructure, letting you focus on writing code and developing functionality. You are only billed for the actual execution of your code, making these solutions cost-effective and efficient. By leveraging Azure’s serverless ecosystem, developers can enhance productivity, streamline operations, and create responsive, event-driven applications with ease.
Note: This article was originally published on the author's other blog (https://kalanawijethunga.medium.com/) in June 2018.
Subscribe to my newsletter
Read articles from Kalana Wijethunga directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Kalana Wijethunga
Kalana Wijethunga
Software Architect with experience in cloud-native solutions and cloud security.