I am running into an issue with blob triggers taking long to fire. Hopefully you can help me with the information I have put together of my situation.
Background
I have a blob trigger function watching a container named 'imageuploads-new'.
I upload images into 'virtual folders' inside the container from a web page and the upload from the webpage goes very fast.
Problem
The problem I have is that very often when I upload the images into the container, most of them gets picked up by the blob trigger almost immediately but some of the images takes very long to be detected by the blob trigger (ranging from a few minutes to 30-40 minutes delay at worst).
A while back I was experiencing delays like this, and then I added a 'keep instance warm' timer triggered function that is called every 4 minutes (as per the recommendation of some users in other issues). At the time that seemed to have solved the problem with delays, but lately I have started to experience delays in blob triggers being fired again. This is causing big issues for me.
I have recreated examples of these delays and tried to give a trace of it so that someone at MS hopefully can figure out what is going wrong for me and help me to solve the issue.
Details about the function app
Below are examples to illustrate where some of the uploaded images were processed after a delay. All times are as displayed as in the trace logs and are in my local time (UTC+1).
Example 1
Example 2
Example 3
Example 4
I initially posted this issue as a comment in issue #691 and @mathewc asked me to create a new issue for it. He also looked into the issue and made the following comment (thanks for this @mathewc!):
@jaltin I recommend you create a new issue with your details, since this is a closed issue about functions not being triggered at all. I was able to use the details you gave above to see some of the delays you mentioned in our system logs - e.g. a series of 111 blobs being processed all on the same worker instance with 110 of them all being processed in the first minute, but the last blob being started 6 minutes later. That delay was at 2018-12-07 11:52:37.530.
However, I do notice that at that time there are a lot of other blobs from other containers being processed by the same function at that time. So perhaps your issue is that you're expecting all the blobs for a particular folder upload to all be processed around the same time, but in reality the function is processing other container blobs at that time, increasing latency.
One suggestion: I'm not sure how resource intensive your function is, but if it is low, you could increase per instance parallelism by upping your queues BatchSize/NewBatchThreshold knobs. That would allow each instance to process more blobs in parallel.
@Mathew you are right that there are lot of other blogs from other containers being processed at the same time. The blog function trigger is the starting point for a number of functions being called in a sequence and the activity you see is a consequence of them being started from the blob trigger function.
Those other calls are not very resource intensive and they gets finished a long time before the last few blobs that are delayed gets processed, so I doubt that they are the culprit here. And also, as I mentioned in my initial posting, the issue seems to have arised lately. Earlier my "keep instance warm" functions seems to have solved it, but not any more. Perhaps something in the hosts runtime has changed lately?
Thanks!
@mathewc, @davidebbo, do you have any ideas about what could cause this?
Hi again @mathewc and @davidebbo.
I am still experiencing this problem regularly (in an app running in production) and I need to find a solution to it or consider alternatives because this is affecting us badly.
Can you or anyone else at Microsoft that works with Functions apps help me with this?
@mathewc and @davidebbo
We are also experiencing the same issue in our environment and affecting us badly on production. It takes minutes to trigger a single image blog upload event.
Kindly update if there is any solution to this problem.
I have moved to use Storage Events and no longer use Blob Triggers.
@mathewc we are also having same issue in production, after restarting the function app it is picking up all the queued blob triggers, is some thing to memory issue? how can we diagnose this problem, function app is showing running status but not picking the blog triggers, please share your views
Hi again @mathewc and @davidebbo (or anyone else at Microsoft that can help with this issue).
Still no update on this? Judging from other users comments it seems that this is a real issue and not just affecting our solution/implementation.
I would really appreciate it if you could have a look at this issue.
@jaltin just a note that I'm no longer at Microsoft, so I'll let others comment further.
Thanks for the update @davidebbo.
Anyone else at Microsoft that can help with this? It's badly affecting us.
@jaltin As mentioned https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-blob#trigger---polling , functions rely on logs to scan for new/changed blobs which could cause delays. Please try the recommendations posted there for faster and more reliable blob processing and let us know if you face any issues.