SecureRandom is very slow when large number of files in java.io.tmpdir

Working on application that took a long to startup. Upon investigation, it turns out the issue is SecureRandom is using “java.io.tmp” directory to set up some entropy (the temp directory on this machine had thousands of files – no wonder it was slow!!).

Work round for Java 6 was to clear files from the temp directory.

http://bugs.sun.com/view_bug.do?bug_id=6705872

According to the bug report, this issue is fixed in Java 7 and will at most use 1024 files.

Leave a Reply

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