1. Fix the java.lang.OutOfMemoryError: PermGen space error by increase the size of Perm.
sudo vi /etc/sysconfig/tomcat6
add following line to the end of the file:
JAVA_OPTS='-Xms1024m -Xmx2048m -XX:PermSize=256M -XX:MaxNewSize=256m -XX:MaxPermSize=256m'
restart tomcat
sudo service tomcat6 restart
find tomcat PID:
ps -ef | grep tocmat
check the heap state:
sudo jmap -heap PID
Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 1073741824 (1024.0MB)
NewSize = 1310720 (1.25MB)
MaxNewSize = 268435456 (256.0MB)
OldSize = 5439488 (5.1875MB)
NewRatio = 2
SurvivorRatio = 8
PermSize = 268435456 (256.0MB)
MaxPermSize = 268435456 (256.0MB)
G1HeapRegionSize = 0 (0.0MB)
2. Open the compression feature.
sudo vi /usr/share/tomcat6/config/server.xml
find following line:
<Connector port="8080"
add following attributes:
compression="on"
compressionMinSize="2048"
compressableMimeType="text/html,text/xml,text/plain,text/javascript,text/css,application/json,application/xml,application/x-javascript"
3. Increase the max number of threads
add following attributes in Connector
maxThreads="500"
minSpareThreads="100"
maxSpareThreads="500"