Building Distributed
Applications
Using the Progress AppServer


Asynchronous Request Queuing

The AppServer can execute only one request at a time over a single connection. To allow a client to submit a sequence of asynchronous requests on the same AppServer connection, Progress maintains a queuing system to manage such requests between the client and the AppServer.

Queuing System Components

The asynchronous request queuing system includes three queues:

Understanding the Queuing Model

For a given AppServer connection, each asynchronous request is executed in the order that it is submitted, and the event procedures for those requests are executed in the same order that the requests are executed. This is order is maintained by the send and response queues associated with the connection.

The send queue queues requests that are submitted for execution by the client. The other queue is the response queue. The response queue queues responses received on a given AppServer connection for asynchronous requests that have completed execution, but whose event procedure has not yet been executed. Figure 2–9 shows how this works, where 1a is the first asynchronous request (AsyncRequest 1a) to AppServer 1 and 2a is the first asynchronous request (AsyncRequest 2a) to AppServer 2, and so forth.

In Figure 2–9, AsyncRequest refers to the execution of an asynchronous RUN statement and EventProc to the execution of an event procedure. These are further identified by 1 for the AppServer 1 connection and 2 for the AppServer 2 connection, and a letter indicating the order of the request on the client. On a given connection, if an asynchronous request is submitted for execution when there is already a request executing on the AppServer, the new asynchronous request is queued on the send queue until all previously submitted asynchronous requests for that connection have executed. Such is the case for AsyncRequests 1d and 2e. The new asynchronous request is only sent to the AppServer for execution once all prior asynchronous requests have completed execution on the AppServer. In Figure 2–9, AsyncRequests 1b and 2c are currently executing on their respective AppServers.

As each request completes execution, the response to the request is queued on the appropriate response queue and the next request in the send queue is sent to the AppServer. In Figure 2–9, AsyncRequests 1c and 2d are next in line for execution. Each response remains in the response queue until the corresponding event procedure can be executed in the context of a PROCESS EVENTS or blocking I/O statement. In Figure 2–9, the PROCEDURE-COMPLETE events for AsyncRequests 1a, 2a, and 2b are all pending execution of their respective event procedures.

Figure 2–9: Asynchronous Request Queuing

The response to an asynchronous request can be received by the client application at any time, but the event procedure associated with that request can be run only if the application is executing a PROCESS EVENTS or blocking I/O statement. Note that the order in which the client handles pending responses for different AppServer connections is undefined. In Figure 2–9, either the event procedure for AsyncRequest 1a or AsyncRequest 2a can execute first.

Thus, Progress guarantees that the responses from asynchronous requests on the same AppServer connection are handled in order of their execution on the client. However, it does not guarantee the order in which responses are handled from multiple AppServer connections.

Tuning the Size of the Send and Response Queues

For each connection, Progress allocates the memory for the send and response queues with a default size. If asynchronous requests are such that they exceed the send and response queue size, Progress stores additional queued requests in a temporary table associated with the client session. Thus, performance can vary based on whether requests are stored in memory or in the temporary table.

To help you maximize the performance of asynchronous requests, Progress provides the Async Queue Size (-asyncqueuesize) client startup parameter. This parameter allows you to specify the the number of bytes that you want Progress to allocate for the send and response queues on an AppServer connection.

The Async Queue Size parameter only applies when you create an AppServer connection on the client, and it applies equally to each such connection. Also, although Progress creates the send and response queues for each connection, they are not used unless you make asynchronous requests to the AppServer. Thus, you can maximize AppServer performance by choosing a value based on the amount of data that you expect to flow between the client and the AppServer for these asynchronous requests. Similarly, if you are making no asynchronous requests, you can choose a low value to reduce the space allocated to queues that you are not planning to use.

For more information on this startup parameter, see the Async Queue Size (-asyncqueuesize) entry in the Progress Startup Command and Parameter Reference.


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