0

We have web application designed using C# MVC .net framework 4.5 and it was published in IIs. We also designed a Xamarin mobile app for the same and its API request handled in same web application through REST API.

Everything works fine except the first time login. After install the app, when user attempt to login the app at very first time it took 24 seconds to recevie the response in mobile app.

First Time Login:
Web API Time enter image description here

REST API Time to recevie response enter image description here

But in Web API it return the response after validation in just 2 seconds and I have tracked it by programmatically logging each stage time difference in text file.

I tried again by logout the app and and relogin. In next relogin it took 2-4 seconds to get the response.

Second Time Login:
Web API Time enter image description here

REST API Time to recevie response enter image description here

Any one expain why this first time delay occur in REST API. Hence the web api retrun the response in just 2-3 seconds.

Ananth Cool
  • 125
  • 8
  • related : [First call of the day to C# webservice very slow - analysis](https://stackoverflow.com/questions/26351987/) – Self Apr 12 '21 at 06:32
  • First call may be slower because it has to get the server running. Are you in debug? is that server deployed or spining on localhost? Do you drop and re init the db? 2-3 sec for a call look long. do you have acess to the server code and can had some benchmark there to narrow the issue? something may be loading all the user info/preset etc. – Self Apr 12 '21 at 06:41
  • 1
    I will also recommend using StopWatch for meanning full result : [Stopwatch vs. using System.DateTime.Now for timing events](https://stackoverflow.com/questions/2923283/) – Self Apr 12 '21 at 06:45

0 Answers0