I’m creating files in the RAM drive on ApplicationStart. Is there any reason why they disappear and need recreating? There are not many files so it is not a space issue AFAIK.
From what I can see they should be available to all sessions.
They stay for a while and then seem to go - I’ve not timed it yet. I think it’s something I’m doing wrong but can’t fathom what. They are created in the application scope and I would have expected them to last for the time of the application - in this case 2 days. They seem to disappear quite fast. The ram available is the default set up using the express install. I doubt there is more than 200K of files.
off the top of my head, unless the application has expired, it’s probably possibly due to memory pressure and the ram drive (i think is using soft references), so if needed, the JVM may GC items in the ram drive if it runs out of memory. [LDEV-1109] - Lucee
you could try adding cflogs to onApplicationStart/onApplicationEnd to see if the application expires or restarts?
Can’t see any memory pressure - The graphs in the admin are not above 20%. The files time out after about 20 minutes and there is no restart with the application.
Rerun onApplicationStart - files appear
Wait 20 mins with server under no load - files disappear
Run restart app using url.restartApp - files appear
Setting for ram in Application.cfc = this.mappings[“/ram”] = “ram://”;
I wasn’t successful with writeLog() - I could get my own message but not any system generated information - could you give me an example please.
Do you know the memory allocated as default in Express?
I’ve been wracking my brain but I can’t remember. I’m sure I’ve read a post here or in the CFML slack saying something like the RAM drive was volatile or something like that and files could just be ejected.
Recently had an issue with files in the RAM drive (which I’m sure, whilst researching found said post) and ended up just moving it to a /tmp and cleaning up after.
just change the log level for application to INFO in the admin, or use the argument type="error", the default log level is ERROR, or use SystemOutput() :: Lucee Documentation which logs to the console
to change the config for express, set ENV vars as per
It’s not the application restarting - I think it is the ENV vars. I changed them to max 2GB and the files have remained now for over two hours… I’ll update this if everything is still OK tomorrow, which should be enough time to test it!
No restart needed - the files are still there - I think this has cured the problem! This is the kind of information that deserves to be in the lucee docs for the RAM Drive. It’s crazy that something so easy to sort is buried in the minds of devs and not available where it is needed.
Humm - The RAM increase worked for about 1 1/2 days and then was GC’d. Files gone again. Do we have any indication of the memory size required before GC won’t remove the files?
Would caching by Lucee increase the needed memory size. I wonder if the size of the memory required needs to be larger than Lucee needs for a period of two days, ie until the Application times out?