Problem with downloading large numbers of files from Azure Storage

Nasir Uddin 46 Reputation points
2023-07-04T18:00:15.2+00:00

I need to download a large number of files from Azure Storage. Then I need to create a zip file and send it to the client. If I do this in synchronous way, then the system will freeze for a significant amount of time to complete the process and download the zip file. Because the number of files could be more than 1000 and the size could be large.

So, I am taking a different approach. I will create a Background Service to handle the request. Here are the steps.

-         Download all the files.

-         Create a zip file and store that zip file to the azure container.

-         Create a link of that zip file and send that link to the client.

But I have a problem here. Should I download all the files into the Memory and create a zip file in the memory and then upload that zip file from memory to azure container? Remember my application is hosted into the Azure App Service. If I follow this step should it not consume lots of memory?

 

Or should I download all the files to a location in the Azure App Service and then convert that folder to a zip file and then upload that file to azure container? But would Azure allow me to download all the files into a directory within the application's execution context in azure host?

 

Can anyone suggest to me which way I should go?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,205 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Luke Murray 11,246 Reputation points MVP
    2023-07-04T19:43:25.27+00:00

    Because you are dealing with large files, I would offload that.

    Depending on the number of files, you could download it to an Azure file share (or fileserver using Hybrid workers), mount it - then zip it using an Azure Automation runbook, and upload it to Azure Blob storage with SFTP support, then the clients can grab it from there.

    If it were only a small amount of files, I would have looked at Webjobs.

    I'm not sure what files or what your app service is doing, but sounds like these files might be better stored in Azure blob storage in the long run, vs staying in the App Service.


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.