You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/nosql/how-to-use-change-feed-estimator.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ The change feed processor acts as a pointer that moves forward across your [chan
22
22
23
23
Your change feed processor deployment can process changes at a particular rate based on its available resources like CPU, memory, network, and so on.
24
24
25
-
If this rate is slower than the rate at which your changes happen in your Azure Cosmos DB container, your processor will start to lag behind.
25
+
If this rate is slower than the rate at which your changes happen in your Azure Cosmos DB container, your processor starts to lag behind.
26
26
27
27
Identifying this scenario helps understand if we need to scale our change feed processor deployment.
28
28
@@ -32,7 +32,7 @@ Identifying this scenario helps understand if we need to scale our change feed p
32
32
33
33
#### As a push model for automatic notifications
34
34
35
-
Like the [change feed processor](./change-feed-processor.md), the change feed estimator can work as a push model. The estimator will measure the difference between the last processed item (defined by the state of the leases container) and the latest change in the container, and push this value to a delegate. The interval at which the measurement is taken can also be customized with a default value of 5 seconds.
35
+
Like the [change feed processor](./change-feed-processor.md), the change feed estimator can work as a push model. The estimator measures the difference between the last processed item (defined by the state of the leases container) and the latest change in the container, and pushes this value to a delegate. The interval at which the measurement is taken can also be customized with a default value of 5 seconds.
36
36
37
37
As an example, if your change feed processor is using latest version mode and is defined like this:
38
38
@@ -44,7 +44,7 @@ The correct way to initialize an estimator to measure that processor would be us
44
44
45
45
Where both the processor and the estimator share the same `leaseContainer` and the same name.
46
46
47
-
The other two parameters are the delegate, which will receive a number that represents **how many changes are pending to be read** by the processor, and the time interval at which you want this measurement to be taken.
47
+
The other two parameters are the delegate, which receives a number that represents **how many changes are pending to be read** by the processor, and the time interval at which you want this measurement to be taken.
48
48
49
49
An example of a delegate that receives the estimation is:
50
50
@@ -71,24 +71,24 @@ And whenever you want it, with the frequency you require, you can obtain the det
Each `ChangeFeedProcessorState`will contain the lease and lag information, and also who is the current instance owning it.
74
+
Each `ChangeFeedProcessorState`contains the lease and lag information, and also who is the current instance owning it.
75
75
76
76
#### Estimator deployment
77
77
78
-
The change feed estimator does not need to be deployed as part of your change feed processor, nor be part of the same project. We recommend deploying the estimator on an independent and completely different instance from your processors. A single estimator instance can track the progress for the all the leases and instances in your change feed processor deployment.
78
+
The change feed estimator doesn't need to be deployed as part of your change feed processor, nor be part of the same project. We recommend deploying the estimator on an independent instance from your processors. A single estimator instance can track the progress for the all the leases and instances in your change feed processor deployment.
79
79
80
-
Each estimation will consume[request units](../request-units.md) from your [monitored and lease containers](change-feed-processor.md#components-of-the-change-feed-processor). A frequency of 1 minute in-between is a good starting point, the lower the frequency, the higher the request units consumed.
80
+
Each estimation consumes[request units](../request-units.md) from your [monitored and lease containers](change-feed-processor.md#components-of-the-change-feed-processor). A frequency of 1 minute in-between is a good starting point, the lower the frequency, the higher the request units consumed.
81
81
82
82
### [Java](#tab/java)
83
83
84
-
The provided example represents a sample Java application that demonstrates the implementation of the Change Feed Processor in latest version mode with the estimation of the lag in processing change feed events. In the application - documents are being inserted into one container (the "feed container"), and meanwhile another worker thread or worker application is pulling inserted documents from the feed container's Change Feed and operating on them in some way.
84
+
This example uses the change feed processor in latest version mode with the estimation of the lag in processing change feed events. In the application - documents are being inserted into one container (the "feed container"), and meanwhile another worker thread or worker application is pulling inserted documents from the feed container's change feed and operating on them in some way.
85
85
86
86
The change Feed Processor is built and started like this:
Change Feed Processor lag checking can be performed on a separate application (like a health monitor) as long as the same input containers (feedContainer and leaseContainer) and the exact same lease prefix (```CONTAINER_NAME + "-lease"```) are used. The estimator code requires that the Change Feed Processor had an opportunity to fully initialize the leaseContainer's documents.
89
+
Change feed processor lag checking can be performed on a separate application (like a health monitor) as long as the same input containers (feedContainer and leaseContainer) and the exact same lease prefix (```CONTAINER_NAME + "-lease"```) are used. The estimator code requires that the change feed processor had an opportunity to fully initialize the leaseContainer's documents.
90
90
91
-
The estimator calculates the accumulated lag by retrieving the current state of the Change Feed Processor and summing up the estimated lag values for each event being processed:
91
+
The estimator calculates the accumulated lag by retrieving the current state of the change feed processor and summing up the estimated lag values for each event being processed:
The total lag initially should be zero and finally should be greater or equal to the number of documents created. The total lag value can be logged or used for further analysis, allowing to monitor the performance of the change feed processing and identify any potential bottlenecks or delays in the system:
@@ -101,13 +101,13 @@ An example of a delegate that receives changes and handles them with a lag is:
101
101
102
102
## Supported change feed modes
103
103
104
-
The change feed estimator can be used for both [latest version mode](./change-feed-modes.md#latest-version-change-feed-mode) and [all versions and deletes mode](./change-feed-modes.md#all-versions-and-deletes-change-feed-mode-preview). In both modes, the estimate provided is not guaranteed to be an exact count of outstanding changes to process.
104
+
The change feed estimator can be used for both [latest version mode](./change-feed-modes.md#latest-version-change-feed-mode) and [all versions and deletes mode](./change-feed-modes.md#all-versions-and-deletes-change-feed-mode-preview). In both modes, the estimate provided isn't guaranteed to be an exact count of outstanding changes to process.
105
105
106
106
## Additional resources
107
107
108
108
*[Azure Cosmos DB SDK](sdk-dotnet-v3.md)
109
109
*[Usage samples on GitHub (.NET latest version)](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/master/Microsoft.Azure.Cosmos.Samples/Usage/ChangeFeed)
110
-
*[Usage samples on Github (.NET all versions and deletes)](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/master/Microsoft.Azure.Cosmos.Samples/Usage/ChangeFeedAllVersionsAndDeletes)
110
+
*[Usage samples on GitHub (.NET all versions and deletes)](https://github.com/Azure/azure-cosmos-dotnet-v3/tree/master/Microsoft.Azure.Cosmos.Samples/Usage/ChangeFeedAllVersionsAndDeletes)
111
111
*[Usage samples on GitHub (Java)](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/tree/main/src/main/java/com/azure/cosmos/examples/changefeed)
112
112
*[Additional samples on GitHub](https://github.com/Azure-Samples/cosmos-dotnet-change-feed-processor)
0 commit comments