简体   繁体   中英

Azure slow response time in Django web app

For a long time I've been managing an Azure web site in testing, staging and production environments. Initially, all of them were free and I noticed the server sometimes was very slow to respond to async requests. Some requests took 15-30 seconds to complete on the Azure web site. A local copy running on IIS worked with no problem and request times ranged from 75ms to 400ms.

At first I thought the problem with the Azure websites was the 'Always on' feature but after upgrading the production server to a Standard 2 level the exact same problems still exist.

Recently I ran a profile with Application Insights and the report for the slow requests shows something named ASYNC_UNKOWN and those 15-30 seconds are there, the actual request only takes a few ms.

CPU and memory look fine from the insights live data when those delays happen.

I don't know what else to do, I'm thinking about dropping Azure and go to some other hosting. I tried hosting the development site on pythonanywhere and it works just fine there. Can someone give me a clue about what could be causing this massive delays on Azure?

EDIT:

Here's the unknown_async long wait time

Application code is fast enough, even with very basic requests it lags hard.

I ended up contacting the paid support in Azure and they recommended changing from FastCGI to httpPlatformHandler following this tutorial

https://azureossd.github.io/2017/09/01/django-app-with-httpplatformhandler-in-azure-app-services-windows/

Performance seems to be better and response times are now in a more acceptable level

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM