bcgov / moh-phlat

Repository for the PHLAT registries data loading application
Apache License 2.0
2 stars 0 forks source link

adding file-size-threshold attribute #30

Closed Ashwani-cgi closed 8 months ago

Ashwani-cgi commented 8 months ago

Please review the ticket linked for the cause and the attempted solution. This pull request implements the first solution mentioned in the ticket's comments

Ashwani-cgi commented 8 months ago

I'm not sure if we need to deal with max-request-size on the backend if we have max-file-size. There is correlation between request size and file size so I feel it is redundant to some extent.

There are some defaults that kicks in if we don't provide the value which is different than what we want. https://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/autoconfigure/web/servlet/MultipartProperties.html

evgeny-pluzhnikov commented 8 months ago

I believe I got the idea. This is about avoiding issue when Tomcat removing the file prematurely. I believe if we want to avoid Tomcat dumping the data into temp file we should have max-file-size < file-size-threshold. It is the case for application.yml but not for application-local.yml. Is there any reason for local config having different limits?

Ashwani-cgi commented 8 months ago

I believe I got the idea. This is about avoiding issue when Tomcat removing the file prematurely. I believe if we want to avoid Tomcat dumping the data into temp file we should have max-file-size < file-size-threshold. It is the case for application.yml but not for application-local.yml. Is there any reason for local config having different limits?

planning to be same in both file. Here are the values and my logic Assuming 20 MB was what we calculated as file size. Keeping threshold for caching above max file size to make sure it does not write to disk. Keeping request size little bigger as it will have some other form data also. Does this sounds ok?

  # total request size limit
  max-request-size: 25MB
  # upload file size limit
  max-file-size: 24MB
  # above this size, tomcat will save it to temp dir.
  file-size-threshold: 25MB