How to eliminate delay making first call to a webservice?

D

DaveOnSEN

Every time I make any .NET framework based webservice consumer I have
the same problem: The first call my application makes to consume a
webservice takes about 15 seconds. Subsequent calls are very fast.
What is happening during this initial delay, and is there anything I can
do to fix this so my applications start up quickly?

For example, typically the first call to consuming a webservice is some
sort of 'login / authenticate' function. The user puts in a username
and password and clicks ok. 15 seconds go by, now user is logged in and
gets a screen populated with data. The call for the data is instant,
whereas the call to login is slow. This is the same no matter what
applications I use, all .net framework applications that consume
webservices that I have seen so far have this problem.

Is there a fix / workaround?

Thank you very much!
 
A

Andy

Every time I make any .NET framework based webservice consumer I have
the same problem: The first call my application makes to consume a
webservice takes about 15 seconds. Subsequent calls are very fast.
What is happening during this initial delay, and is there anything I can
do to fix this so my applications start up quickly?

For example, typically the first call to consuming a webservice is some
sort of 'login / authenticate' function. The user puts in a username
and password and clicks ok. 15 seconds go by, now user is logged in and
gets a screen populated with data. The call for the data is instant,
whereas the call to login is slow. This is the same no matter what
applications I use, all .net framework applications that consume
webservices that I have seen so far have this problem.

Is there a fix / workaround?

You might want to ask this in an asp.net forum, you may get better
answers. Basically, you're running into how IIS recycles the asp.net
worker process. You may need to adjust this so that process isn't
recycled as often.
 
P

Page Brooks

Andy,
I think your problem actually stems from the JIT compiling process that
occurs upon the first request to the web service. You could use Ngen to
pre-compile your assembly to native code.



PRB: Delay on First Method Invocation on Web Services
http://support.microsoft.com/kb/323577
 
A

Andy

I think your problem actually stems from the JIT compiling process that
occurs upon the first request to the web service. You could use Ngen to
pre-compile your assembly to native code.

PRB: Delay on First Method Invocation on Web Services http://support.microsoft.com/kb/323577

Well, its not my problem, I just replied. :)

The OP didn't specify that this only happens when a web service is
changed and the first time used after that, so it sounds like the
worker process is being recycled. Also, ngen won't help. Notice the
Symptoms:

"Although you have used the Native Image Generator (Ngen.exe) to pre-
compile an assembly to native code, you may still see a delay that
lasts a few seconds on the first method invocation on the Web service.
"
 
G

Guest

Does your web.config specify debug="false"? When an application starts for
the first time, a lot of overhead is involved loading assemblies and
initializing the app into a worker process.
As mentioned, IIS Settings can help; these require some study.
Not to sound like an echo, but this really should be in the ASP.NET group.
Peter
 

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

Top