Skip to content

How to set ThreadPoolTaskExecutor if sending numerous http requests at same time?

In my case, I need to send over million of http requests to client’s app for popping notification. like below sudo code

int numOfHttpReq = 1000000;
for (int i = 0; i < numOfHttpReq; i++) {
  call async method with ThreadPoolTaskExecutor ...

I have referenced article from this website, and obtain a formula

Number of threads = Number of Available Cores * (1 + Wait time / Service time)

However, I think it’s not 100% suitable in my case. I’d like to know how to set ThreadPoolTaskExecutor in this case such as CorePoolSize, MaxPoolSize, QueueCapacity, etc…



Why dont you take a look at the “Gatling” tool for these kind of performance related tests. You dont worry about the object pooling and other stuffs just feed then whats your use-case like within the span of time how many concurrent requests / concurrent users / ….other options as well there. Gatling

3 People found this is helpful