VS 2017 How to Handle a large number of WebClient request?-VBForums
Results 1 to 4 of 4

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

  1. #1

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

    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
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    97,356

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

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

    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
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    97,356

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.