Reduce File Size Upload for Azure

2019-07-21 20:53发布

问题:

I Have a hosted service on Azure, every time I want to put the package (cspkg & cscfg files) it always take so long. My cspkg file is 18 MB. Is there any better way to do the upload? my thought is to put the images, style, etc in Storage on Azure and pointing my web app image references (src) to the storage account, so I don't have to include those files in cspkg, or something like that. It is just too much if I only have to modify a single line of code and but have to wait almost 30 min for the upload to be completed.

thx

回答1:

The whole deployment process consists of 2 steps: Uploading package and configuration file to blob storage and actual VM commissioning process. I don't think that you can do much about reducing time for VM commissioning process as this is controlled by Windows Azure. You can however take care of the first part where you upload your package file in blob storage before deployment and then specify the blob URL. However given that your package size is 18MB, I think most of the time is being spent on VM commissioning.

Regarding your approach about putting images and styles in blob storage, I think that's the correct approach. There are two distinct benefits to this approach:

  1. If you need to change some image, all you will have to do is upload the new file in blob storage. You don't have to redeploy your package file.

  2. If needed, you can take advantage of Windows Azure CDN to deliver this content which is more or less static.



回答2:

Adding to Gaurav's excellent answer: There are two more advantages to pushing static content to blob storage (well maybe more than two - feel free to add to this list):

  1. Modern browsers typically limit the number of concurrent connections to a single domain to 2 (so you might be pulling the html plus maybe a jpg concurrently). If you have your static content in blob storage, the endpoint for blob storage is a completely different url, effectively increasing the number of concurrent connections for your browser-based customers).
  2. By moving static content off your compute instance, you're also reducing load on that instance's IIS process and network utilization. If you have many instances deployed, you'll likely realize a reduction in number of instances since you'll be taxing the instances less.