WebService Method calls not paralellized??

Discussion in 'ASP .Net Web Services' started by miha.valencic@gmail.com, Apr 8, 2005.

  1. Guest

    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
    , Apr 8, 2005
    #1
    1. Advertising

  2. Miha Guest

    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]
    Miha, Apr 8, 2005
    #2
    1. Advertising

  3. Miha Guest

    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]
    Miha, Apr 8, 2005
    #3
  4. 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


    > 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
    >
    Dilip Krishnan, Apr 8, 2005
    #4
  5. Miha Guest

    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
    Miha, Apr 8, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Honne Gowda A
    Replies:
    2
    Views:
    855
    Karl Heinz Buchegger
    Oct 31, 2003
  2. andy6
    Replies:
    2
    Views:
    745
    andy6 via DotNetMonster.com
    Jun 9, 2006
  3. Richard Tobin
    Replies:
    24
    Views:
    764
  4. René Preußler

    Asynchronous Call of WebService method within a WebService

    René Preußler, Oct 29, 2008, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    184
    René Preußler
    Oct 29, 2008
  5. Bob
    Replies:
    5
    Views:
    245
Loading...

Share This Page