# Distributed Load-Balancing Method for CCA Parallel Component Applications
## 2 Materials and Methods
### Aggregation of the Computing Nodes
The startup node then reassigns them. 6. The received replies tell the startup node the allocation of the component instances on the computing nodes, and the results of the tasks are collected by the startup node to complete the application. ```

**Algorithm 2**Load balancing algorithm

Figure 6 illustrates the execution process of the proposed load-balancing algorithm using an example. The startup node has five instances of component D and four instances of component C that must be allocated. It packages the names of these components, interfaces, input parameters of each instance, and its own low-load node table as a task allocation request and sends this request to the first node in its low-load node table, node 6. After receiving this request, node 6 first updates its local low-load node table, adds nodes 3, 4, and 9, and deletes node 12. According to its own load status (the number of existing component instances is 2 < LT), it assigns itself four instances of component D (MT\(-\)2 = 4) to generate and execute locally. It then deletes itself from the low-load node table in the task allocation request and local table. Next, node 6 modifies the task allocation request, deletes the component tasks it has just assigned itself, and then forwards the task allocation request to the first node in its local low-load node table, that is, node 8. Node 8 determines that it is not a low-load node. After updating the local low-load node table, it immediately sends the task allocation request to the first node in its low-load node table, that is, node 9. Node 9 updates its local low-load node table, deletes nodes 6 and 8, and adds nodes 4 and 2. According to its number of existing component instances (2 < LT), it assigns itself one component D and three instances of component C. It then deletes itself from the task allocation request and local low-load node table, deletes the component instance tasks it has just assigned itself from the task allocation request, and forwards the task allocation request to node 3. Node 3 updates its local low-load node table, deletes nodes 8, 6, and 9, and adds node 11. According to the number of its existing instances (1 < LT), it assigns itself one instance of component C from the task allocation request. Node 3 deletes itself from the local low-load node table. At this point, all the component instances in the task allocation requests sent from the startup node have been assigned. In Figure 6, the white arrow indicates the delivery of the task allocation request. The gray arrows indicate replies to the startup node. In the above algorithm, each node checks its own status, updates the local low-load node table, receives and forwards task allocation requests, accepts component instances, calls CCAFFEINE, modifies the task allocation requests, and replies to the startup node. These operations are defined in the load balance interface in Table 1 and are implemented by the local computing resource proxy of each node. To reduce the communication overhead, all component instances of an application are allocated in the same sub-cluster. If a node is a member of multiple sub-clusters simultaneously, it contains multiple local low-loadnode tables, and each low-load node table is bound with a sub-cluster ID. The value of the sub-cluster ID is passed along with the task allocation request. Each node uses the corresponding local low-load node table according to this ID. Regardless of which application the component instances belong to, they always increase the load on the node to which they are assigned. Therefore, the component instance table counts the number of all component instances as existing instances on the local node, regardless of the application to which these component instances belong. For simplicity, the nodes in Figure 6 are assumed to be single-core nodes. During the operation of the load-balancing algorithm, if a node has multiple cores, the corresponding LT and MT values on the node are n times those of the single-core node (n is the number of CPU cores of the node).