Skip to content

Commit

Permalink
Document addition of prefetch_count field to trigger policy
Browse files Browse the repository at this point in the history
Signed-off-by: Arnaldo Cesco <[email protected]>
  • Loading branch information
Annopaolo committed Mar 6, 2023
1 parent 239d799 commit 33089f0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions doc/pages/architecture/062-trigger_delivery_policies.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ A Trigger Delivery Policy is composed of:
milliseconds an event is retained in the event queue. When an event expires, it is discarded from the event queue, even if it has not been
delivered. This is optional.


## Known issues

At the moment, Trigger Delivery Policies in general do not provide a guarantee of in-order delivery of events.
Note that, since previous Astarte versions (i.e. < 1.1) did not provide a retry mechanism for events, this change does
not impact the expected behaviour if Trigger Delivery Policies are not used.
If the `retry` strategy is specified, in-order delivery cannot be guaranteed because a > 1 consumer prefetch count is being used. This allows for higher throughput at the cost of consistency.
An experimental feature allows to set the maximum number of messages that can be dequeued concurrently from the event queue
using AMQP (RabbitMQ) [consumer prefetch count](https://www.rabbitmq.com/consumer-prefetch.html). When prefetch count is set to 1, events are processed in order. Higher values allow for higher throughput by relaxing the ordering guarantee.
This feature is disabled by default.

Moreover, Trigger Delivery Policies do not provide a guarantee of in-order delivery of events if the Astarte Trigger Engine component
is replicated (event when the policy prefetch count is set to 1), as data from event queues are delivered to consumers in a round-robin fashion.

- If the Astarte Trigger Engine service is replicated, events could be delivered out of order, as data from event queues are delivered to consumers in a round-robin fashion.
- If the `retry` strategy is specified, in-order delivery cannot be guaranteed because a > 1 [consumer prefetch count](https://www.rabbitmq.com/consumer-prefetch.html) is being used.
This allows for higher throughput at the cost of consistency. In the future, the user will be allowed to choose between having an higher number of
events handled, but out of order, or ordered event handling at a lower rate.
Note that, since previous Astarte versions (i.e. < 1.1) did not provide a retry mechanism for events, both issues do
not impact the expected behaviour if Trigger Delivery Policies are not used.

0 comments on commit 33089f0

Please sign in to comment.