An Azure Event hub partition is an ordered sequence of events. It acts like a queue, when the newer events arrive, they are added to the end of the partition.
Data is retained for a fixed amount of time in Azure event hub partitions. The retention time can be configured by the user and is applicable to all the partitions in the event hub. Partitions are independent and can grow at different rates.
Since, event hubs is designed to have multiple readers, the number of partitions can be set between 2 and 32. This is set at the time of creating an event hub and cannot be changed. Therefore, it is recommended to consider future requirements at the time of creating the event hub.
On the other hand, having more partitions than required, results in the events being sent to multiple partitions and the order of the events might be lost. One work around is to configure the event publisher to send the events to a particular partition but this is not recommended.
Another important consideration while choosing the number of partitions to configure is the number of event receivers. For optimal performance, it is recommended to have one active event receiver per partition.
In terms of processing capacity of the event hub, it is recommended to maintain a 1:1 ratio between partitions and throughput units. A throughput Unit is a unit of capacity on Azure Event Hubs. Throughput Units will be discussed further in a future post.
Azure event hubs billing is independent of the number of partitions that users choose to create. Microsoft recommends that the decision on the number of partitions should include both, the future scalability and the downstream parallelism (concurrent access) required.