Thursday, 4 August 2022

Importance of urandom egd in containers -> java -Djava.security.egd=file:/dev/urandom Importance

 In high distributed, scaled applications , One System/Server needs to connect another Downstream System/Server to establish session, certificates,

Here session/certificates are having random numbers,

Our java security pickup the random number from Linux/Window entropy pool.


What is entropy pool ?

         In any server, user hits the server through keyboard some other noises, Linux server capture those noises put them into entropy pool.


EGD - Entropy Gathered Device


our java security device -> java.security.egd=file:/dev/random


java.security.egd=file:/dev/random

      By default java8 and java11 this property is there in the java.security file, 

If entropy pool having full entries, file:/dev/random works fine,

If entropy pool having no entries, file:/dev/random will waits for long time, it is blocking the thread, it is hitting the performance.


Solution: Always use the java.security.egd=file:/dev/urandom in PCF/Kubernets/Virtual Server.


java.security.egd=file:/dev/urandom

      need to pass this argument in java argument.

If entropy pool having full entries, file:/dev/urandom works fine,

If entropy pool having no entries, file:/dev/urandom will not wait, it will genereate the random number hence it will improve the performance, no blocking of the thread.