async-http-client icon indicating copy to clipboard operation
async-http-client copied to clipboard

Huge delay in request processing when using AsyncHttpClient

Open swasti7 opened this issue 3 years ago • 0 comments

I created a simple HTTP request using the AHC client. I am seeing it is taking around 680ms for an endpoint which normally takes 50ms (verified by using curl) . What is the reason of such large response time with AHC client. Do i need to set something before using AHC client. Not sure what I am missing. Note that I am only sending single request a time.

import org.asynchttpclient.AsyncHttpClient;
import org.asynchttpclient.Response;
import static org.asynchttpclient.Dsl.asyncHttpClient;

AsyncHttpClient client = asyncHttpClient();

Long startTime = System.nanoTime();
Future<Response> responseFuture = asyncHttpClient.prepareGet(healthCheckRequest.getUriString()).execute();
Response res = responseFuture.get();
 Long endTime = HealthCheckUtils.getMillisSince(startTime);
 System.out.println("End time: " + endTime);

swasti7 avatar Jul 31 '22 07:07 swasti7