Web contexts and concurrency?

Question about production configuration for a multi-tenant application.

We have one single code shared by many tenants (virtual hosts). Application context configure different environment, mapping ensure that single base code is shared.

The difference I see from ColdFusion is that CF compile a cfm page and that the compiled page is used by all tenants.
On the other side Lucee, at least in my install configuration, compile the same cfm page for each tenant (in each WEB-INF web context).

I don’t understand the pros/cons of such configuration.
Each tenant will have its own copy, so less concurrent accesses, but on the other side if all tenants hit the same page, the first time the server will be busy compiling the same page for all tenants. Can it be a problem?

Am I missing something here? or there are better configurations?

Can you describe your install config?

The things I think are relevant to my config are:


  • each tenant has a virtual host pointing to its own directory
  • Apache has a reverse proxy configuration
	ProxyPreserveHost On
	ProxyPassMatch ^/(.+\.cf[cm])(/.*)?$$1$2
	ProxyPassMatch ^/(.+\.cfml)(/.*)?$$1$2
	ProxyPassReverse /
  • Apache has modcfml_module to handle cfm and cfc pages
    (Lucee is installed on port 8888)


  • has only one default host in server.xml

<Host name="" appBase="webapps" unpackWARs="true" autoDeploy="true">

The reason for this is probably that we want to add dynamically new hosts, just adding a conf file to the Apache vhost directory

Each tenant directory has its own Application.cfc and a simple entry point index.cfm

  • each tenant maps paths for cfinclude onto a common code base directory
  • additional resources are mapped in lucee admin/components onto base directory for cfc

Please note that it’s a very old application (12+ year old) that doesn’t follow any framework or known structure and just “managed” to become multitenant (200 tenants more or less) from a single tenant application with little effort

Um, is the shared mapped folder mapped at the server level?

well, in each Application.cfc I have a series of mappings relatives to base-dir-path

<cfset this.mappings["/somefolder"]="/var/www/html/basedir/somefolder/" />

(working for cfinclude)

But at Server level (I mean inside the administrator) I have defined a mapping for componentes (“Additional Resources that Lucee checks for Components.”) like:

MyCFC = "/var/www/html/basedir/cfc";

(working for component creation)

keep in mind that web contexts don’t know about each other, but if you do it at the server level, then lucee can use a shared cache between different web contexts

you mean then that it could be more efficient/performant if I put the mapping at the server level?
As I was asking, 2000 hits at the same cache (10 users for 200 tenants) vs 200 hits for ten users per tenant?

yep, you asked how to avoid each web context compiling the same code over and over

doing this at the server should achieve that, which is your goal right?