Best Practices for Views
When creating a view, consider the following best practices:
AMPS must compute and serialize each field in the view. Smaller numbers of views, and less expensive calculations, may provide better performance.
AMPS must determine the update to the view for each change to an underlying topic.
For views that join multiple topics, consider the amount of work produced by an update to each topic in the join. You can estimate this by paying attention to the number of matching messages on each side of the join.
Consider a view that joins a large
orders
topic to anorder_type
topic with a much smaller number of messages. If, for eachorder_type
, there are 10000 matching messages in theorders
topic, then a publish that updates a message in theorder_type
topic would produce 10000 updates to a view joining these two topics together. In cases like this, avoid making unnecessary updates to an underlying topic with messages that match a large number of messages on the other side of the join. (For example, a change to update a value inorder_type
would be a necessary change. Simply republishing the same messages toorder_type
on a periodic basis would produce a large number of updates to the view without changing the results, and is more likely to be unnecessary work.)If an underlying message can have frequent updates and subscribers only need to receive the final state of the message in the view, consider using the
InlineConflation
option to allow the view to avoid processing intermediate changes where possible.For topics that are the underlying topics of views, avoid publishing updates that do not change the values of the fields used in the view. Each update to an underlying topic causes an update to the view. In particular, an approach such as republishing a set of lookup values every few minutes will produce a large amount of work (while AMPS fully recalculates the view) without a change in the results. In general, unless the set of values that was republished is significant, avoid republishing values to a topic underlying a view.
Last updated