# Application of Neural Networks in Distribution of the Load in Cluster-Based Web Systems
## 5 Design of Executor Model  
As it was previously described, the load balancer distributes HTTP requests to different web servers \(S^{w}:w\in\{1,2,\ldots,W\}\). There is one executor model \(E^{w}\) associated with each server \(S^{w}\). The module \(E^{w}\) estimates the time needed to respond to the \(r_{i}\) request. On the basis of the results of the estimation for all servers, the server with the expected shortest response time is selected. The description and research on the modules \(E^{w}\) is given below. Assuming that each of the requests \(r_{i}\) can be serviced by one of the many servers \(S^{w}\), we found that it essential to choose the right one. Since each \(S^{w}\) has one executor model \(E^{w}\) associated with it, it is possible to specify different operating parameters \(Q^{w}\) for each server. At the input to the executor, the parameters \(k_{i}\) and \(d_{i}\) are given, which characterize the incoming request. The executor \(E^{w}\) input also includes information about the number of currently processed static requests \(f_{i}^{w}\) and the number of processed dynamic requests \(g_{i}^{w}\) on the server \(S^{w}\). The model also receives feedback on the real time of servicing the last request \(tr_{i-1}^{w}\) by the server \(S^{w}\) (the \(i-1\) index is arbitrary here since at the time of the next request, the previous one may not have been processed yet, and therefore its response time may also be unknown). The general diagram of the executor module is presented in Figure 4.  
The primary function of the executor model is to estimate the time \(tp_{i}^{w}\). Since further considerations are made for a single executor model \(E^{w}\), there is no superscript \(w\) in the markings and formulas. The time \(tp_{i}\)is calculated as follows:  
\[tp_{i}=p(f_{i}g_{i},k_{i},d_{i},tr_{i-1}) \tag{2}\]  
where  
Figure 4: The general diagram of the Executor Model \(E^{w}\). \(p\)--function that depends on the current operation parameters \(Q\) at the time of the request \(r_{i}\)  
This module can operate in two modes, learning or prediction. Both modes take into account the current state of the server \(f_{i},g_{i}\), the class of the incoming request \(k_{i}\), and the fact whether it is a dynamic request \(d_{i}\). After servicing request \(r_{i}\) by the server, the executor module \(E\) learning step follows. The information needed in the prediction mode \(f_{i},g_{i},k_{i}\), and \(d_{i}\) is also processed in this step. Additionally, the real response time \(tr_{i-1}\) of the last request on the server is taken into account. This allows the operating parameters \(Q\) to be modified in a way that enables predicted \(tp_{i}\) value to be closer to the real \(tr_{i}\) value. The following subsections describe the various possible approaches to the executor model structure and parameterization. They also include the evaluation of these approaches. Since requests are classified and requests belonging to the same class have a similar response time, a separate structure \(NM^{k}\) (\(k=1,\ldots,K\)), having different operating parameters \(Q^{k}\), was extracted for each class, estimating the time. Each NM module contains an artificial neural network. Figure 5 presents the structure of the executor model. The inputs to the \(NM^{k}\) module are \(f_{i},g_{i}\) and \(d_{i}\), while \(k_{i}\) decides which of the \(NM^{k}\) elements will be used in the estimation of the response time \(tp_{i}\). Load balancing is a relatively complex task, but in this article, it was decomposed into many components (for each server and for each type of request). In each of these parts, there is a single simple neural network that should do one thing--predict the response time depending on several parameters. Only the entire system, composed of many simple elements, is the server load balancing system.