I’m working to resolve an issue in our application which was leading to JVM memory issues, because the page can end up generating a very large amount of data, which can lead to OutOfMemory issues.
That got me thinking that it would be useful if there was a way for Lucee to start buffering it’s output to the file system if the buffer stream reached a certain threshold and then when time to send the content upstream, it would read from the file stream.
The goal would be to add safe guards against memory issues on pages that could generated 100s of MBs of data, so instead of the content buffer trying to put it all in a StringBuilder it could write directly to disk after it hits a certain threshold (maybe 10MBs, or whatever the developer finds appropriate). While this obviously would have some performance issues streaming to disk, for requests generating a large amount of data, that performance hit isn’t really going to matter.
In our use case, we cannot use <cfflush />
, because the output is generated via backend process because the content can take minutes to generate.
Perhaps there are better ways to safe guard from these types of issues, but I thought I’d offer up a proposal.