Azure Function (Python) with Event Hub trigger: is there a maximum input batch size beyond configuration settings?

Wessel Vonk 45 Reputation points
2025-07-04T06:48:49.21+00:00

I'm using an Azure Function App in Python with an Event Hub trigger and have set cardinality=many to receive events in a batch.

For sending to Event Hub, I'm aware there's a hard limit on the batch size (e.g., based on total message size). But for receiving events in a batch via the trigger in Python, are there any maximum limits beyond what I configure in host.json, such as:

  • minEventBatchSize
  • maxEventBatchSize
  • maxWaitTime

I am not considering Azure Function memory limits or out-of-memory risks in this question. I'm specifically asking if there is any technical or platform-imposed maximum — either in:

  • the number of events in a single batch, or
  • the total payload size

that would override or cap what I configure in maxEventBatchSize.

If I set a very high maxEventBatchSize (e.g., 5000 or more), and the memory usage is still acceptable, will the Function reliably receive that many events in a single batch?

Any guidance or insights specific to Python functions would be very helpful.

Thanks!

Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
724 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Venkat Reddy Navari 3,785 Reputation points Microsoft External Staff Moderator
    2025-07-04T10:08:03.72+00:00

    Hi Wessel Vonk While maxEventBatchSize in host.json allows you to control how many events are batched per function invocation, there are indeed platform-level limits that can implicitly cap batch size even if you set a high value like 5000.

    Here are considerations:

    1. Event Hubs platform limit: There's no official hard limit on the number of events per batch received, but the total batch size is influenced by the prefetch count, event size, and memory pressure. Azure Functions uses the EventProcessorHost under the hood, which may limit batch sizes dynamically based on throughput and system conditions.
    2. Max payload size: While not strictly documented for Event Hub triggers, the maximum event size is 1 MB per event. A batch could be constrained by the maximum message buffer limit, though this is not always explicitly enforced unless hitting memory/resource limits.
    3. Observed behavior: In practice, if maxEventBatchSize is very high, you might still receive fewer events than requested, depending on: Available events in the partition, maxWaitTime, Runtime conditions (e.g., throttling or internal batching).

    For official guidance, refer to: Azure Functions host.json reference for Event Hub


    Hope this helps. If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.