diff options
Diffstat (limited to 'TAO/orbsvcs')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LB_Balancing_Strategy.cpp | 10 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LB_Balancing_Strategy.h | 21 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LB_Minimum_Dispersion.cpp | 24 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LB_Minimum_Dispersion.h | 15 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LB_ReplicaInfo.h | 10 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing.idl | 167 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Balancing_Strategy.cpp | 10 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Balancing_Strategy.h | 21 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Minimum_Dispersion.cpp | 24 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Minimum_Dispersion.h | 15 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.cpp | 20 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ReplicaInfo.h | 10 |
12 files changed, 116 insertions, 231 deletions
diff --git a/TAO/orbsvcs/orbsvcs/LB_Balancing_Strategy.cpp b/TAO/orbsvcs/orbsvcs/LB_Balancing_Strategy.cpp index eca536d8715..3b8e8837506 100644 --- a/TAO/orbsvcs/orbsvcs/LB_Balancing_Strategy.cpp +++ b/TAO/orbsvcs/orbsvcs/LB_Balancing_Strategy.cpp @@ -12,8 +12,8 @@ TAO_LB_Balancing_Strategy::~TAO_LB_Balancing_Strategy (void) { } -// void -// TAO_LB_Balancing_Strategy::load_changed (TAO_LB_ReplicaProxy *, -// CORBA::Environment &) -// { -// } +void +TAO_LB_Balancing_Strategy::analyze_loads (TAO_LB_Location_Map &, + CORBA::Environment &) +{ +} diff --git a/TAO/orbsvcs/orbsvcs/LB_Balancing_Strategy.h b/TAO/orbsvcs/orbsvcs/LB_Balancing_Strategy.h index c704ecc569b..b14db04fa9c 100644 --- a/TAO/orbsvcs/orbsvcs/LB_Balancing_Strategy.h +++ b/TAO/orbsvcs/orbsvcs/LB_Balancing_Strategy.h @@ -16,13 +16,16 @@ #include "ace/pre.h" -#include "orbsvcs/LoadBalancingS.h" #include "LoadBalancing_export.h" # if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once # endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "orbsvcs/LoadBalancingS.h" +#include "LB_Location_Map.h" + + // class TAO_LB_ReplicaProxy; struct TAO_LB_ObjectGroup_Map_Entry; @@ -51,20 +54,16 @@ public: CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) = 0; -// /// Insert ReplicaProxy servant into the set of replica proxies upon -// /// which the load balancing algorithm is performed. -// virtual int insert (TAO_LB_ReplicaProxy *) = 0; - -// /// Remove ReplicaProxy servant from the set of replica proxies. -// virtual int remove (TAO_LB_ReplicaProxy *) = 0; - + /// Analyze the loads at each location and force client request + /// redirection, if necessary, or disable the redirection at a given + /// location. /** - * The load on one proxy has changed. * @@ Ossama: see my comments on LoadBalancing_i about changing the * signature of this method. */ -// virtual void load_changed (TAO_LB_ReplicaProxy *proxy, -// CORBA::Environment &ACE_TRY_ENV); + virtual void analyze_loads (TAO_LB_Location_Map &location_map, + CORBA::Environment &ACE_TRY_ENV); + }; diff --git a/TAO/orbsvcs/orbsvcs/LB_Minimum_Dispersion.cpp b/TAO/orbsvcs/orbsvcs/LB_Minimum_Dispersion.cpp index 6c774880b2c..d825b811afb 100644 --- a/TAO/orbsvcs/orbsvcs/LB_Minimum_Dispersion.cpp +++ b/TAO/orbsvcs/orbsvcs/LB_Minimum_Dispersion.cpp @@ -92,10 +92,10 @@ TAO_LB_Minimum_Dispersion_Strategy::replica ( } } -#if 0 void -TAO_LB_Minimum_Dispersion_Strategy::load_changed (TAO_LB_ReplicaProxy *proxy, - CORBA::Environment &ACE_TRY_ENV) +TAO_LB_Minimum_Dispersion_Strategy::analyze_loads ( + TAO_LB_Location_Map &location_map, + CORBA::Environment &ACE_TRY_ENV) { int send_load_advisory = 0; @@ -104,18 +104,21 @@ TAO_LB_Minimum_Dispersion_Strategy::load_changed (TAO_LB_ReplicaProxy *proxy, guard, this->lock_)); - if (this->proxies_.is_empty ()) - return; - TAO_LB_ReplicaProxySetIterator begin = this->proxies_.begin (); - TAO_LB_ReplicaProxySetIterator end = this->proxies_.end (); + TAO_LB_Location_Map::iterator begin = + location_map.begin (); + + TAO_LB_Location_Map::iterator end = + location_map.end (); float s = 0; CORBA::ULong n = 0; - TAO_LB_ReplicaProxySetIterator i = begin; - for (;i != end; ++i) + TAO_LB_Location_Map::iterator i = begin; + for ( ; i != end; ++i) { - s += (*i)->current_load (); + s += (*i)->int_id_.load_list[0].value; // @@ Hard coded to + // get things + // going. n++; } @@ -168,4 +171,3 @@ TAO_LB_Minimum_Dispersion_Strategy::load_changed (TAO_LB_ReplicaProxy *proxy, ACE_CHECK; } } -#endif /* 0 */ diff --git a/TAO/orbsvcs/orbsvcs/LB_Minimum_Dispersion.h b/TAO/orbsvcs/orbsvcs/LB_Minimum_Dispersion.h index 19a1b50ae33..34a25bcbbde 100644 --- a/TAO/orbsvcs/orbsvcs/LB_Minimum_Dispersion.h +++ b/TAO/orbsvcs/orbsvcs/LB_Minimum_Dispersion.h @@ -54,18 +54,21 @@ public: /// Destructor ~TAO_LB_Minimum_Dispersion_Strategy (void); - // = The TAO_LB_LoadBalancing_Strategy methods + /** + * @name The TAO_LB_LoadBalancing_Strategy methods + */ + //@{ + virtual CORBA::Object_ptr replica (TAO_LB_ObjectGroup_Map_Entry *entry, CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)); -// virtual void load_changed (TAO_LB_ReplicaProxy *, -// CORBA::Environment &ACE_TRY_ENV); + virtual void analyze_loads (TAO_LB_Location_Map &location_map, + CORBA::Environment &ACE_TRY_ENV); -private: + //@} -// /// Set containing the ReplicaProxy servants. -// TAO_LB_ReplicaProxySet proxies_; +private: // /// Lock used to ensure atomic access to state retained by this // /// class. diff --git a/TAO/orbsvcs/orbsvcs/LB_ReplicaInfo.h b/TAO/orbsvcs/orbsvcs/LB_ReplicaInfo.h index b95d8312a20..7a63f3a5d22 100644 --- a/TAO/orbsvcs/orbsvcs/LB_ReplicaInfo.h +++ b/TAO/orbsvcs/orbsvcs/LB_ReplicaInfo.h @@ -25,8 +25,9 @@ #include "orbsvcs/LoadBalancingC.h" -// Fosrward declarations. +// Forward declarations. struct TAO_LB_Location_Map_Entry; +struct TAO_LB_ObjectGroup_Map_Entry; struct TAO_LB_ReplicaInfo; typedef ACE_Unbounded_Set<TAO_LB_ReplicaInfo *> TAO_LB_ReplicaInfo_Set; @@ -35,6 +36,8 @@ typedef ACE_Unbounded_Set<TAO_LB_ReplicaInfo *> TAO_LB_ReplicaInfo_Set; * @class TAO_LB_ReplicaInfo * * @brief Class that contains all replica-specific information. + * + * */ struct TAO_LB_ReplicaInfo { @@ -50,6 +53,11 @@ struct TAO_LB_ReplicaInfo /// was not created using a GenericFactory. LoadBalancing::GenericFactory::FactoryCreationId_var factory_creation_id; + /// Pointer to the object group map entry corresponding to the + /// object group to which this replica member in this structure + /// belongs. + TAO_LB_ObjectGroup_Map_Entry *object_group_entry; + /// Pointer to the location map entry containing the information /// related to the location the replica corresponding to this /// TAO_LB_ReplicaInfo structure. diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing.idl b/TAO/orbsvcs/orbsvcs/LoadBalancing.idl index d9d18eaa186..8cecbb03874 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing.idl +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing.idl @@ -55,36 +55,6 @@ module LoadBalancing interface LoadNotifier; interface LoadMonitor; - typedef unsigned long long ObjectGroupId; - typedef unsigned long ObjectGroupRefVersion; - - typedef CORBA::RepositoryId TypeId; - typedef Object ObjectGroup; - typedef CosNaming::Name Name; - typedef any Value; - - struct Property { - Name nam; - Value val; - }; - typedef sequence<Property> Properties; - - typedef Name Location; - typedef sequence<Location> Locations; - - typedef Properties Criteria; - - struct FactoryInfo { - GenericFactory the_factory; - Location the_location; - Criteria the_criteria; - }; - typedef sequence<FactoryInfo> FactoryInfos; - - typedef unsigned short MembershipStyle; - const MembershipStyle MEMB_APP_CTRL = 0; - const MembershipStyle MEMB_INF_CTRL = 1; - typedef unsigned short MonitoringStyle; const MonitoringStyle PULL = 0; const MonitoringStyle PUSH = 1; @@ -95,9 +65,6 @@ module LoadBalancing const MonitoringGranularity LOC = 1; const MonitoringGranularity LOC_AND_TYPE = 2; - typedef unsigned short InitialNumberReplicas; - typedef unsigned short MinimumNumberReplicas; - typedef unsigned short ClientBinding; const ClientBinding PER_SESSION = 0; const ClientBinding PER_REQUEST = 1; @@ -107,140 +74,14 @@ module LoadBalancing const BalancingPolicy NON_ADAPTIVE = 0; const BalancingPolicy ADAPTIVE = 1; - exception InterfaceNotFound {}; - exception ObjectGroupNotFound {}; - exception MemberNotFound {}; - exception ObjectNotFound {}; - exception MemberAlreadyPresent {}; - exception BadReplicationStyle {}; - exception ObjectNotCreated {}; - exception ObjectNotAdded {}; - exception PrimaryNotSet {}; - exception UnsupportedProperty { - Name nam; - }; - exception InvalidProperty { - Name nam; - Value val; - }; - exception NoFactory { - Location the_location; - TypeId type_id; - }; - exception InvalidCriteria { - Criteria invalid_criteria; - }; - exception CannotMeetCriteria { - Criteria unmet_criteria; - }; exception MonitorAlreadyPresent {}; exception LocationNotFound {}; - /// Specification of PropertyManager Interface which - /// ReplicationManager Inherits - interface PropertyManager { - void set_default_properties (in Properties props) - raises (InvalidProperty, - UnsupportedProperty); - - Properties get_default_properties (); - - void remove_default_properties (in Properties props) - raises (InvalidProperty, - UnsupportedProperty); - - void set_type_properties (in TypeId type_id, - in Properties overrides) - raises (InvalidProperty, - UnsupportedProperty); - - Properties get_type_properties (in TypeId type_id); - - void remove_type_properties (in TypeId type_id, - in Properties props) - raises (InvalidProperty, - UnsupportedProperty); - - void set_properties_dynamically (in ObjectGroup object_group, - in Properties overrides) - raises (ObjectGroupNotFound, - InvalidProperty, - UnsupportedProperty); - - Properties get_properties (in ObjectGroup object_group) - raises (ObjectGroupNotFound); - }; - - /// Specification of ObjectGroupManager Interface which - /// ReplicationManager Inherits - interface ObjectGroupManager { - ObjectGroup create_member (in ObjectGroup object_group, - in Location the_location, - in TypeId type_id, - in Criteria the_criteria) - raises (ObjectGroupNotFound, - MemberAlreadyPresent, - NoFactory, - ObjectNotCreated, - InvalidCriteria, - CannotMeetCriteria); - - ObjectGroup add_member (in ObjectGroup object_group, - in Location the_location, - in Object member) - raises (ObjectGroupNotFound, - // CORBA::INV_OBJREF, // @@ Missing declaration - MemberAlreadyPresent, - ObjectNotAdded); - - ObjectGroup remove_member (in ObjectGroup object_group, - in Location the_location) - raises (ObjectGroupNotFound, - MemberNotFound); - -// ObjectGroup set_primary_member (in ObjectGroup object_group, -// in Location the_location) -// raises (ObjectGroupNotFound, -// MemberNotFound, -// PrimaryNotSet, -// BadReplicationStyle); - - Locations locations_of_members (in ObjectGroup object_group) - raises (ObjectGroupNotFound); - - ObjectGroupId get_object_group_id (in ObjectGroup object_group) - raises (ObjectGroupNotFound); - - ObjectGroup get_object_group_ref (in ObjectGroup object_group) - raises (ObjectGroupNotFound); - - Object get_member_ref (in ObjectGroup object_group, - in Location loc) - raises (ObjectGroupNotFound, - MemberNotFound); - }; - - /// Specification of GenericFactory Interface which - /// ReplicationManager Inherits and Application Objects Implement - interface GenericFactory { - typedef any FactoryCreationId; - - Object create_object (in TypeId type_id, - in Criteria the_criteria, - out FactoryCreationId factory_creation_id) - raises (NoFactory, - ObjectNotCreated, - InvalidCriteria, - InvalidProperty, - CannotMeetCriteria); - - void delete_object (in FactoryCreationId factory_creation_id) - raises (ObjectNotFound); - }; - /// Specification of ReplicationManager Interface - interface ReplicationManager : PropertyManager, ObjectGroupManager, - GenericFactory { + interface ReplicationManager : + PortableGroup::PropertyManager, + PortableGroup::ObjectGroupManager, + PortableGroup::GenericFactory { void register_load_notifier (in LoadNotifier load_notifier); diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Balancing_Strategy.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Balancing_Strategy.cpp index eca536d8715..3b8e8837506 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Balancing_Strategy.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Balancing_Strategy.cpp @@ -12,8 +12,8 @@ TAO_LB_Balancing_Strategy::~TAO_LB_Balancing_Strategy (void) { } -// void -// TAO_LB_Balancing_Strategy::load_changed (TAO_LB_ReplicaProxy *, -// CORBA::Environment &) -// { -// } +void +TAO_LB_Balancing_Strategy::analyze_loads (TAO_LB_Location_Map &, + CORBA::Environment &) +{ +} diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Balancing_Strategy.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Balancing_Strategy.h index c704ecc569b..b14db04fa9c 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Balancing_Strategy.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Balancing_Strategy.h @@ -16,13 +16,16 @@ #include "ace/pre.h" -#include "orbsvcs/LoadBalancingS.h" #include "LoadBalancing_export.h" # if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once # endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "orbsvcs/LoadBalancingS.h" +#include "LB_Location_Map.h" + + // class TAO_LB_ReplicaProxy; struct TAO_LB_ObjectGroup_Map_Entry; @@ -51,20 +54,16 @@ public: CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) = 0; -// /// Insert ReplicaProxy servant into the set of replica proxies upon -// /// which the load balancing algorithm is performed. -// virtual int insert (TAO_LB_ReplicaProxy *) = 0; - -// /// Remove ReplicaProxy servant from the set of replica proxies. -// virtual int remove (TAO_LB_ReplicaProxy *) = 0; - + /// Analyze the loads at each location and force client request + /// redirection, if necessary, or disable the redirection at a given + /// location. /** - * The load on one proxy has changed. * @@ Ossama: see my comments on LoadBalancing_i about changing the * signature of this method. */ -// virtual void load_changed (TAO_LB_ReplicaProxy *proxy, -// CORBA::Environment &ACE_TRY_ENV); + virtual void analyze_loads (TAO_LB_Location_Map &location_map, + CORBA::Environment &ACE_TRY_ENV); + }; diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Minimum_Dispersion.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Minimum_Dispersion.cpp index 6c774880b2c..d825b811afb 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Minimum_Dispersion.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Minimum_Dispersion.cpp @@ -92,10 +92,10 @@ TAO_LB_Minimum_Dispersion_Strategy::replica ( } } -#if 0 void -TAO_LB_Minimum_Dispersion_Strategy::load_changed (TAO_LB_ReplicaProxy *proxy, - CORBA::Environment &ACE_TRY_ENV) +TAO_LB_Minimum_Dispersion_Strategy::analyze_loads ( + TAO_LB_Location_Map &location_map, + CORBA::Environment &ACE_TRY_ENV) { int send_load_advisory = 0; @@ -104,18 +104,21 @@ TAO_LB_Minimum_Dispersion_Strategy::load_changed (TAO_LB_ReplicaProxy *proxy, guard, this->lock_)); - if (this->proxies_.is_empty ()) - return; - TAO_LB_ReplicaProxySetIterator begin = this->proxies_.begin (); - TAO_LB_ReplicaProxySetIterator end = this->proxies_.end (); + TAO_LB_Location_Map::iterator begin = + location_map.begin (); + + TAO_LB_Location_Map::iterator end = + location_map.end (); float s = 0; CORBA::ULong n = 0; - TAO_LB_ReplicaProxySetIterator i = begin; - for (;i != end; ++i) + TAO_LB_Location_Map::iterator i = begin; + for ( ; i != end; ++i) { - s += (*i)->current_load (); + s += (*i)->int_id_.load_list[0].value; // @@ Hard coded to + // get things + // going. n++; } @@ -168,4 +171,3 @@ TAO_LB_Minimum_Dispersion_Strategy::load_changed (TAO_LB_ReplicaProxy *proxy, ACE_CHECK; } } -#endif /* 0 */ diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Minimum_Dispersion.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Minimum_Dispersion.h index 19a1b50ae33..34a25bcbbde 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Minimum_Dispersion.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Minimum_Dispersion.h @@ -54,18 +54,21 @@ public: /// Destructor ~TAO_LB_Minimum_Dispersion_Strategy (void); - // = The TAO_LB_LoadBalancing_Strategy methods + /** + * @name The TAO_LB_LoadBalancing_Strategy methods + */ + //@{ + virtual CORBA::Object_ptr replica (TAO_LB_ObjectGroup_Map_Entry *entry, CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)); -// virtual void load_changed (TAO_LB_ReplicaProxy *, -// CORBA::Environment &ACE_TRY_ENV); + virtual void analyze_loads (TAO_LB_Location_Map &location_map, + CORBA::Environment &ACE_TRY_ENV); -private: + //@} -// /// Set containing the ReplicaProxy servants. -// TAO_LB_ReplicaProxySet proxies_; +private: // /// Lock used to ensure atomic access to state retained by this // /// class. diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.cpp b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.cpp index f641a312088..3e1c589bbfb 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.cpp +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Pull_Handler.cpp @@ -25,6 +25,9 @@ TAO_LB_Pull_Handler::handle_timeout ( TAO_LB_Location_Map::iterator end = this->location_map_.end (); + if (being == end) + return 0; // No work to be done. + // Iterate over all registered load monitors. // // @todo This could be potentially very slow. Improve concurrent @@ -60,5 +63,22 @@ TAO_LB_Pull_Handler::handle_timeout ( } } + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + this->balancing_strategy_->analyze_loads (this->location_map_, + ACE_TRY_ENV); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + // Catch the exception and ignore it. + + if (TAO_debug_level > 0) + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "(%P|%t) Load analysis exception"); + } + ACE_ENDTRY; + return 0; } diff --git a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ReplicaInfo.h b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ReplicaInfo.h index b95d8312a20..7a63f3a5d22 100644 --- a/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ReplicaInfo.h +++ b/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_ReplicaInfo.h @@ -25,8 +25,9 @@ #include "orbsvcs/LoadBalancingC.h" -// Fosrward declarations. +// Forward declarations. struct TAO_LB_Location_Map_Entry; +struct TAO_LB_ObjectGroup_Map_Entry; struct TAO_LB_ReplicaInfo; typedef ACE_Unbounded_Set<TAO_LB_ReplicaInfo *> TAO_LB_ReplicaInfo_Set; @@ -35,6 +36,8 @@ typedef ACE_Unbounded_Set<TAO_LB_ReplicaInfo *> TAO_LB_ReplicaInfo_Set; * @class TAO_LB_ReplicaInfo * * @brief Class that contains all replica-specific information. + * + * */ struct TAO_LB_ReplicaInfo { @@ -50,6 +53,11 @@ struct TAO_LB_ReplicaInfo /// was not created using a GenericFactory. LoadBalancing::GenericFactory::FactoryCreationId_var factory_creation_id; + /// Pointer to the object group map entry corresponding to the + /// object group to which this replica member in this structure + /// belongs. + TAO_LB_ObjectGroup_Map_Entry *object_group_entry; + /// Pointer to the location map entry containing the information /// related to the location the replica corresponding to this /// TAO_LB_ReplicaInfo structure. |