SAS/IntrNet 1.2: Application Dispatcher |
Administering the Application Server
Server Invocation ParametersThe Application Server is invoked by issuing an AF command within a SAS session. This can be done through the af c=sashelp.web.appstart.scl port=port srvroot='path-to-server-root-directory' <logwind> <debug=yes> <passwd=password> <resident=0> The The The Supplying a Password When Starting the ServerBy default, any user with a Web browser can send a request to an Application Server and cause it to execute one of the administrative programs. Most of the time these special programs should only be executed by the Application Server administrator. If you wish to block users from running administrator programs, then you must supply a password when you start the Application Server. Then the administrator is required to supply this password in the af c=sashelp.web.appstart.scl port=5001 passwd=foobaror af c=sashelp.web.appstart.scl port=5001 passwd="two words" Using Server Administration ProgramsThe Application Server has a few built-in programs that instruct the server to perform special administrative tasks. Here is a table detailing the administration programs:
You can execute a Server Administration Program by supplying the name of the program in a Dispatcher request: http://myserver/cgi-bin/broker?_SERVICE=default&_PROGRAM=ping If you started the Application Server with a password, you must supply the password to execute these programs. For example, http://myserver/cgi-bin/broker?_SERVICE=default&_PROGRAM=break&_PASSWD=foobar Remember: If you do not start the Application Server with a password, any client can run the ENDSAS program and shut down your server. Program LibrariesProgram libraries are directories, partitioned data sets, or SAS libraries that contain Dispatcher programs. Each Dispatcher program must be placed in a program library before the Application Server can run it. One Application Server can access many program libraries. They are defined in the special server autoexec file,
It is an important security measure to segregate Dispatcher programs from their data. Dispatcher programs should not be placed in libraries along with the data they read and update. If your operating system allows you to set read and write permissions on specific directories, then it is recommended that the Application Server have only read access to all program libraries. Furthermore, it is best to allocate program libraries using the During startup the Application Server clears all previous allocated files and libraries. This means that any libname or filename statements in your SAS autoexec file will be cleared. Next, the server submits the code in the server autoexec file ( Server Control FilesThe Application Server looks for the following server control files in the server root directory:
To identify the server root directory, invoke the Application Server using the
Make sure to enclose the path in quotation marks so it is interpreted as a single parameter, and be careful to use single quotation marks inside of the double quotation marks if you use a
The Server LoggingIf you want to log Application Server events, you need to include the The A server command using the /usr/local/sas -dmsbatch -fsd ascii.vt100 \ -initcmd "af c=sashelp.web.appstart.scl port=5001 logwind \ srvroot='/usr/local/lib/IntrNet/inetsrv'" \ -altlog /usr/local/lib/IntrNet/inetsrv/appsrv.log Note: Don't forget to use different names or directories for log files when starting more than one Application Server. Creating an Icon to Run the Server (Windows only)Under Windows, SAS/IntrNet software creates a Start Menu shortcut in The SAS System program group to start a default Application Server. You can copy this shortcut to create additional Start Menu or Desktop shortcuts for Application Servers.The shortcut should include the following information:
The complete command in your shortcut might look like this: "C:\Program Files\sas\sas.exe" -config "C:Program Files\sas\config.sas" -dmsbatch -altlog "C:Program Files\sas\IntrNet\appsrv.log" -initcmd "af c=sashelp.web.appstart.scl port=5001 srvroot='C:\Program Files\sas\IntrNet'" You may want to check the box to run the Application Server minimized rather than in a normal window. Using a Script to Start the ServerYou can write a script that automatically starts your Application Server and runs it in the background. The following items should be included in the script:
The following is an example script that you could use to start the Application Server on UNIX:
export DISPLAY= /usr/local/sas -dmsbatch -fsd ascii.vt100 \ -initcmd "af c=sashelp.web.appstart.scl port=5001 \ srvroot='/usr/local/lib/IntrNet/inetsrv'" On Windows, your script would be very similar to the default Start Menu shortcut created at installation. It might contain the following: C:\Program Files\sas\sas.exe -dmsbatch -initcmd "af c=sashelp.web.appstart.scl port=5001 srvroot='C:\Program Files\sas\IntrNet'" For further information on SAS invocation options, consult the SAS Companion for your operating system. Multiple Application Servers Using the Same File SystemRunning multiple Application Servers raises the same issues as running multiple SAS sessions. There is little to be concerned with if you set up each server on a different file system. However, quite often, multiple servers may be set up which access the same file system. This raises the general issue of file contention between the Application Servers. Here are some guidelines to follow if you set up multiple Application Servers on the same file system:
Development vs. Production EnvironmentsThere are several tradeoffs that you will need to assess when administering Application Servers for both development and production levels of service. In general, the choices are between performance and security for production environments and the ease of use and ease of administration for development environments. You can run Application Servers without passwords for users who are busy developing applications. This enables the users to handle some administrative tasks such as shutting down a server if needed. You may also find it is easier on the system administrator to allow any application developer to administer their own Application Server. This could also free up some of the load on centrally administered servers and improve performance. It is important, though, not to forget to employ the proper security measures for production, and especially for Internet-accessible environments. Using SAS/SHARE SoftwareSAS/AF software has a default feature that causes SCL entries to be cached after the first time they are executed. This feature helps to improve performance. A program that repeatedly issues a statement such as Launch vs. SocketThe two Dispatcher service types, launch and socket, provide a choice for processing Dispatcher programs. As you learn more about the software it will become easier to make the decision about which type of service to use. This section assists you in making those choices. The primary difference between the two services is that a socket service reuses a server session, and a launch service provides a fresh server session that handles only that single request. The primary consideration that stems from this difference is that programs executed with a socket service can impact other applications attempting to use the same service. Many applications can use a single launch service without directly impacting one another because, with each click to submit a Web form, a new process is started to service that user. Because each request to a launch service is a separate process on the server side, they cannot directly impact one another. They can, however, indirectly impact one another through their demands on system resources. At first it may appear that launch is the better choice because users will be more insulated from one another. However, there is no clear choice. Launch is better for some situations and socket is better for others. One negative aspect of using launch is that there is currently no way to limit the number of server sessions that can be invoked. If 1000 users go to your Web site and click "submit" on a form using a launch service, your Web server will attempt to run 1000 brokers that will attempt to run 1000 Application Server sessions. This example is probably extreme for most sites and most applications, but it illustrates the effect of attempting to scale an application using a launch service. A benefit to the socket service is that the server can run on any machine in your network. Launch can only start Application Servers on the Web server machine, the same machine where the Broker runs. Some sites need to restrict the resource usage on their Web server machines and will probably prefer to put the Application Server on a separate machine. Socket services accommodate this need. Another important difference is that each Application Server is serial, meaning that it only handles one request at a time. If a socket service maps to a single server and that server is currently busy processing a request, each request sent to that server will wait. This essentially forms a queue of requests waiting for the same server port. If the number of requests is large or the length of time to process a request is large, then it is possible that some of the queued requests will time out. One way to handle this is to define a pool of servers as a single socket service and/or to increase the timeout value for the service. Comparatively, you can think of a launch service as a demand-driven pool of servers. The Application Dispatcher will do no queuing under launch (though the Web server might) and each user will be processed in parallel instead of sequentially. No user will timeout because of a long running program that was submitted before their request. Some Dispatcher programs can take a long time to complete. This can be a problem when processed via a socket service. If a long running job ties up the server, then other users may not get served. It is important to note that the timeout set in the configuration file does not interrupt the Application Server. This timeout simply causes the Broker to exit and return an error message. The Application Server session will continue to process the job until it completes. Meanwhile, users with requests queued up would be receiving timeout messages. For this reason, the launch service is recommended for long-running Dispatcher programs. The socket service is recommended for short programs. Launch services are much easier for the system administrator to support. Once a launch service is set up, the system administrator's work is complete, unless there is a need for changes in the configuration. Socket services map to Application Servers, which must be started up and left running. The disadvantage for system administrators is that they must make sure the Application Servers are started, and they must respond if they go down. The advantage for users is that they do not pay the cost of starting a SAS session. This is a big benefit to users, especially when the compute task is something that only takes a couple seconds. Each launch request must incur the additional time for starting a SAS session. Lastly, the issue of development vs. production environments can also be an issue of launch vs. socket. The Dispatcher programs that the developers at your site are creating will be will be unstable and contain errors. Some errors can cause the server to get into an unrecoverable or undesirable state. If the server is a socket service, then multiple developers may be using it at once. One program's error could affect the server in such a way that another developer's program produces unexpected results. Application Server administrators may find themselves restarting the servers often and explaining to one developer how another developer's program was the problem. One solution to this is to have the program developers run their own Application Servers, as explained above, but that too may prove difficult to administer. A second alternative would be to encourage developers to use a launch service when developing Dispatcher applications. No matter how defective the behavior of a single program, it will not affect any other developers if a launch service is used. |
SAS/IntrNet 1.2: Application Dispatcher |