Most likely your JVM heap needs some tuning... you want the average heap utilisation to be ~30-60% of the -Xmx (and set the -Xms to the same as -Xmx)
On a 8Gb ram machine default ergonomics in the JVM probably are putting the heap max at 1G or 2G... my analysis of memory usage patterns suggest that 4g is a better start point for most people... then measure average heap usage (using visualvm or jconsole) and tune the heap up or down from there to get average at 30-60% of max.
Tomcat is a servlet container *just like* the embedded Jetty servlet container that you get when you run the war file directly,
There is no advantage in using tomcat and the only reason is if you have a corporate mandate or want to run another war based app along side... the problem with that is it makes tuning a single JVM for the needs of multiple apps very difficult.
* Stick with the embedded Jetty.
* Ensure you are not storing files on spinning rust. SSD is your friend for the Jenkins master file system
* Do not run builds on the master. They will steal CPU cycles. use remote build agents... plus it's more secure.
* Tune your JVM heap size... do not go mad. The defaults are mostly ok. You just need to: set -Xmx to the same value as -Xms; and ensure that average heap utilisation is between 30 and 60% of the allocated value... if less than 30% then you are wasting CPU managing too big a pool, take memory away from the JVM. If more than 60% then you are wasting CPU on GC, give it more memory
--
Sent from my phone