WebService Method calls not paralellized??

M

miha.valencic

Hi!

I've obveserved a strange fenomenon calling one webservice from a
multithreaded client. What I found out is, that the processing of the
client requests on the server side is not paralellized.

I have a sample WS with one method, int Add(int, int). the method just
adds first and second argument and returns the result.

The client is written in c# and starts n threads (i tested with 5, 10,
30) and invokes the service. The client also reports back the
Environment.TickCount after it finishes.

What happens is, that if the method call takes a long time (I've
embedded Thread.Sleep(5000) in it), the requests are processed really
funny. Like only two at a time are processed. It seems like only two
threads are processing client requests in IIS. I am using IIS on XP
pro, with .NET Framework 1.1.

If anyone has clues or ideas why that is so, I'd appreciate feedback.
Note that if there is no sleep(5000) in the WS Method call, or this is
minimal, the requests "seem" to be executed in parallel or are just so
fast.

The code (asmx, client) is available on
http://miha.magdalenice.net/temp/TestClientMain.zip -- compile with csc
*.cs.

Thanks,

Miha
 
M

Miha

More info on that:

Actually, not only that the request are not being paralelized, there is
a *gap* between each two requests. For instance, the WS method has
1000ms sleep in it. Which is evident between request 3 and request 4.
Two requests get executed concurently, or so it seems (1 and 2, 3 and
4, 5 and 6, and so on). And between these groups, there is 1000ms
gap-delay).

Is it possible that WinXP pro processes only 2 requests concurently????

Results output: (first is the thread ID, [t:number] is
Environment.TickCount. The Invoking Add operation is just before Invoke
is called (wsdl generated proxy code).

C:\work\dev\cs\WSTest>testclientmain
Starting @ 3049034
[1224] Invoking Add operation
Finished @ 3049064
[1136] Invoking Add operation
[2064] Invoking Add operation
[3216] Invoking Add operation
[3220] Invoking Add operation
[1732] Invoking Add operation
[2720] Invoking Add operation
[1792] Invoking Add operation
[2792] Invoking Add operation
[3120] Invoking Add operation
[1224] 1 + 2 = 3 [t:3050115]
[1136] 1 + 2 = 3 [t:3050125]
[2064] 1 + 2 = 3 [t:3051117]
[3216] 1 + 2 = 3 [t:3051127]
[3220] 1 + 2 = 3 [t:3052128]
[1732] 1 + 2 = 3 [t:3052138]
[2720] 1 + 2 = 3 [t:3053140]
[1792] 1 + 2 = 3 [t:3053150]
[2792] 1 + 2 = 3 [t:3054151]
[3120] 1 + 2 = 3 [t:3054161]
 
M

Miha

The previous comment referes to Cassini as a web server. Hosting asmx
in IIS, produces the following results:

C:\work\dev\cs\WSTest>testclientmain
Starting @ 3539459
Finished @ 3539459
[1352] Invoking Add operation
[2920] Invoking Add operation
[2756] Invoking Add operation
[2716] Invoking Add operation
[3536] Invoking Add operation
[4056] Invoking Add operation
[2628] Invoking Add operation
[2632] Invoking Add operation
[2748] Invoking Add operation
[1252] Invoking Add operation
[1352] 1 + 2 = 3 [t:3540621]
[2920] 1 + 2 = 3 [t:3540621]
[2716] 1 + 2 = 3 [t:3541612]
[2756] 1 + 2 = 3 [t:3541612]
[4056] 1 + 2 = 3 [t:3542614]
[3536] 1 + 2 = 3 [t:3542614]
[2632] 1 + 2 = 3 [t:3543615]
[2628] 1 + 2 = 3 [t:3543615]
[1252] 1 + 2 = 3 [t:3544616]
[2748] 1 + 2 = 3 [t:3544616]
 
D

Dilip Krishnan

Hello Miha,
I may be wrong here, but I think Wndow XP has a limitation that allows you
to open only 2 tcp connections to/from it at most. So its possible your client
is experiencing that limitation

HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dilip.krishnan at apdiya dot com
 
M

Miha

Dilip,

I was experimenting further and found that by increasing maxconnection
attribute value in macihne.config I was able to get past that.

What remains is a test with .net remoting (where my friend initially
found a problem).

So, this is not XP limitation (it would be a silly limitation ;)), it
is a configuration option for .net application (not for the whole
system).

Thanks for your input.

rgds,
Miha
 

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

Forum statistics

Threads
474,262
Messages
2,571,048
Members
48,769
Latest member
Clifft

Latest Threads

Top