Muokkaa

Jaa


Serverless apps using Azure Cosmos DB

Azure Cosmos DB
Azure Functions

Solution ideas

This article describes a solution idea. Your cloud architect can use this guidance to help visualize the major components for a typical implementation of this architecture. Use this article as a starting point to design a well-architected solution that aligns with your workload's specific requirements.

You can use Azure Functions and Azure Cosmos DB to build globally distributed, scalable serverless applications.

Architecture

Architecture diagram that shows the functions that are triggered by an online order and a database change feed.

Download a Visio file of this architecture.

Dataflow

  • A customer places an order in an e-commerce website.

  • The order triggers an instance of Functions. The function processes the customer's checkout and stores information about the order in Azure Cosmos DB.

  • The database insert operation triggers an Azure Cosmos DB change feed event.

  • Systems that subscribe to change feed events are notified.

  • The change feed notifications trigger Functions:

    • A function applies taxes to the order.
    • A function processes payment for the order.
    • A function fulfills the order.

Components

  • Functions is an event-driven serverless compute platform. With Functions, you can use triggers and bindings to integrate services at scale.
  • Azure Cosmos DB is a globally distributed, multi-model database. With Azure Cosmos DB, your solutions can elastically scale throughput and storage across any number of geographic regions.

Scenario details

Microservices offer many benefits:

  • They provide highly scalable solutions.
  • You can deploy each service independently.
  • Fault isolation is straightforward when you confine functionality to separate containers.
  • They fit well in a DevOps environment.
  • They decrease time to market by speeding up the software development life cycle.

An efficient way to implement microservices is to use a serverless technology. This solution uses Functions, an Azure offering that provides a serverless compute experience. The solution uses Azure Cosmos DB for data storage. Azure Cosmos DB offers a change feed that integrates with Functions.

Potential use cases

This solution applies to many areas:

  • E-commerce
  • Retail
  • Inventory management

Next steps

See the following architectures that include Functions and Azure Cosmos DB:

See the following architectures that feature Functions:

See the following architectures that feature Azure Cosmos DB: