Reputation: 4872
If I have a vec of 100 urls and make paralel iterator which makes 100 blocking HTTP requests, is the first request blocking the rest of them or can the all be made before some of them finish?
Upvotes: 1
Views: 263
Reputation: 1647
When you call Rayon
method, it creates a ThreadPool
. You can create your own ThreadPool
with number of threads you want to run in parallel.
So in your particular case, each request will block the thread it executed in, but threads will be run in parallel. In other words, if you have pool with 3 threads, then it will execute 3 requests in parallel.
Vec: [#1, #2, #3, #4, #5, #6, #7, #8] // list of requests
time ->
thread 1: #1...#4......#8
thread 2: #2.....#6...#7
thread 3: #3....#5
Upvotes: 2