Professional Web Applications Themes

WebService Method calls not paralellized?? - ASP.NET Web Services

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) ...

  1. #1

    Default WebService Method calls not paralellized??

    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
    [url]http://miha.magdalenice.net/temp/TestClientMain.zip[/url] -- compile with csc
    *.cs.

    Thanks,

    Miha

    miha.valencic@gmail.com Guest

  2. #2

    Default Re: WebService Method calls not paralellized??

    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 Guest

  3. #3

    Default Re: WebService Method calls not paralellized??

    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 Guest

  4. #4

    Default Re: WebService Method calls not paralellized??

    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
    > [url]http://miha.magdalenice.net/temp/TestClientMain.zip[/url] -- compile with
    > csc *.cs.
    >
    > Thanks,
    >
    > Miha
    >

    Dilip Krishnan Guest

  5. #5

    Default Re: WebService Method calls not paralellized??

    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 Guest

Similar Threads

  1. Tool to monitor/trace all method calls?
    By lisa@starways.net in forum ASP.NET Building Controls
    Replies: 2
    Last Post: July 7th, 12:24 PM
  2. Concurrent Method Calls
    By rev_robert in forum Macromedia ColdFusion
    Replies: 0
    Last Post: June 9th, 06:57 PM
  3. Performance of web method calls
    By Rivaaj in forum ASP.NET Web Services
    Replies: 0
    Last Post: December 1st, 04:12 PM
  4. Replies: 0
    Last Post: July 18th, 04:41 PM
  5. SOAP remote method calls? the best bet?
    By Sham Ramakrishnan in forum ASP.NET General
    Replies: 0
    Last Post: July 2nd, 05:00 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139