CHAPTER 14 SOLVING COMMON JAVA EE PERFORMANCE (Web site construction)
Friday, November 30th, 2007CHAPTER 14 SOLVING COMMON JAVA EE PERFORMANCE PROBLEMS creating an instance in the heap. Their environment was running out of permanent space, but because of the noclassgc tuning option on the heap, the JVM was unable to unload classes to make room for new ones. To correct this out-of-memory error, I configured their heap with a huge permanent space (512MB) and disabled the noclassgc JVM option. As Figure 14-7 illustrates, when the permanent space becomes full, it triggers a full garbage collection that cleans up Eden and the survivor spaces, but does not reclaim any memory from the permanent space. Figure 14-7. Garbage collection behavior when the permanent space becomes full Note When sizing the permanent space, consider using 128MB, unless your applications have a large number of classes, in which case you can consider using 256MB. If you have to configure the permanent space to use anything more, then you are only masking the symptoms of a significant architectural issue. Configuring the permanent space to 512MB is OK while you address your architectural issues, but just realize that it is only a temporary solution to buy you time while you address the real problems. Creating a 512MB permanent space is analogous to getting painkillers from your doctor for a broken foot. True, the painkillers make you feel better, but eventually they will wear off, and your foot will still be broken. The real solution is to have the doctor set your foot and put a cast on it to let it heal. The painkillers can help while the doctor sets your foot, but they are used to mask the symptoms of the problem while the core problem is resolved. As a general recommendation, when configuring the permanent space, make it large enough to hold all of your classes, but allow the JVM to unload classes when it needs to. Size it large enough so that hopefully it will not unload classes, but a minor slowdown to load classes from the file system is far more preferable than a JVM OutOfMemoryError crash!
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.