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:
Connections
DNS
KeepAlive
Cache
Server requests
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.
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"
This instruction 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>
Statistics gathering updates an Init function in the obj.conf. Therefore, you must stop and start your server for these changes to take effect.
The following example shows stats-init in the obj.conf file:
Init profiling="on" fn="stats-init" update-interval="5"
You can also designate the following values:
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. whether to 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.
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.
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>
You must activate statistics on Proxy Server before you can monitor performance. You can activate statistics 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.
When you enable statistics/profiling, statistics information is made available to any user of your server.
Access the Server Manager, and click the Server Status tab.
Click the Monitor Current Activity link.
The Monitor Current Activity page is displayed.
Select the Yes option for Activate Statistics/Profiling to enable statistics.
Click OK.
Click Restart Required.
The Apply Changes page appears.
Click the Restart Proxy Server button to apply the changes.
Under the default object in the obj.conf file, add the following line:
NameTrans fn="assign-name" name="stats-xml" from=" (/stats-xml|/stats-xml/.*)" |
Add the following Service function to obj.conf:
<Object name="stats-xml">
Service fn="stats-xml"
</Object>
Add the stats-init SAF to the obj.conf.
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.
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 areas.
The following connection statistics are available from the Server Manager:
Total number of connections
Maximum number of queued connections
Peak number of queued connections
Current number of queued connections
Number of processes
The following DNS statistics are available from the Server Manager:
Maximum DNS cache entries
Number of processes
Number of DNS cache hits (also shown as a bar graph)
Number of DNS cache misses (also shown as a bar graph)
The following keep-alive statistics are available from the Server Manager:
Maximum keep-alive connections
Keep-alive timeout
Number of processes
Number of keep-alive hits (also shown as a bar graph)
Number of keep-alive flushes (also shown as a bar graph)
Number of keep-alive refusals (also shown as a bar graph)
Number of keep alive time-outs (also shown as a bar graph)
The following server statistics are available from the Server Manager.
Total number of requests.
Number of bytes received.
Number of bytes sent.
Number of processes.
A breakdown of the requests per HTTP server code (also shown as bar graphs). For example, the HTTP server code 200 indicates a fulfilled request.
Access the Server Manager, and click the Server Status tab.
Click the Monitor Current Activity link.
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.
Choose the kind of statistics you want displayed from the Select Statistics To Be Displayed drop-down list.
For more information about the types of statistics, see Displaying Statistics in the Server Manager.
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 the value of the refresh interval.
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. For more information, see the next section.
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 enables 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.
You can enable the perfdump SAF only after you have enabled the stats-xml function.
Add the following object to your obj.conf file after the default object:
<Object name="perf">
Service fn="service-dump"
</Object>
Add the following line to the default object:
NameTrans fn=assign-name from="/.perf" name="perf"
Restart your server software.
Access perfdump by going to 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
The following example shows 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 DiskCacheInfo: ------------------ Hit Ratio 0/0 ( 0.00%) Misses 0 Cache files at startup 0 Cache files created 0 Cache files cleaned up 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.
If you want to limit the users who can view the perfdump statistics for your server from a browser you need to create an ACL for the /.perf URI .
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>
Performance buckets enable 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 the 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:
Name of the bucket- This name is used for associating the bucket with a function
Description- A description of the functions that the bucket is associated with
Number of requests for this function- The total number of requests that caused this function to be called
Number of times the function was invoked- This number might not coincide with the number of requests for the function because some functions might be executed more than once for a single request
Function latency or the dispatch time- The time used by the server to invoke the function
Function time- The time spent in the function itself
The default-bucket is predefined by the server. It records statistics for the functions not associated with any user-defined bucket.
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 the magnus.conf file:
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"
This example 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>
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:
Average, Total, and Percent columns give data for each requested statistic.
Request Processing Time is the total time required by the server to process all requests it has received so far.
Number of Requests is the total number of requests for the function.
Number of Invocations is the total number of times that the function was invoked. This value differs from the number of requests in that a function could be called multiple times while processing one request. The percentage column for this row is calculated in reference to the total number of invocations for all of the buckets.
Latency is the time in seconds the Proxy Server uses to prepare for calling the function.
Function Processing Time is the time in seconds Proxy Server spent inside the function. The percentage of Function Processing Time and Total Response Time is calculated with reference to the total Request Processing Time.
Total Response Time is the sum in seconds of Function Processing Time and Latency.
The following example shows sample 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%) |