Fixing ColdBox performance affected by custom tag paths

I’m putting this here to preserve it and so others can find it. I recently helped someone who had a simple ColdBox application that performed very well on their local CommandBox development server. However, when they placed the app on their production server (Adobe CF 2018), it was very slow. Taking up to 2 seconds for a simple event to run.

After purchasing a FusionReactor license, we were led straight to the problem. Here is a portion of the profiler output for a request that was taking nearly 2 seconds to run.

Can you spot it? The frameworksupertype calls the CF function expandPath() and a huge portion of time was being spent there. We traced the two expandPath() calls which are used to include application helper mixins and it was only being called about 20 times per request, which should have been no more than a few ms worth of processing.

The profiler shows however that the custom tag paths are being scanned. Sure enough, Adobe CF will scan your custom tag folders when expanding a path since ColdFusion 10.

Enhancement in ColdFusion 10 lets files in the custom tag directory to also resolve. For instance, if there is a file test.txt in the custom tag directory (C:\Zeus), the function (with \test.txt) returns C:\Zeus\test.txt.

On the server in question, a large “lib” folder had been placed in one of the custom tag directories with over 4,000 files in different sub directories. Every call to expandPath() was kicking off what appears to be a recursive scan of the entire folder which slowed the app down.

The main takeaways here are that performance overhead can come from very unexpected places and FusionReactor was integral in being able to quickly locate the source of the issue.

1 Like

That “someone” was me. Thanks for your help, Brad. We have a number of things on that server that are not ideal, but it was shocking to find how slow Adobe ColdFusion can be at scanning your folders for a simple expand path call. This probably also improves performance in many other apps on that server where it wasn’t such a big hit that it was this noticeable.