Results 1 to 4 of 4

Thread: How to Handle a large number of WebClient request?

  1. #1

    Thread Starter
    Member buzz4rd's Avatar
    Join Date
    Feb 2012
    Posts
    42

    Cool How to Handle a large number of WebClient request?

    I need to handle 500+ Http Request per seconds by using WebClient. And I also want to show the status of those request in Listview subitem.

    I tried 5/10 Http Request per second but it freezes The ui.

    I know a little bit about Thread But I heard it depends on hardware capacity.

    1. So how Can I optimize it?
    2. How can I handle a large number of request without freezing my ui?
    please

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: How to Handle a large number of WebClient request?

    The number of concurrent tasks does indeed depend on hardware capacity but that's not an argument for or against using multiple threads. If your hardware can't handle the load then nothing will help other than better hardware. Do some research on multi-threading and parallelism to get a grounding. The WebClient class even has asynchronous methods built in. Whatever else you do though, don't do any time-consuming work on the UI, whether it's one task or 500+ per second.

  3. #3

    Thread Starter
    Member buzz4rd's Avatar
    Join Date
    Feb 2012
    Posts
    42

    Re: How to Handle a large number of WebClient request?

    Quote Originally Posted by jmcilhinney View Post
    Do some research on multi-threading and parallelism to get a grounding.
    Is it similar like Thread Pool or something else?
    please

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    Re: How to Handle a large number of WebClient request?

    The ThreadPool class is one option when it comes to multi-threading, but one of many. The idea is that, instead of creating Thread objects yourself, you simply queue up work items for the ThreadPool and it executes of on different threads as it sees fit. There are advantages in that Threads get reused so there's less overhead and the maximum number of threads is also managed for you. There are a number of instances in .NET programming where the ThreadPool is used indirectly, e.g. the BackgroundWorker class raises its DoWork event on a ThreadPool thread.

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width