# Distributed Load-Balancing Method for CCA Parallel Component Applications
## 2 Materials and Methods
### Aggregation of the Computing Nodes
When a component is ready, the XML file from the data flow analysis results can be queried to determine the number of instances to generate, along with their interfaces and input parameters. The load-balancing task manager then packages this information into a task allocation request, distributing it among the low-load nodes within the sub-cluster to allocate computational resources and execute them in a distributed manner. The second event is triggered when a parallel component within the sub-cluster completes its execution, with results returned to the sub-cluster's startup node by the local computing resource proxy on the executing node. The load-balancing task manager updates the data flow analysis XML file, setting the status of all components dependent on the completed component to ready. It then packages their information into task allocation requests and initiates the load-balancing algorithm to distribute computational resources and execute the instances of ready components. #### 2.3.4 Load-Balancing Algorithm

We define two thresholds: LT and MT. Each computing node maintains a local component instance table that records the number of component instances it holds. If this number is less than LT, there are too few tasks on this node and it should take on new tasks. MT is the threshold for a moderate load. When assigning new tasks to nodes with too few tasks, we should ensure that the total number of tasks on this node does not exceed MT. The initial values of LT and MT are set for single-core nodes. If a node is a multicore node (n CPU cores), the corresponding LT and MT values on that node are n times those of a single-core node. Normally, single-core nodes should have an LT value between 2 and 4 and an MT value between 6 and 10. If the computational load for most parallel component instances is low, the LT value can be increased as appropriate. When there is an abundance of computational nodes and resources, the MT value can be decreased accordingly. On the contrary, if computational resources are limited, the MT value should be increased as necessary. The experimental section of this paper provides specific examples to illustrate these points. Each node in a sub-cluster must also maintain a local low-load node table to record the information of nodes with too few tasks in the sub-cluster. The overall process of the load-balancing algorithm is Algorithm 2. In order to enhance the efficiency of information exchange, the startup node and low-load nodes are required to interact under two specific circumstances. First, prior to the execution of a deployed application, the startup node must gather information from all low-load nodes within the local sub-cluster. Second, once a low-load node accepts new component instance tasks that are distributed through the system, it is necessary for that node to update its status to \"not a low-load node\" and subsequently notify the startup node of this change. ```
1. The startup node collects the local low-load node information of other nodes. 2. The startup node packages the component names, interfaces, and input parameters of N component instances as well as its own low-load node table as a task allocation request and sends it to the first node in its own low-load node table. 3. When a node receives a task allocation request, the following occurs: 1. If the local table indicates that local node is not a low load node, it deletes itself from the table in the task allocation request and then forwards the task allocation request. 3. If the local table specifies that this node is a low-load node and the number of component instances in the local component instance table is x, it selects MT-x component instances in the task allocation request as its newly assigned tasks and executes them. 4. After receiving a reply from a node, the startup node deletes the node from its low-load node table. 5. If there are unallocated tasks in the task allocation request held by a node but the local low-load node table is empty, it sends the task allocation request to the startup node.