Search code examples
mysqlazure-web-app-servicetimedelay

Minimize delay between server and web app


Good day everyone, I have some problem about Azure App Service and MySQL In-app, hopefully I could pick up some advice from you. The situation here I have a web application running on azure linux operating system, but an in-app mysql database. So far the the query work just fine, but the thing here is that I was told to minimize the delay between the web service and database. I have checked my query time response, using Postman, and the response time is around 1000ms-2.5s, I don't know if it is possible to reduce the delay between web service and database down to, maybe 500ms or even better? Thank you.


Solution

  • There are a lot of causes that lead to response latency. It is hard to say how to reduce it,but generally, it could be caused by: network latency, your app service business logic, SQL query complexity, SQL server performance.

    So my suggestions are:

    1. Deploy your app service in the region nearby your users to reduce network latency.
    2. If your business logic is complex and your app service CPU usage is high, scale it up to a higher tier.
    3. MySQL In-app just for development, its performance is not so good and not recommended for production, you can create a new Azure MySql instance at the same region with your app service for good SQL performance.
    4. Optimize your SQL query to get a better SQL query efficiency, such as create indexes for columns that always be used by queries, avoid storing large text or binary files in DB and create cache for data that always be queried but cost a lot.