Follow Us on Twitter

Tweaking the entropy pool for a better SOA performance

by Patrick Sinke on March 14, 2014 · 1 comment

At my current assignment, I’ve gone to great lengths to improve the Oracle SOA Enterprise Manager Console performance. One of the actions I took, was purging about 700 gigabytes of data from the dehydration store. Although that solved lots of other problems, the EM still wasn’t very responsive. Loading composite details could take op to 20 minutes, it they ever loaded at all. Apparently, the database was ok, because there was no load at all there. The java processes used a lot of CPU and memory though.

I found out recently that the SOA suite uses a Linux feature called the kernel entropy pool, or just entropy pool. This is a small pool of random data (generally about 4kb), generated by events on the host system, like mouse movements and IDE timings. the /dev/random module continuously feeds this pool with pseudo-random data. But when not enough seed-data is available, because more entropy data is requested than is generated, the pool gets depleted. When this happens, processes depending on the entropy pool will stall, slowing down your system.

Oracle SOA suite and it’s Java processes apparently use a lot of entropy data. They are able to quickly drain the entropy pool, at which point they will stall until new entropy data comes available. Which may take a long time!

Fortunately, there is a relatively simple solution. It’s a linux package called haveged:

haveged is a userspace entropy daemon which is not dependent upon the standard mechanisms for harvesting randomness for the system entropy pool. This is important in systems with high entropy needs or limited user interaction (e.g. headless servers).

haveged uses HAVEGE (HArdware Volatile Entropy Gathering and Expansion) to maintain a 1M pool of random bytes used to fill /dev/random whenever the supply of random bits in dev/random falls below the low water mark of the device. More information about HAVAGE is available at http://www.irisa.fr/caps/projects/hipsor/

Usually you can install it just by typing yum install haveged or apt-get install haveged. If the package is not available in the repositories, you can always build it yourself. Coming up is a little script that does most of the work for you. It also adds the haveged daemon to the startup file and appends the library path environment settings to your profile. Please review and test this script thoroughly before applying it to your production environment!

wget http://www.issihosts.com/haveged/haveged-1.9.1.tar.gz
tar zxvf haveged-1.9.1.tar.gz
cd haveged-1.9.1
./configure
make
make install
cp /etc/rc.local /etc/rc.local.org
echo '# 2014-03-14 Autostart haveged' >> /etc/rc.local
echo '/usr/local/sbin/haveged -w 1024' >> /etc/rc.local
# add library path to  ~/.bash_profile
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib' >> ~/.bash_profile
# start service right away
/usr/local/sbin/haveged -w 1024

Configured like this, haveged will monitor your entropy pool and add more entropy to it, whenever the entropy falls below the watermark of 1024 bytes.

It’s interesting to run the following command a few times, either before and after installing haveged, so you can measure the change in entropy pool size.

cat /proc/sys/kernel/random/entropy_avail

Actually, the result on our production environment was stunning. EM responsiveness improved enormously and other problems, like not being able to abort old running instances, where fixed too.

Tweaking the entropy pool for a better SOA performance, 4.0 out of 5 based on 1 rating
Ratings:
VN:F [1.9.22_1171]
Rating: 4.0/5 (1 vote cast)

One comment on “Tweaking the entropy pool for a better SOA performance

  1. Tim S. on said:

    Users of HAVEGED should be aware that it will peg your CPU at 100% on some systems, such as the one I am using: Linux 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux.

    I am using the latest version of HAVEGED and previous versions exhibit the same behavior. I cannot find a way around this problem and I am not the only one, judging by search engine results.

    VA:F [1.9.22_1171]
    Rating: 0 (from 0 votes)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy This Password *

* Type Or Paste Password Here *

57,966 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

 

Previous post:

Next post:

About Whitehorses
Company profile
Services
Technology

Whitehorses website

Home page
Whitebooks
Jobs

Follow us
Blog post RSS
Comment RSS
Twitter