There is a rest endpoint that I am hitting via http library and converting the response to String (as shown below), which is then written to HDFS (Hadoop Distributed File System).
HttpClient httpclient = new HttpClient();
HttpGet httpget = new HttpGet(url);
HttpResponse response= httpclient.execute(httpget);
BufferedReader in = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
String inputLine;
StringBuffer content = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
content.append(inputLine);
}
String respStr = content.toString();
What I realized that though REST API is responding in milliseconds but due to above code of converting the response to string, it is taking a lot of time.
Can someone suggest how to speed up the behavior or how to do it right way?