1

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?

ditoslav
  • 4,563
  • 10
  • 47
  • 79

1 Answers1

2

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
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Dmitry
  • 1,426
  • 5
  • 11
  • Thank you, I was wondering if the "blocking" means on a higher level than the threads produced by rayon – ditoslav Jun 29 '21 at 12:53