In my Azure function the Process of converting a pdf file to a jpg file is not working asynchronously when multiple Azure Function are trigger. It look like they all wait each other before making the upload into the Azure Storage.
I am using nuggets package Aspose.pdf version 20.9.0
Do you have Solution to make Process the most async possible into a Azure function?
It is hard to determine the cause of the issue without replicating it at our side. Would you kindly share sample code snippet which is sufficient to reproduce the behavior that you are experiencing at your side? We will try to reproduce the scenario at our side and share our feedback with you accordingly.
PS: Please also try using Aspose.PDF for .NET 20.11 before sharing the requested information.
AzureFunctionAsposePdf.pdf (41.0 KB)
The idea is to get a pdf from a location in the azure storage by a queue message, do the conversion (pdf to jpg) and upload back the jpg into the storage.
The Error only come when the function is deploy into Azure Function app. In local whit the Azure toolkit it work pretty fine. But when the function is deploy what make the processing slow for multiple function trigger is the Process method.
The runtime of my function is v3 and i am also using .net 2.1
The Aspose.PDF for .NET is a multi-threaded safe API which allows you to use it in an environment where one thread should access only single PDF document at a time. OR one document should be accessed by only one thread. Nevertheless, as you already mentioned, that issue is not occurring in local environment, there might be a delay during downloading and uploading the files when project is live on server.
Regarding your original requirements, we need to further investigate whether such capability can be added to the API. Would you please share a sample PDF document as well so. We will log an investigation ticket and share the ID with you.
I also have more informations on the problem it look like even if the Azure function should be a thread whit only one pdf to convert. It look like Process when multiple Azure Function are trigger is creating some Memory Allocation Issues whit MIcrosoft.WindowsAzure.Storage.
Exemple of Memory Allocation Issues:
MemoryAllocationIssuesExemple.jpg (236.1 KB)
And I think that the memory issues is causing the processing to use more and more RAM the more you have Function trigger at the same time (to much for the azure function environment).
Exemple of a Process RAM of one pdf: It need approximately 0,3 of RAM
ProcessByteOnePdf.PNG (6.6 KB)
Exemple of a Process RAM of multiple pdf: Process are going up to approximately 3G of RAM for 9 pdf
ProcessByteMultiplePdf.PNG (6.0 KB)
For the pdf sample you can use whatever content but this is example:
SamplePdf1.pdf (48.9 KB)
PfdSample2.pdf (66.6 KB)
Thanks for sharing further information.
We have logged an investigation ticket as PDFNET-49107 in our issue tracking system for further analyzing this case. We will look into details of this matter and keep you posted with the status of its resolution. Please be patient and spare us some time.
We are sorry for the inconvenience.