SOLVED

Problem with custom warmup in app service

%3CLINGO-SUB%20id%3D%22lingo-sub-1197408%22%20slang%3D%22en-US%22%3EProblem%20with%20custom%20warmup%20in%20app%20service%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1197408%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20trying%20to%20add%20a%20custom%20page%20for%20warmup%20so%20that%20after%20swapping%20slots%20in%20azure%20dev%20ops%20release%20pipeline%2C%20the%20application%20from%20the%20secondary%20slot%20will%20be%20warmed%20up.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWeb.config%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E...%3CBR%20%2F%3E%3CAPPLICATIONINITIALIZATION%3E%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%3CADD%20initializationpage%3D%22%26quot%3B%2FWarmup.aspx%26quot%3B%22%3E%3CBR%20%2F%3E%3C%2FADD%3E%3CBR%20%2F%3E...%3C%2FAPPLICATIONINITIALIZATION%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Easpx%20page%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3Epublic%20partial%20class%20Warmup%20%3A%20System.Web.UI.Page%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20protected%20void%20Page_Init(object%20sender%2C%20EventArgs%20e)%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%7B%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20Thread.Sleep(600000)%3B%20%2F%2F%2010%20minutes%3CBR%20%2F%3E%26nbsp%3B%20%26nbsp%3B%20%7D%3CBR%20%2F%3E%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20test%2C%20I%20added%20Thread.Sleep%20without%20real%20code.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EA%20swap%20takes%20about%203%20minutes%2C%20although%20at%20least%20a%20warm-up%20should%20take%2010%20minutes.%20As%20a%20result%2C%20I%20get%20a%20cold%20application.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20am%20I%20doing%20wrong%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1197408%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EApp%20Services%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EAzure%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1951705%22%20slang%3D%22en-US%22%3ERe%3A%20Problem%20with%20custom%20warmup%20in%20app%20service%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1951705%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F569097%22%20target%3D%22_blank%22%3E%40user6868%3C%2FA%3E%26nbsp%3BI'm%20guessing%20that%20the%20request%20is%20timing%20out%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EDuring%20the%20swap%20operation%20the%20site%20in%20the%20staging%20slot%20is%20warmed%20up%20by%20making%20an%20HTTP%20request%20to%20its%20root%20directory.%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EBy%20default%20the%20swap%20will%20proceed%20as%20long%20as%20the%20site%20responds%20with%3CSTRONG%3E%20any%20status%20code%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EUtilizing%20this%2C%20could%20help%20to%20avoid%20cold%20starts%2C%20undesired%20downtimes%20or%20high%20latency%20situations.%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EHowever%2C%20if%20you%20prefer%20the%20swap%20to%20not%20proceed%20if%20the%20application%20fails%20to%20warm%20up%20then%20you%20can%20configure%20it%20by%20using%20these%20app%20settings%3A%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%3B%20font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%20style%3D%22margin-left%3A%20.375in%3B%20direction%3A%20ltr%3B%20unicode-bidi%3A%20embed%3B%20margin-top%3A%200in%3B%20margin-bottom%3A%200in%3B%22%20type%3D%22disc%22%3E%0A%3CLI%20style%3D%22margin-top%3A%200%3B%20margin-bottom%3A%200%3B%20vertical-align%3A%20middle%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EWEBSITE_SWAP_WARMUP_PING_PATH%20-%20The%20path%20to%20make%20the%20warm%20up%20request%20to%20(default%20value%20-%20%E2%80%9C%2F%E2%80%9D)%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20style%3D%22margin-top%3A%200%3B%20margin-bottom%3A%200%3B%20vertical-align%3A%20middle%3B%22%3E%3CSPAN%20style%3D%22font-family%3A%20Calibri%3B%20font-size%3A%2011.0pt%3B%22%3EWEBSITE_SWAP_WARMUP_PING_STATUSES%20-%20Expected%20HTTP%20response%20codes%20for%20the%20warm-up%20operation%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

I'm trying to add a custom page for warmup so that after swapping slots in azure dev ops release pipeline, the application from the secondary slot will be warmed up.

 

Web.config:

 

...
<applicationInitialization>
    <add initializationPage="/Warmup.aspx">
</applicationInitialization>
...

 

aspx page:

 

public partial class Warmup : System.Web.UI.Page
{
    protected void Page_Init(object sender, EventArgs e)
    {
        Thread.Sleep(600000); // 10 minutes
    }
}

 

For test, I added Thread.Sleep without real code.

 

A swap takes about 3 minutes, although at least a warm-up should take 10 minutes. As a result, I get a cold application.

 

What am I doing wrong?

1 Reply
best response confirmed by motasem13 (Microsoft)
Microsoft Verified Best Answer
Solution

@user6868 I'm guessing that the request is timing out

 

During the swap operation the site in the staging slot is warmed up by making an HTTP request to its root directory.

By default the swap will proceed as long as the site responds with any status code.

Utilizing this, could help to avoid cold starts, undesired downtimes or high latency situations.

 

However, if you prefer the swap to not proceed if the application fails to warm up then you can configure it by using these app settings:

 

  • WEBSITE_SWAP_WARMUP_PING_PATH - The path to make the warm up request to (default value - “/”)
  • WEBSITE_SWAP_WARMUP_PING_STATUSES - Expected HTTP response codes for the warm-up operation