I am using ning async http client to achieve non-blocking kindness. When checking apples and apples (without blocking against blocking), I see that the non-blocking version serves more sample requests, however the async-http client creates more threads than its blocking copy. Is this expected or something that I am missing?
Here are the numbers from the stress test
Async Http Client jMeter - 2 threads, 120 seconds, 1 sec ramp up Peak threads : 270 Heap usage: 600mb Peak cpu usage: 30% Total samples: 18228 Blocking version jMeter - 2 threads, 120 seconds, 1 sec ramp up Peak threads: 118 heap usage: 260mb cpu usage: 18% total samples: 1472
I am creating a connection thread pool (reusing them)
AsyncHttpClientConfig.Builder builder = new AsyncHttpClientConfig.Builder(); builder.setRequestTimeoutInMs(2000); builder.setMaximumConnectionsPerHost(10); builder.setMaximumConnectionsTotal(100); client = new AsyncHttpClient(builder.build());
Is something missing here? I tried looking at the thread dump to see what creates the threads, but didn't find anything useful. My bet is that for each HTTP connection, a thread is created to trigger a callback when I / O is completed in the async http client.
source share