Sun Java System Web Proxy Server 4.0.3 2006Q2 Administration Guide

Monitoring the Server Using Statistics

You can use the statistics feature to monitor your server’s current activity. The statistics show you how many requests your server is handling and how well it is handling these requests. If the interactive server monitor reports that the server is handling a large number of requests, you may need to adjust the server configuration or the system’s network kernel to accommodate the requests. Statistics are disabled by default because gathering statistics adds overhead to the Proxy Server. Enabling statistics causes the server to begin gathering and saving statistics information.

Once you enable statistics, you can view statistics in the following areas:

For a description of the various server statistics for which the interactive server monitor reports the totals, see the Monitor Current Activity page in the online help.

Processing Proxy Server Statistics

A built-in function called stats-xml is used to collect Proxy Server statistics. This function must be enabled to view statistics from the Server Manager or to generate a report using the perfdump function. The stats-xml function is also used to enable profiling, which is a requirement for monitoring statistics through the use of a custom NSAPI function. Enabling statistics and profiling on the server initializes a server function called stats-init in the obj.conf file to begin statistics gathering.

Init profiling="on" fn="stats-init"

It also creates a NameTrans directive that allows you to access statistics from a browser window.

NameTrans fn="assign-name" name="stats-xml" from="(/stats-xml|/stats-xml/.*)

Finally, enabling statistics adds a Service directive to process the stats-xml function when the NameTrans directive is selected

<Object name="stats-xml">

Service fn="stats-xml"

</Object>


Note –

Statistics gathering updates an Init function in the obj.conf. Therefore, you must stop and start your server for these changes to take effect.


You can retrieve the stats-xml output using the following URL:

http://computer_name:proxyport/stats-xml/proxystats.xml

This request will return an XML page containing the Proxy Server statistics. Some browsers allow you to view the data within the browser window; others require that you save the data to an external file and view it with an external viewer. The usefulness of this information is not fully apparent without the ability to parse the statistics for different views of the data for analysis. The use of third-party tools can assist in this process. Without a parsing tool, the stats-xml output is best observed through the Server Manager or the perfdump SAF.

Restricting Access to the stats-xml Output

You should create an ACL for the /stats-xml URI if you want to limit the users who can view the stats-xml statistics for your server from a browser.

The ACL file must also be referenced in the stats-xml object definition in the obj.conf file. For example, if you created a named ACL for the /stats-xml URI, you would need to reference the ACL file in a PathCheck statement in the object definition as follows:

<Object name="stats-xml">

PathCheck fn="check-acl" acl="stats.acl"

Service fn="stats-xml"

</Object>

Enabling Statistics

You must activate statistics on Proxy Server before you can monitor performance. This can be done through the Server Manager, or by editing the obj.conf and magnus.conf files. Users who create automated tools or write customized programs for monitoring and tuning may prefer to work directly with stats-xml.


Caution – Caution –

When you enable statistics/profiling, statistics information is made available to any user of your server.


ProcedureTo enable statistics from the Server Manager

Steps
  1. Access the Server Manager, and click the Server Status tab.

  2. Click the Monitor Current Activity link.

    The Monitor Current Activity page displays.

  3. Select the Yes option for the Activate Statistics/Profiling? element to enable statistics.

  4. Click OK.

  5. Click Restart Required.

    The Apply Changes page appears.

  6. Click the Restart Proxy Server button to apply the changes.

ProcedureTo enable statistics using stats-xml

Steps
  1. Under the default object in obj.conf, add the following line:


    NameTrans fn="assign-name" name="stats-xml" from="
    (/stats-xml|/stats-xml/.*)"
  2. Add the following Service function to obj.conf:

    <Object name="stats-xml">

    Service fn="stats-xml"

    </Object>

  3. Add the stats-init SAF to magnus.conf.

    Here is an example of stats-init in obj.conf:

    Init profiling="on" fn="stats-init" update-interval="5"

    The above example shows you can also designate the following:

    • update-interval. The period in seconds between statistics updates. A higher setting (less frequent) will be better for performance. The minimum value is 1; the default value is 5.

    • profiling. Activate NSAPI performance profiling. The default is “no,” which results in slightly better server performance. However, if you activate statistics through the user interface, profiling is turned on by default.

Using Statistics

Once you have enabled statistics, you can get a variety of information on how your server instance is running. The statistics are broken up into functional areas.

ProcedureTo access statistics

