Reputation: 21
I need to send x HTTP client request. I want to send the requests in parallel, but no more than y at once.
I will explain:
The client can handle only y requests simultaneously. I need to send x request to the client, while x > y.
I don't want to wait until all the first y requests will end, and then send another bulk of y requests. This approach isn't efficient, because at each moment, my client can handle y requests. If I will wait until all the first y will end to send another y requests, the client won't be fully utilized.
Many thanks!
Upvotes: 1
Views: 1569
Reputation: 21
I'm answering my question... After some tests, the described test does not scale well with any reactor pattern. The solution here is to use a thread poll of y for sending x tasks.
Upvotes: 1
Reputation: 17741
I would suggest to go with your solution based on callbacks, and not to rely on maxPoolSize
.
From the documentation:
* If an HttpClient receives a request but is already handling maxPoolSize requests it will attempt to put the new
* request on it's wait queue. If the maxWaitQueueSize is set and the new request would cause the wait queue to exceed
* that size then the request will receive this exception.
Upvotes: 0