3 //=============================================================================
5 * @file CosLoadBalancing.idl
7 * @author Object Management Group
9 //=============================================================================
12 #ifndef COSLOADBALANCING_IDL
13 #define COSLOADBALANCING_IDL
15 #include
"PortableGroup.idl"
19 * @class CosLoadBalancing
21 * @brief This module defines the interfaces and data types used in
22 * TAO's Load Balancing service.
24 * TAO's Load Balancer manages distribution of requests to replicas of
25 * a given Object in an effort to ensure that the applications/hosts
26 * pointed to by the Object reference are as equally loaded as
27 * possible, i.e. load balanced.
29 * The definition of 'load' is application specific, for example, some
30 * applications may choose to load balance access to multiple
31 * dedicated lines, or separate network interfaces, as well as more
32 * traditional load balancing metrics, such as CPU or power load.
34 module CosLoadBalancing
36 typeprefix CosLoadBalancing
"tao.lb";
38 const IOP
::ServiceId LOAD_MANAGED
= 123456; // @todo TBA by OMG
40 typedef PortableGroup
::Location Location
;
41 typedef PortableGroup
::Properties Properties
;
43 // Types used for obtaining and/or reporting loads
44 typedef unsigned long LoadId
;
46 // OMG defined LoadId constants.
47 const LoadId LoadAverage
= 0;
48 const LoadId Disk
= 1;
49 const LoadId Memory
= 2;
50 const LoadId Network
= 3;
51 const LoadId RequestsPerSecond
= 4;
57 typedef sequence
<Load
> LoadList
;
59 exception MonitorAlreadyPresent
{};
60 exception LocationNotFound
{};
61 exception LoadAlertNotFound
{};
62 exception LoadAlertAlreadyPresent
{};
63 exception LoadAlertNotAdded
{};
65 exception StrategyNotAdaptive
{};
67 interface LoadManager
;
71 readonly attribute
string name
;
73 Properties get_properties
();
75 /// Report loads at given location to the LoadManager.
76 void push_loads
(in PortableGroup
::Location the_location
,
78 raises
(StrategyNotAdaptive
);
80 /// Get loads, if any, at the given location. Load balancing
81 /// strategies may use this method to query loads at specific
82 /// locations. Returned loads are the effective loads computed by
83 /// the Strategy, as opposed to the raw loads maintained by the
85 LoadList get_loads
(in LoadManager load_manager
,
86 in PortableGroup
::Location the_location
)
87 raises
(LocationNotFound
);
89 /// Return the next member from the given object group which will
90 /// requests will be forward to.
91 Object next_member
(in PortableGroup
::ObjectGroup object_group
,
92 in LoadManager load_manager
)
93 raises
(PortableGroup
::ObjectGroupNotFound
,
94 PortableGroup
::MemberNotFound
);
96 /// Ask the Strategy to analyze loads, and enable or disable alerts
97 /// at object group members residing at appropriate locations.
98 oneway
void analyze_loads
(in PortableGroup
::ObjectGroup object_group
,
99 in LoadManager load_manager
);
101 // The loads at the given location should no longer be considered
102 // when performing load analysis.
103 // void location_removed (in PortableGroup::Location the_location)
104 // raises (LocationNotFound);
107 typedef Strategy CustomStrategy
;
109 /// Property value for built-in load balancing Strategy.
118 /// Forward requests back to the load manager via the object group
120 void enable_alert
();
122 /// Stop forwarding requests, and begin accepting them again.
123 void disable_alert
();
126 /// Interface that all load monitors must implement.
127 interface LoadMonitor
129 /// Retrieve the location at which the LoadMonitor resides.
130 readonly attribute Location the_location
;
132 /// Retrieve the current load at the location LoadMonitor resides.
133 readonly attribute LoadList loads
;
136 /// Specification of LoadManager Interface
137 interface LoadManager
138 : PortableGroup
::PropertyManager
,
139 PortableGroup
::ObjectGroupManager
,
140 PortableGroup
::GenericFactory
142 /// For the PUSH load monitoring style.
143 void push_loads
(in PortableGroup
::Location the_location
,
146 /// Return the raw loads at the given location, as opposed to the
147 /// potentially different effective loads returned by the
148 /// Strategy::get_loads() method.
149 LoadList get_loads
(in PortableGroup
::Location the_location
)
150 raises
(LocationNotFound
);
152 /// Inform member at given location of load alert condition.
153 void enable_alert
(in PortableGroup
::Location the_location
)
154 raises
(LoadAlertNotFound
);
156 /// Inform member at given location that load alert condition has
158 void disable_alert
(in PortableGroup
::Location the_location
)
159 raises
(LoadAlertNotFound
);
161 /// Register a LoadAlert object for the member at the given
163 void register_load_alert
(in PortableGroup
::Location the_location
,
164 in LoadAlert load_alert
)
165 raises
(LoadAlertAlreadyPresent
,
168 /// Retrieve the LoadAlert object for the member at the given
170 LoadAlert get_load_alert
(in PortableGroup
::Location the_location
)
171 raises
(LoadAlertNotFound
);
173 /// Remove (de-register) the LoadAlert object for the member at the
175 void remove_load_alert
(in PortableGroup
::Location the_location
)
176 raises
(LoadAlertNotFound
);
178 // The following load monitor methods are only used for the PULL
179 // load monitoring style.
181 /// Register a LoadMonitor object for "pull" monitoring of the
183 void register_load_monitor
(in PortableGroup
::Location the_location
,
184 in LoadMonitor load_monitor
)
185 raises
(MonitorAlreadyPresent
);
187 /// Retrieve the LoadMonitor object for the given location.
188 LoadMonitor get_load_monitor
(in PortableGroup
::Location the_location
)
189 raises
(LocationNotFound
);
191 /// Remove (de-register) the LoadMonitor object for the given
193 void remove_load_monitor
(in PortableGroup
::Location the_location
)
194 raises
(LocationNotFound
);
200 #endif
/* COSLOADBALANCING_IDL */