Question

Difficulty: HardProcess Azure Cosmos DB Change Feed Notifications

A company runs a high-throughput transaction processing system that stores invoice documents in an Azure Cosmos DB container. To generate real-time financial reports, you are implementing a scaling consumer application with multiple active host instances. The instances must load-balance the processing of change feed events from the source container. Which configuration must you apply to the lease container and the Change Feed Processor instances to ensure correct load-balanced execution?

  1. A
    Configure the lease container with /id as the partition key. Initialize the processor on each instance with a unique processor name to distribute the lease ownership.
  2. Configure the lease container with /id as the partition key. Initialize the processor across all instances with the same processor name and a unique host instance name for each instance.Answer
  3. C
    Configure the lease container with the same partition key as the source container. Initialize the processor across all instances with the same processor name and a unique host instance name for each instance.
  4. D
    Configure the lease container with /id as the partition key. Implement code to acquire a blob lease on the lease container prior to starting each Change Feed Processor instance.

Answer

Configure the lease container with /id as the partition key. Initialize the processor across all instances with the same processor name and a unique host instance name for each instance.
The correct option correctly identifies that the lease container must use /id as its partition key, and that the Change Feed Processor instances must share the same processor name to work as a single consumer group while using unique host instance names to distribute the lease ownership among themselves.

Step-by-Step Solution

1
Define the partition key of the lease container.
The lease container is created with /id as its partition key.
The SDK's Change Feed Processor uses the id field of lease documents to store partition lease states. Thus, /id is the required partition key path for the lease container.
2
Configure the processor name on all host instances.
All instances of the consumer application are configured with the same processor name.
Using the same processor name groups the instances together as a single logical consumer, enabling them to load-balance the processing of the change feed.
3
Configure the instance name on each host instance.
Each instance is initialized with a unique instance name.
The instance name identifies each physical or virtual host. A unique value allows the processor to distribute lease ownership and coordinate among the instances.

Key Concept

Azure Cosmos DB Change Feed Processor scale-out and lease container configuration requirements
Rate this question