Skip to content

Conversation

@stillnet
Copy link

By adding some logging to ViewRenderer.cfc, I noticed that when this ViewRenderer.includeNotFound exception was thrown, it was looking for the view file under the ColdFusion installation directory wwwroot (C:\ColdFusion2016\cfusion\wwwroot for example). Not sure why this is happening, but it only happens under load, this caching change should fix it. I have been running this in production without issues so far.

In my testing this also improved performance. Many pages were taking 100-300ms to find their view files. With this fix (and after the location is cached), they take 0ms.

…ves performance also.

In my testing this improved performance by quite a bit. Many pages were taking 200-350ms to find the view file. After this fix, they take 0ms.
@ghidinelli
Copy link

@stillnet nice tweak - can you tell me what your <viewMappings> node looks like in coldspring.xml? And what you get if you dump getViewMappings() both under load and under normal requests on your system?

Introducing caching here may require some locking, which may or may not be better than fileExists().

Also, looks like you're deployed on Windows. Can you put a timer around that specific block that loops over the viewMappings running fileExists() and see if that's really the part that is generating 100-300ms times? I'm wondering if Windows fileExists() is slow.

On my Docker/Linux setup running on my Mac, my viewMapping only seems to have one element and it finds the file exists in 1-3ms.

@stillnet
Copy link
Author

My viewmappings element in ColdSpring.xml is set to /views. We load many viewmappings in our other ModelGlue.xml files though. We probably have about a dozen.

You could be right about locking, perhaps there should be locking during the set, but it shouldn't be necessary during the read. Even allowing two sets to run at once - I don't think we'll end up with a half written variable, I think one will just overwrite the other.

Yes I am on windows. I did have benchmark code around the viewmapping/fileExists loop, that was the part that was taking 100-300ms. I agree it's probably related to running fileExists(), not necessarily a CF problem.

I'm not able to run getViewMappings(), what should I be running this on? I tried the viewState and on application.nav_glue (our instance of MG).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants