<div dir="ltr"><div><div><div><div>Hey Stuart,<br><br></div>this exact problem we discussed some time ago with David but didn't go as far as implementing a prototype.<br></div>At the time one of bigger contention bottleneck was in jdk classes (java.lang.*, java.util.*, etc)<br></div>and I think we should do something similar to what you did also in jboss-modules to address speeding up this.<br></div><div>It would probably yield even better results in end run.<br><br>--<br></div><div>tomaz<br></div><div><div><div><div><div><br><br></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 15, 2017 at 1:36 AM, Stuart Douglas <span dir="ltr"><<a href="mailto:stuart.w.douglas@gmail.com" target="_blank">stuart.w.douglas@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">When JIRA was being screwy on Friday I used the time to investigate an idea I have had for a while about improving our boot time performance. According to Yourkit the majority of our time is spent in class loading. It seems very unlikely that we will be able to reduce the number of classes we load on boot (or at the very least it would be a massive amount of work) so I investigated a different approach.<div><br></div><div>I modified ModuleClassLoader to spit out the name and module of every class that is loaded at boot time, and stored this in a properties file. I then created a simple Service that starts immediately that uses two threads to eagerly load every class on this list (I used two threads because that seemed to work well on my laptop, I think Runtime.availableProcessors()/<wbr>4 is probably the best amount, but that assumption would need to be tested on different hardware). </div><div><br></div><div>The idea behind this is that we know the classes will be used at some point, and we generally do not fully utilise all CPU's during boot, so we can use the unused CPU to pre load these classes so they are ready when they are actually required.</div><div><br></div><div>Using this approach I saw the boot time for standalone.xml drop from ~2.9s to ~2.3s on my laptop. The (super hacky) code I used to perform this test is at <a href="https://github.com/wildfly/wildfly-core/compare/master...stuartwdouglas:boot-performance-hack" target="_blank">https://github.com/wildfly/<wbr>wildfly-core/compare/master...<wbr>stuartwdouglas:boot-<wbr>performance-hack</a></div><div><br></div><div>I think these initial results are encouraging, and it is a big enough gain that I think it is worth investigating further.</div><div><br></div><div>Firstly it would be great if I could get others to try it out and see if they see similar gains to boot time, it may be that the gain is very system dependent.</div><div><br></div><div>Secondly if we do decide to do this there are two approach that we can use that I can see:</div><div><br></div><div>1) A hard coded list of class names that we generate before a release (basically what the hack already does), this is simplest, but does add a little bit of additional work to the release process (although if it is missed it would be no big deal, as ClassNotFoundException's would be suppressed, and if a few classes are missing the performance impact is negligible as long as the majority of the list is correct).</div><div><br></div><div>2) Generate the list dynamically on first boot, and store it in the temp directory. This would require the addition of a hook into JBoss Modules to generate the list, but is the approach I would prefer (as first boot is always a bit slower anyway).</div><div><br></div><div>Thoughts?</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Stuart</div></font></span></div>
<br>______________________________<wbr>_________________<br>
wildfly-dev mailing list<br>
<a href="mailto:wildfly-dev@lists.jboss.org">wildfly-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/<wbr>mailman/listinfo/wildfly-dev</a><br></blockquote></div><br></div>