ffmpeg – Python Azure Function Blob trigger concurrency problem

I developed an OCR in python using pytesseract and cv2. It takes files for a blob container and extracts text from them. I deployed it to an Azure Function container. I used a container because I need system dependencies (poppler-utils tesseract-ocr ffmpeg libsm6 libxext6).

If I simulate the function locally using Azurite I am able to process multiple files at a time. But if I deploy it to Azure, if I upload 2 files at once, the CPU goes to 100% and blocks there. I figured there is a concurrency problem, because it runs well if I configure the host file like this

"extensions": {
    "blobs": {
      "maxDegreeOfParallelism": 1,
      ...
    }
}

Can I do something about it or are the libraries/dependencies not compatible with concurrency?

Read more here: Source link