I am running a jar file on ubuntu system having 16 GB RAM. I used spring boot framework, JPA while developing the application. I observed that memory and cpu usage keep on increasing after application started.
What could be possible reason to constantly increase the CPU usage and memory ?
What are operations is doing by application -> Update text file with
File file = new File(file path);
OutputStream os = new FileOutputStream(file.getAbsoluteFile());
and read operation by
FileInputStream inputStream = new FileInputStream(file);
InputStreamResource resource = new InputStreamResource(inputStream);
updating file with one min frequency.
I tried with run the jar as well as deploy war file on tomcat server in both cases its behaving same.
The main intension is to create proto-buffer text file. I have added
@Scheduled(fixedDelay = 60000)
@RequestMapping(value = "/test")
public String generateProtoBuf(){
...
}
so every min this method will trigger and update the text file.
I exposed another API.
@RequestMapping(path = "/getProtoBuf", method = RequestMethod.GET)
public ResponseEntity<Resource> getProtoBuf() throws IOException {
...
}
this API will call every twice in min. file size will be less than 1 MB.
For initial few hours app is running normally but after few hour when cpu usage increase by 15% then It will drastically increase and touches 100% .