Linux Web App running Django has slow performance

Little's 0 Reputation points
2025-03-05T16:55:24.5333333+00:00

Hi

I have a P1V3 App service plan with React App and a Django Rest (Python) Server on that plan. Since today the response time is quite high and has been persistent. There are no ghost process, the database doesn't report high usage. Always on is enabled on the Web App. The health check doesn't report any issue. The number of instances has remained the same as before, there have been no updates in a couple of days, so that would rule out any code changes making the server slow. Do you have any ideas what could be causing this issue ?

Thanks

Kind Regards

Rajat

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,434 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Divyesh Govaerdhanan 1,920 Reputation points
    2025-03-06T01:56:05.83+00:00

    Hello,

    Welcome to Microsoft Q&A,

    Monitor CPU, Memory & Disk Usage:

    1. Go to Azure App Service → Diagnose and Solve Problems.
    2. Click on "High Response Time" and "Performance Counters".
    3. Check:
      • CPU Usage (>80% indicates issues).
      • Memory Usage (>70% might cause slowdowns).
      • Disk Queue Length (high values indicate slow I/O).

    Check Dependencies Using Application Insights:

    1. Enable App Insights:
      • Azure Portal → App Service → Application Insights → Enable.
        • Set LOG_LEVEL=DEBUG in Django for detailed logs.
        1. Use App Insights "Performance" tab to analyze:
          • Django API response times.
            • Third-party API requests.
              • Database calls (even if DB CPU is low, slow queries still matter).
              1. Look for long response times in dependency calls.

    Solution:

    • If external APIs are slow, use async calls in Django.
    • If some queries are slow, try indexing and caching results.

    Also consider

    Optimize Gunicorn Workers to reduce Python cold start delays.

    Check Scaling Policies if auto-scaling isn’t responding quickly.

    Move Static Files to CDN instead of serving them from Django.

    Please Upvote and Accept the Answer if it helps!!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.