# Machine Learning Failure-Aware Scheme for Profit Maximization in the Cloud Market
## 4 Computing Resources Trading Based on a Fault Tolerance Scheme  
Our scheme allows a client's request to be migrated to a new CR if execution is not possible on the present machine. The CP should guarantee the QoS for clients. **Definition 1**. : _For any request, the CP assigns the requested number of CRs to serve the request from the pool of available CRs. The CP receives the reward for serving the request if the request is successfully completed before the deadline._  
The CP's primary objective is to maximize profit by utilizing CRs as much as possible while minimizing the chance of deadline violation. However, if the demand for the service is high, the risk of CR failure increases dramatically, which may result in contract violation and a reduction in client satisfaction. Furthermore, frequent CR failures prohibit the CP from meeting clients' cloud expectations, which inevitably harms the CP's reputation, resulting in economic loss in the long run. In this regard, the CP's primary concern is to ensure that all requests are served on time. Obviously, the main concern of the CP is maximizing its profit as follows:  
\[P=\sum_{t=0}^{T}\lambda\left(p_{i}^{t}-b_{i}^{t}\right) \tag{8}\]  
where \(T\) is the simulation time, and \(\lambda\) is the requests arrival rate. We assume that the arrival rate of clients' requests follows a Poisson distribution with arrival rate \(\lambda\). The service rate for an incoming request is assumed to be exponentially distributed with service rate \(\mu\). These assumptions reflect some of the reality of trading applications. To ensure that clients receive a high quality service, a CP must keep a certain number of CRs on hand in case of CR failure. The CP should consider the failure probability for each machine when keeping certain number of CRs. As a result, and because service demand changes over time, the CP requires a policy to protect clients from machine failure. In our work, a state-dependent policy based on Markov decision processing (MDP) is proposed to model CRs trading inthe cloud market. We integrate the CP's penalty for CR failure in the MDP model. An MDP algorithm is used to extract the optimal management policy that maximizes the CP's profit for given cloud market state \(H_{\text{f}}\). The optimal trading policy will be extracted to select the set of possible service requests that maximize the net profit for the CP. The net profit \(G\) is computed as follows:  
\[G=\max_{i\in A}\lambda\left(p_{i}^{t}-b_{i}^{t}\right) \tag{9}\]  
All requests that do not generate extra profit are rejected by the CP. Generally, the sensitivity of clients' payments to the number of failed CRs can be approximated by the cost of penalty for CR failure:  
\[\frac{\partial P}{\partial F}=S(F) \tag{10}\]  
where \(F\) is the number of failed CRs. \(S(F)\) is a measure of the change in client willingness to pay in the cloud market based on the number of failed CRs. In order to maximize profit, the CP must respond to fluctuations in service demand by adjusting the price of services and the number of CRs dealing with machine failure. The sensitivity of the CP's revenue to the number of failed CRs can be represented as follows:  
\[\frac{\partial R}{\partial F}=\frac{\partial P}{\partial F}-\frac{\partial b} {\partial F} \tag{11}\]  
The cost of machine failure is a linear function of \(F\) and it is computed as follows:  
\[b=aF \tag{12}\]  
Substituting (9) in (10), the CP's net revenue is maximized when number of failed machines equals the root of:  
\[F_{t+1}=F_{t}-\frac{S(F_{t})-a}{\frac{\partial(S(F_{t})-a)}{\partial F}} \tag{13}\]  
[PERSON]'s method of successive linear approximations is used [26; 27] to find the root of Equation (12).