how to keep asp.net core web api app always ON to avoid cold/idle issue hosted in AKS

Mohammad Ajmal Yazdani 391 Reputation points
2021-09-16T14:03:10.883+00:00

I have bunch of asp.net core web api apps running in AKS and below is the observation:

  • First api request of the day completes in 5009ms. 132782-1.png
  • Subsequent request within few seconds completes in 367ms 132769-2.png

After 20 minutes When again I making API call,

  • First call took again 2590ms, why? Is this cold start behavior? how to avoid it? 132699-3.png
  • Subsequent calls completes in 372ms 132700-4.png

I came to know we have some solution for it in App Service where I can make service ALWAYS ON to avoid delay in API response after idle time.

Question is, what are solution for AKS deployed web api's? Will liveness prob will help here (so far I havn't used it)?

Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
1,937 questions
{count} votes

Accepted answer
  1. SRIJIT-BOSE-MSFT 4,331 Reputation points Microsoft Employee
    2021-10-05T23:08:16.017+00:00

    @Mohammad Ajmal Yazdani , we regret the delay and any inconvenience it might have caused. We tried reproducing this behavior without much success. However, if you are observing this, as you have correctly pointed out, liveness probes is the best shot telling Kubernetes to restart the container if critical functionality is impaired.

    The kubelet uses liveness probes to know when to restart a container. For example, liveness probes could catch a deadlock, where an application is running, but unable to make progress. Restarting a container in such a state can help to make the application more available despite bugs.

    You can refer to this blog which does a good job of explaining how you can set up your liveness probe health check.

    ----
    ​Disclaimer: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as convenient to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    ----
    Hope this helps.

    Please "Accept as Answer" if it helped, so that it can help others in the community looking for help on similar topics.

    0 comments No comments

0 additional answers

Sort by: Most helpful