# Providing Predictable Quality of Service in a Cloud-Based Web System
## 3 Web Cloud Earliest Deadline First Method and Web Switch
### Scheduling Section  
The Scheduling Section queues and organizes the order of incoming requests in a way that lets the requests to be serviced in a time shorter than the expected time \(t_{max}\). The time should be achievable for a not-overloaded web system, even for time-consuming requests. The scheduling section is composed of three modules--a request-analysis module, a service module, and a queue module. Figure 2: Web Cloud Earliest Deadline First (WCEDF) web switch design. The incoming HTTP request, \(r_{i}\) (where \(i\) is the index of request and \(i~{}=~{}1,\ldots,I\)) is, on one hand, a physical HTTP request containing expressions compatible with HTTP protocol, and on the other hand, it is the set of information. In Figure 2, the request \(r_{i}\) is marked by a double line, representing the physical flow of the request in the switch, and a single line representing carried information. The request analysis module classifies incoming HTTP request \(r_{i}\) to single class \(k_{i}\) (\(k_{i}\in\{1,\ldots,K\}\)), which is a number representing requests having similar service times. Requests can be divided into two groups. The first consists of requests for static objects such as images, html, style css, or javascript files. The second group of requests (called dynamic requests) is connected with the dynamic content of responses produced at the moment of arrival of the request to the WWW server (by executing scripts on the server like PHP, Python, Java, or Net Core). As far as static requests are concerned, the classification is conducted on the basis of the requested files' size. In the case of dynamic requests, they are classified separately for each requested object, for example, taking into account the address of the object. The queue module stores requests and puts them into the queue, \(Q_{i}\). The policy of the queue is EDF (Earliest Deadline First) and the requests are organized in accordance with deadlines \(d_{i-j},\ldots,d_{i}\) calculated in the service model for each request put into the queue. The deadline \(d_{i}\) determines when the service of the request \(r_{i}\) should begin on web servers. The request \(r_{i}\) can leave the queue \(Q_{i}\) if it is first in the queue and the number \(n_{i}\) of the requests being serviced in the web system is not greater than \(n_{max}\). The value \(n_{max}\) is a maximum number of requests serviced at the same time in the web system. If \(n_{i}<n_{max}\) then the request is not placed in the queue and is passed to the switching section and serviced in the web system. Queueing requests at the front of the system has many advantages, but it also has some disadvantages. When we queue requests, we have the opportunity to reorder them in a way that lets the problematic request to be serviced first. Unfortunately, keeping requests in the queue prevents them from being serviced on the web servers. Therefore, it is very important to find the balance between the length of the queue and the number of requests being serviced in the rest of the system. The value \(n_{max}\) determines both queue length and number of serviced requests. It is calculated for the web system as follows  
\[n_{max}~{}=~{}\left\{ \begin{array}{c}n_{min},\,if\,\,\overline{N}<n_{min}\\ w.\overline{N},\,\,otherwise\end{array} \right., \tag{1}\]  
where \(\overline{N}\) is the mean number of requests in the web system (the sum of queued and serviced requests) calculated periodically after servicing determined, large number, or requests. \(n_{min}\) is a minimum value that can be assigned to the \(n_{max}\). In the experiments described in Section 4, it was obtained that \(n_{max}~{}=~{}500\) and the mean value \(\overline{N}\) and \(n_{max}\) were recalculated after servicing each 10,000 requests. The service model calculates the deadline \(d_{i}\) and a term \(d^{\prime}{}_{i}\). As mentioned earlier, the deadline \(d_{i}\) points the time that the request \(r_{i}\) should start to be serviced.