The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Asynchronous Webservice Calls â€" the Truth behind the Begin… End… functions â€" Part II

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Steve Hebert

Posts: 218
Nickname: sdhebert
Registered: Apr, 2005

Steve Hebert is a .NET developer who has created the .Math compiler library.
Asynchronous Webservice Calls â€" the Truth behind the Begin… End… functions â€" Part II Posted: Jul 20, 2006 9:13 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Steve Hebert.
Original Post: Asynchronous Webservice Calls â€" the Truth behind the Begin… End… functions â€" Part II
Feed Title: Steve Hebert's Development Blog
Feed URL: /error.htm?aspxerrorpath=/blogs/steve.hebert/rss.aspx
Feed Description: .Steve's .Blog - Including .Net, SQL Server, .Math and everything in between
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Steve Hebert
Latest Posts From Steve Hebert's Development Blog

Advertisement
In my previous post on this topic,  I concluded with three key points:
  • The Begin function does not actually initiate the physical call on the wire – it simply places these calls into a queue to be processed later. 
  • Due to point #1, if you are making multiple asynchronous calls while varying the parameters on an input struct or class, you must deep-copy that structure before passing.
  • Due to a maximum of two calls being made at any one time,  I recommended that you handle the asynchronous calls yourself via a threadpool. 

 

While the first two points hold, it turns out the maximum number of simultaneous calls is, in fact, a way of playing nice. As I mentioned in the earlier post, flooding a public server with too many simultaneous requests may result in being pegged as a DoS attack. Thanks to SecretGeek's comments and  Tomas Restrepo's blog entry, they opened some questions with my conclusions pointing to their own experiences around connection handling.


If you wish to pipeline requests, you need to look at key issues with setting up the client machine and the server.  Unfortunately, the client-side still uses multiple threads to handle the requests (instead of using overlapped IO), but at least I don't have to manage the threadpool myself.  


Configuring the Client

 

The client can handle more than two simultaneous asynchronous requests and the configuration bits lie in machine.config.  By default, the maxconnection setting within .Net is defaulted to “2” for any given address/port. You can change this setting system-wide or specify configurations for specific addresses.   

 

<system.net>
    <connectionManagement>
        <add address="*" maxconnection="2"/>
    </connectionManagement>
</system.net>

 

Setting this value to “20” allows all requests on the test call I put together to be fired simultaneously.  (Note that I couldn’t get this to actually work with more than 10 on my development box – reasons below.) Keep in mind that in setting this value, you must also be mindful of a host of other threading settings – maxWorkerThreads, maxIOThreads, minFreeThreads and minLocalRequestFreeThreads.  For a more thorough discussion on this topic, check out Tess’ blog entry on this topic

 

Configuring the Server

 

Getting these requests to be serviced simultaneously under IIS 5.x and Windows XP is another story.  When I set the maxconnection setting, my local IIS webserver responded with a 403 error.  It continued responding with the 403 error for several minutes. 

 

Feeling like a server error, I verified the problem in a KB article stating that IIS is honoring the 10 connection limit of XP Pro.  The KB does mention that turning off HTTP Keep-Alives under IIS will improve the performance in this instance, but I didn’t see any changes when trying to set maxconnection to anything larger than 10.

 

I’m on vacation this week, so I’m not sure how Win2k3/IIS6 will respond with a flood of webservice calls and how HTTP Keep-Alives play into this performance.  That will be a posting for another day.

 

Read: Asynchronous Webservice Calls â€" the Truth behind the Begin… End… functions â€" Part II

Topic: It's Not Just Stand-up Previous Topic   Next Topic Topic: Fixing a broken asp.net installation. (The Web server

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use