Groups | Blog | Home
all groups > asp.net webservices > june 2007 >

asp.net webservices : Why is the first request to my web method slow?


Sinex
6/20/2007 12:00:00 AM
Hi,
I have a web service with multiple web methods. A client consumes my
service thru a proxy object. Say the client calls a web method F1(). The
first time my client calls the method it takes a while for the response to
come back. But subsequent requests are served much faster! Why is this
happening?

I am under the impression that every call to a web method is a brand new
request to the web service. The service spits out the response and the
connection is closed (right?). Or is it that the server (IIS) remembers my
client and handles subsequent calls on the same connection?

Sinex

Andrew Brook
6/22/2007 12:00:00 AM
Hi Sinex,

I think the first time the web service is accessed the application is
started (perhaps even compiled depending on which version of .NET and
deployment options you chose - also, isn't JIT compilation always used??
:) ). There could also be something to do with HTTP connections but im not
sure.

In my case, the couple of second delay on first request was causing me
severe problems. I tried adding the IIS application into it's own pool for
which i changed settings so the worker process should never shut down or
recycle (this was in IIS6). In practise this didn't seem to have much of an
effect, however, I may have not configured it correctly.

If anyone else knows how to decrease the time of the first call then please
shout up :)

Andrew

[quoted text, click to view]

John Saunders [MVP]
6/22/2007 9:32:02 AM
[quoted text, click to view]

Write a program to simply make the first call. Run it at system startup,
after IIS has finished starting. You may want to make it a Windows Service,
set its startup to automatic, and make it dependent on IIS.
--
John Saunders [MVP]

AddThis Social Bookmark Button