Database For Big Data
Semester - 7th Course Code - CSE4252
Serverless Design Pattern
Department of Computer Science & Information Technology,
Faculty of Engineering and Technology,
Institute of Technical Education,
SIKSHA ’O’ ANUSANDHAN (Deemed to Be University),
Bhubaneswar, Odisha
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 1 / 20
Outline I
1 Serverless Design Pattern
2 Durable Functions
What is Durable Functions?
When to use durable function?
What are the Key Characteristics of durable function?
What are the different types of durable functions?
What are the different durable function patterns?
Query Documents
What is Azure Logic Apps?
When to use Logic Apps?
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 2 / 20
Serverless Design Pattern
Introduction Serverless Design Pattern
Feature of Azure Functions that allows for the
creation of stateful, erverless workflows.
Enable writing long-running, stateful functions in a
serverless environment.
Allows for the coordination of complex workflows and
function chaining with orchestration.
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 3 / 20
Durable Functions What is Durable Functions?
What is Durable Functions?
The durable function is a feature of Azure Functions.
It allows for the creation of stateful and serverless
workflows.
Enable writing long-running, stateful functions in a
serverless environment.
Allows for the coordination of complex workflows and
function chaining with orchestration.
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 4 / 20
Durable Functions When to use durable function?
When to use durable function?
There are few senarios where we need the durable
function:
Execute a sequence of functions in a specified order.
Run multiple tasks in parallel (fan-out) and aggregate
the results (fan-in).
Workflows that need to wait for session timout.
Dealing with requests that require several,
time-consuming backend calls.
Periodic actions based on a predefined schedule.
When managing multiple microservices that need to
coordinate complex workflows.
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 5 / 20
Durable Functions What are the Key Characteristics of durable function?
What are the Key Characteristics of durable function?
The key characteristics of durable function are:
Code-First Approach: Workflows are defined in
code using languages like C#, JavaScript, and
Python, making it highly customizable and flexible for
developers.
Complex Orchestration: Supports advanced
patterns like function chaining, fan-out/fan-in, human
interaction, long-running workflows, and timed delays.
State Management: Durable Functions manage
their own state, so workflows can pause, resume, and
persist state across failures.
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 6 / 20
Durable Functions What are the Key Characteristics of durable function?
Contd...
Error Handling and Retries: Provides detailed error
handling and retry logic, allowing granular control over
failures.
Performance and Scalability: Suitable for
high-performance applications, as they run serverlessly
and can scale up efficiently.
Cost Model: Billed based on the compute resources
used (i.e., time spent running), making it
cost-effective for workflows with intermittent or
short-lived actions.
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 7 / 20
Durable Functions What are the different types of durable functions?
What are the different types of durable functions?
There are several types of durable function with a specific
role.
1 Client Functions:
These functions initiate the Durable Functions
workflow.
They can start new orchestrations, check their
status, and handle inputs or outputs.
Often triggered by HTTP requests
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 8 / 20
Durable Functions What are the different types of durable functions?
2 Activity Functions:
Basic unit of work in the durable function.
Process the actual task or work in the durable
function.
Activity functions handle specific tasks within the
orchestration, such as data processing, calling
APIs, or other I/O operations.
Activity functions are not deterministic and can
perform operations that might vary on each run.
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 9 / 20
Durable Functions What are the different types of durable functions?
3 Orchestrator Functions:
The orchestrator function controls the workflow
logic and coordinates tasks.
Orchestrator functions can call activity functions,
wait for external events, manage timers, and
handle retries.
The orchestrator function manages state,
automatically persisting it across function
executions.
They are ”deterministic,” meaning the code must
always execute in the same way on replay to avoid
inconsistent outcomes.
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 10 / 20
Durable Functions What are the different types of durable functions?
4 Entity Functions:
Entity functions, also known as ”Durable
Entities,” provide a way to create stateful objects
in Durable Functions.
They represent and manage state over time and
support operations like updating, reading, and
resetting the state.
Unlike orchestrator functions, entities are designed
to hold state persistently and can be interacted
with asynchronously from other functions.
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 11 / 20
Durable Functions What are the different durable function patterns?
What are the different durable function patterns?
Each pattern addresses specific use cases, enabling developers to handle
complex, long-running, or stateful workflows in a serverless environment.
Different types of durable function patterns are:
1 Function Chaining:
Executes a sequence of functions in a specific order.
Each function depends on the output of the previous one, forming a
chain.
Ideal for workflows where each step depends on the results of the
previous step, like order processing.
Example
Let A, B, C, D are four functions. The function chaining pattern execute
the functions in the specfic order by providing output of one function as
input to other function in the workflow.
A→B→C →D
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 12 / 20
Durable Functions What are the different durable function patterns?
2 Fan-out/Fan-in:
Executes multiple functions in parallel and waits for all of them to
complete.
Often involves aggregating results from multiple parallel tasks.
Useful for scenarios requiring large-scale parallel processing, such as
batch data processing or image resizing for multiple files.
Example
Parallel(A, B, C ) → Aggregation
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 13 / 20
Durable Functions What are the different durable function patterns?
3 Async HTTP API/Async Function calls:
Manages asynchronous operations and provides a way for clients to
check the status of an orchestration.
Typically, the client function triggers an orchestration, returns a status
endpoint URL, and the client can poll this endpoint to check for
completion.
Useful for HTTP-triggered workflows that need to provide immediate
response while the long-running task completes in the background.
Example
Client initiates → Returns URL to check status → Client polls until
completion
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 14 / 20
Durable Functions What are the different durable function patterns?
4 Monitor a Workflow:
Continuously monitors a condition or external state until it meets a
specified criterion.
The orchestrator periodically checks the status and may use a timer to
wait between checks.
Ideal for situations like waiting for a specific resource to be available, or
for a file to be uploaded.
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 15 / 20
Durable Functions Query Documents
4 Monitor a Workflow:
Continuously monitors a condition or external state until it meets a
specified criterion.
The orchestrator periodically checks the status and may use a timer to
wait between checks.
Ideal for situations like waiting for a specific resource to be available, or
for a file to be uploaded.
Example
While (Condition Not Met) {
Check Status
Wait for Timer
}
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 16 / 20
Durable Functions Query Documents
5 Human Interaction Pattern:
Pauses the workflow until an external event (usually a user action)
occurs.
Useful for approval workflows, like document reviews, where user
intervention is required.
Example
Wait for User Approval → Continue Workflow
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 17 / 20
Durable Functions Query Documents
1 Aggregator Pattern:
Combines multiple events or data inputs over time into a single output
or summary.
The orchestrator function waits for events to arrive, collects them, and
performs aggregation logic once the required events are received.
Useful for scenarios that require collecting data or events over a period,
such as IoT data aggregation.
Example
Wait for Event A, B, C → Aggregate and Process
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 18 / 20
Durable Functions What is Azure Logic Apps?
What is Azure Logic Apps?
Logic Apps is a workflow automation service that offers a visual,
no-code/low-code experience for creating workflows using connectors to
various cloud and on-premises services.
Visual Designer: A drag-and-drop interface allows non-developers to
build workflows without needing to code, making it easy to use.
Extensive Built-In Connectors: Includes connectors for hundreds of
services (e.g., Office 365, Salesforce, Twitter, etc.), which simplifies
integrations.
Business Process Automation: Designed for automating business
workflows, such as approvals, notifications, and data integration
across services.
Stateful Workflow Management: Logic Apps automatically
manage workflow state and persistence, making them resilient to
failures.
Error Handling and Monitoring: Comes with built-in error handling
and monitoring tools accessible from the Azure portal.
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 19 / 20
Durable Functions When to use Logic Apps?
When to use Logic Apps?
There are few scenarios where we can use Logic Apps.
Business Workflow Automation: When the
workflow involves business processes or requires
integration with multiple external services.
Low-Code Solutions: When the team has limited
coding experience or prefers a visual design approach.
Integration Scenarios: When you need to connect
with multiple external services quickly using
connectors (e.g., handling form submissions, triggering
emails).
Non-Critical Workflows: When high performance
isn’t the main priority, and the workflow can tolerate
small delays
Dr. Sudhanshu Shekhar Bisoyi Database For Big Data 20 / 20