# Distributed Load-Balancing Method for CCA Parallel Component Applications
## 2 Materials and Methods  
### Computing Resource Management Based on an Object-Oriented Mechanism  
Parallel component applications are frequently deployed on heterogeneous cluster platforms. A heterogeneous cluster consists of several computing nodes with varying configurations, all interconnected through a network. To effectively manage the computing resources within the cluster and balance the load, the PCDDB method utilizes a computing resource management approach grounded in an object-oriented mechanism.  
Each node can be conceptualized as an object, employing object-oriented techniques. A node possesses several computing-resource attributes that directly influence its performance, such as the number of CPU cores, CPU clock frequency, memory capacity, and network bandwidth. Additionally, it includes attributes essential for managing these nodes, such as the hostname and IP address. For each attribute, the corresponding setter and getter methods are implemented, leveraging a reflection mechanism. Nodes with different attributes and methods may vary; for instance, a node equipped with a GPU might include an attribute for the number of CUDA cores, along with setter and getter methods to access this attribute. For nodes sharing the same attributes, we have abstracted their common characteristics and defined a general computing node class.  
For instance, a \"Workstation\" class can be defined to represent a group of workstations with identical configurations. When we want to add a new node to a cluster, we simply instantiate an object of the appropriate computing node class. Beyond the set and get methods, additional methods can be defined within a computing node class to facilitate node management. All computing node classes inherit from a common base class, which is designated as an abstract type. This base class encapsulates the common attributes and methods shared by all computing node classes, effectively abstracting the most fundamental characteristics of a computing node. Figure 2 illustrates an example of a defined hierarchy for computing node classes.  
For the overall heterogeneous cluster, we have selected a high-performance server to serve as the resource-management node, where a cluster resource manager is deployed. This cluster resource manager establishes a class library to manage all computing node classes. When a new node is added to the cluster, the cluster resource manager queries the CPU frequency, memory capacity, and other computing resource information of the node. Utilizing this information, it searches for the corresponding class within the class library. If it identifies a class with attributes that match the new node, it employs the Babel compilation tool [14] to generate a component instance (object) of this class, which is then sent to the newly added node. This component instance interacts with other nodes, acting as a proxy for local computing resources. If the cluster resource manager cannot find a class in the class library that matches the attributes of the newly added node, it will generate a new node class based on the attribute values of the new node and subsequently add it to the class library. Our cluster resource manager and all resource proxies are implemented in C++ and have a seamless interface with CCAFFEINE [14]. The CCA parallel component runtime framework is also implemented in C++.