Page tree

Documentation for Ice 3.5. The latest release is Ice 3.7. Refer to the space directory for other releases.

Skip to end of metadata
Go to start of metadata

Active Connection Management (ACM) is enabled by default and helps to improve scalability and conserve application resources by closing idle connections.

On this page:

Configuring Active Connection Management

ACM is configured separately for client (outgoing) and server (incoming) connections using the properties Ice.ACM.Client and Ice.ACM.Server, respectively. The default value of Ice.ACM.Client is 60, meaning an outgoing connection is closed if it has not been used for sixty seconds. The default value of Ice.ACM.Server is zero, which disables ACM for incoming connections. Ice disables server ACM by default because it can cause incoming oneway requests to be silently discarded.

You can also selectively enable or disable ACM for individual object adapters by setting the property <adapter>.ACM.

The decision to close a connection is not based only on a lack of network activity. For example, a request may take longer to complete than the configured idle time. Therefore, ACM does not close a connection if there are outgoing or incoming requests pending on that connection, or if a batch request is being accumulated for that connection.

When it is safe to close the connection, the closure is usually transparent to the client and server applications because the connection is automatically reestablished if necessary. We say connection closure is usually transparent because it is possible that the Ice run time will be unable to reestablish a connection for a variety of reasons. In such a situation, the application receives a local exception for new requests (usually a ConnectFailedException).

It is important that you choose an idle time that does not result in excessive connection closure and reestablishment. The default value of sixty seconds is a reasonable default, but your requirements may determine a more appropriate value.

The run time periodically scans through all open connections to close those that have exceeded their idle time. By default, the scanning interval is 10% of the smallest configured ACM timeout, with a minimum of 5 seconds and a maximum of 5 minutes. You can choose a different scanning interval by setting the property Ice.MonitorConnections to the desired interval in seconds. Once a connection exceeds its idle time, it is closed during the next scan. This means that, if you set a scanning interval of 120 seconds, and have an ACM timeout of 60 seconds, idle connections will be closed once they have been idle for between one and three minutes. For servers with many (thousands) of incoming connections, you should set the scanning interval to the longest amount of time you can afford connections to remain open past their idle limit; this reduces the overhead of the scans and makes it more likely that each scan will actually find and close idle connections.

Disabling Active Connection Management

Since server ACM is disabled by default, you only need to set Ice.ACM.Client to 0 to disable ACM for all connections. In this configuration a connection is not closed until its communicator is destroyed or it is closed explicitly by the application. It is important to note that disabling ACM in a process does not prevent a remote peer from closing a connection; all peers must be properly configured in order to truly disable ACM.

There are certain situations in which it is necessary to disable ACM. For example, oneway requests can be silently discarded when a connection is closed . As another example, ACM must be disabled when using bidirectional connections. A bidirectional connection is enabled by using a router such as Glacier2 or by configuring a connection explicitly for bidirectional use. If you do not disable ACM in such cases, ACM can prematurely close a bidirectional connection and thereby cause callbacks to fail unexpectedly.

See Also
  • No labels