Skip to content

Commit

Permalink
editorial review of recent ASB prefetch and locking changes (#6936)
Browse files Browse the repository at this point in the history
* editorial review of recent ASB prefetch and locking changes

* tweak

* Update transports/azure-service-bus/configuration.md

Co-authored-by: Adam Ralph <[email protected]>

---------

Co-authored-by: Laila Bougria <[email protected]>
  • Loading branch information
adamralph and lailabougria authored Dec 17, 2024
1 parent b1e4420 commit 20109f4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions transports/azure-service-bus/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ To disable prefetching, prefetch count should be set to zero.

> [!NOTE]
> The lock duration for all prefetched messages starts as soon as they are fetched. To avoid `LockLostException`, ensure the lock-renewal duration is longer than the total time it takes to process all prefetched messages (i.e., message handler execution time multiplied by the prefetch count).
> In addition, it's important to consider the endpoint's scaling. If the prefetch count is high, the lock may deprive other endpoint instances of messages, rendering additional endpoint instances unnecessary.
> In addition, it's important to consider how endpoints are scaled. If the prefetch count is high, the lock may deprive other endpoint instances of messages, making those instances redundant.
## Lock-renewal

Expand All @@ -61,7 +61,10 @@ To ensure smooth processing, it is recommended to configuring the `MaxAutoLockRe
partial: lockrenewal

> [!NOTE]
> Message lock renewal is initiated by client code, not the broker. If the request to renew the lock fails after all the SDK built-in retries (e.g., due to connection loss), the lock won't be renewed, and the message will become unlocked and available for processing by competing consumers. Lock renewal should be treated as a best effort, not as a guaranteed operation.
> Message lock renewal is initiated by client code, not the broker. If a request to renew a lock fails after all the SDK built-in retries (e.g., due to connection loss), the lock won't be renewed, and the message will become unlocked and available for processing by competing consumers. Lock renewal should be treated as a best effort, not as a guaranteed operation.
> [!NOTE]
> If message lock renewal is required, it may be worth checking the duration of the handlers, and see whether these can be optimised. In addition, it may be worth checking whether the prefetch count is too high, considering all messages are locked on peek. This may indicate that too many messages are locked for which the processing exceeds the lock duration.
> The following approaches may be considered to minimize or avoid the occurrence of message lock renewals:
>
> - Optimise the message handlers to reduce their execution time.
> - Reduce the prefetch count. All messages are locked on peek, so when they are prefetched, they remain locked until they are all processed.

0 comments on commit 20109f4

Please sign in to comment.