Pages

Thursday, June 5, 2014

How to check which process is using more memory in linux server

1. ps -eo pmem,pcpu,vsize,pid,cmd | sort -k 1 -nr | head -5

2. use top command

then SHIFT + f button in the keyboard

Press the Letter corresponding to %MEM

Then press ENTER

3. ps aux | awk '{print $2, $4, $11}' | sort -k2rn | head -n 10

4. ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS


Monday, May 5, 2014

How to update heap size in tomcat 7

Step 1: Open up the catalina.sh file with any text editor.

Step 2: Search for "JAVA_OPTS=" in the file and in particular locate the following lines of code:


if [ -z "$LOGGING_MANAGER" ]; then
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
else 
JAVA_OPTS="$JAVA_OPTS $LOGGING_MANAGER"
fi


Step 3: At the end of the JAVA_OPTS definitions add "-Xms256m -Xmx512m".


if [ -z "$LOGGING_MANAGER" ]; then
JAVA_OPTS="$JAVA_OPTS -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xms256m -Xmx512m"
else 
JAVA_OPTS="$JAVA_OPTS $LOGGING_MANAGER -Xms256m -Xmx512m"
fi


Step 4: Save the file and restart Tomcat.