# Distributed Load-Balancing Method for CCA Parallel Component Applications
## 2 Materials and Methods
### Aggregation of the Computing Nodes
\begin{table}
\begin{tabular}{l l} \hline \hline
**Load Balance Interface Definition** & **Function** \\ \hline bool self\_state\_check(\_\)ck(string ctable) & Self-state check \\ bool receive\_task\_info(string sourceIP, string messageID) & Receive task allocation request \\ void update\_low\_load\_table(string LNtable) & Update the local low-load node table \\ void update\_distance\_table(string ctable) & Update the local component instance table \\ int forward\_task\_request(string desIP, string cname, string args, string Ltable) & Send a task allocation request \\ bool accept\_component(string cname, int cnum, string LNtable, string Ltable) & Accept a component instance \\ bool edit\_task\_request(string Ltable, string cname, int cnum) & Edit the task allocation request \\ void call\_CCAFFINE(string rc\_file) & Call CCAFFEINE \\ void reply\_to\_initNode(string desIP, string cname, int cnum) & Reply to the startup node \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Balance interfaces and definitions. Figure 4: Structure of CCA-balance. runs, the resource-management node of the execution platform selects a sub-cluster and copies the.la library files of the business components to each computing node in the sub-cluster. The load-balancing of the component instances belonging to the same application are carried out within this sub-cluster. Dynamically assigning a component instance to a computing node within a sub-cluster does not require the transmission of the code of the component instance over the network. Instead, the name, interface, and parameters of the component are sent to the node. The local computing-resource proxy of the node then calls the CCAFFEINE framework, which links the.la dynamic library, generates the component instance, and executes it. #### 2.3.3 Data Flow Analysis

To achieve a multi-component, multi-data model and lay the groundwork for load-balancing, it is essential to perform a data flow analysis on the business component codes. PCDDB contains a data flow analysis engine that scrutinizes the source codes of a component application. It counts the occurrences of component calls within the codes, marks them, and calculates the input parameters for components, following the direction of data flow. Figure 5 shows an example of the data flow analysis. In Figure 5, components A and B are each called 10 times. All 10 calls to component A are made through the same interface, interface1, with input parameter \"i\" marked as \"in\", indicating that it does not need to be returned externally. Moreover, there is no dependency between the 10 calls to A, and the input parameter values for each call range from 1 to 10. For the 10 calls to component B, the input parameters for each call depend on the execution results of component A, meaning that component B is dependent on component A. The data flow analysis of the component codes reveals the dependency relationships between components, interface information, and the input parameters of components whose dependencies have been resolved. These components form the component instance tasks that are to be assigned. The results of the data flow analysis are recorded in an XML file. Figure 5: Example of data flow analysis. According to the results of this analysis, if a component does not depend on any other unexecuted components and has not been executed yet, we say the component is in a ready state, that is, a state that can be executed immediately. During the execution of an application, it is necessary to dynamically allocate computing resources for components in the ready state. The PCDDB method incorporates a load-balancing task manager responsible for generating component instance tasks and initiating resource allocation, which is deployed on the startup node of each sub-cluster. This manager is activated by two types of events. The first event is triggered when a user initiates the execution of a parallel component application on the sub-cluster; components in a ready state when the application starts require resource allocation and execution.