Profiler
From Resin 3.0
m |
|||
Line 153: | Line 153: | ||
<tr><td> →</td><td class='text'>jdbc:postgresql://127.0.0.1:5432/test</td></tr> | <tr><td> →</td><td class='text'>jdbc:postgresql://127.0.0.1:5432/test</td></tr> | ||
</table> | </table> | ||
− | </td><td class='number | + | </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> |
Revision as of 13:30, 28 November 2005
Resin includes high level profiling capability for profiling requests and database conenctions.
Contents |
Enabling the Profiler
<web-app ...> <servlet-mapping servlet-class="com.caucho.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.profiler.ProfilerFilter"> <init use-query="false"/> </filter> <filter-mapping filter-name="resin-profiler" url-pattern="*"> <dispatcher>REQUEST</dispatcher> </filter-mapping>
View Results
- Make a request, for example http://localhost:8080/webapp/foo.jsp
- View results http://localhost:8080/webapp/resin-profiler
Name | Average Time | Total Time | Invocation Count | ||
---|---|---|---|---|---|
| 1.749 | 1.749 | 1 | ||
| 0.000 | 0 |
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.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
- Make a request, for example http://localhost:8080/webapp/foo.jsp
- View results http://localhost:8080/webapp/resin-profiler
Name | Average Time | Total Time | Invocation Count | ||
---|---|---|---|---|---|
| 1.749 | 1.749 | 1 | ||
| 0.863 | 0.863 | 1 | ||
| 0.575 | 0.575 | 1 | ||
| 0.060 | 0.060 | 1 | ||
| 0.000 | 0 |
Profiling databases
The profiler-point directive is used in the database driver to configure profiling of database usage. Results are given for each unique sql statement or prepared statement.
Database profiling imposes more overhead than request profiling and should be used on production servers with care.
<database jndi-name="jdbc/caucho/crm"> <driver> <type>org.postgresql.Driver</type> <url>jdbc:postgresql://127.0.0.1:5432/...</url> <user>...</user> <password>...</password> <profiler-point/> </driver> <spy/> </database>
View results
- Make a request that uses the database. for example http://localhost:8080/webapp/foo.php
- View results http://localhost:8080/webapp/resin-profiler
Name | Average Time | Total Time | Invocation Count | ||
---|---|---|---|---|---|
| 4.198 | 4.198 | 1 | ||
| 8.007 | ||||
| 0.003 | 1.863 | 560 | ||
| 0.003 | 1.262 | 420 | ||
| 0.004 | 0.963 | 213 | ||
| 0.002 | 0.499 | 187 | ||
| 0.088 | 0.176 | 2 | ||
| 0.005 | 0.164 | 30 |
JMX
The Profiler instantiates a JMX bean with type `Profiler'.