Steps
  1. Access the Server Manager, and click the Server Status tab.

  2. Click the Monitor Current Activity link.

  3. Choose the refresh interval from the Select Refresh Interval drop-down list.

    The refresh interval is the number of seconds between updates of the statistics information displayed.

  4. Choose the kind of statistics you want displayed from the Select Statistics To Be Displayed drop-down list.

    For more information of the types of statistics, see Displaying Statistics in the Server Manager.

  5. Click Submit.

    If your server instance is running, and you have enabled Statistics/Profiling, you see a page displaying the kind of statistics you selected. The page is updated every 5-15 seconds, depending upon what you chose for the refresh interval.

  6. Select the process ID from the drop-down list.

    You can view current activity through the Server Manager, but these categories are not fully relevant for tuning your server. The perfdump statistics are recommended for tuning your server.

Displaying Statistics in the Server Manager

This section describes how a subset of the proxystats.xml data can be viewed in the Server Manager.

You can view totals, maximum values, peak numbers, and bar graphs of information pertaining to connections to the Proxy Server, DNS processing, keep-alive values, cache, and server requests.

The following section describe the types of information that may be obtained for each of these.

Connection Statistics

The following connection statistics are available from the Server Manager:

DNS Statistics

The following DNS statistics are available from the Server Manager:

Keep-Alive Statistics

The following keep-alive statistics are available from the Server Manager:

Server Request Statistics

The following server statistics are available from the Server Manager.

Monitoring Current Activity Using the perfdump Utility

The perfdump utility is a Server Application Function (SAF) built into Proxy Server that collects various pieces of performance data from the Proxy Server internal statistics and displays them in ASCII text. The perfdump utility allows you to monitor a greater variety of statistics than those available through the Server Manager.

With perfdump, the statistics are unified. Rather than monitoring a single process, statistics are multiplied by the number of processes, which gives you a more accurate view of the server as a whole.

Enabling the perfdump Utility

You can enable the perfdump SAF only after you have enabled the stats-xml function and you can only enable it by directly editing the obj.conf file.

ProcedureTo enable the perfdump SAF:

Steps
  1. Add the following object to your obj.conf file after the default object:

    <Object name="perf">

    Service fn="service-dump"

    </Object>

  2. Add the following to the default object:

    NameTrans fn=assign-name from="/.perf" name="perf"

  3. Restart your server software.

  4. Access perfdump by entering this URL:

    http://computer_name:proxyport/.perf

    You can request the perfdump statistics and specify how frequently (in seconds) the browser should automatically refresh. The following example sets the refresh to every 5 seconds:

    http://computer_name:proxyport/.perf?refresh=5

Sample perfdump Output

The following is sample perfdump output:


			 
proxyd pid: 6751

Sun Java System Web Proxy Server 4.0 B05/02/2005 15:32 (SunOS DOMESTIC)

Server started Thu May 19 13:15:14 2005
Process 6751 started Thu May 19 13:15:14 2005

ConnectionQueue:
-----------------------------------------
Current/Peak/Limit Queue Length            0/1/4096
Total Connections Queued                   1
Average Queue Length (1, 5, 15 minutes)    0.00, 0.00, 0.00
Average Queueing Delay                     0.09 milliseconds

ListenSocket ls1:
------------------------
Address                   http://0.0.0.0:8081
Acceptor Threads          1

KeepAliveInfo:
--------------------
KeepAliveCount        0/256
KeepAliveHits         0
KeepAliveFlushes      0
KeepAliveRefusals     0
KeepAliveTimeouts     0
KeepAliveTimeout      30 seconds

SessionCreationInfo:
------------------------
Active Sessions           1
Keep-Alive Sessions       0
Total Sessions Created    48/128

CacheInfo:
------------------
enabled             yes
CacheEntries        0/1024
Hit Ratio           0/0 (  0.00%)
Maximum Age         0
Native pools:
---------------------------
NativePool:
Idle/Peak/Limit               1/1/128
Work Queue Length/Peak/Limit  0/0/0

Server DNS cache disabled

Async DNS disabled

Performance Counters:
------------------------------------------------
 ..........................Average         Total      Percent

Total number of requests:                      1
Request processing time:    0.2559        0.2559

default-bucket (Default bucket)
Number of Requests:                            1    (100.00%)
Number of Invocations:                         7    (100.00%)
Latency:                    0.2483        0.2483    ( 97.04%)
Function Processing Time:   0.0076        0.0076    (  2.96%)
Total Response Time:        0.2559        0.2559    (100.00%)

Sessions:
----------------------------
Process  Status     Function
6751     response   service-dump
proxyd pid: 6751
Sun Java System Web Proxy Server 4.0 B05/02/2005 15:32 (SunOS DOMESTIC)
Server started Thu May 19 13:15:14 2005
Process 6751 started Thu May 19 13:15:14 2005

