简体   繁体   English

部署后预热 Azure Web App(不使用部署槽)

[英]Warming up Azure Web App after deploy (without using deployment slots)

We have a number of Azure Web Apps which we deploy to regularly (several times a week).我们有许多 Azure Web 应用程序,我们定期(每周数次)部署这些应用程序。 The deploys are performed using the Zip Push Deploy method ( https://docs.microsoft.com/en-us/azure/azure-functions/deployment-zip-push ), and this works very well.部署是使用 Zip Push Deploy 方法 ( https://docs.microsoft.com/en-us/azure/azure-functions/deployment-zip-push ) 执行的,这非常有效。

Our issue is that the different web apps are not properly started until the first requests are issued against the server, which means that the first user gets a large performance penalty.我们的问题是,在针对服务器发出第一个请求之前,不同的 Web 应用程序不会正确启动,这意味着第一个用户会受到很大的性能损失。 We tried to resolve this by making a request right after the deploy is done, but it seems that we too often hit the old version of the web app instead of warming up the new one.我们试图通过在部署完成后立即发出请求来解决这个问题,但似乎我们经常使用旧版本的 Web 应用程序而不是预热新版本。

I know that we could use deployment slots and their warmup-functionality, but for many reasons, deployment slots are not an option for us right now.我知道我们可以使用部署槽及其预热功能,但出于多种原因,部署槽现在不是我们的选择。

Is there any way we can know when a deployment is finished so that we don't trigger a warmup call before the new code is up and running (eg user a Powershell script)?有什么方法可以让我们知道部署何时完成,这样我们就不会在新代码启动并运行之前触发预热调用(例如,用户使用 Powershell 脚本)?

Currently we use a Powershell query similar to the one below to hit the app services, but often they return very quickly due to the fact that the deployment has not yet completed:目前我们使用类似于下面的 Powershell 查询来访问应用服务,但由于部署尚未完成,它们通常会很快返回:

# Warmup Azure service
$warmupUrl = "https://$appName.azurewebsites.net/"
Write-Output "Making request to $warmupUrl"
$stopwatch = [Diagnostics.Stopwatch]::StartNew()

Try {
  # Allow redirections on the warm up
  $response = Invoke-WebRequest -UseBasicParsing $warmupUrl - 
MaximumRedirection 10 -TimeoutSec 240
   $stopwatch.Stop()
   $statusCode = [int]$response.StatusCode
  Write-Output "$statusCode Warmed Up Site $TestUrl in 
$($stopwatch.ElapsedMilliseconds)s ms"
} catch {
    #$_.Exception|format-list -force
} Finally
{
     $stopwatch.Stop()
     Write-Output "Warmed Up Site $warmupUrl in 
 $($stopwatch.ElapsedMilliseconds)s ms"
}

Any chance that you are using async zipdeploy and not waiting for it?您是否有机会使用异步 zipdeploy 而不是在等待它? If you wait for it, the new bits should be effective pretty quickly.如果你等待它,新的位应该很快就会生效。 To be safe, wait 10 seconds after the deployment (to allow file change notifications to propagate) and I would not expect that you'll ever hit the old version.为安全起见,在部署后等待 10 秒(以允许文件更改通知传播),我不希望您会遇到旧版本。

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

相关问题 具有数据库迁移的Azure Web App部署槽 - Azure Web App deployment slots with database migration 在Azure上预热经过身份验证的应用服务 - Warming up Authenticated App Service on Azure 使用部署槽将复杂的IIS网站移动到Azure Web应用程序 - Moving a complex IIS web site to Azure Web app using deployment slots Azure App Service - 为现有App Service设置部署槽 - Azure App Service - Setting up Deployment Slots for existing App Service Azure Web 应用部署槽 web.config - Azure Web App deployment slots web.config Azure Web应用程序-其他部署插槽会影响生产插槽吗? - Azure web app - Additional deployment slots affect production slot? Azure:Azure应用服务的部署插槽的定价 - Azure: Pricing of deployment slots for an Azure App Service 一个 azure function 应用程序会触发所有部署槽吗? - An azure function app will trigger all the deployment slots? 是否可以在没有 VSCode 的情况下将 web 应用程序部署到 azure? - Is it possible to deploy web app to azure without VSCode? Azure Web 应用部署槽,我可以将槽应用换成主生产,然后删除旧的吗? - Azure Web App deployment slots, can I swap a slot app for the main production, then delete the old one?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM