Configure Throughput for Azure Event Hubs

Optimizing throughput is crucial for the efficient operation of your Azure Event Hubs. This guide explains how to configure and manage throughput units (TUs) and processing units (PUs) to meet your application's demands.

Understanding Throughput Units (TUs)

Throughput Units (TUs) are the primary metric for measuring the ingress and egress capacity of an Event Hubs namespace. Each TU provides a specific amount of ingress and egress bandwidth per second. You can provision TUs at the namespace level or at the individual Event Hub level.

Provisioning TUs

You can provision TUs using the Azure portal, Azure CLI, or Azure Resource Manager (ARM) templates.

Azure Portal

  1. Navigate to your Event Hubs namespace in the Azure portal.
  2. Under "Settings," select "Event Hubs."
  3. Click on the specific Event Hub you want to configure or create a new one.
  4. In the configuration pane, adjust the "Throughput units" slider or input field.
  5. Click "Save."

Azure CLI

az eventhubs event-hub update \
    --resource-group myResourceGroup \
    --namespace-name myNamespace \
    --name myEventHub \
    --throughput-units 4

Scaling TUs

It's often necessary to scale TUs up or down based on your application's workload. Event Hubs supports auto-scaling for Standard and Premium tiers, which can automatically adjust TUs based on predefined metrics.

Tip: For Standard and Premium tiers, consider enabling auto-scaling to dynamically adjust throughput based on real-time traffic.

Processing Units (PUs) for Kafka

If you are using Event Hubs for Kafka (EH Kafka), throughput is managed differently using Processing Units (PUs). EH Kafka provides a Kafka-compatible endpoint, and PUs are allocated per partition.

Configuring PUs

PUs are configured when you create or update an Event Hubs namespace in the Premium or Dedicated tier.

Azure Portal (for EH Kafka)

  1. Navigate to your Event Hubs namespace in the Azure portal.
  2. Under "Settings," select "Overview."
  3. You will see options to configure "Processing Units" for Kafka.
  4. Adjust the slider or input the desired number of PUs.
  5. Click "Save."

Azure CLI (for EH Kafka)

az eventhubs namespace update \
    --resource-group myResourceGroup \
    --name myNamespace \
    --capacity 4 \
    --sku Premium \
    --zone-redundancy Disabled

Note: The exact CLI command and parameters might vary depending on the tier and specific EH Kafka configuration.

Monitoring Throughput

Regularly monitoring your Event Hubs throughput is essential to identify bottlenecks and optimize resource usage. Key metrics include:

Use Azure Monitor to visualize these metrics and set up alerts for when thresholds are approached or exceeded.

Best Practices for Throughput Management

Note: Event Hubs Basic tier has a fixed throughput capacity and does not support manual TU configuration.