22 February 2010

System Entropy in Linux

Entropy is needed by many applications, SSL and Java in particular can be heavy consumers of entropy. Linux makes the devices /dev/random and /dev/urandom available to applications to pull entropy from. These two devices contain entropy collected from several system sources. Wikipedia has a good page on  . Kernel.org has some good information .

You can check the contents of your Linux entropy pool by using the command:

           cat /proc/sys/kernel/random/entropy_avail

A topped up entropy pool is indicated with an entropy_avail level around 4000(bits). An entropy pool of 200 or less can be a problem and cause application and connection slowness, especially if you are supporting many ssl or java applications.

This being said, you may find yourself with blocking or hanging applications due to lack of entropy.

If you find that you are running low on entropy it is important to identify what processes are using entropy.  You can do this using the lsof command like so:

lsof | grep /dev/random  

lsof | grep /dev/urandom

This two examples should show you what processes are accessing the /dev/random and /dev/urandom devices which provide entropy to applications.

0 comments:

Post a Comment