Hi Wessel Vonk
Great question - this is a subtle but important detail when scaling Event Hub–triggered Azure Functions in Python.
Clarifying Inbound Limits:
While outbound Event Hubs batches are indeed capped at 1 MB, inbound batches to Azure Functions (via Event Hub trigger) do not have a strict size limit like 1 MB. However:
- The actual size of the inbound batch is influenced by:
-
maxEventBatchSize
(your configured value, e.g., 3000–5000) - Size of each individual event
- Internal thresholds like function app memory, timeout, and Python worker buffer limits
-
There isn’t a hard-documented limit on total batch payload size, but in practice:
Azure may internally cap or truncate batches if:
- The total payload size approaches several MBs, or
- The event processing latency exceeds runtime constraints
What This Means in Python:
- If your events are small (~1 KB or less), you can reliably receive batches of 1000+ events.
- However, if total batch size becomes too large (e.g., >5–10 MB), you may notice inconsistent delivery or auto-splitting.
- The Python worker is single-threaded, so processing large batches may also affect throughput and memory usage - especially with deserialization of large payloads.
Recommendation:
- Keep
maxEventBatchSize
aligned with event size - test for sweet spot between batch size and processing latency. - Add monitoring to log
len(events)
and memory usage. - If needed, scale out by enabling Event Hub partition concurrency in host.json:
{
"extensions": {
"eventHubs": {
"batchCheckpointFrequency": 1,
"eventProcessorOptions": {
"maxBatchSize": 3000,
"prefetchCount": 5000
}
}
}
}
I hope this information helps. Please do let us know if you have any further queries.
If this helps, feel free to click Accept Answer
and let us know if you have further questions.