Azure app service and Python Flask API

rukiman 0 Reputation points
2023-08-21T01:09:41.0633333+00:00

I have deployed a Python Flask API. It has several APIs. However I noticed when consuming one API that is taking a while to run, the other APIs seems to take ages to run. It appears like only one API can run at a time. I understand typically for a Python Flask API you have to put it behind ngix however I thought Azure App service would support their own simultaneous requests?

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

1 answer

Sort by: Most helpful
  1. VenkateshDodda-MSFT 24,951 Reputation points Microsoft Employee Moderator
    2023-08-21T06:16:53.48+00:00

    @rukiman Thanks for reaching out to Microsoft Q&A, apologize for any inconvenience caused on this.

    Yes, App Service can handle multiple requests simultaneously, python apps on Azure App service uses Gunicorn or uWSGI to handle multiple requests.
    It should not be the cause of the issue. However, there could be other factors that are causing the delay in your Flask APIs.

    • Python is a single-threaded runtime, if you want to run large number of I/O events you need to run your API's in asynchronous programming techniques such as asyncio or threading.
    • If your app service plan is not powerful enough to handle the load, it could cause delays in processing requests. You can try scaling up your plan to see if it improves the performance.
    • You can also check the logs and metrics of your App Service to see if there are any errors or performance issues that could be causing the delay. You can also use Azure Monitor to monitor your App Service and get insights into its performance.

    Hope this helps.

    Feel free to reach back to me if you have any further questions on this.

    0 comments No comments

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.