简体   繁体   English

Azure web 使用 vscode 部署应用程序比 devops 管道更快

[英]Azure web app deployment using vscode is faster than devops pipeline

Currently, I am working on Django based project which is deployed in the azure app service.目前,我正在开发基于 Django 的项目,该项目部署在 azure 应用服务中。 While deploying into the azure app service there were two options, one via using DevOps and another via vscode plugin.在部署到 azure 应用服务时,有两种选择,一种是通过使用 DevOps,另一种是通过 vscode 插件。 Both the scenario is working fine, but strangle while deploying into app service via DevOps is slower than vscode deployment.这两种情况都运行良好,但通过 DevOps 部署到应用程序服务时扼杀比 vscode 部署慢。 Usually, via DevOps, it takes around 17-18 minutes whereas via vscode it takes less than 14 min.通常,通过 DevOps 大约需要 17-18 分钟,而通过 vscode 需要不到 14 分钟。

Any reason behind this.这背后的任何原因。

Assuming you're using Microsoft hosted build agents, the following statements are true:假设您使用的是 Microsoft 托管的构建代理,以下陈述是正确的:

With Microsoft-hosted agents, maintenance and upgrades are taken care of for you.使用 Microsoft 托管的代理,您可以进行维护和升级。 Each time you run a pipeline, you get a fresh virtual machine.每次运行管道时,您都会获得一个全新的虚拟机。 The virtual machine is discarded after one use.虚拟机在使用一次后被丢弃。

and

Parallel jobs represents the number of jobs you can run at the same time in your organization.并行作业表示您可以在组织中同时运行的作业数。 If your organization has a single parallel job, you can run a single job at a time in your organization, with any additional concurrent jobs being queued until the first job completes.如果您的组织有一个并行作业,您可以在您的组织中一次运行一个作业,任何其他并发作业都将排队等待第一个作业完成。 To run two jobs at the same time, you need two parallel jobs.要同时运行两个作业,您需要两个并行作业。

Microsoft provides a free tier of service by default in every organization that includes at least one parallel job.默认情况下,Microsoft 在每个包含至少一个并行作业的组织中提供免费服务层。 Depending on the number of concurrent pipelines you need to run, you might need more parallel jobs to use multiple Microsoft-hosted or self-hosted agents at the same time.根据您需要运行的并发管道数量,您可能需要更多并行作业才能同时使用多个 Microsoft 托管或自托管代理。

This first statement might cause an Azure Pipeline to be slower because it does not have any cached information about your project.第一条语句可能会导致 Azure 管道变慢,因为它没有任何关于您的项目的缓存信息。 If you're only talking about deploying, the pipeline first needs to download (and extract?) an artifact to be able to deploy it.如果您只是在谈论部署,则管道首先需要下载(并提取?)一个工件才能进行部署。 If you're also building, it might need to bring in the entire source code and/or external packages before being able to build.如果您也在构建,它可能需要在构建之前引入整个源代码和/或外部包。

The second statement might make it slower because there might be less parallelization possible than on the local machine.第二条语句可能会使它变慢,因为可能的并行化可能比本地机器上的少。

Next to these two possible reasons, the agents will most probably not have the specs of your development machine, causing them to run tasks slower than they can on your local machine.除了这两个可能的原因之外,代理很可能没有您的开发机器的规格,导致它们运行任务的速度比它们在本地机器上的速度要慢。

You could look into hosting your own agents to eliminate these possible reasons.您可以考虑托管自己的代理以消除这些可能的原因。

Do self-hosted agents have any performance advantages over Microsoft-hosted agents?自托管代理是否比 Microsoft 托管代理具有任何性能优势?
In many cases, yes.在很多情况下,是的。 Specifically:具体来说:

If you use a self-hosted agent, you can run incremental builds.如果您使用自托管代理,则可以运行增量构建。 For example, if you define a pipeline that does not clean the repo and does not perform a clean build, your builds will typically run faster.例如,如果您定义了一个不清理 repo 并且不执行清理构建的管道,那么您的构建通常会运行得更快。 When you use a Microsoft-hosted agent, you don't get these benefits because the agent is destroyed after the build or release pipeline is completed.当您使用 Microsoft 托管的代理时,您不会获得这些好处,因为该代理在构建或发布管道完成后被销毁。

A Microsoft-hosted agent can take longer to start your build. Microsoft 托管的代理可能需要更长的时间才能开始构建。 While it often takes just a few seconds for your job to be assigned to a Microsoft-hosted agent, it can sometimes take several minutes for an agent to be allocated depending on the load on our system.虽然通常只需几秒钟即可将您的作业分配给 Microsoft 托管的代理,但有时可能需要几分钟才能分配代理,具体取决于我们系统上的负载。

More information: Azure Pipelines Agents更多信息: Azure 管道代理

When you deploy via DevOps pipeline.当您通过 DevOps 管道进行部署时。 you will go through a lot more steps.您将通过更多步骤完成 go。 See below:见下文:

Process the pipeline-->Request Agents(wait for an available agent to be allocated to run the jobs)-->Downloads all the tasks needed to run the job-->Run each step in the job(Download source code, restore, build, publish, deploy,etc.).处理管道-->请求代理(等待分配一个可用代理来运行作业)-->下载运行作业所需的所有任务-->运行作业中的每个步骤(下载源代码、还原、构建、发布、部署等)。

If you deploy the project in the release pipeline.如果您在发布管道中部署项目。 Above process will need to be repeated again in the release pipeline.上述过程将需要在发布管道中再次重复。

You can check the document Pipeline run sequence for more information.您可以查看文档管道运行顺序以获取更多信息。

However, when you deploy via vscode plugin.但是,当您通过 vscode 插件进行部署时。 Your project will get restored, built on your local machine, and then it will be deployed to azure web app directly from your local machine.您的项目将得到恢复,在您的本地计算机上构建,然后将直接从您的本地计算机部署到 azure web 应用程序。 So we can see deploying via vscode plugin is faster, since much less steps are needed.所以我们可以看到通过 vscode 插件部署更快,因为需要的步骤少得多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure Devops Pipeline ACR 部署到 Web 应用程序容器 - Azure Devops Pipeline ACR deployment to Web App Container 从 Azure DevOps 发布管道成功部署后,应用服务不加载 Web 应用 - App Service does not load web-app after successful deployment from Azure DevOps release pipeline Azure 应用服务、DevOps 和 Web API 部署 - Azure App Services, DevOps and Web API deployment Azure DevOps - 使用部署组或部署作业向环境发布管道? - Azure DevOps - Release Pipeline using Deployment Groups or Deployment Job to an Environment? Azure DevOps - 本地部署管道 - Azure DevOps - on prem deployment pipeline Azure DevOps 发布管道消除了应用服务部署槽 - Azure DevOps Release Pipeline wipes out App Service Deployment Slot Azure Web服务器成功部署后,Azure Web App wwwroot未更新 - Azure Web App wwwroot not updated after successful Azure devops deployment 是否可以通过 Azure DevOps 管道将 Web 应用程序部署到 Azure 中国 - Is it possible to deploy the Web App to Azure China by the Azure DevOps pipeline Azure DevOps 首次部署 Web 应用程序总是出错 - Azure DevOps First Time Web App Deployment Always Gives Error 将Azure发行版(Web App Service)中的管道版本部署在错误的文件夹中 - Pipeline releases in azure devops (Web App Service) deployed in wrong folder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM