Release 10.1A: OpenEdge Application Server:
Developing AppServer Applications

> ## State-aware operating mode

> When OpenEdge sends a client application’s connection request to an AppServer that is running in state-aware operating mode, the AppServer broker connects the client application directly to one of the agents in its AppServer agent pool. The connected AppServer agent remains dedicated to the client application for the life of the connection.

> Unlike state-reset, OpenEdge does not reset the AppServer session context between connections. Whatever context remains when one connection finishes is available to the next connection.

> ##### General AppServer-client interaction

> The general interaction between a state-aware AppServer and client proceeds as follows:

> 1. The client connects to the AppServer broker with or without the help of a NameServer, which provides the address of the broker from a list of AppServers that support a specified application service.

> Note: The algorithm the NameServer uses to choose the broker depends on whether the NameServer is configured for load balancing. For more information, see the "Load balancing and session models" section.

> 2. The AppServer broker connects the client to an available AppServer agent, which makes the session context available from any client previously connected to this agent. The broker is then available to accept a connection request from another client.

> 3. The client invokes an application service request (synchronously or asynchronously).

> 4. The connected agent executes the request and returns the results to the client.

> 5. The client handles the results of the application service request and either invokes another request as in Step 3 or disconnects from the AppServer as in Step 6.

> 6. When the client no longer requires the application service, it disconnects from the AppServer agent and cleans up after its connection to the application service, making the AppServer agent available to handle another client connection.

> The number of available simultaneous client connections to a state-aware AppServer corresponds to the number of AppServer agents that it is configured to startup and manage at one time.

> ##### Connection management

> When the AppServer receives a connection request, the AppServer broker chooses an AppServer agent that is not currently dedicated to some other client application’s connection. If all AppServer agents are unavailable, the AppServer broker might create another AppServer agent for the connection, or it might return an error. The result depends on how many AppServer agents are running and the values of various configuration settings.

> When the client application disconnects from its AppServer agent, the AppServer agent notifies the AppServer broker that it is now available to service another client application connection.

> To help an AppServer session perform common connection tasks, such as user authentication, you can configure a Connect procedure that runs for each connection request and a Disconnect procedure that runs for each disconnection request. For more information on these procedures, see Chapter 2, " Programming the AppServer."

> ##### Performance considerations

> Because an AppServer running in state-aware operating mode dedicates an AppServer agent to each client connection, the connected client is guaranteed of having each request handled immediately by the AppServer. Assuming that the general process load on the AppServer platform is light enough, this means that the client can expect relatively fast response time from the AppServer.

> However, throughput in a state-aware connection tends to drop as client load increases, because the number of dedicated AppServer agents available to handle client connections is necessarily limited by the number of AppServer agents that can be started on the AppServer machine.

> ##### Context management

> Unlike state-reset, an AppServer running in state-aware operating mode does not reset its session context between client connections. Instead, OpenEdge maintains any context created in the AppServer session until you specifically delete it in some procedure that you write.

> For an AppServer running in state-aware operating mode you can also configure Startup and Shutdown procedures that run in every AppServer session when it starts up and shuts down. You can use these procedures to establish and discard run-time context that the AppServer maintains in common for all connections. For more information on the Startup and Shutdown procedures, see Chapter 2, " Programming the AppServer."

> Like state-reset, because each AppServer agent is dedicated to a client connection, the AppServer maintains all session context between client requests. Thus, for example, any global values or database connections that you set in remote procedures remain available for the life of the connection or until you change them during some remote procedure call.

> As noted in a previous section, an AppServer session running in state-aware operating mode maintains most of its context between client connections. However, it does delete any remote persistent procedures that are still active when the connection terminates.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095