Java Tip #7 - Use .hotspot_compiler file to stop compilation
The hotspot compiler has known bugs that can cause the compilation thread to go cpu bound. We had seen this behavior occasionally in production. A customer would call & report that no one was logged into the system, but it was at 100% on one cpu. The instance would normally be restarted & things would be fine. We couldn't figure out why & of course the customer was frustrated at having to restart the system. I can't blame 'em. For a time we had no clue what was causing the problem.
Recently we did some load testing at Sun's Market Development Engineering lab (very cool, btw) and really stressed our application. We kept seeing this "java/9" thread go to 100% cpu during the warmup period. It didn't happen every time, but it happened often enough to slow us down. The busy process was visible in prstat using the -L flag to list lightweight processes (lwp). We used pstack to look at the offending lwp & saw it was the hotspot compiler. We applied the +XX:PrintCompilation vm flag and found that the compilation was stopping at various times & it always seemed to happen on the same methods. We used the .hotspot_compiler file to exclude various methods and the stuck thread problem was solved.
The .hotspot_compiler file goes in working directory & has a line for each method to be excluded.
For example:
exclude com.whatever.TheClassName theMethodName
This would prevent the com.whatever.TheClassName.theMethodName() from being compiled.
Here's a "more" listing of a file with a single entry.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5043395
According to the bug report, this is resolved in tiger aka 1.5. When we rerun our load tests in June 2005, I will know for sure.
Recently we did some load testing at Sun's Market Development Engineering lab (very cool, btw) and really stressed our application. We kept seeing this "java/9" thread go to 100% cpu during the warmup period. It didn't happen every time, but it happened often enough to slow us down. The busy process was visible in prstat using the -L flag to list lightweight processes (lwp). We used pstack to look at the offending lwp & saw it was the hotspot compiler. We applied the +XX:PrintCompilation vm flag and found that the compilation was stopping at various times & it always seemed to happen on the same methods. We used the .hotspot_compiler file to exclude various methods and the stuck thread problem was solved.
The .hotspot_compiler file goes in working directory & has a line for each method to be excluded.
For example:
exclude com.whatever.TheClassName theMethodName
This would prevent the com.whatever.TheClassName.theMethodName() from being compiled.
Here's a "more" listing of a file with a single entry.
And the console output from the compiler.
$ more .hotspot_compiler
#http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5043395
exclude oracle/jdbc/driver/OraclePreparedStatement executeBatch
### Excluding compile: oracle.jdbc.driver.OraclePreparedStatement::executeBatchThis bug report is similar to the problem we had.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5043395
According to the bug report, this is resolved in tiger aka 1.5. When we rerun our load tests in June 2005, I will know for sure.
0 Comments:
Post a Comment
<< Home