So i have a very relatively simple java application spring 2.3.7 on java 8 that microservice simply calls DB to save update or retrive base64 image string thats all.
So i have deployed that in my server - xms 128 mb then pushed a load of 1000 users using k6 pushing load directly to that microservice.
All is similar to the same service method
public ApiSuccess uploadFiles(UploadFilesRequest request) throws GeneralException {
log.info("In FileUploadService.uploadFiles");
try {
List<UserUploadFiles> files = request.getFiles();
if (!CollectionUtils.isEmpty(files)) {
for (UserUploadFiles file : files) {
UploadedFileEntity fileEntity = smbUploadFileRepository.findByTransactionIdAndType(request.getTransactionId(), file.getType());
if (!isAllowedBase64File(file.getData())) {
throw new GeneralException(
MessageCodes.COMMON_ERROR_MESSAGE.getMsgCode(),
Collections.singletonList(getInvalidFileTypeMessage()),
HttpStatus.BAD_REQUEST
);
}
if (null == fileEntity) {
fileEntity = new UploadedFileEntity();
fileEntity.setFile(file.getData());
fileEntity.setTransactionId(request.getTransactionId());
fileEntity.setType(file.getType());
} else {
fileEntity.setFile(file.getData());
}
smbUploadFileRepository.save(fileEntity);
}
}
}catch (GeneralException ge){
throw ge;
}
catch (Exception ex) {
log.error("Exception FileUploadService.uploadFiles : ", ex);
throw new GeneralException(MessageCodes.FAILED_TO_GET_UPLOADED_FILES.getMsgCode(),
Collections.singletonList(ex.getMessage()),
HttpStatus.INTERNAL_SERVER_ERROR);
}
log.info("Exit FileUploadService.uploadFiles");
return new ApiSuccess(HttpStatus.OK,
languageHelper.getMessagePropValue(MessageCodes.SUCESS_TO_SAVE_UPLOADED_FILES.getMsgCode(), null),
MessageCodes.SUCESS_TO_SAVE_UPLOADED_FILES.getMsgCode());
}
But it apprently takes 1GB to handle 200 concurrent users then once the load is 0 and i stop using the application and interacting with server itself
I checked visualVM heap usage this is what i see
after 3.15 there was 0 load then why did the objects accumulate and after sometime it becomes right angled triangle waves comes down goes every 5-10 minutes and yeah there is no schedular and stuff running.
One such instance is
There is no load here after 12.30
So is my application healthy and this is how java spring is supposed to behave or do i have any leak or retention as i checked but could not find anything.

