Chapter 22 Creating Web Applications


Configuring a distributed Web application

Web applications can be distributed by deploying them to a Jaguar server cluster that has been augmented with third-party address-redirection software that performs HTTP load-balancing and failover.

If a Web application is distributed and running in a cluster, Jaguar stores session data in a persistent data store to support shared sessions and session failover. However, since session data is bound a single user, you cannot use sessions to store global read-write data. Many applications use ServletContext properties to store global data, but the ServletContext is not global to a distributed application and cannot be used as a shared-memory store. Instead, you must a database (or an EJB entity Bean that connects to a database) to store global data. You can use the Web application's environment properties to store global read-only data.

Jaguar stores session data for distributed Web applications in a remote database that is shared by all servers that run the Web application, connecting through the predefined JDBC connection cache ServletPersistenceCache. Sybase recommends that you configure this cache to connect to an enterprise-grade database server.

Note   The sample ServletPersistenceCache properties must be changed As preconfigured, the ServletPersistenceCache connects to the sample database that is included with the Jaguar sample applications. This sample uses the evaluation version of Adaptive Server Anywhere, which does not allow connections from multiple hosts. You must use another database that allows connections from multiple hosts, and supports the number of connections required by your cluster.

You must define a Jaguar cluster to run a distributed Web application. For more information, see the chapter "Jaguar Clusters and Synchronization" in the Jaguar CTS System Administration Guide.

Steps To distribute a Web application

These steps must be performed in Jaguar Manager, while connected to the primary server for your Jaguar cluster:

  1. Select the Distributed checkbox on the General tab in the Web Application Properties dialog box.

  2. Install the Web application to one or more logical servers that are part of the cluster.

  3. Configure the properties of the connection cache named ServletPersistenceCache to connect to the database that you use for persistent session storage. This cache must use JDBC and have cache-by-name access allowed. See the "Jaguar Configuration" chapter in the Jaguar CTS System Administration Guide for instructions.

  4. Make sure the ServletPersistenceCache cache is installed in each logical server where the Web application is installed.

  5. If using a database other than Sybase Adaptive Server Enterprise or Adaptive Server Anywhere, create a table as described in "Creating the database table".

  6. Synchronize the Jaguar cluster to propagate the configuration changes to other servers in the cluster. See Chapter 3, "Jaguar Clusters and Synchronization" in the for more information..


Creating the database table

If you are storing session data in a database other than Sybase Adaptive Server Enterprise or Adaptive Server Anywhere, you must manually create the table that stores the session data. Create a table named ps_HttpSession with the following schema:

Column

Data format

ps_key (primary key).

Variable length binary, 255 bytes maximum length, cannot be null.

ps_size

Integer, cannot be null.

ps_bin1

Variable length binary, 255 bytes maximum length, can be null.

ps_bin2

Variable length binary, 255 bytes maximum length, can be null.

ps_bin3

Variable length binary, 255 bytes maximum length, can be null.

ps_bin4

Variable length binary, 255 bytes maximum length, can be null.

ps_data

Binary large object. This type must be functionally equivalent to a Sybase image type. The JDBC driver used by the specified connection cache must allow access to the ps_data column using the JDBC setBytes and getBytes methods.

 


Copyright © 2000 Sybase, Inc. All rights reserved.