Equivalent of "Save Class Files" in Railo

115 views
Skip to first unread message

Brad Wood

unread,
Jul 30, 2013, 1:15:31 PM7/30/13
to ra...@googlegroups.com
I swear I've had conversations about this before, but my Google-Fu is failing me today.

Is there a setting in Railo to not save class files to disk?  In Adobe CF it's called "Save Class Files".

Thanks!

~Brad

Mark Drew

unread,
Jul 30, 2013, 1:18:18 PM7/30/13
to ra...@googlegroups.com

Class files are automatically stored to disk. This is under performance and how often these class files should be checked (AFAIK). 


The class files are then stored under WEB-INF/railo/cfclasses



Regards
Mark Drew

The Railo Company
Professional Open Source
skype: mark_railo ma...@getrailo.com
+44 7971 852296 http://www.getrailo.com
--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/0678fe1b-6efd-4785-b1ef-2bdaf7d8f711%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Screen Shot 2013-07-30 at 18.17.18.png

Brad Wood

unread,
Jul 30, 2013, 1:21:56 PM7/30/13
to ra...@googlegroups.com
Yes, but my question was if there is a setting to turn off the disk persistence.  I don't see a setting for that under performance.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 



You received this message because you are subscribed to a topic in the Google Groups "Railo" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/railo/etPan.51f7f55a.216231b.9ad9%40railo.home.

Mark Drew

unread,
Jul 30, 2013, 1:25:05 PM7/30/13
to ra...@googlegroups.com

