Slow image processing with cfcontent

We are planning migration from ColdFusion 11 to Lucee 5.3.2.77 in the upcoming weeks. On some of our web pages, we serve thumbnails (100x100 jpgs) residing on a different network server. In ColdFusion 11, these requests take 10ms each. On Lucee, the requests take 1,000ms, or 100x longer. A page that used to load in under a second now could take 20-30 seconds.

The code is quite simple for our getThumbnail.cfm?id=[#] page:

<cfset loc = “\\networkserver\images\thumbnail_[#].jpg”>
<cfcontent type = “image/jpeg” file = “#loc#” deleteFile = “No” reset=“yes”>

I’ve also tried modified code, which did not improve performance

<cfscript>
loc = “\\networkserver\images\thumbnail_[#].jpg”;
imagefile = FileReadBinary(loc);
</cfscript>
<cfcontent type = “image/jpeg” variable = “#imagefile#” reset=“yes”>

Does anyone know what could be causing the slow performance or additional overhead? We are running Windows 2019 on all servers and we don’t believe there are any network bottlenecks to the Lucee server. I have written some custom Java code in Lucee to speed up other parts of the application, but I was hoping this would not be necessary here.

Same problem serving from a local or mapped drive?

Is it cfcontent or just reading the file over the network, underlying Lucee uses the same resource handling for filereadbinary() etc .

Try logging out the getTickCount() between each call, i.e before and after filereadbinary()

I tried an image on the local Lucee server with the same result. getTickCount() outputs the same value before and after filereadbinary(). I assume this means that processing is delayed until the return variable is used in subsequent code.

In other words, filereadbinary() happens instantly, but <cfcontent type=“image/jpeg” variable=“#filebinary#” reset=“yes”> takes at least a second to return even with very small local or networked image files.

Does it also happen with the latest snapshot?

Thanks for your assistance. The image files returned quickly in both the 5.3.2.77 snapshot and the 5.3.5.61 snapshot. This meant there was something else wrong with my server setup rather than the Lucee baseline files.

Turns out the Java setting -Djava.net.preferIPv4Stack=true was causing slow file downloads. We originally set this option to prevent other issues since our internal network makes use of IPv6 but the CFML code and external access is limited to IPv4. I’ll have to re-visit the IPv6 issues and either update some settings on our internal networks or add code to handle this some other way in Lucee.

1 Like