c# - WebAPI Slow first call to service -
i having issues wcf , slow startup times, switched of code use webapi. while startup time has reduced massively (~8-15 seconds down ~2) still have odd latency on startup. ~2 seconds subsequent calls under 0.5 seconds consistently, until timeout occurs.
i reviewed of applicationpool settings ensure there wasn't startup delays or idle timeout settings.
i found link very slow first call web service didn't me - still same speed issue on cold start. found 1 first call web service each day slow again doesn't seem apply me.
i enabled tracing on webapi service , found difference between first , second call 2 lines showing webhosthttpcontrollertyperesolver.getcontrollertypes
. can't seem find difference can see.
is there other sort of logging use determine going on?
this summary of conversation beneath question
well timeouts never same, same ballpark...to expand, publish server - first call ~2 seconds - subsequent calls ~0.5 seconds. after maybe 20 minutes (hard determine actual time) same occurs - ~2 ~0.5.
20
minutes - that's default apppool idle time-out (minutes). sounds iis unloads app pool next time hit after 20
mins "loads again" (not sure if recompiles) hence lag. make 0
disable timeout (beware repercussions) or make larger value.
if disable timeout, might want consider adding scheduled task recycle app-pool @ times of low usage, perhaps 1:00 or time suitable needs.
a note of wcf
i having issues wcf , slow startup times
this experience (with iis-hosted wcf) , mention above, disabled timeout on app-pools wcf services. keeps them nice , warm. in addition, have daily recycle event @ time when know system won't used allow iis housekeeping.
wcf hosted in iis far iis concerned, just iis app. :)
Comments
Post a Comment