Then put the setting check every time. I mean, then it will still compile it, save it to disk, but just every time. I shall defer to the engineering team on the precise process (i.e. if it needs to actually compile to disk) but I don't understand why you need to turn that off (or on) since it's nothing to do with you (I don't mean, you Brad, I mean a developer in general) as it is the internals of Railo 


Again, I am just a propeller head and have no actual details on the compile time settings. 


Regards
Mark Drew

The Railo Company
Professional Open Source
skype: mark_railo ma...@getrailo.com
+44 7971 852296 http://www.getrailo.com

Brad Wood

unread,
Jul 30, 2013, 1:37:20 PM7/30/13
to ra...@googlegroups.com
Heh, understood.  The question mostly came out of as conversation I had today where I suggested someone to try turning off that setting and then realized they were on Railo and couldn't find the setting.

I've had real issues with disk storage of class files in some instances for Adobe ColdFusion.  Adobe doesn't ever clear out the class files and it keeps them all in one giant directory.  The number can grow and grow.  This is exacerbated if you use any sort of framework like Mockbox or WireBox AOP that creates temporary stub .cfm files to generate dynamic methods at runtime.  Each of those temp .cfm files are deleted from disk, but the class file lives on forever.  I've had ACF servers crawling to a halt due to tens of thousands of files in one directory and Windows can't deal with that very well.  The only thing you can do is regularly clean the directory or turn off "save class files" and take a hit on restart.

Now that being said, I haven't actually seen this be an issue yet with Railo so I'm not saying it is, but that's why I was looking for the setting today.  The person I was talking to had 44,700 class files on their Windows Railo server.  

I do see that Railo breaks them up in sub directories which probably helps quite a bit.  I would be interested to hear if Railo occasionally cleans out old class files just for the sake of housekeeping.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 



Gert Franz

unread,
Jul 30, 2013, 1:44:10 PM7/30/13
to ra...@googlegroups.com
What you can do is to edit the Railo-web.xml.cfm and change the cfllasses folder to something like ram://cfclasses
I don't know the exact naming but you'll find it. Then Railo compiles into Ram only. And you just need to change something in the admin for the change to be picked up...

HTH

--
Gert Franz
Somewhere on the road

Brad Wood

unread,
Jul 30, 2013, 1:49:30 PM7/30/13
to ra...@googlegroups.com
Ahh, very clever.  Thanks for the tip.

If Railo has taken steps to inherently protect against an unhealthy accumulation of class files on disk, I'd love to hear about that too.  I don't want to try and fix Railo problems if they don't exist in the first place.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 



Igal @ getRailo.org

unread,
Jul 30, 2013, 2:05:53 PM7/30/13
to ra...@googlegroups.com
in Railo the cfclass file names stay the same when the templates are recompiled and saved (e.g. index_cfm$cf.class remains index_cfm$cf.class), so in general the files are overwritten and not being added as they do (or at least used to do) in ACF.

there is an issue with the default storage (file) of Client and Session data, where on an active site hundreds of thousands of small files are generated and can cause a problem on some operating systems (Windows, for example).  we added a warning to the Server Overview page for contexts that have more than 100,000 files of either type.  choosing a different type of storage resolves this issue.


Igal

For more options, visit https://groups.google.com/groups/opt_out.
 
 

-- 
Igal Sapir
Railo Core Developer
http://getRailo.org/

Adam Cameron

unread,
Jul 30, 2013, 2:08:37 PM7/30/13
to ra...@googlegroups.com
Yeah, I can't vouch for Railo, but on ColdFusion saving class files rapidly becomes a performance hit on the system (Windows) if your app is such that you generate more than a thousand or so classes. The reason being - it seems - that Windows really struggles to file-scan a directory to find the pre-compiled class if it's needed... say the one in memory has been garbage collected... once there are more than a few hundred files in that directory. On big apps it's more expedient to let the class recompile from source code than rely on Windows finding and loading a saved one.

I doubt this is a problem on *nix-based file systems.

The issue with CF is that all the classes are stored in one flat directory. If they were stored hierarchically (which shouldn't be too much of an issue?), then there'd be no problem. I did mention this to the Adobe bods, but they looked at me like I was speaking [some language they didn't understand... CF perhaps], and that was that.

Anyway... I dunno if the same consideration exists on Railo, but this would be one reason why one might not want those class files saving. Something to test, perhaps.

-- 
Adam



Mark Drew

unread,
Jul 30, 2013, 2:13:50 PM7/30/13
to ra...@googlegroups.com
I feel an Adam Cameron blog post brewing... Or a disturbance in the Force... I am never sure of which :)

As an aside, Railo does create sub folders and doesn't need to create classes for each function in a CFC so the number of files is  greatly reduced


MD

For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
Mark Drew
Railo Technologies      Professional Open Source
skype: mark_railo        ma...@getrailo.com
+44 7971 852296           www.getrailo.com

Igal @ getRailo.org

unread,
Jul 30, 2013, 2:17:18 PM7/30/13
to ra...@googlegroups.com
in Railo 4+ the UDFs are created as Java "internal classes".  that's the reason you see the "$" symbol in the debug output for example when a UDF is called.
--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to the Google Groups "Railo" group.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

-- 
Igal Sapir
Railo Core Developer
http://getRailo.org/

Brad Wood

unread,
Jul 30, 2013, 2:20:47 PM7/30/13
to ra...@googlegroups.com
> in Railo the cfclass file names stay the same when the templates are recompiled and saved

This wouldn't protect against libraries like Mockbox and WireBox AOP which write out temp files whose names are GUIDs to prevent collisions.  Every temp file has a unique name and therefore a unique class file.

Generally speak though, I Adobe reuses the same file names as well, so that behavior in itself wouldn't be any benefit over Adobe's.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 



Brad Wood

unread,
Jul 30, 2013, 2:22:31 PM7/30/13
to ra...@googlegroups.com
lol, an Adam Cameron blog post _is_ a disturbance in the force.

Thanks for the clarification on the lack of class files per function.  I was wondering if that was the case based on the file names.  That is certainly a huge improvement when using a site with lots of CFC and methods.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 



--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to a topic in the Google Groups "Railo" group.

Igal @ getRailo.org

unread,
Jul 30, 2013, 2:26:10 PM7/30/13
to ra...@googlegroups.com
perhaps they fixed that, but in ACF8 if you had modified a template 10 times you would get 10 different class files with different numeric suffixes, which was creating huge problem when not addressed in time.

if you create a bunch of classes then you should probably add some cleanup process that will run periodically and remove files older than x seconds.  also, perhaps those libraries should  reconsider their file naming conventions.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Brad Wood

unread,
Jul 30, 2013, 2:37:34 PM7/30/13
to ra...@googlegroups.com
perhaps they fixed that, but in ACF8 if you had modified a template 10 times you would get 10 different class files with different numeric suffixes, which was creating huge problem when not addressed in time.

That's possible.  I ran my test in ColdFusion 10 Update 11 when I confirmed that the class files are re-used.  I don't have ACF 8 or 9 installed right now to try them.


if you create a bunch of classes then you should probably add some cleanup process that will run periodically and remove files older than x seconds.  

You mean writing CFML code to delete the Railo class files?  Honestly, I'm kind of in the same mindset as Mark on this-- developers ideally shouldn't need to concern themselves with the internal workings of the application server.  I would suggest rather than Railo delete class files once the .cfm file has been removed.

also, perhaps those libraries should  reconsider their file naming conventions.

What would you suggest?  We need to account for any number of concurrent threads creating any number of unique method stubs at a single time on the server by writing files to a shared directory in a way that avoids any collisions.  Forcing a unique name for each file is certainly the easiest way to accomplish this.  The only other method I can think of is if we kept a running list of rotating filenames in use and marked them as unused after we deleted the .cfm so we could use them again.  But that's a lot of work to avoid something that in my opinion the application server should be cleaning up on its own.  (class files with no corresponding cfm/cfc file)  Do you have other suggestions on how to avoid file collisions without unique names?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 



Chris Blackwell

unread,
Jul 30, 2013, 2:56:49 PM7/30/13
to railo
<file-system
  deploy-directory="ram:///cfclasses/"
  fld-directory="{railo-web}/library/fld/"
  temp-directory="ram:///temp/"
  tld-directory="{railo-web}/library/tld/">
</file-system> 

Igal @ getRailo.org

unread,
Jul 30, 2013, 3:00:04 PM7/30/13
to ra...@googlegroups.com
is your code limited to CF-ML/Script or can it be in Java as well?  in Java you can write a class that will generate a unique filename in a synchronized manner.  sure, you can do it CF as well but personally I prefer to keep stuff like that in Java for performance and data-integrity reasons.

I don't think that it would be an issue if you run a code once a day, for example, that scans a folder and deletes files that are older than 7 days.  each fileDelete should be in its own try/catch so that the code will keep running if some deletions fail.  this can be done as an EventGateway that will sleep for 24 hours between iterations.

having Railo monitor the file system to detect deletions of source code (via event listener) will add much overhead IMO.  but -- we can add a process (or EventGateway) which will scan the cfclasses folder, read the source-filename from the class files (it's saved somewhere in the beginning of the file), check if the source exists, and if not -- delete the class file.  of course, you can do that yourself in an EventGateway ;)




On 7/30/2013 11:37 AM, Brad Wood wrote:
perhaps they fixed that, but in ACF8 if you had modified a template 10 times you would get 10 different class files with different numeric suffixes, which was creating huge problem when not addressed in time.

That's possible.  I ran my test in ColdFusion 10 Update 11 when I confirmed that the class files are re-used.  I don't have ACF 8 or 9 installed right now to try them.

if you create a bunch of classes then you should probably add some cleanup process that will run periodically and remove files older than x seconds.  

You mean writing CFML code to delete the Railo class files?  Honestly, I'm kind of in the same mindset as Mark on this-- developers ideally shouldn't need to concern themselves with the internal workings of the application server.  I would suggest rather than Railo delete class files once the .cfm file has been removed.

also, perhaps those libraries should  reconsider their file naming conventions.

What would you suggest?  We need to account for any number of concurrent threads creating any number of unique method stubs at a single time on the server by writing files to a shared directory in a way that avoids any collisions.  Forcing a unique name for each file is certainly the easiest way to accomplish this.  The only other method I can think of is if we kept a running list of rotating filenames in use and marked them as unused after we deleted the .cfm so we could use them again.  But that's a lot of work to avoid something that in my opinion the application server should be cleaning up on its own.  (class files with no corresponding cfm/cfc file)  Do you have other suggestions on how to avoid file collisions without unique names?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 



On Tue, Jul 30, 2013 at 1:26 PM, Igal @ getRailo.org <ig...@getrailo.org> wrote:
perhaps they fixed that, but in ACF8 if you had modified a template 10 times you would get 10 different class files with different numeric suffixes, which was creating huge problem when not addressed in time.

if you create a bunch of classes then you should probably add some cleanup process that will run periodically and remove files older than x seconds.  also, perhaps those libraries should  reconsider their file naming conventions.

--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to the Google Groups "Railo" group.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Brad Wood

unread,
Jul 30, 2013, 3:00:08 PM7/30/13
to ra...@googlegroups.com
Thanks Chris.  Even though I do enjoy the benefit of having class files persisted across restarts, that's handy info to have.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 



--
Did you find this reply useful? Help the Railo community and add it to the Railo Server wiki at https://github.com/getrailo/railo/wiki
---
You received this message because you are subscribed to a topic in the Google Groups "Railo" group.

Brad Wood

unread,
Jul 30, 2013, 3:19:06 PM7/30/13
to ra...@googlegroups.com
The only real limitations are that the code needs to run on supported versions of Railo and Adobe CF without any unreasonable security requirements.  Typical stuff for a framework that need to be usable by most anyone.

Thanks for the event gateway suggestions.  Since railo creates the class files, I'm in favor of the onus being on Railo to clean them up.  I created this ticket for the enhancement: https://issues.jboss.org/browse/RAILO-2552

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp 

ColdBox Platform: http://www.coldbox.org 



Adam Cameron

unread,
Jul 31, 2013, 3:23:54 AM7/31/13
to ra...@googlegroups.com


On Tuesday, 30 July 2013 19:26:10 UTC+1, Igal wrote:
perhaps they fixed that, but in ACF8 if you had modified a template 10 times you would get 10 different class files with different numeric suffixes, which was creating huge problem when not addressed in time.

That is, I'm afraid, not true. Nor is it true of any version of CF I can recall using.

-- 
Adam 

Adam Cameron

unread,
Jul 31, 2013, 3:25:35 AM7/31/13
to ra...@googlegroups.com


On Tuesday, 30 July 2013 19:13:50 UTC+1, Mark Drew wrote:
I feel an Adam Cameron blog post brewing... Or a disturbance in the Force... I am never sure of which :)


That had not occurred to me, but yeah sounds like the typical "mildly interesting but not really that useful to know" sort of thing I investigate & write up.

 
As an aside, Railo does create sub folders and doesn't need to create classes for each function in a CFC so the number of files is  greatly reduced



Good to know, cheers Mark.

-- 
Adam 

Michael Offner

unread,
Jul 31, 2013, 5:02:32 AM7/31/13
to ra...@googlegroups.com
that is not exactly true, Railo never creates inner classes, every Page class (a Page class represents a cfml template), has a method "udfCall" that holds the bodies of all functions in that template and you can call the body of a specific function by index.
we have given a lot of thoughts and testing in Railo 0.0, to find the fastest way to handle UDFs with the smallest memory footprint, inner classes was not a option, because they have a huge overhead.

Micha




2013/7/30 Igal @ getRailo.org <ig...@getrailo.org>

For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
/micha

Michael Offner CTO Railo Technologies GmbH
Reply all
Reply to author
Forward
0 new messages