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