python – Azure Functions EventHub trigger lagging

I have a problem that my Function App (written in Python v1) is not processing the events fast enough so I am experiencing lagging. I don’t have access to the EventHub so I cannot change anything to the configurations there.

I am receiving batches with up to 100 messages which need to be processed. I added the following to my host.json:

{...
 "extensions": {
    "http": {
      "routePrefix": ""
    },
    "eventHubs": {
      "maxBatchSize": 100,
      "prefetchCount": 1000,
      "targetUnprocessedEventThreshold": 500
    }
  }
}

And I updated the code to use coroutines (asyncio.gather(*tasks)) as I have many I/O tasks, but it seems like the Function is still struggling to catch up. I also scaled it out but the VNet ran out of address space, I might need to create a new one with more space.

Is there anything else I could do? Thank you in advance!

Read more here: Source link