Private Server, Shared Server
The OpenROAD application image that executes the remote 4GL procedure calls can run in either a private server or a shared server.
A private server is a separate server process dedicated to serving one and only one client. This configuration is easy to understand and it avoids the complications that can arise when interleaving concurrent requests from multiple clients in a shared server. But the performance cost is high because a new server process must be launched each time a client calls the Remote Server Initiate method. Further, it does not scale well to large numbers of clients because each client must have a separate, dedicated server process on the server machine.
A shared server allows any number of clients to connect to the same server process. A shared server allows the Remote Server Initiate request to be very fast, since most of the time a shared server process for the desired application is already active and does not need to be launched or initialized. A shared server also scales better for large numbers of clients, since many clients can share the resources of one server process.
Using a shared server requires special discipline on the part of the application developer because remote 4GL procedure calls from different clients can be interleaved in any order. Remote calls are serialized, so that the 4GL need not manage concurrent threads within the scope of one remote call, but the application must be designed to allow switching client context between one call and the next. This means that care must be taken to associate the appropriate application state with the appropriate client.
One simple technique for managing client state in a shared server environment is to have each client hold a structure containing its own state variables, and to pass that structure as an extra by-reference parameter on all remote 4GL calls. The server application can then use that structure to restore the current client's application state at the beginning of the call and then save any changes in that client state before returning.
The OpenROAD Application Server can be configured to have a single shared server process for each application, or multiple server processes for a single application. The multiple server configuration provides automatic load balancing across the multiple server processes, and allows larger numbers of clients to be served efficiently (especially on multiprocessor machines). However, the multiple server configuration requires even more discipline in the management of application state from one call to the next, because each time a client makes a remote call it may be routed to a different server process.
An optional parameter on the RemoteServer.Initiate method specifies whether the client wants to use a private or a shared server. The default is to use a shared server.