Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 1st, 2008, 08:33 PM
Registered User
 
Join Date: Jan 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Web Service first hit delay

Hi everybody,

Here is the question.
I have win form appl (C#) witch accesses the web service (ASP.NET, C#), multiple instances of appl hast to be used on different machines, everything works but, during the first hit, doesn’t matter from witch machine, it takes about 25-30 sec to get an answer, then more machines trying to access it simultaneously then slower 4 – 5 machines will bring it to 40-45 sec, every following request is done in 5 sec, if client closes appl and starts it right back, so here is no problems with web service timeout because appl is started literally right after closing, again first request will take in about 40-45 sec and every following will take 5 sec. Web service do not indentifies the client in any way, its ready to answer to anybody who’ll call its method. As far as I know web service, as any other web appl, because of HTTP is stateless but it seems like web service remembers each instance of appl and rebuilds or constructs something every time new instance is calling it.
So the question is what may cause this delay during first hit of web service and how I can decries this delay?

Thank you.


 
Old July 1st, 2008, 08:47 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

You don't say WHAT the web service is doing.

But just for example, if it is making some big SQL query and is returning lots of data, it could very well be that subsequent "hits" to the same service are finding that the query data has been cached by SQL Server (or even by the file system, if you are using Access DB). So just that, alone, could account for all of it.

It's also possible that the web server where this is running is heavily loaded with other tasks. So when this web service is first "hit", it needs to load many many resources (DLLs, espeically) that are not used by other things on the same server. That, too, can take quite a while on a fully loaded server.

Anyway, I don't think you gave us enough details to make more than guesses at the answer.
 
Old July 1st, 2008, 09:08 PM
Registered User
 
Join Date: Jan 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Old Pedant,
First of all thank you for your response.
Web Service is running DB2 Store proc using DB2 Connect and it does returns a lot of data about 300-600 kb but data every time is different so its cannot be cashed.
Web server is not heavily loaded; we were monitoring memory and CPU use during the tests. I was logging the time needed to run the code inside the web service, simply by storing timestamp in variable when code starts its execution and a timestamp right before the return statement and writing it in the log file, and its show that it takes about 3 sec to execute all the code, in the same time I did the same thing in client appl saving timestamp right before calling the web service method and right after it and on the first run it show 40 sec, by merging both results from client and web service logs from the same client I can see that execution on web service is pretty much the same during first or any other call, may be on the first it’s a bit longer but on client side first call takes 40 sec all following much less, and as I sad before if client appl is closed and restarted again immediately after, the first run after restart will take again 40 sec and all following from the same instance of appl 5-10 sec.
And another thing, just in case, initialization of web service like WebService WS = New WebService is done on win form load not in the event witch fires web service method.

Thank you.
 
Old July 1st, 2008, 10:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Insane idea, mmm, maybe the store procedure doesn't work ok?? You said that all the code YOU wrote run in 3 seconds, but remember that IIS has to handle an HTML back to the client.. maybe you have images that slow it down?? or some other things in your page??

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old July 2nd, 2008, 08:17 AM
Registered User
 
Join Date: Jan 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi gbianchi,

Thank you for your response, Store proc is working i am getting my response but slower then i need it too on the first hit of web service,
another thing is that the client appl is Win Form appl not a web form so there is no web pages involved, and second as far as i know there is not HTML involved, web service returns XML.

Thank you

 
Old July 2nd, 2008, 08:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

You are right, my mistake, you are talking about a web service. Maybe your client is not working ok?? do you display the XML in any format?? what if you only call the webservice?? (without doing anything else)...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old July 2nd, 2008, 08:44 AM
Registered User
 
Join Date: Jan 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am logging every step on the client the same way as on the web service and the timestamps before the web service call and right after show that the web service call itself takes 40 sec on the first run, in the same time the execution of a code in web service takes 3 – 3.5 sec so I’ll guess that sending response back takes another 8 sec so here we are getting 11 – 15 sec and that exactly how long does it take to get the result during second or any other following request, the question is what takes another 30 sec during first request. ( This is not a timeout problem because client appl was closed and started back and time out is set for 20 min)
Actually the main question is: Web Service is stateless but it looks like web service remember the each instance of the appl preloads some resources for this particular client and then holds them up for this particular client.

Thank you







Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Service Consuming another web service CraigWhitfield EJB 0 January 10th, 2008 08:38 AM
Error to Add Web Reference from a Web service jdjbarrios ASP.NET 2.0 Professional 0 July 18th, 2006 02:58 PM
web service help nidheeshkayal ASP.NET 2.0 Professional 0 April 3rd, 2006 12:37 AM
Service Oriented Web Service aldwinenriquez .NET Web Services 2 September 15th, 2005 03:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.