5 Replies Latest reply on Jul 11, 2012 9:02 PM by PHCharbonneau

    Performance tuning & Proxy

      Thanks Kalyan for your reply on the query earlier.

      1.Could you help with the commands to know a process utilizing High CPU and Memory (for Solaris and Linux),please?

      2. Why is the web logic server not recommended to be a web server and need of Apache and others instead?
      Are we suppose to implement web logic server as web server at all?

      a) If so, in what situations do we consider this? b) If not, would like to know the potential blockers/disadvantages of implementing weblogic as a web server in any environments?

        • 1. Re: Performance tuning & Proxy
          Kalyan Pasupuleti-Oracle
          Here is the for first query:

          identifying high cpu usage in solaris.


          1. Run the prstat command on the Java process. Do this for several iterations so you can see a pattern.

          Example: prstat -L -p <PID> 1 1

          Note: If you do not have prstat available on your Solaris installation, you can do the following instead:
          ps -Le -o pid,user,s,lwp,pcpu,args | awk '$3 != "S" { print }'

          where the output will show the PID, user, state, and the lightweight thread number.

          An example output is something like this:
          0 root T 1 sched
          2769 root O 1 ps -Le -o pid,user,s,lwp,args
          3383 usera R 27 /wwsl/sharedInstalls/solaris/j2sdk1.4.2_04/bin/java -client -Xms32m -Xmx200m -X
          3383 usera R 31 /wwsl/sharedInstalls/solaris/j2sdk1.4.2_04/bin/java -client -Xms32m -Xmx200m -X
          2770 usera R 1 awk $3 != "S" { print }
          You can then use the information from the fourth column of the output for the LWP number in the next steps.

          2.Run the pstack command on the Java process to get a mapping of the Light Weight Process (LWP) to the PID (Process ID).

          Example: pstack 9499 and redirect the output to a file.

          If you use regular thread libraries (i.e., you do not have /usr/lib/lwp in the LD_LIBRARY_PATH) in Solaris, a LWP is not mapped to OS thread directly, so you have to take pstack from the process (so check to see if you are using the alternate thread library).

          3.Get several thread dumps of the server over time to make sure you get the right threads executing.

          You can do this by doing a kill -3 <PID> on the Java Process.

          4.Map the LWP id to the Java Thread id.

          For example, if the LWP in question is "8" it could map to the Java thread "76". Then calculate the hex value of 76 to be 0x4c.

          5.Examine in the thread dump to find the thread that matched "nid= <to that identifier/value>".

          For this example, you would find the thread that matched "nid=0x4c" and this would be the thread that is consuming the CPU.

          6.You will then need to:

          Determine why this is happening in your code
          OR if the top of the stacktrace is from WebLogic or contact Support.

          • 2. Re: Performance tuning & Proxy
            Kalyan Pasupuleti-Oracle
            Here is solution for second query.

            We can use weblgoic as proxy server but as stated why it is not recommended because it is heavy weight container to hold same process which light weight process will do so that is reason why the most of the people choose different proxy server instead of weblogic as proxy server.

            Hope I explain your query.

            • 3. Re: Performance tuning & Proxy
              Hi Kalyan,

              Thank you for the explanation. However, still have some query here.

              1.If we are able to fetch the LWP ID (Fourth column) from " ps -Le -o pid,user,s,lwp,pcpu,args | awk '$3 != "S" { print }' ", cannot we map it to the Java Thread id (by taking thread dump; kill -3 <PID>) directly? So, is Pstack still required here?

              2.Otherwise, are you saying that LWP ID (Fourth column) is not the one from
              " ps -Le -o pid,user,s,lwp,pcpu,args | awk '$3 != "S" { print }' ", and it is indeed the output of Pstack (LWP ID) that correspondingly should match the value (Fourth column) taken from the command mentioned above ?

              3. Also, could you please let me know how to find a process utilizing High memory on Solaris?

              4. Could you direct me to any article or doc that explains 'Identifying High CPU and Memory' on Linux as well, please?

              Thanks so much for your help!
              • 4. Re: Performance tuning & Proxy
                Kalyan Pasupuleti-Oracle

                Currently there are no such articles are available for such things.

                I suggest you try to follow up given details you will find the difference.

                Note: Make sure that you take thread dump instantly or else PID and LWID will not match.

                • 5. Re: Performance tuning & Proxy

                  I suggest that you go through my Java High CPU guide part1 series as it describes how to investigate CPU % per Thread for various OS, including how to correlate with Thread Dump data.

                  Do you have any data to share regarding a current production problem case that you are facing? I recommend that you provide Thread Dump and prstat / top / ps data so we can analyze the problem from here.