Newer Version Available
Choosing a Partition Key
Choosing a Partition Key for Best Performance
For best performance, and if event ordering isn't a concern, make sure you select a partition key that contains a wide range of values, such as IDs. That way, the received events are more likely to be evenly distributed across the subscriptions based on the hash value of the partition key field. For example, the EventUuid system field or a required custom field containing ID values, such as record IDs, provides a wide range of unique values.
If you choose an event field that doesn't contain a wide range of values, the processing of partitions can sometimes be less performant. For example, if you choose an event field that contains names of US regions, and if there are more events in the South region, the partition for the South region has more events to process than the partitions for other regions. This processing isn’t efficient.
Choosing a Partition Key for In-Order Event Processing
If you want to preserve the order of events for events that have the same partition key, choose a partition key that contains hard-coded values, such as categories or regions. Events with identical partition key values are processed by the same partition in their original received order in the event bus.
For example, if five events are received, and the first and second event contain a partition key of APAC, they're processed in order by one partition. The next three events have the partition key of EMEA, and they're processed in order by another partition.