How to send a scenario contains 6 events, x times per hour for y duration in the REST HTTP web API. This is the current codebase which can support a single scenario. Could someone help me to develop this to accept 19000 scenarios per hour for maximum up to 3 days?
@PostMapping("/sendtest")
public TestResult sendScenario(@RequestBody TestRequest testRequest) throws Exception {
ExecutorService executor;
executor = Executors.newFixedThreadPool(5);
executor.submit(() - > {
try {
this.sendeventfortest(testResult, testRequest.getLoggerURL(), httpEndPoint);
} catch (JsonProcessingException e) {
logger.error("Error occurred while sending scenario with identifier");
}
});
}
CodePudding user response:
- Given you use PostMapping annotation you're using Spring framework to build a web application.
- Java web applications are launched in the web/application servers like Jetty or Tomcat or JBoss or whatever
So in order to test it you need to deploy your application onto the web or application server and use a load testing tool like Apache JMeter to conduct the required load and analyze the results.
If your application will be able to handle 19k requests per hour you're good to go, if not - you will need to use profiler tools to inspect what does your sendeventfortest
function is doing, where it spends the most time, etc.
CodePudding user response:
Thank you for the input.
I am building a mockup with front end in angular and the back end in Java to send events to my application written in C#. So the testing input(calls per hour and the test duration) is from the angular to Java through Rest http post request. Can I enhance the rest api to send multiple scenarios(19K) from the java back end rather than using the tools.