locked
Does Parallel.Invoke spin up / consume async HttpWebRequest threads? RRS feed

  • Question

  • I've searched, but have been unable to find a concise, specific answer to my question.  This could potentially be due to the fact that I'm by no means an expert on IIS or Threading and Parallel Processing and am not asking the right question in my search.  Anyhow....

    I have a task that requires calling 8 web services to get a collection of information I need to display.  I'd like to wrap all calls around a Parallel.Invoke to improve performance.  However, as this will be done on a large, public website, and I don't want to consume all available HttpWebRequest threads for the first X number of customers to vastly improve the speed of their online experience at the expense of the remaining Y number of customers whose requests are queuing, waiting for threads to become available.

    Some material I've found (http://www.albahari.com/threading/part5.aspx) definitely seems to indicate that Parallel.Invoke does perform some magic to "partition large numbers of elements into batches which it assigns to a handful of underlying Tasks", which, to me, indicates that Parallel.Invoke would NOT consumer 8 HttpWebRequest threads for each web service call in my example.  But, it's not absolutely clear to me that my interpretation is necessarily correct.

    So, in the thread running my code, when the Parallel.Invoke is reached with 8 parallel tasks, would this all be done in the existing HttpWebRequest thread?  Would Parallel.Invoke spin up one additional HttpWebReqeust thread and the 8 parallel tasks be done in that thread?  Or, is a new HttpWebRequest thread needed for each parallel task?  Thanks.


    Kent
    • Moved by Andrew_Zhu Tuesday, August 9, 2011 8:03 AM (From:.NET 4: Windows Workflow Foundation)
    Thursday, August 4, 2011 4:54 PM

All replies

  • Hi kent,

    Thank you for your post.

    Could you provide us more information?

    That will help us redirect you to the right direction.

    Have a nice day.

     


    Thanks
    Liam Huang
    STO Application Support
    Server and Tools Online Operations Team
    Thursday, August 18, 2011 2:50 AM