Profiler

From Resin 3.0

(Difference between revisions)
Jump to: navigation, search
(Added description for filter init param "use-query")
 
(14 intermediate revisions by 6 users not shown)
Line 1: Line 1:
Resin includes high level profiling capability for profiling requests and database conenctions.
+
Resin includes high level profiling capability for profiling requests. <!-- and database conenctions. -->
  
 
= Enabling the Profiler =
 
= Enabling the Profiler =
Line 5: Line 5:
 
   <[[web-app]] ...>
 
   <[[web-app]] ...>
 
    
 
    
     <servlet-mapping servlet-class="com.caucho.profiler.ProfilerServlet" url-pattern="/resin-profiler">
+
     <servlet-mapping servlet-class="com.caucho.tools.profiler.ProfilerServlet" url-pattern="/resin-profiler">
 
       <init>
 
       <init>
 
         <profiler enabled="true"/>
 
         <profiler enabled="true"/>
Line 21: Line 21:
 
    
 
    
 
     <filter filter-name="resin-profiler"
 
     <filter filter-name="resin-profiler"
             filter-class="com.caucho.profiler.ProfilerFilter">
+
             filter-class="com.caucho.tools.profiler.ProfilerFilter">
 
       <init use-query="false"/>
 
       <init use-query="false"/>
 
     </filter>
 
     </filter>
Line 29: Line 29:
 
     </filter-mapping>
 
     </filter-mapping>
  
== View Results ==
+
 
 +
Initialization Parameter  "use-query":
 +
 
 +
If true, use the query portion of the url to distinguish requests, default is false
 +
 
 +
 
 +
== View results ==
  
 
* Make a request, for example http://localhost:8080/webapp/foo.jsp
 
* Make a request, for example http://localhost:8080/webapp/foo.jsp
Line 52: Line 58:
 
     </table>
 
     </table>
  
 +
== XML format ==
 +
 +
The output of the profiler can be returned in XML format using the query string "?format=xml".
 +
 +
== Sort order ==
 +
 +
By default, the entries are sorted descending by Total Time. To change the sort order to Invocation Count, just add the query string "?sort=count".
  
 
= Profiling sub-requests =
 
= Profiling sub-requests =
Line 63: Line 76:
 
    
 
    
 
     <filter filter-name="resin-profiler"
 
     <filter filter-name="resin-profiler"
             filter-class="com.caucho.profiler.ProfilerFilter">
+
             filter-class="com.caucho.tools.profiler.ProfilerFilter">
 
       <init use-query="false"/>
 
       <init use-query="false"/>
 
     </filter>
 
     </filter>
Line 74: Line 87:
 
     </filter-mapping>
 
     </filter-mapping>
  
== View Results ==
+
== View results ==
  
 
* Make a request, for example http://localhost:8080/webapp/foo.jsp
 
* Make a request, for example http://localhost:8080/webapp/foo.jsp
Line 113: Line 126:
 
         </td><td class='number'>&nbsp;</td><td class='number' title='totalTime=0.000 thisTime=0.000 childrenTime=0.000'>0.000</td><td class='number'>0</td></tr>
 
         </td><td class='number'>&nbsp;</td><td class='number' title='totalTime=0.000 thisTime=0.000 childrenTime=0.000'>0.000</td><td class='number'>0</td></tr>
 
     </table>
 
     </table>
 
+
<!--
 
= Profiling databases =
 
= Profiling databases =
  
Line 153: Line 166:
 
             <tr><td>&nbsp;&nbsp;&rarr;</td><td class='text'>jdbc:postgresql://127.0.0.1:5432/test</td></tr>
 
             <tr><td>&nbsp;&nbsp;&rarr;</td><td class='text'>jdbc:postgresql://127.0.0.1:5432/test</td></tr>
 
           </table>
 
           </table>
         </td><td class='number' title='totalTime=0.005 thisTime=0.001 childrenTime=0.003'>0.005</td><td class='number' title='totalTime=8.007 thisTime=2.739 childrenTime=5.268'>8.007</td><td class='number'>1579</td></tr>
+
         </td><td class='number'></td><td class='number' title='totalTime=8.007 thisTime=2.739 childrenTime=5.268'>8.007</td><td class='number'></td></tr>
  
 
       <tr class='level2'><td>
 
       <tr class='level2'><td>
Line 191: Line 204:
  
 
     </table>
 
     </table>
 
+
-->
 
= JMX =
 
= JMX =
  
 
The Profiler instantiates a [[JMX]] bean with type `Profiler'.
 
The Profiler instantiates a [[JMX]] bean with type `Profiler'.

Latest revision as of 20:11, 14 April 2008

Resin includes high level profiling capability for profiling requests.

Contents

Enabling the Profiler

 <web-app ...>
 
   <servlet-mapping servlet-class="com.caucho.tools.profiler.ProfilerServlet" url-pattern="/resin-profiler">
     <init>
       <profiler enabled="true"/>
     </init>
     <load-on-startup/>
   </servlet-mapping>

Profiling requests

Request profiling gives insight into the time taken for requests from client browsers.

It imposes very little overhead and is suitable for production servers.

 <web-app ...>
 
   <filter filter-name="resin-profiler"
           filter-class="com.caucho.tools.profiler.ProfilerFilter">
     <init use-query="false"/>
   </filter>
 
   <filter-mapping filter-name="resin-profiler" url-pattern="*">
     <dispatcher>REQUEST</dispatcher>
   </filter-mapping>


Initialization Parameter "use-query":

If true, use the query portion of the url to distinguish requests, default is false


View results


Profiling Results for /webapp
NameAverage TimeTotal TimeInvocation Count
/foo.jsp
1.7491.7491
/resin-profiler
 0.0000

XML format

The output of the profiler can be returned in XML format using the query string "?format=xml".

Sort order

By default, the entries are sorted descending by Total Time. To change the sort order to Invocation Count, just add the query string "?sort=count".

Profiling sub-requests

Sub-request profiling adds profiling information for pages that are sub-requests of the top level request, typically with <jsp:include>, <jsp:forward>, or the equivalent mechanisms for Servlets.

It imposes a bit more overhead and may be suitable for production servers.

 <web-app ...>
 
   <filter filter-name="resin-profiler"
           filter-class="com.caucho.tools.profiler.ProfilerFilter">
     <init use-query="false"/>
   </filter>
 
   <filter-mapping filter-name="resin-profiler" url-pattern="*">
     <dispatcher>REQUEST</dispatcher>
     <dispatcher>FORWARD</dispatcher>
     <dispatcher>INCLUDE</dispatcher>
     <dispatcher>ERROR</dispatcher>
   </filter-mapping>

View results


Profiling Results for /webapp
NameAverage TimeTotal TimeInvocation Count
/foo.jsp
1.7491.7491
  →/baz.jsp
0.8630.8631
  →/bar.jsp
0.5750.5751
    →/bung.jsp
0.0600.0601
/resin-profiler
 0.0000

JMX

The Profiler instantiates a JMX bean with type `Profiler'.

Personal tools