Chapter 19 Creating Web Applications


Configuring a distributed Web application

Web applications can be distributed by deploying them to as EAServer 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, EAServer 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.

EAServer 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 EAServer 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 an EAServer cluster to run a distributed Web application. For more information, see the chapter "Clusters and Synchronization" in the EAServer System Administration Guide.

Steps Distributing a Web application

These steps must be performed in Jaguar Manager, while connected to the primary server for your EAServer 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 "Database Access" chapter in the EAServer 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 EAServer cluster to propagate the configuration changes to other servers in the cluster. See the "Clusters and Synchronization" chapter in the EAServer System Administration Guide 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.

The following table definitions can be used for creating an Oracle 8.1.7 database:

PS_KEY RAW (255) NOT NULL,
PS_SIZE NUMBER NOT NULL,
PS_BIN1 RAW (255),
PS_BIN2 RAW (255),
PS_BIN3 RAW (255),
PS_BIN4 RAW (255),
PS_DATA LONG RAW

 


Copyright © 2002 Sybase, Inc. All rights reserved.