Solved

C# - Stress testing a Web Service - Timeout

Posted on 2007-11-19
7
1,725 Views
Last Modified: 2013-11-07
Hi,

I have a web service that is query'ing a database. The query takes a few seconds to run.

I'm stress testing my web service using a couple of threads.

If the interval is too short between the threads that execute the web service, I get the following exception.

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> Error fetching *MyWebserviceMethods*.
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)

Any ideas why this is happening? I thought web services can handle some load.

Thank you.
0
Comment
Question by:Endelm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
7 Comments
 
LVL 6

Expert Comment

by:ventaur
ID: 20312764
How are you calling the web service method?
0
 

Author Comment

by:Endelm
ID: 20313082
I'm using a while loop and 3 threads.

I execute the 3 threads at the same time.....then sleep for 1 sec.....then run the 3 threads again, etc.

If I set the threads to sleep for 5 or 10 seconds I don't get this error.

The execution of each web service call takes a few seconds.

Thank you.
0
 
LVL 6

Accepted Solution

by:
ventaur earned 500 total points
ID: 20313183
I think you'll need to call the web service method asynchronously to avoid the problem.
private void MyMethodCompleted(Object sender, localhost.MyMethodCompletedEventArgs Completed) {
  // Do something once the web service method, "MyMethod", has completed.
}
 
...
 
// Create the web service and attach an event for the method's completion.
MyWebserviceMethods Service = new localhost.MyWebserviceMethods();
Service.MyMethodCompleted += new localhost.MyMethodCompletedEventHandler(MyMethodCompleted);
 
// Call the web service method asynchronously.
Service.MyMethodAsync();

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Endelm
ID: 20315427
Interesting.

What does this do and how is it different from what I was doing?

Thank you! :)
0
 
LVL 6

Expert Comment

by:ventaur
ID: 20315532
If you call your web service method's xxxAsync version, it will automatically occur on its own thread; thus, preventing blocking. However, if you wish to perform any action(s) upon the completion of the method call, you have to subscribe to its xxxCompleted event.
0
 
LVL 1

Expert Comment

by:adam_ingeniti
ID: 20317984
So in other words, "asynchronous" means that each call to the web service will occur on its own thread, and thus should not interfere with each other.
0
 
LVL 6

Expert Comment

by:ventaur
ID: 20319692
You pretty much have it with that statement.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question