Azure Function Blob Storage Trigger

Nic Markram 30 Reputation points
2023-09-28T05:34:49.8266667+00:00

Hi There

I have built and deployed an Azure Function (Python V2, consumption plan) that runs with a blob storage trigger. Assuming the function runs without errors, which is does, is delivery for every blob guaranteed? After running tests over the last couple of days, I see way less triggers for my function than new blobs in my storage account that it is monitoring. The function runs successfully for every trigger but when the scale gets bigger, the function is not triggering consistently.
For example, Over the last 24 around 5000 new blobs were inserted into the storage account but the function triggered only around 400 times.

This is not a question of code errors in the function itself as I have tested both locally and deployed versions that work, as well as this specific function working the 400 odd times. I also see no function executions that have errors. All the blobs have the same structure. I believe this is a question of scale and triggering.

Please assist me in understanding why I am missing so many triggers? Is delivery guaranteed? I believed that the azure functions would scale out as needed and shouldn't miss any triggers?

Some additional info:

  • Here is my function in Python:
# this function receives a blob, transforms it and inserts it into a sql db

@app.blob_trigger(
    arg_name="myblob",
    path="calldata-cd4fd9a4-6318-4b99-be0b-23c1a53afe25", # container name
    connection="xxxx",
)
async def trigger_CCSales(myblob: func.InputStream):
    filename = myblob.name

    try:
        logging.info(f"Detected Blob: {filename}")
        if filename.endswith(".json"):
            blob_content = myblob.read()
            json_obj = json.loads(blob_content.decode("utf-8"))

            cleaned = transform_data(json_obj)
            result = await insert_async(cleaned)  # Await the async function
            logging.info(f"Result: {await result}")

        else:
            logging.warning("Detected New Directory, skipping...")

    except Exception as e:
        logging.warning(f"Exception Caught: {str(e)}")
  • I have seen the warning ([Warning] [HostMonitor] Host CPU threshold exceeded (81 >= 80)) but have been told that this is a silent warning and has no effect on the application (github thread): User's image
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,303 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,020 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Mike Urnun 9,831 Reputation points Microsoft Employee
    2023-10-03T23:25:45.3833333+00:00

    Hello @Nic Markram - Sorry for the late reply. Could you share exactly how many blobs are in delay and which hosting SKU your Blob triggered function is running on? It's very likely that the workload is high-scale, and the Blob triggers don't do too well in such conditions. This is documented as follows and the best practice is to switch to Event Grid: Polling and latency


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.