ConnectionQueue:
-----------------------------------------
Current/Peak/Limit Queue Length            0/1/4096
Total Connections Queued                   1
Average Queue Length (1, 5, 15 minutes)    0.00, 0.00, 0.00
Average Queueing Delay                     0.09 milliseconds

ListenSocket ls1:
------------------------
Address                   http://0.0.0.0:8081
Acceptor Threads          1

KeepAliveInfo:
--------------------
KeepAliveCount        0/256
KeepAliveHits         0
KeepAliveFlushes      0
KeepAliveRefusals     0
KeepAliveTimeouts     0
KeepAliveTimeout      30 seconds

SessionCreationInfo:
------------------------
Active Sessions           1
Keep-Alive Sessions       0
Total Sessions Created    48/128

CacheInfo:
------------------
enabled             yes
CacheEntries        0/1024
Hit Ratio           0/0 (  0.00%)
Maximum Age         0

Native pools:
----------------------------
NativePool:
Idle/Peak/Limit               1/1/128
Work Queue Length/Peak/Limit  0/0/0

Server DNS cache disabled

Async DNS disabled

Performance Counters:
------------------------------------------------
                           Average         Total      Percent

Total number of requests:                      1
Request processing time:    0.2559        0.2559

default-bucket (Default bucket)
Number of Requests:                            1    (100.00%)
Number of Invocations:                         7    (100.00%)
Latency:                    0.2483        0.2483    ( 97.04%)
Function Processing Time:   0.0076        0.0076    (  2.96%)
Total Response Time:        0.2559        0.2559    (100.00%)

Sessions:
----------------------------
Process  Status     Function

6751     response   service-dump

            

For more information about these parameters, see “Using Statistics to Tune Your Server” on Chapter 2 of the Sun ONE Web Server 6.1 Performance Tuning, Sizing, and Scaling Guide.

Restricting Access to the perfdump Output

You need to create an ACL for the /.perf URI if you want to limit the users who can view the perfdump statistics for your server from a browser.

The ACL file must also be referenced in the perf object definition in the obj.conf file. For example, if you created a named ACL for the /.perf URI, you would need to reference the ACL file in a PathCheck statement in the object definition as follows:

<Object name="perf">

PathCheck fn="check-acl" acl="perf.acl"

Service fn="service-dump"

</Object>

Using Performance Buckets

Performance buckets allow you to define buckets and link them to various server functions. Every time one of these functions is invoked, the server collects statistical data and adds it to the bucket. For example, send-cgi and NSServletService are functions used to serve the CGI and Java servlet requests respectively. You can either define two buckets to maintain separate counters for CGI and servlet requests, or create one bucket that counts requests for both types of dynamic content. The cost of collecting this information is little and impact on the server performance is usually negligible. This information can later be accessed using the perfdump utility. The following information is stored in a bucket:

The default-bucket is predefined by the server. It records statistics for the functions not associated with any user-defined bucket.

Configuration

You must specify all configuration information for performance buckets in the magnus.conf and obj.conf files. Only the default bucket is automatically enabled.

First, you must enable performance measurement as described in Monitoring Current Activity Using the perfdump Utility.

The following examples show how to define new buckets in magnus.conf:

Init fn="define-perf-bucket" name="acl-bucket" description="ACL bucket"

Init fn="define-perf-bucket" name="file-bucket" description="Non-cached responses"

Init fn="define-perf-bucket" name="cgi-bucket" description="CGI Stats"

The example above creates three buckets: acl-bucket, file-bucket, and cgi-bucket. To associate these buckets with functions, add bucket=bucket-name to the obj.conf function for which you wish to measure performance.

Example

PathCheck fn="check-acl" acl="default" bucket="acl-bucket"

...

Service method="(GET|HEAD|POST)" type="*~magnus-internal/*" fn="send-file" bucket="file-bucket"

...

<Object name="cgi">

ObjectType fn="force-type" type="magnus-internal/cgi"

Service fn="send-cgi" bucket="cgi-bucket"

</Object>

Performance Report

The server statistics in buckets can be accessed using the perfdump utility. The performance buckets information is located in the last section of the report returned by perfdump.

The report contains the following information:

The following is an example of the performance bucket information available through perfdump:


Performance Counters:
------------------------------------------------
                           Average         Total      Percent

Total number of requests:                      1
Request processing time:    0.2559        0.2559

default-bucket (Default bucket)
Number of Requests:                            1    (100.00%)
Number of Invocations:                         7    (100.00%)
Latency:                    0.2483        0.2483    ( 97.04%)
Function Processing Time:   0.0076        0.0076    (  2.96%)
Total Response Time:        0.2559        0.2559    (100.00%)