Search code examples
javalinuxmavenosb

Oracle Service Bus maven build time 30 times slower on Linux than on Windows


I currently have a OSB project with a set of 21 modules that take roughly 4 minutes to build on my local 2 core/12GB ram laptop running Windows using no threading, just a simple build install. It takes 10-20 seconds per module.

When building this exact same project on my CI server running on Ubuntu, with 8 cores/16GB RAM build time is closer to 110 minutes, using around 4 minutes per module.

Some details on the Linux build:

  • Most of these 4 minutes per module is spent sitting idle on 0% CPU utilization.
  • MAVEN_OPTS are "-Xmx512m -Xms512m"
  • Same build time on Java 7 and 8
  • When running with the -X flag it spends most of it's time at "-- end configuration --"

I have tried increasing the file descriptor limit, thinking this was the problem. This did not do anything to the build time.


Solution

  • After profiling maven with VisualVM both on Windows and Linux I found that on Linux it spent abnormal amounts of time generating a random seed.

    enter image description here

    So by changing to (the slighty less secure) /dev/./urandom build time went from 110 minutes down to 1minute 47seconds.

    An example of how to do this is by passing in the setting as a flag:

    -Djava.security.egd=file:/dev/./urandom

    If you would like to set this permanently, this can be done in the file jdk1.7.0_75/jre/lib/security/java.security by changing:

    securerandom.source=file:/dev/urandom to
    securerandom.source=file:/dev/./urandom.

    This might bring some security implications of which you should do some research first if you need to do this.