Table of Contents Previous Next
Logo
IceGrid : 35.24 Server Activation
Copyright © 2003-2008 ZeroC, Inc.

35.24 Server Activation

You can choose among four activation modes for servers deployed and managed by an IceGrid node:
• manual
You must start the server explicitly via the IceGrid GUI or icegridadmin, or programmatically via the IceGrid::Admin interface.
• always
IceGrid activates the server when its node starts. If the server stops, IceGrid automatically reactivates it.
• on demand
IceGrid activates the server when a client invokes an operation on an object in the server.
• session
This mode also provides on-demand activation but requires the server to be allocated by a session.

35.24.1 Activation in Detail

On-demand server activation is a valuable feature of distributed computing architectures for a number of reasons:
• It minimizes application startup times by avoiding the need to pre-start all servers.
• It allows administrators to use their computing resources more efficiently because only those servers that are actually needed are running.
• It provides more reliability in the case of some server failure scenarios, e.g., the server is reactivated after a failure and may still be capable of providing some services to clients until the failure is resolved.
• It allows remote activation and deactivation.
On-demand activation occurs when an Ice client requests the endpoints of one of the server’s object adapters via a locate request (see Section 35.3.1). If the server is not active at the time the client issues the request, the node activates the server and waits for the target object adapter to register its endpoints. Once the object adapter endpoints are registered, the registry returns the endpoint information back to the client. This sequence ensures that the client receives the endpoint information after the server is ready to receive requests.

35.24.2 Requirements

In order to use on-demand activation for an object adapter, the adapter must have an identifier and be entered in the IceGrid registry.
When using session activation mode, IceGrid requires that the server be allocated; on-demand activation fails for servers that have not been allocated. (See Section 35.11 for more information on server allocation.)
The session activation mode recognizes an additional reserved variable in the server descriptor, ${session.id}. The value of this variable is the user ID or, for SSL sessions, the distinguished name associated with the session.

35.24.3 Efficiency

Once a server is activated, it remains running indefinitely (unless it uses the session activation mode). A node deactivates a server only when explicitly requested to do so (see Section 28.17.6). As a result, server processes tend to accumulate on the node’s host.
One of the advantages of on-demand activation is the ability to manage computing resources more efficiently. Of course there are many aspects to this, but Ice makes one technique particularly simple: servers can be configured to terminate gracefully after they have been idle for a certain amount of time.
A typical scenario involves a server that is activated on demand, used for a while by one or more clients, and then terminated automatically when no requests have been made for a configurable number of seconds. All that is necessary is setting the server’s configuration property Ice.ServerIdleTime to the desired idle time. See Appendix C for more information on this property.
For a server activated in session activation mode, IceGrid deactivates the server when the session releases the server or when the session is destroyed.

35.24.4 Activating Servers with Specific User IDs

On Unix platforms you can activate server processes with specific effective user IDs, provided that the IceGrid node is running as root. If the IceGrid node does not run as root, servers are always activated with the effective user ID of the IceGrid node process. (The same is true for Windows—servers always run with the same user ID as the IceGrid node process.)
For the remainder of this section, we assume that the node runs as root on a Unix machine.
The user attribute of the server descriptor specifies the user ID for a server. If this attribute is not specified and the activation mode is not session, the default value is nobody. Otherwise, the default value is ${session.id} if the activation mode is session.
Since individual users often have different account names and user IDs on different machines, IceGrid provides a mechanism to map the value of the user attribute in the server descriptor to a user account. To do this, you must configure the node to use a user account mapper object. This object must implement the IceGrid::UserAccountMapper interface:
exception UserAccountNotFoundException {};

interface UserAccountMapper {
    string getUserAccount(string user)
            throws UserAccountNotFoundException;
};
The IceGrid node invokes getUserAccount and passes the value of the server descriptor’s user attribute. The return value is the name of the user account.
IceGrid provides a built-in file-based user account mapper that you can configure for the node and the registry. The file contains any number of user–account-ID pairs. Each pair appears on a separate line, with white space separating the user account from the identifier. For example, the file shown below contains two entries that map two distinguished names to the user account lisa:
lisa O=ZeroC\\, Inc., OU=Ice, CN=Lisa
lisa O=ZeroC\\, Inc., OU=Ice, CN=Lisa S.
The distinguished names must be unique. If the same distinguished name appears several times in a file, the last entry is used.
You can specify the path of the user account file with the IceGrid.Registry.UserAccounts property for the registry and the
IceGrid.Node.UserAccounts property for a node.
To configure an IceGrid node to use the IceGrid registry file-based user account mapper, you need to set the IceGrid.Node.UserAccountMapper property to the well-known proxy
IceGrid/RegistryUserAccountMapper. Alternatively, you can set this property to the proxy of your own user account mapper object. Note that if this
property is set, the node ignores the setting of
IceGrid.Node.UserAccounts.

35.24.5 Endpoint Registration

Section 28.17.5 discusses the configuration requirements for enabling automatic endpoint registration in servers. It should be noted however that IceGrid simplifies the configuration process in two ways:
1. The IceGrid deployment mechanism automates the creation of a configuration file for the server, including the definition of object adapter identifiers and endpoints (see Section 35.4.4).
2. A server that is activated automatically by an IceGrid node does not need to explicitly configure a proxy for the locator because the IceGrid node defines it in the server’s configuration file.
Table of Contents Previous Next
Logo