1.2.2.2 When to Use Stateless Objects
Stateless objects generally provide good performance and optimal usage of server resources, because server resources are never used when objects are idle. Using stateless objects is a good approach to implementing server applications and are particularly appropriate when:
- The client application waits for user input between invocations on the object.
- The client request contains all the data needed by the server application, and the server can process the client request using only that data.
- The object has high access rates, but low access rates from any one particular client application.
By making an object stateless, you can generally assure that server application resources are not being reserved unnecessarily while waiting for input from the client application.
An application that employs a stateless object model has the following characteristics:
- Information about and associated with an invocation is not maintained after the server application has finished executing a client request.
- An incoming client request is sent to the first available server process. After the request has been satisfied, the application state disappears and the server application is available for another client application request.
- Durable state information for the object exists outside the server process. With each invocation on this object, the durable state is read into memory.
- Successive requests on an object from a given client application may be processed by a different server process.
- The overall system performance of a machine that is running stateless objects is usually enhanced.
Parent topic: Implementing Stateless and Stateful Objects