Previous Table of Contents Next


23.2.9 Transport Heartbeats


   With IIOP (TCP/IP), a problem can arise when a client invokes a method on a server, the host on which the server resides fails or the link fails, and the client ORB does not detect the TCP/IP problem and receives no reply. Typically, this problem is solved by using round-trip timeouts in the client application. Setting a timeout at the application level for each request is laborious, even if one knew approximately how long a particular method will take. An alternative solution proposed here is to send another request message on the same connection that takes a known (short) time to execute; that is, a kind of no op.

   This section therefore defines a new TAG_FT_HEARTBEAT_ENABLED component of the TAG_INTERNET_IOP profile, and adds two new policies: Heartbeat and HeartbeatEnabled.

   23.2.9.1 TAG_FT_HEARTBEAT_ENABLED Component

   The TAG_FT_HEARTBEAT_ENABLED component in a TAG_INTERNET_IOP profile indicates that the addressed endpoint supports heartbeating.

   module IOP { const ComponentId TAG_FT_HEARTBEAT_ENABLED = 29;

   };

   module FT { struct TagFTHeartbeatEnabledTaggedComponent {

   // tag =TAG_FT_HEARTBEAT_ENABLED boolean heartbeat_enabled; };

   };

   The TAG_FT_HEARTBEAT_ENABLED component contains only a boolean.

   const ComponentId TAG_FT_HEARTBEAT_ENABLED = 29;

   A constant that designates the TAG_FT_HEARTBEAT_ENABLED component that is contained in a TAG_INTERNET_IOP profile.

   struct TagFTHeartbeatEnabledTaggedComponent { // tag =TAG_FT_HEARTBEAT_ENABLED boolean heartbeat_enabled; };

   The TAG_FT_HEARTBEAT_ENABLED component may be included in a TAG_INTERNET_IOP profile to indicate that the endpoint is heartbeat_enabled.

   23.2.9.2 Heartbeat Policy

   The Heartbeat Policy, applied at the client, allows the client to request heartbeating of its connections to servers, using the heartbeat_interval and heartbeat_timeout.

   module FT { const CORBA::PolicyType HEARTBEAT_POLICY = 48;

   struct HeartbeatPolicyValue {

boolean heartbeat;
TimeBase::TimeT heartbeat_interval;
TimeBase::TimeT heartbeat_timeout;
};

   interface HeartbeatPolicy : CORBA::Policy { readonly attribute HeartbeatPolicyValue heartbeat_policy_value; }; };

   When the Heartbeat Policy is applied at a client ORB, the ORB is responsible for taking the following steps. While a connection exists to a remote server, the ORB sends a request message over the connection at least as often as was requested by the heartbeat_interval of the Heartbeat Policy of any client connected to a server over that connection. The request message is equivalent to an invocation of the method:

   void FT_HB ();

   on any one of the server objects accessed by the connection. The FT_HB() operation name is reserved in CORBA for this purpose, and IDL compilers use the standard escape techniques if IDL specifications contain operations with this name.

   If the corresponding reply message does not arrive at the client ORB within the heartbeat_timeout of the Heartbeat Policy of a client connected to a server over that connection, the ORB closes the connection for that client. The connection may remain open for other clients whose Heartbeat Policy define a larger value for the heartbeat_timeout.

   The policy is defined by:

   const CORBA::PolicyType HEARTBEAT_POLICY = 48;

   A constant that designates the Heartbeat Policy for the client.

   struct HeartbeatPolicyValue {

   boolean heartbeat;

   TimeBase::TimeT heartbeat_interval;

   TimeBase::TimeT heartbeat_timeout; };

   The HeartbeatPolicyValue consists of a boolean that indicates whether the client ORB supports heartbeating, a heartbeat_interval that determines the frequency with which the client ORB pings the server, and a heartbeat_timeout that indicates the time by which the client ORB must receive a reply from the server before it closes the connection. Both the heartbeat_interval and the heartbeat_timeout use the standard TimeBase::TimeT representation, which uses a unit of 100 nanoseconds.

   interface HeartbeatPolicy : CORBA::Policy {

   readonly attribute HeartbeatPolicyValue heartbeat_policy_value; };

   A server ORB must respond to requests that contain the FT_HB() operation by immediately sending a reply message. The contents of the reply message are not defined. The request id of the reply message must match the request_id of the request message.

   A server ORB must not involve POAs or servants on receipt or reply of the FT_HB() message.

   23.2.9.3 Heartbeat Enabled Policy

   Because heartbeating can generate significant network traffic, and can use significant server resources, the heartbeating capability is explicitly enabled or disabled using the Heartbeat Enabled Policy.

   module FT { const CORBA::PolicyType HEARTBEAT_ENABLED_POLICY = 49;

   interface HeartbeatEnabledPolicy : Policy { readonly attribute boolean heartbeat_enabled_policy_value; }; };

   The Heartbeat Enabled Policy allows the heartbeating of a server endpoint. If the Heartbeat Enabled Policy is enabled for a server endpoint, the TAG_INTERNET_IOP profile for that endpoint contains the TAG_FT_HEARTBEAT_ENABLED component to indicate to the client that the server endpoint is heartbeat_enabled.

   The policy is defined by:

   const PolicyType HEARTBEAT_ENABLED_POLICY = 49;

   A constant that designates the Heartbeat Enabled Policy for the server.

   interface HeartbeatEnabledPolicy : CORBA::Policy readonly attribute boolean heartbeat_enabled_policy_value;

   };

   The heartbeat_enabled_policy_value determines whether the server endpoint supports heartbeats.

   If a client attempts to apply the Heartbeat Policy to a server for which the Heartbeat Enabled Policy is not enabled; that is, heartbeat_enabled_policy_value is false, then an INVALID_POLICIES exception is thrown. The Heartbeat Enabled Policy can be checked using validate_policies().