OutOfMemoryError: PermGen space
November 25th, 2008
Today, during load testing I saw one of those dreaded “java.lang.OutOfMemoryError: PermGen space” errors on our fairly large web application deployed in Tomcat running on Sun JDK 1.5.
We used to use the default (64m) for the perm space. I bumped it to 128 for now, until I can find some time to dig into this using JProfiler and JHAT.
I will be particularly looking at the amount of our classes loaded from WEB-INF/classes dir (we have a lot of generated classes from legacy code), Static references in our legacy code, Spring AOP/Hibernate CGLib usage and ThreadLocal usage in our application.
I found some useful information here:
Performance tuning vs. Lean/Agile
November 6th, 2008
I am currently working on performance tuning & refactoring a product. And, interestingly I found some Agile/Lean principles that apply for performance tuning and refactoring:
- Most Lean principles appear counter-intuitive at first
- Aim for system optimization instead of point optimization
- Build prototype and measure (run quick experiments), not just theorize
- Minimize the number and size of things-in-process
- The most predictable performance comes from maintaining options until you have the most information