[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"blog-post-fixing-slow-railo-startup-running-on-tomcat-8":3},{"id":4,"title":5,"body":6,"date":209,"description":12,"extension":210,"meta":211,"navigation":212,"path":213,"published":212,"seo":214,"slug":215,"stem":216,"summary":5,"tags":217,"__hash__":221},"blog/blog/2014-03-15-fixing-slow-railo-startup-running-on-tomcat-8.md","Fixing Slow Railo Startup Running on Tomcat 8",{"type":7,"value":8,"toc":202},"minimark",[9,13,18,21,24,27,31,34,39,42,48,59,74,78,89,93,104,109,112,115,118,123,137,140,145,157,162,165,169,172,176,179,190,196,199],[10,11,12],"p",{},"Over the last week++ I have been taking on the role of Server Admin. I by no means consider myself to be one, let alone good at it; but, since I manage my own VPS through Viviotech, it has deeply become a necessity where there comes that time when I need to be that guy. Quite often more than less.",[14,15,17],"h2",{"id":16},"my-situation","My situation...",[10,19,20],{},"As of late I've been battling frequent occurrences where my server gets brought to it's knees from hits by various bots; among other things. In some cases the hang would wig out a request and crash the expected result ending in a barrage of errors. Page requests would take 5-10mins for every single request! After playing with how I was distributing memory and applying some better handling of objects and sessions, things have been running smooth. From there I decided I wanted to go the extra step and show some love to the stack of the server side. So I upgraded Java to the latest (7u51) and Tomcat 7.0.52 to version 8.0(.3).",[10,22,23],{},"Upgrading Tomcat in itself was a bit of a tug but nothing insane. I was hoping it would be a \"just copy over the /lib folder\" install but it wasn't ;) I suspect the updates to some of the config files was the culprit but I don't know for sure as I simply merged everything and re-added the bits in the XML that make Railo and Tomcat talk. If/When I get time I will shed more light on this; but that's another blog post!",[10,25,26],{},"Upon getting things settled and sites rendering again I instantly hit a noticeable drawback - really slow server startup. In my case about 1-2 minutes! All in all, I host 7 sites of a small to moderate size with no steep requirements at start/render time. This delay was a smack in the face difference. So I took a look in the catalina.out log file and came across a few warnings.",[14,28,30],{"id":29},"the-solution-among-some-other-fixes","The solution among some other fixes...",[10,32,33],{},"Take note that some of these warnings probably/definitely do not effect performance, if at all. I'm simply going to knock 'em out here as I did at the time.",[35,36,38],"h4",{"id":37},"update-if-you-use-lucee-these-fixes-also-apply","Update: If you use Lucee, these fixes also apply! :)",[10,40,41],{},"Let's start with the main fix of lowering the start time of our sites. With every site context that was loaded, I would get this response in the logs. . .",[10,43,44],{},[45,46,47],"code",{},"Mar 09, 2014 11:55:07 PM org.apache.jasper.servlet.TldScanner scanJars INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.",[10,49,50,51,58],{},"A Google search brought me to ",[52,53,57],"a",{"href":54,"rel":55},"http://wiki.apache.org/tomcat/HowTo/FasterStartUp",[56],"nofollow","wiki.apache.org"," which states that TLD Scanning checks JAR files for tag libraries and their descriptor files. Everywhere I read more in regards to this scan pointed out that startup time can take a nasty blow; as this scan is performed on each context. Seeing as I only run CFML apps with Railo, it seemed ok to completely turn scanning off.",[10,60,61,62,65,66,69,70,73],{},"I found that there are a few documented ways to turn this scan off; however, I could only get two ways to work for me. Many results on Google, including a StackOverflow question, said to set the ",[45,63,64],{},"processTlds"," property to ",[45,67,68],{},"false"," in the ",[45,71,72],{},"\u003CContext>"," of a given site setup in server.xml. When I tried this I got no results and a warning in catalina.out stating there was no such property. To confuse me more, the property is listed in the Tomcat 8 docs giving me the impression that you can use it. I'm not completely sure in that regard though. Oh well.",[35,75,77],{"id":76},"first-solution","First solution:",[10,79,80,81,84,85,88],{},"A simple, surefire method of switching the check off is to go into ",[45,82,83],{},"context.xml",", located in Tomcat's /conf directory, and add ",[45,86,87],{},"\u003CJarScanner scanClassPath=\"false\" />",". That's it!",[35,90,92],{"id":91},"second-solution","Second solution:",[10,94,95,96,99,100,103],{},"Inside catalina.properties, located in the /conf directory, around line: 97, is a setting declared for ",[45,97,98],{},"tomcat.util.scan.StandardJarScanFilter.jarsToSkip",". In it's original form there is a list of select JARs to be skipped. What I tried doing was commenting out that list and replacing it with ",[45,101,102],{},"*.jar"," giving this line. . .",[10,105,106],{},[45,107,108],{},"tomcat.util.scan.StandardJarScanFilter.jarsToSkip=*.jar",[10,110,111],{},"Nice!",[10,113,114],{},"With either changes alone, after a fresh restart, I was getting a startup time averaging around 8 seconds and no more warning of JAR scanning in catalina.out. That's 60+ seconds down to ~8. Awesome!",[10,116,117],{},"So let's go over the other warnings. Next was this...",[10,119,120],{},[45,121,122],{},"SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/opt/railo/lib/slf4j-nop.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/opt/railo/lib/railo-sl4j.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.",[10,124,125,126,129,130,133,134,136],{},"From what I have gathered from searching, the Railo folks switched ",[45,127,128],{},"railo-sl4j.jar"," out for ",[45,131,132],{},"sl4j-nop.jar"," after version 4. This is a result of me upgrading Railo 3.x to 4 once upon a time and never noticing I guess. Removing ",[45,135,128],{}," kills the warning and things function all the same (It's just one less error in the logs really).",[10,138,139],{},"The last occurrence was this. . .",[10,141,142],{},[45,143,144],{},"Mar 09, 2014 11:54:36 PM org.apache.catalina.users.MemoryUserDatabase open WARNING: Exception configuring digester to permit java encoding names in XML files. Only IANA encoding names will be supported.",[10,146,147,148,152,153,156],{},"Again, trusty Google landed me at ",[52,149,150],{"href":150,"rel":151},"http://adfinmunich.blogspot.com/2013/04/exception-during-startup-from-tomcat-6.html",[56]," which gives an explanation and a list of properties to add to ",[45,154,155],{},"catalina.properties",".",[10,158,159],{},[45,160,161],{},"javax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl javax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl javax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl javax.xml.datatype.DatatypeFactory=com.sun.org.apache.xerces.internal.jaxp.datatype.DatatypeFactoryImpl",[10,163,164],{},"After restart there was no more occurrence of the warning and things continued to function.",[35,166,168],{"id":167},"update-031714-some-things-i-forgot","Update: 03/17/14 - Some things I forgot. . .",[10,170,171],{},"Depending on what version of Tomcat you are using (It could vary from what I've noticed), there are some directories that you can do away with in the \"/webapps\" folder inside of Tomcat. These dirs include /docs, /examples, /host-manager and /manager (in Tomcat 8 at least). Make sure to leave \"/ROOT\". The docs folder is filler as I see it and the other 3 are processed during Tomcat's startup. This will incur a check through each WEB-INF dir; especially if Jar Scanning is on. I've had them removed for some time now and seen no issue since.",[14,173,175],{"id":174},"some-things-i-havent-looked-into","Some things I haven't looked into. . .",[10,177,178],{},"The above helped me a great deal. Hopefully it helps someone else. There are some other bits that I've started to look into regarding performance at startup but have yet to dive into and test.",[10,180,181,182,185,186,189],{},"The wiki.apache.org link is a good start for things to try/modify/apply. I have also read mixed opinions on applying the \"autoDeploy\" and \"unpackWars\" properties to \"false\" in a site's ",[45,183,184],{},"\u003CHost>"," element in ",[45,187,188],{},"server.xml",". From what I read if there is any performance gain, especially considering you might not even have a WAR file to unpack or deploy, it's minimal with today's rigs.",[10,191,192,193,195],{},"I have also come across loading website contexts in parallel threads at startup by setting \"startStopThreads\" to 1 or greater in ",[45,194,184],{},". This apparently can give a boost when applied correctly. No experience on this though.",[10,197,198],{},"The Tomcat 8 docs on these properties can be found here.",[10,200,201],{},"As I learn more on tuning and the lot I will be sure to throw another post together. Cheers!",{"title":203,"searchDepth":204,"depth":204,"links":205},"",2,[206,207,208],{"id":16,"depth":204,"text":17},{"id":29,"depth":204,"text":30},{"id":174,"depth":204,"text":175},"2014-03-15","md",{},true,"/blog/2014-03-15-fixing-slow-railo-startup-running-on-tomcat-8",{"title":5,"description":12},"fixing-slow-railo-startup-running-on-tomcat-8","blog/2014-03-15-fixing-slow-railo-startup-running-on-tomcat-8",[218,219,220],"CFML","Lucee","Apache Tomcat","l7_N1VD34w20uLstvgKUWD0gnRCoTZ2Hgj0pcEwdvAE"]