Mappings directory with corresponding single cfclasses directory


#1

In a virtual hosts environment (we have 300+ virtual hosts running Lucee 5.2.4.37 on IIS 10) we have a mapping to a global components and other directories. As mentioned in previous posts updating a single or multiple files in a mapped directory causes re-compiling in all WEB-INF/lucee/cfclasses within all virtual hosts which fills the server memory and often requires a Lucee restart.

My question
Is there a way to have a single global compiled cfclasses directory for these mapped directories to avoid the overhead of the redundant file compilation in all the virtual hosts directories as the same changed file is essentially compiled to the exact same file 300+ times currently.

I appreciate any guidance on scaling this better.
Thanks,
Andrew


#2

Does each site have separate settings? i.e. Could you just have them all share the same web context? One of the reasons the class files are stored separately is because you might have “full null support” enabled in one web context but disabled in another, which would generate two different versions of the bytecode.

If you must have different web contexts, you could try some symlinks to share the class files, but I’ll warn that I’ve never tried this and I don’t really know if it will work. It also likely won’t prevent each web context from having it’s own in-memory cache of the class files.

I am curious if precompiling your shared libs as a lar file and then creating mappings that point to the same lar would make any difference. I’m not entire sure how the class files are handled from lucee archives (LARs)


#3

Thank you for your reply.

  1. Yes all sites could share the same web context, there is nothing different about each site. How would I achieve this?
  2. I am not aware of how to enable “NULL” support at the web level, I only see that setting at the “Server” level in Administrator.

#4

Sorry, I might have been wrong about null support specifically. The point was the web context settings could potentially affect bytecode generation

I think to lock everything into a single web context, you can just set the init-param in your web.xml to override the lucee-web-directory setting.

<init-param>
  <param-name>lucee-web-directory</param-name>
  <param-value>/path/to/shared/web-context</param-value>
</init-param>

I’m not 110% on that, but I think it should work. If not, the next step would be to remove mod_cfml and manually define a single Tomcat host and you’d probably need some rewrite and virtual dir nonsense to still have separate web roots for everything possibly. But before you get off in those weeds, see if a single web context improves anything.