Previous     Contents     Index     DocHome     Next     
iPlanet Web Server, Enterprise Edition Programmer's Guide to Servlets



Appendix D   Remote Servlet Profiling


You can use a profiler to perform remote profiling on the iPlanet Web Server to discover bottlenecks in server-side performance. This appendix describes two profilers:



The Optimizeit! Profiler

You can purchase Optimizeit! from Intuitive Systems at:

http://www.optimizeit.com/index.html

Once Optimizeit! is installed using the following instructions, it becomes integrated into iPlanet Web Server 6.0.

To enable remote profiling, make the following modifications in the jvm12.conf files as appropriate:


jvm.enableClassGC=0
jvm.option=-Xrunoii
jvm.profiler=optimizeit
java.compiler=NONE
OPTITDIR=optimizeit_root_dir/OptimizeIt30D

When the server starts up with this configuration, you can attach the profiler (for further details see the Optimizeit! documentation).

Also, update the PATH and NSES_CLASSPATH system variables to include the profiler's own jar files and dll files.



Note If any of the configuration options are missing or incorrect, the profiler may experience problems that affect the performance of the iPlanet Web Server.





The HPROF Profiler



HPROF is a simple profiler agent shipped with the Java 2 SDK. It is a dynamically linked library that interacts with the JVMPI and writes out profiling information either to a file or to a socket in ASCII or binary format. This information can be further processed by a profiler front-end tool such as HAT.

HPROF can present CPU usage, heap allocation statistics, and monitor contention profiles. In addition, it can also report complete heap dumps and states of all the monitors and threads in the Java virtual machine. For more details on the HPROF profiler, see the JDK documentation at:

http://java.sun.com/products/jdk/1.2/docs/guide/jvmpi/jvmpi.html#hprof

To use HPROF profiling on Unix, follow these steps:

  1. To enable HPROF profiling, edit the jvm12.conf file as shown here:


    jvm.printErrors=2
    jvm.profiler=hprof
    jvm.option=-Xrunhprof:options
    #jvm.option=-Xrs must be commented out
    java.compiler=NONE

    Suggested options for using iPlanet Web Server with HPROF are:

    jvm.option=-Xrunhprof:file=/tmp/hprof.txt,heap=all,format=a

    or:

    jvm.option=-Xrunhprof:file=/tmp/hprof.txt,cpu=samples,format=a

    The syntax of HPROF is as follows:

    -Xrunhprof[:help]|[:option=value,option2=value2, ...]

    Using help lists options that can be passed to HPROF. The output is as follows:

    Hprof usage: -Xrunhprof[:help]|[:<option>=<value>, ...]

    Option Name and Value Description Default
    --------------------- ----------- -------
    heap=dump|sites|all heap profiling all
    cpu=samples|old CPU usage off
    format=a|b ascii or binary output a
    file=<file> write data to file java.hprof
    (.txt for ascii)
    net=<host>:<port> send data over a socket write to file
    depth=<size> stack trace depth 4
    cutoff=<value> output cutoff point 0.0001
    lineno=y|n line number in traces? y
    thread=y|n thread in traces? n
    doe=y|n dump on exit? y

  2. You must also change a line in the iPlanet Web Server start script. The start script file is server_root/https-server_id/start. Change the following line:

    PRODUCT_BIN=uxwdog

    to this:

    PRODUCT_BIN=ns-httpd

  3. Start the server by running the start script. Since the server runs in the foreground (the change in step 2), the command prompt returns only after the server has been stopped.

  4. In another window or terminal, find the process ID of the server process.

    % ps -ef | grep ns-httpd

    This command lists two ns-httpd processes. Look at the PPID (parent process ID) column and identify which of the two processes is the parent process and which is the child process. Note the PID (process ID) of the child process ID.

  5. Send a SIGQUIT signal (signal 3) to the child process:

    % kill -QUIT child_PID

    This displays the following ASCII menu in the window from where the start script was invoked:

    % start
    iPlanet-WebServer-Enterprise/6.0
    [LS ls1] http://test, port 9000 ready to accept requests
    Default selection: alloc and heap dump
    startup: server started successfully
    SIGQUIT
    A SIGQUIT has been received. Do you want to:
    [ 0 ] continue program
    [ 1 ] check & print one deadlock
    [ 2 ] check & print all deadlocks
    [ 3 ] dump thread stacks
    [ 4 ] dump lock registry
    [ 5 ] heap inspection
    [ 6 ] hprof dump
    [ 7 ] terminate program
    Type number corresponding to selected action:

  6. Select menu option 6 by typing the number 6 and then typing the Enter key.

    This causes HPROF data to be saved in the file specified in the jvm.option line in jvm12.conf, for example /tmp/hprof.txt.

  7. Type 0 and press Enter to continue the program (the Web Server).

  8. To capture more HPROF profiles, repeat steps 6 and 7.

  9. To stop the Web Server, run the stop script from another window.

    % ./stop

  10. Undo the changes in steps 1 and 2 to return your Web Server to its original configuration.


Previous     Contents     Index     DocHome     Next     
Copyright © 2001 Sun Microsystems, Inc. Some preexisting portions Copyright © 2001 Netscape Communications Corp. All rights reserved.

Last Updated May 02, 2001