Using the WSI monitor interface
The Web Server Interface Monitor window appears when you select Open Web Server Interface Monitor from the Options menu of the Organizer. The WSI monitor window consists of a notebook with the following sections, each on a separate notebook tab:
•Servers
•Parts
•Info
•Errors
The Servers page
The Servers page contains an entry for each WSI server process currently running. Each entry provides the following information about the server process:
Transport
The type of transport. Currently this is either wsi-tcp (for most interfaces), sst-http (for Server Smalltalk), or cgi-link (for compatability with previous version of Web Connection).
Total
The total number of requests made to this WSI server process.
Peak
The peak number of active transactions at any given time.
Start Time
The time this WSI server process was started.
Transport Information
Specific transport information such as the port address.
In addition, you can also use this page to set up profiling of your Web Connection application using ENVY/Stats and choose to start a new server process or stop a server process that is already running.
Profiling using ENVY/Stats
To set up profiling using ENVY/Stats, you must first load the Envy/Stats config map from the Configuration Maps browser. After you have done this, the Profile using ENVY/Stats checkbox will be enabled. When you select Profile using ENVY/Stats, the Profiler iterations field becomes enabled. This specifies how many times you want to execute the Web Connection part being profiled. If you specify a high number, the time it takes the Web Connection part to render in the Web browser will be longer than if you do not profile or if you profile with a small number of iterations.
When the Web Connection part is processed to generated HTML, the process will be profiled using the Envy/Stats EsbSampler spyOn: method. After the part has been generated, an Envy/Stats Method Execution Trace browser is opened. This shows a tree view of the methods detected to have been executed during processing and the time spent in each method.
Note that the EsbSampler uses a timer to periodically sample which methods are executing. The results from this way of profiling may not show every method that is executed because some methods can execute between timer ticks. For a part like the EsbSampler, increasing the profiler iterations might result in more useful results. For simple Web Connection parts on fast machines, profiling the execution may show that no methods were executed. This of course is an anomaly of the sampling method. However, the profiling should show the time spent in file I/O, database transactions, and other more expensive methods of your application, thus letting you optimize your code.
Starting and Stopping Servers
In order to test your Web Connection parts, you must be linked to a Web Server. The first time you try to test a Web Connection part, you will have to specify a WSI Server process. Once you have the WSI Server process defined, you don't have to explicitly start the server. When you test a Web Connection part, VA Smalltalk will start the server to test the part. If you are using more than one server, the one that was last used with Web Connection is the one that is started automatically. If you want to change to a different server, you can stop the current server and start another server on this page.
To stop one or more server processes, select one or more entries on the Servers page and then select Stop Selected Servers.
To start a new server, follow these steps:
1. Select Start a WSI Server.
2. In the Start a WSI Server window, specify the information about the new server process:
a. In the Transport field, select the transport you want to use for incoming requests. Normally, this is wsi-tcp (for most interfaces) or sst-http (for Server Smalltalk). The cgi-link transport is provided for compatibility with previous versions of the Web Connection feature.
b. In the Port number field, specify the TCP/IP port number you want this monitor to listen to for incoming requests.
c. Select Reuse port if already in use to avoid an error message if the port is already in use.
This option should typically not be selected unless your TCP/IP software does not immediately clear ports. For example, if you stop a WSI server process and then immediately try to restart it on the same port, an error might result on some systems when the server tries to bind to the port. This happens when the system mistakenly believes the port is still in use. Select this option to prevent this error.
d. Select Bind to any server address if your VA Smalltalk server has only one TCP/IP address. If the server has multiple addresses and you want the WSI server to bind to a specific address, select Bind to a specific server address and specify the address you want to bind to.
3. Select OK to start the WSI server process. An entry for the new server process appears on the Servers page of the Web Server Interface Monitor window.
The Parts page
The Parts page gives you information about the transaction requests for all WSI server processes, on a per-part basis. The monitor provides the following information for each Web Connection part:
Name
The VA Smalltalk part name.
Count
The number of requests that have been received for this part.
Minimum
The shortest time (in milliseconds) the part has taken to respond to an incoming request.
Average
The average time (in milliseconds) the part has taken in responding to incoming requests.
Maximum
The longest time (in milliseconds) the part has taken to respond to an incoming request.
Last Access
The timestamp of the last received request for this part.
Requests for parts not found in the image are grouped under the AbtWsiNotFoundHandler part.
Select Clear Statistics to clear all of the displayed statistics and return the Parts page to its initial state.
The Info page
The Info page contains a running log of informational messages for the WSI server processes, such as the times the server processes were started or stopped and which ports they use.
Select Save As to save the log information to a file. Select Clear Messages to clear all of the displayed information and return the Info page to its initial state.
The Errors page
The Errors page contains a running log of error messages for the WSI server processes, such as requests for unavailable parts or invalid request formats.
Select Save As to save the error information to a file. Select Clear Messages to clear all of the displayed information and return the Errors page to its initial state.
Starting a Web Connection image without a WSI monitor window
In addition to using the Web Server Interface Monitor window, you can start a Web Server Interface server without opening the Web Server Interface Monitor window. This is done by adding the showMonitor option to the WSI configuration file. For example:
#=====cut here====================
# Sample configuration file
transport wsi-tcp
port 8081
reuseAddr true
showMonitor false
wsiPassword eBusinessIBM
monitorTitle Web Monitor for HR image
generateWalkback false
# bindToHost (defaults to all)
#=====cut here====================
The configuration file is specified on the command line start up using the -wc:filename option. For example, if this file were stored as startup.txt you would start your Web connection application using:
myappl -wc:startup.txt
Note:
Even though no user interface is displayed, the VA Smalltalk virtual machine requires that a user interface be present.
When running without a WSI Monitor, you have to manually stop the application process to shut it down. The Web Connection feature also includes a part which displays the WSI Monitor information and allows you to reset the information or shut down the WSI server, all from your Web browser. The part is AbtWebWsiMonitorPage. Open the part in a web browser.
To shut down the server, check the Yes, I really want to shutdown checkbox, then select the Shutdown button. The WSI server will be stopped, then after a ten second delay, the image will shutdown.
Caution:
Since providing an interface that lets you shutdown your server from the web exposes a security risk, the page is password protected. A separate password protection page has been added. However, this page is a sample page and has not been thoroughly tested. The password protection framework is for demonstration purposes only, no claim is made to the security capabilities of the framework. Since we cannot guarantee that this password protection is secure, we recommend that for critical applications, the WsiRemoteControl not be packaged with the application, and that normal operating system process termination be used to stop the server. If the password protection page is used, it is recommended that it be accessed via a secure socket.
When you point your browser to the AbtWebWsiMonitorPage, you will be routed to a login page. You must enter a password to access the monitor page. At development time, the default password is password. At runtime, the password must be provided with the WsiPassword option in the startup options file. If it is not specified, then the password is not initialized and access to the protected page is theoretically prevented.
The password protection is implemented by storing the password in session data. When the protected page is to be accessed, the value of the session data is checked against the valid password. If the password is not valid, or the session data expires, the request is routed back to the login page.
To package the Web WSI Monitor page with your application, add a prerequisite to AbtWebWsiRemoteControlApp.