Details
-
Improvement
-
Status: Closed
-
High
-
Resolution: Cannot Reproduce
-
None
-
None
Description
The BinariesServlet creates an in memory copy of all binaries. For binaries smaller than the max cache size that is fine. For larger binaries it is not ok. Creating many concurrent requests to a large binary can lead to an OOME.
Large binaries should be directly streamed from jcr which will create a local file copy and not keep the connection to the database open (configurable).
The key components are:
- set/check maxSize in binariesservlet from HstCache.getMaxSize() (binariesCache)
- check getLength() of the binary property (jcr:data). The length is stored separately in the db and it is a cheap call
- if it is larger than maxSize, stream directly and do not call BinaryPage.loadDataFromStream() which creates a local in memory copy