Why is Azure deploying from Visual Studio so long?

I created a new cloud service with one working role using the Azure.NET SDK 2.6. RoleEntryPoint is pretty empty.

The first time it took some time due to the creation of a virtual machine. I expect publication attempts to be much faster. It turns out that it takes at least 5 minutes. Looking through the deployment activity logs in VS, I see:

20:17:06 - Checking for Remote Desktop certificate... 20:17:07 - Applying Diagnostics extension. 20:17:29 - Preparing deployment for AzureCloudService2 - 15/05/2015 20:17:03... 20:17:29 - Connecting... 20:17:29 - Verifying storage account ... 20:17:30 - Uploading Package... 20:17:51 - Updating... 20:19:59 - Instance 0 of role WorkerRole1 is ready 20:20:00 - Starting... 20:20:19 - Initializing... 20:20:19 - Created web app URL: ... 20:20:19 - Complete. 

Why does it take 2 minutes to update this application? Is there any way to speed this up?

+6
source share
1 answer

2 to 4 minutes to upgrade your Azure deployment do not match, given that:

  • Enables package download
  • The package is copied several times internally until it reaches your instance.
  • We effectively mount the package as another drive on the machine.
  • Make sure everything is ok
  • Switch applications to start from a new installed disk (which means stopping the old one, starting a new one)
  • Disconnect the old drive containing the old package
  • Report that everything is in order

And this is a simplification of what is actually happening. All this happens asynchronously, and if it takes 15-20 seconds for each element, you see my point here.

There are a few things you can do if you want a faster deployment:

  • Reduce the package size if you have large files. It’s better to load your big dependencies from the repository at startup rather than bundle them in a package
  • If this is WebRole and you want to quickly test the updates, you can enable WebDeploy as part of the deployment, and then run the normal Publish .. workflow from VS. This is just a checkbox when you publish your package from VS. After that, it takes a few seconds to update the files. Keep in mind that for the changes you want to save, you must update the cloud package by doing a full redistribution, otherwise, if the instance is re-mapped, you will lose the changes you made. This is mainly for development only.
  • If it's a WorkerRole, you can split your workloads into processes (a simple .exe) so that your WorkerRole EntryPoint is loaded from storage, unpacked, and executed. If you have a newer version, you simply upload the new package to the repository. Your working class simply controls the repository for newer versions of the package, and then downloads it, unpacks and runs the new .exe file after destroying the old one.

Hope this helps.

+5
source

Source: https://habr.com/ru/post/987311/


All Articles