I have to build a fairly custom load testing tool, and because of this I don't want to use JMeter (lets assume for a moment that the level of customization cannot be done using jmeter).
One import part of this load testing tool is sending a XML for to a API endpoing.
How can I improve the below code to make this fast/efficient?
private boolean PostErrorToApi() throws IOException {
File xmlSample = new File("/path/to/file/sample.xml");
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost("http://localhost:8090/some/api/method/get/");
httpPost.setEntity(new FileEntity(xmlSample, "text/xml, application/xml"));
CloseableHttpResponse response = httpClient.execute(httpPost);
String line = "";
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
} finally {
response.close();
}
if (line.equals("200 OK"))
return true;
else
return false;
}
My goal is to get to a few thousand requests per second (http latency shouldn't be that much of an issue since this will be in a private network).
I'm not trying to get a real world scenerio here, the goal is to see if the services can stay up for 48 hours and just to monitor any issues that might come up etc.