Hello,
I am using AsyncHttpClient version 2.10.1 in my application. I use one instance of Http Client for each data center (AWS region). At this time, I haven't configured the number of threads http clients are supposed to use. As a result I see, HttpClient created 100s of threads per httpclient.
Since AsyncHttpClient is Netty based and handles connections asynchronously, I don't think I need 100s of threads to handle a few thousand connections. My understand is HttpClient creates 2 times the number of OS threads per http client. I am looking to override this behavior. I looked at DefaultAsyncHttpClientConfig class and I see multiple configs related to threads. I need help on which setting is the most appropriate to control number of threads HttpClient uses. I saw following:
- setEventLoopGroup: I assume once I set this, I don't need to set any other settings related to thread.
- setThreadFactory: My understanding is this is not needed if I set setEventLoopGroup.
- setIoThreadsCount: Not sure why is this needed. Isn't this implicit after setting EventLoopGroup. Is this used in conjunction with setThreadFactory?
- setThreadPoolName: I understand this is used for naming pool but again I believe setting EventLoopGroup makes this redundant.
When I look at thread dumps, I see 2 Timer threads per HttpClient. What are these used for and how are they different from threads set using above settings.
Thanks!
Prabhash Rathore