Unnecessary getRootPath() file system access on every request adds overhead
Now that I've added Lucee to the Techempower language benchmarks, I'm performance tuning the tests-- some of which just hit a hello world page with 512 threads to see how many requests the server can process a second.
One of the very first things I saw when profiling the JVM, was basically 512 threads all running the exact same code in the stack trace below.
Every page request to Lucee calls
as part of CFMLEngineImpl.getCFMLFactory() which results in a touch to the file system. This is not a check which needs to be run more than once per server restart since the servlet context root will not change. Lucee needs to cache this lookup and not invoke the file system hit every request.
FWIW, "inspect templates" was set to "never" during this test.
Could this have caused this error repeatedly showing up in stdout.log leading up to 500/server unresponsive?
[ERROR] io.undertow.request: UT005023: Exception handling request to /applicatie/index.cfm
javax.servlet.ServletException: cannot determinate webcontext root, the ServletContext from class [io.undertow.servlet.spec.ServletContextImpl] is returning null for the method call sc.getRealPath("/"), possibly due to configuration problem.
That probably depends on whether the servlet's resource manager follows symlinks or not. If ServetContext.getRealPath() returns the location of the symlink, then it should still point to wherever the symlink points. You can probably test that by checking what you get from this:
See if you get your symlink back or if you get the folder that the symlink points to back.
“This is not a check which needs to be run more than once per server restart since the servlet context root will not change”
What about if the target is a symlink ?
Thanks for the information!