Variable and degrading performance when using jbcrypt

I am using jbcrypt for hash passwords in a project. Performance is around 500 ms when checking passwords on the hardware I use (log_rounds is set to 12). However, after some time with regular use, the execution time suddenly drops to a whopping 15 seconds. The drop is very sudden without buildup and remains constant until the process is restarted.

Profiling shows that extra time is used in the key method (..).

Source: http://jbcrypt.googlecode.com/svn/tags/jbcrypt-0.3m/src/main/java/org/mindrot/jbcrypt/BCrypt.java

This method only calculates the hash using basic functions like xor, and shift, etc. No object assignments, use of external resources, random number generation, etc.

Performance is not reduced for other functions in the same process. The memory allocation is stable and low. Full GC is not involved.

Has anyone seen this before or any clue to why this is happening? I could understand the variable performance, which to some extent depended on other circumstances, but this is a very sudden and stable drop from about 500 ms. up to about 15000 ms.

+6
source share
2 answers

It turned out that this had something to do with class loading. The library has been loaded into many different class loaders. The problem disappeared when we loaded the library into the system class loader.

+3
source

It is possible that SecureRandom ends up entropy and causes this problem.

See How to solve a performance problem using Java SecureRandom?

+4
source

All Articles