Initially when we deployed our releases each environment took about 5 to 10 minutes maximum, and from one moment to the next it was + 1h and sometimes even the Hosted Agent is canceled by Time-out. In the meantime I increased Microsoft-hosted, Parallel Job from default to 2 but it didn't work out what I can do to fix this situation.
hosted agent devops take to long time or cancel
1.7k Views Asked by HideCode AtThere are 2 best solutions below

We would suggest you first check if it also take same long time when you try to deploy locally instead through Azure DevOps Service.
Then since you have mentioned it used to be work about 5 to 10 minutes. Also kindly double check your build/release pipeline history and verify if there is any modify of your pipeline recently.
Besides there are also some things you can do if you want faster deployments:
Make the size of the package smaller in case you have big files in there. It's better to download your big dependencies from storage during startup, than bundling them in the package
If it's a WebRole and you want to test updates fast, you can enable WebDeploy as part of the deployment and then do a normal "Publish.." workflow from within VS. It's just a check box when you publish your package from VS. It takes seconds to update the files after that. Be aware though that for changes you want to persist, you have to update the cloud package by doing a full redeploy, otherwise if the instance gets re-imaged, you'll loose the changes you made. This is basically only for development.
If it's a WorkerRole, you can split your loads into processes (simple .exe) that your WorkerRole's EntryPoint downloads from storage, unzips and executes. If you have a newer version, you just upload a new package to storage. Your workerrole simply monitors storage for newer versions of the package and then downloads it, unzips and runs the new .exe file after killing the old one.
Hope it helps.
I create a slot stage in Azure, and change web deploy to zip deploy in Pipeline. Divide my apps in two resources group in Azure(Dev resource and PROD Resource). The azure had exaust. And problem solved.