views:

1622

answers:

2

I have to send many web service calls out to delete a bunch of records in Amazon SDB (unfortunately, rows can only be deleted one at at time currently).

I am using Amazon's SDB c# library which does not use async WebRequests.

Currently I use ThreadPool.QueueUserWorkItem to queue up a bunch of calls (I configured my connectionManagement maxconnection to allow for a bunch of connections) this works well..as the request is sent out, it blocks and another request is made.

Is this the wrong way to achieve this goal? Should I be using async delegates and doing BeginInvoke and EndInvoke?

+4  A: 

If you just need to queue up some jobs (that don't return values directly) go with ThreadPool.QueueUserWorkItem. It's faster. The difference is covered in other questions (and some great blog entries out there.)

Mehrdad Afshari
+2  A: 

Going trully async would require to abandon the Amazon library and roll your own, using BeginGetRequestStream/BeginGetResponse (which I would recommend). If you stick with the sync WebRequests, then use QueueUserWorkItem.

Remus Rusanu