<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 15, 2017 at 10:27 PM, Rostislav Svoboda <span dir="ltr"><<a href="mailto:rsvoboda@redhat.com" target="_blank">rsvoboda@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi.<br>
<br>
I can confirm I see improvements in boot time with your changes.<br>
My HW is Lenovo T440s with Fedora 25, Intel(R) Core(TM) i7-4600U CPU (Base Frequency 2.10 GHz, Max Turbo 3.30 GHz)<br>
<br>
I executed 50 iterations of start - stop sequence [1], before execution 5x start - stop for "warmup"<br>
<br>
With your changes<br>
Min: 3116 Max: 3761 Average: 3247.640000<br>
<br>
Without:<br>
Min: 3442 Max: 4081 Average: 3580.840000<br>
<span class=""><br>
<br>
> 1) A hard coded list of class names that we generate before a release<br>
<br>
</span>This will improve first boot impression, little bit harder for maintaining the list for the final build.<br>
<br>
Property files could be located inside properties directory of dedicated module (<resource-root path="properties"/>). Properties directory could contain property files for delivered profiles.<br>
<br>
Layered products or customer modifications could deliver own property file.<br>
e.g. predefined property file for standalone-openshift.xml in EAP image in OpenShift environment, I think they boot the server just once and throw away the whole docker image when something changes.<br>
<span class=""><br>
<br>
> 2) Generate the list dynamically on first boot, and store it in the temp<br>
<br>
</span>This looks like the most elegant thing to do. Question is how it will slow down the initial boot. People care about first boot impression, some blog writers do the mistake too.<br></blockquote><div><br></div><div>It will not actually slow down the initial boot (at least not in a measurable way), but the first boot would not get the benefit of this optimisation.</div><div><br></div><div>Stuart</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This would also block boot time improvements for use-cases when you start the server just once - e.g. Docker, OpenShift.<br>
<br>
Also the logic should take into account which profile is loaded - e.g standalone.xml vs. standalone-full-ha.xml<br>
<br>
Rostislav<br>
<br>
[1]<br>
rm wildfly-11.0.0.Beta1-SNAPSHOT-<wbr>preload/standalone/log/server.<wbr>log<br>
rm wildfly-11.0.0.Beta1-SNAPSHOT/<wbr>standalone/log/server.log<br>
<br>
for i in {1..50}; do<br>
echo $i<br>
wildfly-11.0.0.Beta1-SNAPSHOT-<wbr>preload/bin/standalone.sh 1>/dev/null 2>&1 &<br>
sleep 8<br>
wildfly-11.0.0.Beta1-SNAPSHOT-<wbr>preload/bin/jboss-cli.sh -c :shutdown 1>/dev/null 2>&1<br>
done<br>
grep WFLYSRV0025 wildfly-11.0.0.Beta1-SNAPSHOT-<wbr>preload/standalone/log/server.<wbr>log | sed "s/.*\(....\)ms.*/\1/g" | awk 'NR == 1 { max=$1; min=$1; sum=0 }<br>
{ if ($1>max) max=$1; if ($1<min) min=$1; sum+=$1;}<br>
END {printf "Min: %d\tMax: %d\tAverage: %f\n", min, max, sum/NR}'<br>
<br>
<br>
for i in {1..50}; do<br>
echo $i<br>
wildfly-11.0.0.Beta1-SNAPSHOT/<wbr>bin/standalone.sh 1>/dev/null 2>&1 &<br>
sleep 8<br>
wildfly-11.0.0.Beta1-SNAPSHOT/<wbr>bin/jboss-cli.sh -c :shutdown 1>/dev/null 2>&1<br>
done<br>
grep WFLYSRV0025 wildfly-11.0.0.Beta1-SNAPSHOT/<wbr>standalone/log/server.log | sed "s/.*\(....\)ms.*/\1/g" | awk 'NR == 1 { max=$1; min=$1; sum=0 }<br>
{ if ($1>max) max=$1; if ($1<min) min=$1; sum+=$1;}<br>
END {printf "Min: %d\tMax: %d\tAverage: %f\n", min, max, sum/NR}'<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
----- Original Message -----<br>
> When JIRA was being screwy on Friday I used the time to investigate an idea I<br>
> have had for a while about improving our boot time performance. According to<br>
> Yourkit the majority of our time is spent in class loading. It seems very<br>
> unlikely that we will be able to reduce the number of classes we load on<br>
> boot (or at the very least it would be a massive amount of work) so I<br>
> investigated a different approach.<br>
><br>
> I modified ModuleClassLoader to spit out the name and module of every class<br>
> that is loaded at boot time, and stored this in a properties file. I then<br>
> created a simple Service that starts immediately that uses two threads to<br>
> eagerly load every class on this list (I used two threads because that<br>
> seemed to work well on my laptop, I think Runtime.availableProcessors()/<wbr>4 is<br>
> probably the best amount, but that assumption would need to be tested on<br>
> different hardware).<br>
><br>
> The idea behind this is that we know the classes will be used at some point,<br>
> and we generally do not fully utilise all CPU's during boot, so we can use<br>
> the unused CPU to pre load these classes so they are ready when they are<br>
> actually required.<br>
><br>
> Using this approach I saw the boot time for standalone.xml drop from ~2.9s to<br>
> ~2.3s on my laptop. The (super hacky) code I used to perform this test is at<br>
> <a href="https://github.com/wildfly/wildfly-core/compare/master...stuartwdouglas:boot-performance-hack" rel="noreferrer" target="_blank">https://github.com/wildfly/<wbr>wildfly-core/compare/master...<wbr>stuartwdouglas:boot-<wbr>performance-hack</a><br>
><br>
> I think these initial results are encouraging, and it is a big enough gain<br>
> that I think it is worth investigating further.<br>
><br>
> Firstly it would be great if I could get others to try it out and see if they<br>
> see similar gains to boot time, it may be that the gain is very system<br>
> dependent.<br>
><br>
> Secondly if we do decide to do this there are two approach that we can use<br>
> that I can see:<br>
><br>
> 1) A hard coded list of class names that we generate before a release<br>
> (basically what the hack already does), this is simplest, but does add a<br>
> little bit of additional work to the release process (although if it is<br>
> missed it would be no big deal, as ClassNotFoundException's would be<br>
> suppressed, and if a few classes are missing the performance impact is<br>
> negligible as long as the majority of the list is correct).<br>
><br>
> 2) Generate the list dynamically on first boot, and store it in the temp<br>
> directory. This would require the addition of a hook into JBoss Modules to<br>
> generate the list, but is the approach I would prefer (as first boot is<br>
> always a bit slower anyway).<br>
><br>
> Thoughts?<br>
><br>
> Stuart<br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> ______________________________<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>
</div></div></blockquote></div><br></div></div>