## 3 Efficient Caching Rate-Control for Edge Computing
### Rate-Control Using a Modified PID Controller  
Above all, EDCrammer adopts and improves the PID controller. The proportional (P) term provides a fixed percentage close to the setpoint, which is the desired cache utilization. The integral term (I) closes the gap from the proportional term over time. The derivative (D) term responds rapidly  
Figure 4: Overall flow for the data caching and hitting process. to changes. The well-known advantages of a PID controller are: (1) low resources use; (2) feasibility and ease of implementation without the need for a mathematical model; and (3) ease of tuning gains by simple trial and error. Thus, our PID controller is both lightweight and agile, making it suitable for caching on edge nodes. \[u(t)=K_{p}e(t)+K_{i}\int_{0}^{t}e(\tau)d\tau+K_{d}\frac{de(t)}{dt} \tag{1}\]  
A basic PID controller can be expressed mathematically as given in Equation (1), and it is mainly used in an analog environment. However, caching occurs in a digital environment, thus we modified the mathematical model by applying a stream processing-based computation method, as shown in Equation (2). \[u(n)=K_{p}e(n)+K_{i}\sum_{0}^{n}e(k)+K_{d}\frac{e(n)-e(n-1)}{\Delta iteration} \tag{2}\]  
Figure 5 illustrates the advanced digital PID controller proposed in this paper. As mentioned above, the original PID controller was designed to control continuous analog values, mainly an actuator whose value changes gradually until it reaches a desired point. For example, when controlling the speed of an autonomous vehicle, a PID controller effectively controls the actuator. A digital controller requires more precise control because there is no actuator. Existing PID controllers used in grid resource information system support monitoring, managing, deploying resources and services dynamically [49]. The existing PID controllers less consider _term1_ overshooting issue and min-max range of PID output. Therefore, we improved the existing PID controllers to add overshooting guard and min-max range, and to consider the PID output variation more sensitively for data caching on resource-limited edge nodes, as shown in Equation (3). The variation control value was set by using _r(n)_ (setpoint), \(K_{d}\) gain, and \(\alpha(1/100)\). _r(n)_ is the desired cache utilization. \(K_{d}\) gain is used to stabilize the variation of the PID. By \(\alpha\), the sensitivity of the proposed algorithm is fine-tuned. If the absolute value of the difference between the current output and the previous output, \(|u(n)-u(n-1)|\), of the advanced digital PID controller is smaller than the variation control value, the PID output is not updated because the change is considered insignificant. If it is larger than the variation control value, the change is recognized, and the PID output is updated. After that, the output is regulated from 0 to the maximum cache capacity to reduce the burden of the SDC and control the data transmission rate, as shown in Equation (5). The regulated output or rate-control bit is transmitted to the SDC. The SDC periodically notifies EDCrammer about the current cache utilization. Additionally, _term1_ is the sum of the errors. An unregulated error sum could be out of control. Therefore, _term1_ is controlled by checking the sign of the current error and the previous output against the saturation of the cache capacity. When the cache is saturated, the proposed algorithm blocks the windup of _term1_. Through the signs of the current error and the previous output, it reacts immediately when the trend changes, as shown in Equation (4). In this study, we used \(K_{p}=0.7\), \(K_{i}=0.5\) and \(K_{d}=0.7\) for each gain of P, I, and D, respectively. In addition, the output is regulated from 0 to the maximum cache capacity. It is important to consider the amount of data consumed in the SDC when caching because processing the remaining data consumes additional resources.