Description
Unlike synchronous calls (which force the client to wait until processing has completed), asynchronous calls free the client to do other work while the server handles requests.
Purpose
When the timing of function execution is not critical, you can use asynchronous function calls to improve system throughput.
Usage
To make an asynchronous function call, you need to call the remote object function with the POST keyword.
For example, the following script instantiates a remote object on the server and makes an asynchronous call to a function of the remote object.
// Global variable: // connection myconnect // Instance variable: // uo_custdata mycustdata
myconnect.CreateInstance(mycustdata) mycustdata.post retrieve_data()
The following restrictions apply to asynchronous function calls made to remote objects:
- If the function returns a value, the return value will be ignored.
- The client cannot pass parameters by reference in an asynchronous call. Arguments passed by reference will not cause errors at compile time, but will result in errors at execution time.
- The client cannot poll to determine whether an asynchronous request has been processed. To notify a client that a request has been processed, the server can send a message back to the client.
- All asynchronous calls are executed in the order they are received. However, the exact timing of function execution cannot be guaranteed.
- If the server or the client crashes, execution of queued asynchronous or synchronous requests cannot be guaranteed. If the server crashes, any queued requests will be lost.
When a client issues a synchronous call, the server executes the function immediately while the client waits until processing has completed. When a client issues an asynchronous call, the server adds the request to a queue and performs the processing at a later point in time; meanwhile, the client can continue to do other work while the server handles the request.
Asynchronous calls are first queued locally so that the calling function can continue to execute immediately. As each request is pulled off of the local queue, it is sent to the server, where it is added to the client session's asynchronous requeust queue. Requests are then executed in the order they are received.
If a synchronous call comes in after several asynchronous calls have been made, the synchronous call is executed as soon as possible. Asynchronous requests against a particular object will be processed after all synchronous requests made against this object.
|