<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Diagnosing Performance Problems</title><meta name="generator" content="DocBook XSL Stylesheets V1.64.1"><link rel="home" href="index.html" title="OpenACS Core Documentation"><link rel="up" href="maintenance-web.html" title="Chapter�6.�Production Environments"><link rel="previous" href="uptime.html" title="External uptime validation"><link rel="next" href="database-management.html" title="Chapter�7.�Database Management"><link rel="stylesheet" href="openacs.css" type="text/css"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><a href="http://openacs.org"><img src="/doc/images/alex.jpg" border="0" alt="Alex logo"></a><table width="100%" summary="Navigation header" border="0"><tr><td width="20%" align="left"><a accesskey="p" href="uptime.html">Prev</a> </td><th width="60%" align="center">Chapter�6.�Production Environments</th><td width="20%" align="right"> <a accesskey="n" href="database-management.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="maint-performance"></a>Diagnosing Performance Problems</h2></div></div><div></div></div><div class="itemizedlist"><ul type="disc"><li><p>Did performance problems happen overnight, or did they sneak up on
    you? Any clue what caused the performance problems (e.g. loading 20K
    users into .LRN)</p></li><li><p>Is the file system out of space?  Is the machine swapping to disk constantly?</p></li><li><p>Isolating and solving database problems.</p><div class="itemizedlist"><ul type="circle"><li><p>Without daily internal maintenance, most databases slowly degrade in performance.  For PostGreSQL, see <a href="install-next-nightly-vacuum.html" title="Vacuum Postgres nightly">the section called &#8220;Vacuum Postgres nightly&#8221;</a>.  For Oracle, use <tt class="computeroutput">exec dbms_stats.gather_schema_stats('SCHEMA_NAME')</tt> (<a href="http://www.piskorski.com/docs/oracle.html" target="_top">Andrew Piskorski's Oracle notes</a>).</p></li><li><p>You can track the exact amount of time each database query on a page takes:</p><div class="orderedlist"><ol type="1"><li><p>Go to <a href="/acs-admin/install" target="_top">Main Site : Site-Wide Administration : Install Software</a></p></li><li><p>Click on "Install New Application" in "Install from OpenACS Repository"</p></li><li><p>Choose "ACS Developer Support"&gt;</p></li><li><p>After install is complete, restart the server.</p></li><li><p>Browse to Developer Support, which is automatically mounted at <tt class="computeroutput"><a href="/ds" target="_top">/ds</a></tt>.
              </p></li><li><p>Turn on Database statistics</p></li><li><p>Browse directly to a slow page and click "Request Information" at the bottom of the page.</p></li><li><p>This should return a list of database queries on the page, including the exact query (so it can be cut-paste into psql or oracle) and the time each query took.</p><div class="figure"><a name="id2536626"></a><p class="title"><b>Figure�6.8.�Query Analysis example</b></p><div class="mediaobject"><img src="images/query-duration.png" alt="Query Analysis example"></div></div></li></ol></div></li><li><p>Identify a runaway Oracle query: first, use <b class="userinput"><tt>ps aux</tt></b> or <b class="userinput"><tt>top</tt></b> to get the UNIX process ID of a runaway Oracle process.</p><p>Log in to SQL*Plus as the admin:</p><pre class="screen">[<span class="replaceable"><span class="replaceable">service0</span></span> ~]$ svrmgrl

Oracle Server Manager Release 3.1.7.0.0 - Production

Copyright (c) 1997, 1999, Oracle Corporation.  All Rights Reserved.

Oracle8i Enterprise Edition Release 8.1.7.3.0 - Production
With the Partitioning option
JServer Release 8.1.7.3.0 - Production

SVRMGR&gt; <b class="userinput"><tt>connect internal</tt></b>	        
Password:</pre><p>See all of the running queries, and match the UNIX PID:</p><pre class="programlisting">select p.spid  -- The UNIX PID
       ,s.sid  ,s.serial#
       ,p.username  as os_user
       ,s.username  ,s.status
       ,p.terminal  ,p.program
  from v$session s  ,v$process p
 where p.addr = s.paddr
 order by s.username ,p.spid ,s.sid ,s.serial# ;</pre><p>See the SQL behind the oracle processes:</p><pre class="programlisting">select s.username
       ,s.sid  ,s.serial#
       ,sql.sql_text
  from v$session s, v$sqltext sql
 where sql.address    = s.sql_address
   and sql.hash_value = s.sql_hash_value
 --and upper(s.username) like 'USERNAME%'
 order by s.username ,s.sid ,s.serial# ,sql.piece ;</pre><p>To kill a troubled process:</p><pre class="programlisting">alter system kill session 'SID,SERIAL#';  --substitute values for SID and SERIAL#</pre><p>(See <a href="http://www.piskorski.com/docs/oracle.html" target="_top">Andrew Piskorski's Oracle notes</a>)</p></li></ul></div></li></ul></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="uptime.html">Prev</a> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right"> <a accesskey="n" href="database-management.html">Next</a></td></tr><tr><td width="40%" align="left">External uptime validation </td><td width="20%" align="center"><a accesskey="u" href="maintenance-web.html">Up</a></td><td width="40%" align="right"> Chapter�7.�Database Management</td></tr></table><hr><address><a href="mailto:docs@openacs.org">docs@openacs.org</a></address></div><a name="comments"></a><center><a href="http://openacs.org/doc/maint-performance.html#comments">View comments on this page at openacs.org</a></center></body></html>