0

I have deployed a .Net Core API to Azure as an App Service.
I have set the Always on feature to true.
When I log the requests, I see that Azure Always on requests are coming every 5 minutes.

always on logs

My usage with API is HTTPS but Always on requests are sending with HTTP. I don't know if this is the case

azure vs usage logs

For the first request, it is sometimes 10 seconds, but after the first request, it is around 100ms.

What is missing here?

I have logged the durations: durations

Connor Low
  • 5,900
  • 3
  • 31
  • 52
  • 1
    Please add some (relevant) code to enable us to help you. Without any code, this is going to be a tough nut to crack. Refer to [ask] and provide a [example]. – rickvdbosch Sep 15 '21 at 10:09
  • Which part of code do you want to see? I don't know which piece of code to share. – Kubilay Bayraktar Sep 15 '21 at 10:23
  • It looks like it's all in the `SubscriptionController`. Might be the query you're executing is simply taking too much time? Again, please provide us with (relevant) code, like the `Index` action or the `SubscriptionInfo` action on the `SubscriptionController`. – rickvdbosch Sep 17 '21 at 13:01
  • These are the regular durations of endpoints. The problem occurs rarely after some time period at the first request. Do you still think it is code related? https://imgur.com/a/hDf7r32 – Kubilay Bayraktar Sep 20 '21 at 07:54

1 Answers1

1

There are quite a few reasons why this might be the case:

  1. You're connecting to resources that take time connecting to the first time
  2. Some information is being cached and needs to be read the first time
  3. There is initialization code present
  4. Lazy instantiation of (static/singleton) instances
  5. ... other ...

Add some logging to your application, maybe enable Application Insights if you haven't done so already and go try to find the culprit.

rickvdbosch
  • 14,105
  • 2
  • 40
  • 53