问题
What is the best method to zip large files present in AZ blob storage and download them to the user in an archive file (zip/rar) does using azure batch can help ? currently we implement this functions in a traditionally way , we read stream generate zip file and return the result but this take many resources on the server and time for users. i'am asking about the best technical and technologies solution (preferred way using Microsoft techs)
回答1:
There are few ways you can do this **from azure-batch only point of view**
: (for the initial part user code should own whatever zip api they use to zip their files but once it is in blob and user want to use in the nodes then there are options mentioned below.)
For initial part of your question I found this which could come handy: https://microsoft.github.io/AzureTipsAndTricks/blog/tip141.html (but this is mainly from idea sake and you will know better + need to design you solution space accordingly)
In option 1 and 3 below you need to make sure you user code handle the unzip or unpacking the zip file. Option 2 is the batch built-in feature for *.zip
file both at pool and task level.
Option 1: You could have your
*rar or *zip
file added asazure batch resource files
and then unzip them at the start task level, once resource file is downloaded. Azure Batch Pool Start up task to download resource file from Blob FileShareOption 2: The best opiton if you have
zip
but not rar file in the play is this feature namedAzure batch applicaiton package
link here : https://docs.microsoft.com/en-us/azure/batch/batch-application-packages
The application packages feature of Azure Batch provides easy management of task applications and their deployment to the compute nodes in your pool. With application packages, you can upload and manage multiple versions of the applications your tasks run, including their supporting files. You can then automatically deploy one or more of these applications to the compute nodes in your pool.
- https://docs.microsoft.com/en-us/azure/batch/batch-application-packages#application-packages
An application package is a .zip file that contains the application binaries and supporting files that are required for your tasks to run the application. Each application package represents a specific version of the application.
With regards to the size: refer to the max allowed in blob link in the document above.
Option 3: (Not sure if this will fit your scenario) Long shot for your specific scenario but you could also mount virtual blob to the drive at join pool via mount feature in azure batch and you need to write code at start task or some thing to unzip from the mounted location.
Hope this helps :)
来源:https://stackoverflow.com/questions/58435521/generating-zip-files-in-azure-blob-storage