Coldfusion cfimage tag in a cluster

The cfimage tag in coldfusion stores it temporary files to the local
file store then uses a JSP Serverlet to serve them back to the user.
This is a neat solution in that it avoids the need to invoke coldfusion
for each image serve and allows you to have a cached copy but it is a
bit of a hack in that it tampers with the JRun module to make it
work by mapping /CFFileServerlet from your webserver to the jrun server.
This means that it goes round any access control you have set up in your
web server and may even subvert some sandbox controls. I may dig a bit
deeper at some point to try and find out how this actually works but for
now I just need a solution.

 As for the cluster, as the image files is written to a local file store
then it is only available on one server. Simple solution to this is to
have the JRUN connector use sticky sessions so that you always go back
to the same server and the image is always there to be served. This will
only work if you have created a session in your application by setting
the "SessionManagement=true" in your Application.cfm/cfc. Otherwise the jrun
module will just pick a server at random and quite often this will be a
different server for the image than the one that just served the cfm.

 The other option is to set the tmpCache to be on shared storage. I am
not sure if this will be a problem having two servers accessing it at
the same time or not but it would mean that the temp files would be
available to both server. What do you think the chances are that
ColdFusion does NFS safe file locking in it's temp directory?
I assume that if you could change the location of the tmpCache directory
that the CFFileServerlet hack would stop working so I am going to try
linking it off to a nfs location or a bind mount. I could not workout a
simple way to change it anyway.

 As a side note I think that the cfreport tag uses the same hack but the
chance is that you will have a session set up if you get to reporting.

521 views and 0 responses