[quoted text, click to view] Marlene A. Roman wrote:
>
> I understand that the very first call to the webservice is slow because the
> webservice needs to JIT. But I've noticed that after a period of time, when
> the webservice is not being used, the request is slow again (only the first
> time) and then subsequent requests are responded faster. It's like it went
> to sleep and needs to be awake in order to respond to the request faster.
>
others wrote:
> I experience this as well, i always assumed it was because when the
> service hasn't been used for a while
> the application gets stopped and as soon as the next request comes in, the
> application needs to be restarted.
> For testing purpose and final deployment, please publish the website
> (precompile) with dynamic updates "disabled" so that there's no need for any
> compilation on the fly at all.
Hello.
I have designed web services too and testing one from multiple sources
at random times can show this slowness as the web service needs to be
restarted. In addition to deployment settings, other ways exist to
have quick response times.
A Web service is like a web page in that after the webmethod has
finished, the parent thread will remove the web service after web
method call and especially after the timeout period is reached on web
server setting.
The other ways to increase performance and In no particular order,
1). If you want the results from the web method returned quickly on the
next caller (< 10 minutes), add and adjust the "CacheDuration"
attribute to the web method like this
<WebMethod (CacheDuration:=600)>
string[] GetSomeData(int someId)
2). Enable session and increase session time out for the web service.
2.a). Enabling session state for the web service (in web.config) can
help too. Fastest setting is the default mode of "inproc" with the
tradeoff of fault tolerance as the session is "in process" and local to
the web server running the web service.
3. This next option is more work but it will always keep the web
service running on the web server. Call it from another application
periodically (ie; service or a local application periodically calling
it.)
Hope this helps too