Logo Background

Monitor Unix Memory RSS And VSS

  • By on January 22, 2010 | 4 Comments

    Keep a good practice in monitor your Unix system memory growth especially on memory RSS and VSS using glance on HP-UX. What if you don’t have the tools glance available for system monitoring?

    You can opt to use the command top, however I would love to use the command ‘UNIX95= ps -eo vsz,ruser,pid,args | sort -rn’ in any Unix variant as the output doesn’t change fast on screen.

    You can split the monitoring based on process name such as f60webmx (Oracle Forms session), java or LIB (Oracle Concurrent Manager session) by using the query as below.

    while true
    do
    UNIX95= ps -eo vsz,ruser,pid,args | sort -rn | grep f60webmx | grep applprod | head -20
    sleep 5
    clear
    done
    while true
    do
    UNIX95= ps -eo vsz,ruser,pid,args | sort -rn | grep java | grep applprod | head -20
    sleep 5
    clear
    done
    while true
    do
    UNIX95= ps -eo vsz,ruser,pid,args | sort -rn | grep LIB | grep applprod | head -20
    sleep 5
    clear
    done

    In every 5 second, the screen will be refresh to display the top 20 process with highest memory consumption.

    From the first column of the result, multiply it with 4096 and divide by 1024/1024 to get the result of memory in MB.

    Previous
    Next
    » Read Core File In Unix
  1. #1 Ruben
    January 25, 2010 12:36 am

    Are you having high memory consumption in java process? Use the script to check on the JDBC connectivity if you are running on Oracle E-Business 11i or R12.

    select ‘Number of user sessions : ‘ || count( distinct session_id) How_many_user_sessions
    from icx_sessions icx where disabled_flag != ‘Y’
    and PSEUDO_FLAG = ‘N’
    and (last_connect + decode(FND_PROFILE.VALUE(‘ICX_SESSION_TIMEOUT’), NULL,limit_time, 0,limit_time,FND_PROFILE.VALUE(‘ICX_SESSION_TIMEOUT’)/60)/24) > sysdate and counter < limit_connects;

    select count(*), machine, process, module
    from v$session
    where program like 'JDBC%'
    group by machine, process, module order by 1 asc;

    Post ReplyPost Reply
  1. #2 Kusanagi
    February 4, 2010 8:06 pm

    Ruben,

    We had error on the Oracle E-Business Suite login page where the user saw the error as below.

    Request URI:/OA_HTML/AppsLocalLogin.jsp
    Exception:
    java.lang.OutOfMemoryError: Java heap space

    We found there’s high number of JDBC connection upon checking using your SQL.

    We restarted our Apache instance in periodic basis to flush the Java memory heap and set the concurrent memory growth by setting the 2 lines below in environment files:

    FDMXHEAP=500000000
    export FDMXHEAP

    The value of FDMXHEAP was set to 500MB and we still monitor on the issue. Let me know if you have any solution to share. Thanks

    Post ReplyPost Reply
  1. #3 Ruben
    July 13, 2011 10:00 pm

    Just want to share out the two Unix script as below. Quite useful to detect memory leak and CPU hunger processes.

    # Top 20 process with highest memory utilization
    while true
    do
    echo “Top 20 Memory Hunger Process”
    echo `date`
    UNIX95= ps -ef -o pid,ruser,vsz,args | sort -r -n -k3 | head -20
    sleep 5
    clear
    done

    # Top 20 process with highest CPU utilization
    while true
    do
    echo “Top 20 CPU Hunger Process”
    echo `date`
    UNIX95= ps -ef -o pid,ruser,pcpu,args | sort -r -n -k3 | head -20
    sleep 5
    clear
    done

    Post ReplyPost Reply
  1. #4 Unix Geek
    July 17, 2011 9:05 pm

    Looking on how to capture prstat in specific timeframe and output it to a file? This is the prstat command which will run every 30 minutes and spool to output file.

    prstat -a -c 1800 | nawk ‘$1==”PID” { “date” | getline d ; close(“date”) } { print d,$0 }’ >> prstat.log

    Post ReplyPost Reply
Leave a Comment