Who has never faced to "java.lang.OutOfMemoryError: PermGen space" using JBoss Application Server and JBoss Seam Framework?
I have faced to this problem more frequently in production environment because the application has expanded considerably. I remember I had the same problem in Brazil when we were doing our final project of Post Graduate APGS at PUC University. When I got this job, the fist thing I did was change JVM settings to fix this problem in my workstation.
You are going to see in many sites and blogs people saying that increasing the PermSize will solve the problem. This way you just postpone this exception.
By default, the Collect Garbage cleans the Heap but does NOT clean the Permanent Generation.
The default value for PermSize is 64 MB which is not enough neither for development nor production environment. You definitely should not use the default configuration for professional applications involving JBoss Application Server and JBoss Seam Freamework.
The only way to really resolve this issue is enabling CG to clean the Permanent Generation space as well.
I haven't had this problem since I started using those configuration:
-Xms512m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=512m -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
I run JBoss in my computer inside Eclipse but if you run outside or for production environment you have to put those parameters on the file JBOSS_HOME/bin/run.conf .
#
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
#JAVA_OPTS="-Xms1024m -Xmx1024m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
JAVA_OPTS="-Xms1024m -Xmx1024m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -XX:PermSize=192m -XX:MaxPermSize=192m -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled"
fi
I am sure you will never see PermGen space again!
cheers
Leonardo Pinho Correa
Java Analyst/Developer, soccer player and beer drinker
I write about life in Australia, soccer, social life, Java, Ruby, Information Technology and my work experience. There is also a lot about Java2word, which is an open source project I run for fun on my free time.
Showing posts with label JBoss. Show all posts
Showing posts with label JBoss. Show all posts
Friday, 14 August 2009
Sunday, 26 July 2009
MySQL command Explain saved my life!
Today I have to thank Paulinho about everything I learned in my Post Graduate APGS (Analisys, Project and Management of Information System - Latu Sensu ). Paulinho is a database specialist and teaches DB subject at PUC-RJ (Pontífica Universidade Católica) in Rio de Janeiro.
I remember I didn 't give it a shit about that subject, used to joke about that and I didn 't believe in that f#&*$ng "explain" command at that time.
I have been involved in a project which uses MySql, JBoss Seam, JBoss Server, JAX-WS and RedHat Linux... Pretty cool stuff!!!
I had to run one query quite big with a couple of joins. I left running for 1 hour and didn 't finish.
This time I remembered Database classes with the teacher Paulinho and decided to "explain" that query.
You don't need to be a DBA to do it, just need to put the word "explain" in front of your query and run it!!! like this:
explain select * from employee inner join department on ...
The most important thing in your result is the column "Type" which tells you how bad is you query.
For the worse to the best ones, here are possibles values of "Type" (in Mysql):
All, index, range, Eq_ref, const, system
If you see "All" in any line of the "type" column means you have your ass in the line (tá fudido).
If you carefully analyze the result you can much improve your query. In my case I just created a few indexes and removed some calculated fields from the clause where.
The original query was running in one hour - The new query ran in less than one minute making inner join in tables with over 1 million lines each!!!
Now we are going to take a look at Ingres database... Let have a go and see it... write about that later...
Leonardo Correa
Java Analyst/Developer, soccer player and beer drinker
I remember I didn 't give it a shit about that subject, used to joke about that and I didn 't believe in that f#&*$ng "explain" command at that time.
I have been involved in a project which uses MySql, JBoss Seam, JBoss Server, JAX-WS and RedHat Linux... Pretty cool stuff!!!
I had to run one query quite big with a couple of joins. I left running for 1 hour and didn 't finish.
This time I remembered Database classes with the teacher Paulinho and decided to "explain" that query.
You don't need to be a DBA to do it, just need to put the word "explain" in front of your query and run it!!! like this:
explain select * from employee inner join department on ...
The most important thing in your result is the column "Type" which tells you how bad is you query.
For the worse to the best ones, here are possibles values of "Type" (in Mysql):
All, index, range, Eq_ref, const, system
If you see "All" in any line of the "type" column means you have your ass in the line (tá fudido).
If you carefully analyze the result you can much improve your query. In my case I just created a few indexes and removed some calculated fields from the clause where.
The original query was running in one hour - The new query ran in less than one minute making inner join in tables with over 1 million lines each!!!
Now we are going to take a look at Ingres database... Let have a go and see it... write about that later...
Leonardo Correa
Java Analyst/Developer, soccer player and beer drinker
Labels:
Database,
Information Technology,
IT,
Java,
JBoss,
JBoss Seam,
MySql
Subscribe to:
Posts (Atom)