How to proceeded with troubleshooting long startup times with Azure Application service for Linux?

Frode Aarø 0 Reputation points
2025-03-04T13:14:58.7266667+00:00

We recently switched from application service for Windows to application services for Linux in Azure and are delighted with the improved performance we have noticed in almost every aspect. However there is one area that has actually gone the wrong way regarding performance. The app service for Linux startup time is extremely slow compared to its Windows counterpart. Deploys from github now uses an irritating amount of time when we deploy to a staging slot, start it up and then swap it with the production slot and its the startup process that makes up the bulk of the excess time that we now see used. We see the same tendencies if we simply start the staging or production slot manually in our dev environment. Before the move from Windows to Linux the startup time for the app varied between 50 and and 80 second. After the move we see startup times around 5 minutes. Because of all the other improvements we have experienced going back is not an option so anything we can find that might help decreasing the startup time would just be a bonus.

So my question is does anyone have any tips or tricks regarding minimizing app service for Linux startup time? Are there any configuration options that should be checked that might lead to this?

Since there is no other problem with this than the irritation of having to wait for the startup I can't really defend making a support case about it so any relevant info would be greatly appreciated.

The app services that we use in our dev environment have this setup:

App plan: P1v3
Instance count: 1
App(s) / Slots: 1 / 1
OS: Linux
Publishing model: Code
Runtime Stack: Dotnetcore - 9.0
Always on: Yes

Azure Frontdoor enabled

I have tried to scan through the app logs but have so far not found anything that stands out as a problem. It just looks like the startup goes through all the hoops and simply takes the time it needs. I have also tried bombarding ChatGPT with this to the point where I think it’s harboring a grudge against me :)

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

2 answers

Sort by: Most helpful
  1. Laxman Reddy Revuri 3,265 Reputation points Microsoft External Staff
    2025-03-05T09:49:24.21+00:00

    Hi@Frode Aarø
    apologize for any inconvenience caused on this.
    Ensure your application is configured to use the WEBSITE_WARMUP_PATH setting. This helps define paths indicating when your application is ready to serve requests, reducing perceived startup time.

    Implement the Health Check feature to manage unexpected code and platform failures during startup. It can remove failing instances from the load balancer, minimizing downtime.

    Set up Auto-Heal rules to monitor failed requests and automatically restart the worker process if the application enters an unrecoverable state after startup.

    Thoroughly test your application's startup behavior, including simulating dependency failures to understand its response under different conditions. Even a small failure rate can cause significant issues when multiple instances are involved.

    Analyze application logs regularly for signs of delays or failures during startup to identify areas needing optimization.

    Review and optimize your application code and dependencies to improve startup performance. Reducing dependencies or enhancing their loading times can significantly impact startup duration.

    If possible, increase the instance count to distribute the load and improve overall responsiveness during startup.

    Since the "Always On" setting is enabled, ensure your application is benefiting from this feature to remain loaded and ready to respond.
    references:
    https://learn.microsoft.com/en-us/azure/app-service/routine-maintenance-downtime#strategies-for-increased-uptime

    0 comments No comments

  2. Frode Aarø 0 Reputation points
    2025-03-13T09:36:16.7166667+00:00

    None of the troubleshooting tips so far has helped but I think we will have to accept it as it is for now. Further down the line we might try to use App services for containers and deploy the entire docker container to see if that results in a different experience. Right now however since this is more of an irritation that an actual error situation we will keep it as it is and move on to other issues :)

    Thank you for your assistance anyway @Laxman Reddy Revuri

    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.