Why is the first request to my web method slow?

S

Sinex

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
 
A

Andrew Brook

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
 
J

John Saunders [MVP]

Andrew Brook said:
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 :)

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,979
Messages
2,570,185
Members
46,728
Latest member
FernMcmull

Latest Threads

Top