Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

First call to web service each day is slow

While building this web service and the app that calls it, we have noticed that the first call to the web service each day is extremely slow. It even will time out on some days. However, every call after that work great. Can anybody shed light on why this might be and how we can get rid of this pain?

Thanks in advance!

like image 329
Justin Balvanz Avatar asked Dec 04 '22 15:12

Justin Balvanz


2 Answers

If it's an ASP.NET web service, it may be the CLR initializing and loading and verifying the assemblies for the first time. You may want to consider pre-compilation

like image 143
Mark Cidade Avatar answered Jan 21 '23 01:01

Mark Cidade


Agree with the other answers on caching, initialization, etc. As far as a workaround, one possibility may be to set up some sort of daily task (SQL Server job, Windows service, something else?) to simulate a hit to the service each day, so that your users don't experience this first slow request.

like image 27
Bo Schatzberg Avatar answered Jan 21 '23 00:01

Bo Schatzberg