We are having a web application which depends on around 125 jars including spring, hibernet, zk, etc.
When we start the tomcat server, it loads around 55K classes into the permgen. Coz of this huge class loading, application startup takes significant amount of time. Moreover permgen space required by application is very high as other classes are also loaded during the program execution.
- Is there a way to control how many classes are loaded at start up so that application comes up fast?
- Is there a way to free/unload classes from permgen which are less frequently used? [These questions are specific to the classes which are loaded from the external jars]
I had tried with -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled options specified for java. But only 42 classes were unloaded after sometime.
Any help or pointers are highly appreciated.