javalinuxmongodbhsqldbfongo

Java applications with In memory database are taking too long to build


I am using in memory databases like HSQL and FONGO in my java application for junit tests

I am executing these build on linux machine.

Due to these in memory database, build are taking too long to build.

Build which is supposed to complete in 2 minutes is taking 30 mins.

Any pointers would be of great help


Solution

  • I was able to fix the issue with this.

    The random number generation was taking too long. I did the following changes.

    The library used for random number generation in Sun's JVM relies on /dev/random by default for UNIX platforms. This can potentially block the WebLogic SIP Server process because on some operating systems /dev/random waits for a certain amount of "noise" to be generated on the host machine before returning a result. Although /dev/random is more secure, BEA recommends using /dev/urandom if the default JVM configuration delays WebLogic SIP Server startup.

    To determine if your operating system exhibits this behavior, try displaying a portion of the file from a shell prompt:

    head -n 1 /dev/random
    

    If the command returns immediately, you can use /dev/random as the default generator for SUN's JVM. If the command does not return immediately, use these steps to configure the JVM to use /dev/urandom:

     1. Open the $JAVA_HOME/jre/lib/security/java.security file in a text
        editor. 
     2. Change the line:  
        securerandom.source=file:/dev/random
                to
        securerandom.source=file:/dev/urandom 
     3. Save your change and exit the text editor.