séan35
séan35

Reputation: 1052

Managing ThreadPool and Connection Pool sizes with CompletableFuture for concurrent third-party API calls

I'm working on implementing concurrent third-party API calls for items in a list using CompletableFuture in Java. Instead of processing these requests sequentially, I want them to be executed asynchronously without waiting for each other.

We plan to use CompletableFuture, but I believe we'll need to manage the thread pool carefully. Without setting parameters like max pool size, the application might consume excessive memory and potentially freeze during high traffic.

My main concerns are:

  1. How should we determine appropriate thread pool and queue sizes for this scenario?
  2. We currently have a connection pool (size: 20) for third-party API calls. Should the thread pool size be limited to not exceed this connection pool size?

I'm specifically looking for:

Can anyone provide guidance on these aspects of concurrent API call implementation using CompletableFuture?

Upvotes: 1

Views: 61

Answers (0)

Related Questions