計算機科學系 Department of Computer Science Report production coordinator: Suan Choi,
[email protected], +852 3411 7079 Report Web Site: http://www.comp.hkbu.edu.hk/tech-report
Design of a Fuzzy PI controller to Guarantee Proportional Delay Differentiation on Web Servers Ka Ho Chan, Xiaowen Chu COMP-06-001 Release Date: October 16, 2006
Department of Computer Science, Hong Kong Baptist University
Abstract PI controller has attracted researchers in industrial control processes because of its simplicity and robust performance in a wide range of operating conditions. It has been used to provide proportional delay differentiation on web servers in pervious work. However, PI controller can not achieve satisfactory results due to (1) the web server’s non-linearity properties (2) the difficulty of building an accurate model for the web server. To address these issues, a nonlinear fuzzy PI controller is proposed in this paper, which has the advantage of fuzzy controller while maintaining the simplicity and robustness of classical PI controller. The control gains of the proposed controller can be selftuned according to the delay ratio error and the error varying rate which are measured online periodically. The proposed fuzzy PI controller can reduce the settling time and is more robust against strong uncertainties. We implement the fuzzy PI controller by modifying the source code of Apache web server. The experimental results demonstrate that our fuzzy PI controller outperforms the classical PI controller in several aspects. Keywords: QoS, Fuzzy PI controller, Web servers
Report Cover Designer: So Kin Ming
Design of a Fuzzy PI Controller to Guarantee Proportional Delay Differentiation on Web Servers Ka Ho Chan, Xiaowen Chu Department of Computer Science Hong Kong Baptist University, Kowloon, Hong Kong {chxw, khchan}@comp.hkbu.edu.hk
Abstract— PI controller has attracted researchers in industrial control processes because of its simplicity and robust performance in a wide range of operating conditions. It has been used to provide proportional delay differentiation on web servers in pervious work. However, PI controller can not achieve satisfactory results due to (1) the web server’s non-linearity properties (2) the difficulty of building an accurate model for the web server. To address these issues, a nonlinear fuzzy PI controller is proposed in this paper, which has the advantage of fuzzy controller while maintaining the simplicity and robustness of classical PI controller. The control gains of the proposed controller can be self-tuned according to the delay ratio error and the error varying rate which are measured online periodically. The proposed fuzzy PI controller can reduce the settling time and is more robust against strong uncertainties. We implement the fuzzy PI controller by modifying the source code of Apache web server. The experimental results demonstrate that our fuzzy PI controller outperforms the classical PI controller in several aspects. Keywords- QoS, Fuzzy PI controller, Web servers
I.
INTRODUCTION
With the wide spread usage of all kinds of web applications, the access rates of popular web sites are growing rapidly, which causes increasing pressure to web servers. On the other hand, web servers experience an extreme variation in access demand: sometimes very lightly loaded, sometimes suffered from enormous connection requests caused by the flash crowds. It is not economically feasible to design web servers for peak load, because even well-equipped web servers may still be overloaded by the increasing Internet user populations. During overload period, not all requests can be served in a timely manner. However, it is possible to provide a better service to premium users. Performanceenhancing mechanisms that can achieve such QoS properties during server overload are therefore of major importance. Previous work has proposed the proportional delay differentiation model for web servers. It aims to maintain pre-specified delay ratios between different classes of client requests. Lu et al. have proposed a classical PI controller to guarantee the delay ratios between different classes [3]. Due to the difficulty of building an accurate model for web servers with non-linear properties, the authors regarded the web server as a second order system and then determined the system parameters by system identification technique. However, PI controller still can not get satisfactory results on some performance metrics such as the settling time, oscillation. On the contrary of PI controller, fuzzy controller is independent of accurate model and could be a good selection for providing proportional delay guarantee [4] [5] [7]. But the main drawback of fuzzy
controller is the big amount of parameters to be tuned. It is especially difficult to make initial approximate adjustment because there is no cookery book to do the job [5]; and the performance usually depends on the quality of the expert knowledge. In this paper, we first design a fuzzy PI controller to provide proportional delay differentiation for web servers. It combines the advantages of the fuzzy controller and the PI controller. Firstly, it is more robust than the PI controller in present of very bursty traffic, showing lower settling time and smaller oscillation while performing as well as PI controller in steady state. Secondly, it is convenient to determine the parameters using the guidelines for PI controller. The simple fuzzy set definition makes it more convenient for the users to set parameters without any risk of yielding a nonzero steady-state error which may occur with a fuzzy controller. The rest of the paper is organized as follows: Section II presents the background and related work. The architecture of the system is described in Section III. Section IV introduces the design of the fuzzy controller. Section V presents the experimental results. Finally, section VI concludes the paper.
II. BACKGROUND Apache [1] is typically structured as a pool of workers that handle HTTP request. Our studies use release 1.3.9 in which a worker is simply a process. Our system can also be applied to the case that a worker is a thread. In Apache 1.3.9, when a request arrives, it enters the TCP Accept Queue and waits for a free worker. A worker handles a single connection before accepting a new request of connection. The number of worker processes is limited by a configuration parameter. If there is an available process, the incoming request can be served immediately. In HTTP/1.0, each request consumes one TCP connection. HTTP/1.1 introduced a new concept called persistent connection [12], which allows multiple requests from the same client to reuse an open TCP connection. Persistent connections make it unnecessary to establish and terminate a new TCP connection for every request. After a request is served, the TCP connection must be kept open for a certain time, to see if another request will follow on the same connection. The persistent connection introduced by HTTP/1.1 gives rise to a peculiar server bottleneck: when all processes are actively processing requests or waiting for another request on a persistent connection, the incoming requests must wait until a process becomes available. Let the connection delay denote the time interval between the arrival of a connection request and the time the connection is accepted. Let the processing delay denote the time interval between the web server starting to process a request and the time the server completing the transmission of the response to the client. Due to the persistent connection of HTTP/1.1, the service time of a single connection could be very long which totally depends on the user behavior. If the web server is heavily loaded, which is the scenario that we consider in this paper, lots of connection requests are queued in the TCP listening queue. From queueing theory, we know that this connection delay is related to the average queue length, the average service time, and the number of simultaneous connections allowed by the system. Generally, the connection delay is much longer than the processing delay in this scenario. We simply use “delay” to represent connection delay in this paper. Providing delay differentiated services to web system has been popular in recent years. Admission control and scheduling strategies are used to provide differentiated services. In [8], a heuristic
2
Fig. 1. The System Architecture admission control method has been proposed to drop the incoming request by a token bucket to provide 90th percentile delay guarantee for the premium class in the context of the SEDA Web server. SEDA decomposes Internet services into multiple stages, each one of which can perform admission control. By monitoring the response time, each stage can enforce a targeted 90th percentile response time. In that method, admission control is done by using an additive-increase multiplicative decrease (AIMD) control algorithm that adapts the rate at which tokens are generated for a token bucket traffic shaper. But this approach cannot guarantee the QoS a class received; and the performance of the algorithm is very sensitive to several control parameters. In [6], an admission control method based on a PI controller is proposed to ensure the predefined delay target. But the controller is based on the system model which has the assumption that the web server can be modeled by an M/G/1/PS queueing model. However, the exponential inter-arrival distribution is not accurate to characterize the web traffic [2]. In addition to the admission control methods, resource scheduling using feedback control theory has been applied to web system, for example, the PI controller is used for differentiated services providing in [3]. In addition, the queuing theory used in [9] has been combined to provide differentiated delay services. But the queuing theory can only work well in a long term scale. Other than providing differentiated services, feedback control has been used to adjust the two parameters of the Apache server, namely KeepAlive and MaxClient, in [10]. The approach shows quick convergence and stability. However, these two parameters do not directly address other important metrics of interest to web servers, such as response time and throughput.
III. ARCHITECTURE Our web server architecture is shown in Fig. 1. It includes three modules: Connection Scheduler, Delay Ratio Monitor, and Fuzzy PI Controller.
3
Fig. 2. The structure of the fuzzy PI controller for two classes •
Connection Scheduler
The Connection Scheduler listens to the well-known port and accepts every incoming connection request. The Scheduler classifies requests into different classes based, for example, on the client’s IP address. The scheduler maintains a FIFO connection queue and a process counter for each class. The process counter is used to enforce the number of processes, denoted by pk, to be allocated to each class. A new request is allocated to a process only if the number of consumed processes for the request’s class is less than the process counter of this class. •
Delay Ratio Monitor
The delay ratio monitor carries out the measurements of the proportional delay ratios experienced by requests of adjacent class ki and class ki+1, denoted by Ck/ Ck-1. •
Fuzzy PI Controller
The proposed fuzzy PI controller guarantees our desired delay ratio of 3, which has been used in [3], for the premium class, i.e. class 0, and basic class, i.e. class 1, by assigning suitable number of processes, say, p0 and p1, to handle requests. For every control loop, the delay ratio error, which is computed by the difference between the measured delay ratio Ck and the desired delay ratio (also called delay ratio set point) for class k and class k-1 (denoted by DRk) multiplied by Ki, and the error rate inputs multiplied by Kp to the controller, where Kp and Ki are the conventional proportional and integral gains respectively. The controller then decides the process ratio and computes the processes allocated to each class. The key problem is the design of an efficient controller that makes the system self-correcting and self-stabilizing. In this paper, we present a fuzzy PI controller that achieves this goal and satisfies the proportional delay guarantees. We next describe the design of the fuzzy PI controller in detail.
IV. DESIGN OF THE PROPOSED FUZZY PI CONTROLLER Feedback control provides a sound way to keep the control variable to the set point. The widely used controller is the classical PI controller due to its simplicity. As earlier mentioned, for the web server, the classical PI controller can not get satisfactory results on several metrics, i.e., settling time and oscillation, due to nonlinearity of the web servers and the absence of the accurate model. To
4
overcome the limited performance of the classical PI controller, the fuzzy PI controller is proposed in this section. Comparing with the classical PI control with fixed gain, all control gains in the proposed fuzzy PI controller are self-tuned and nonlinear functions of the inputs. In this section, we briefly describe the fuzzy PI controller: its mathematic principle and engineering design, and then introduce how it self-tunes to system uncertainty. We first establish the system structure for the fuzzy PI controller of the web server, describe the three main steps in its design: fuzzification, inference, and defuzzification, and give an example how it self-tunes. The basic structure of the proposed fuzzy PI controller for two classes is presented in Fig. 2. In our paper, the premium class and the basic class are considered. The proposed fuzzy PI controller has two inputs. One is the multiplication of Ki and delay ratio error, and the other is the multiplication of Kp and the error rate. First, we should decide the conventional gains for our web server. The classical PI controller output is: m
U ( m) = K p e( m) + K i ∑ e( n )
(1)
n =0
where U (m) = p0(m)/p1(m), V(m) = C1(m)/C0(m) and E(m)= DR -V(m); Then, it is easy to get:
ΔU (m) = K p (e(m) − e(m − 1)) + K i e(m)
(2)
Let ev (m) = e(m) − e( m − 1) , then the fuzzy PI controller output is:
ΔU (m) = f fuzzy ( K i e(m), K p ev ( m))
IV.1
(3)
The computation of Kp and Ki
To design the proportional and integral gains for the proposed controller, the model for web server should be constructed. Till now, no accurate model can be used for the web server, so we get the model by system identification which has been used in [3]. For the space of limitation, we only conclude the results here. The model for our specific system is: V (m) = 0.51V (m −1) − 0.18V (m − 2) + 0.57U (m − 1) + 0.27U (m − 2)
(4)
The PI controller for our system used in [3] is: U(m) = U(m-1) + g(E(m) – rE(m-1))
(5)
Combing (1) and (5), we can compute the proportional and integral gains as following:
Kp = g ⋅r
Ki = g − g ⋅ r
(6)
Based on above model shown in (4), the root locus method can be used to get g and r. For our specific system, g = 0.3579 and r=0.05 are very suitable.
5
IV.2
The proposed fuzzy PI controller
In this section, we describe the three steps of the fuzzy controller. •
Fuzzification
The membership functions for input and output have been defined as shown in Fig.3 and Fig.4. The linguistic variables for two numeric inputs and one output are E, EC and U respectively. Linguistic variables are a natural way by membership function to handle uncertainties created by the stochastics present in computer systems.
Fig.3. the membership functions for E and EC
Fig.4. the membership function for U
In Fig.3, L1 and L2 are defined as the maximum value of Ki e(m) and K p ev (m) . In the normal case, [-8, 8] is large enough to observe delay ratio error and the error varying rate. Therefore, we have: L1 = 8Ki L2 = 8 K p
(7)
Note that e(m) can be arbitrarily large due to busty traffic or the initial state. When this happen, the controller behaves like a proportional controller or integral controller according to the value of ev (m) . In the membership function of output, H is set as 4. Numerous experiments verify that this setting is reasonable and acceptable. •
Inference
The actions of the fuzzy controller are guided by a set of if-then rules. The rules are established for our controller is relatively easy which can be concluded as following: Rule1: IF E is negative and EC is negative THEN U is negative; Rule 2: IF E is negative and EC is positive THEN U is zero; 6
Rule 3: IF E is positive and EC is negative THEN U is zero; Rule 4: IF E is positive and EC is positive THEN U is positive; “Negative” and “positive” are linguistic values. For each rule, The IF part considers a position now the system stays and the THEN part indicates how the process ratio should be changed- “negative” is a decrease, and “positive” is an increase. For example, Rule 1 considers the delay ratio is above the set point and even far away from the set point, The THEN part indicates how the output should be decreased. In conclusion, Rule 1 and Rule 4 consider the situations that the E and EC are of the same sign, and so the output should be set a large value to make the process quick converge. Conversely, Rule 2 and Rule 3 describe situations that E and EC are of the opposite sign, and then the output should be set a small value to produce a lower overshoot and to reduce the settling time. •
Defuzzification
The following commonly used formula is employed to defuzzify the incremental control of fuzzy control law: The membership function for output is U =
∑b ⋅ μ ∑μ i
i
where bi is the output for Rule i and µi is the
i
corresponding membership value for Rule i. µi is computed by the operator ∧ which means computing the minimum value ‘min’, i.e., μ1 = μ m ( E ) ∧ μ n ( EC ) , where μm (M ) is the membership degree of linguistic variable “M” for the linguistic value “m”. In our controller, m can be “positive” or “negative”. For example, μn (E ) is the membership degree of E for “negative”. Finally, we remark that the overhead of this algorithm is small. This is because the algorithm totaled contains tens of multiplications and additions. Another reason is the controller only needs to adjust the process assignment once a sampling period.
VI.3
Self-tuning to uncertainty
Let us look an example to show how the control gains of the fuzzy PI controller self-tunes to adapt to uncertainty. For example, in some sampling period, assuming e and ev falling in such areas: 0 ≤ e ≤ L1 , − L2 ≤ ev ≤ 0 ,
and also satisfying: − L1 / L2 ≤ e / ev ≤ 0 Under above circumstance, the membership degrees of these two inputs (E and EC) for two linguistic values (“negative” and “positive”) are computed as:
μn ( E ) =
L1 − E ; 2 L1
μ p (E) =
L1 + E 2 L1
7
μ n ( EC ) =
L2 + EC ; 2 L2
μ p ( EC ) =
L2 − EC 2 L2
Using ‘max-min’ reasoning, the membership values for the rules’ premise that represents the certainty each rule premise holds for the given input:
μ1 = μn ( E ) ∧ μ n ( EC ) =
L1 − E 2 L1
μ2 = μn ( E ) ∧ μ p ( EC ) =
L1 − E 2 L1
μ3 = μ p ( E ) ∧ μ n ( EC ) =
L2 + EC 2 L2
μ4 = μ P ( E ) ∧ μ p ( EC ) =
L2 − EC 2 L2
where μ i represents the membership value for Rule i. Then the output U is computed as: U=
− H ⋅ L1 ⋅ EC + H ⋅ L2 ⋅ E 2 L2 (2 L1 − E )
(8)
Combining (2) and (8), we get the dynamic gains K i ' and K p ' : Ki ' =
H 2( 2 L1 − E )
KP '=
− H ⋅ L1 2 L2 (2 L1 − E )
It can be seen that the control gains Ki and Kp are self-tuning according the two inputs and nonlinear function of the inputs. This is also the reason why the fuzzy PI controller performance better than the classical PI controller with fixed gains.
V. EXPERIMENT We have modified the source code of Apache 1.3.9 web server which runs on a Linux platform to implement the adaptive architecture and fuzzy PI control algorithm. The sampling period was set to 30 seconds. The controller computes the number of processes assigned to each class. All experiments were conducted on a test-bed composed by a server running Linux-2.6.12 and a set of clients running Linux-2.4.18. The server and the clients were connected by a 1-Gbps Ethernet. The clients generate web traffic using the Surge workload generator [11]. The percentage of base, embedded, and loner objects were 30%, 38%, and 32%, respectively. The server machine has a 2.8GHz Pentium processor and 1GB RAM. We have done two experiments: Experiment 1 has a lower load variance, whilst Experiment 2 suffers higher load variance.
V.1 y
Experiment 1 Server: The total number of processes was configured to 128. It is a constant number in our experiment. The timeout of HTTP/1.1 connection was set to 15 seconds (the default value). The number of processes was initially set to 64 for class 0 (the high priority class), and 64 for class 1 (the low priority group).
8
y
Client: We used several client machines in this experiment. In the first 1000 seconds, one client machine simulated 300 class 0 clients and another client machine simulated 200 class 1 clients. At the 1000th second, a new client machine simulated 200 new class 1 clients and another new client machine simulated 200 new class 0 clients. Such that the number of class 0 clients changed to 500 and the number of class 1 clients changed to 400.
Fig. 5. The delay ratio of the PI controller and the fuzzy controller
Fig.5 shows the behaviors of the classic PI controller and the fuzzy PI controller. The figure shows the delay ratio of both controllers deviate from the set point seriously after load changing at 1000th second. After a shorter period of time, the fuzzy PI controller reacted and re-converged to the set point at around 1700th second. However, it takes a longer time for the PI controller to converge to the set point (at around 2200th second). The PI controller also shows a more violent oscillation. In order to quantify the oscillation, the relative difference between the measured and desired delay from the initial state to the time when the server reached the steady state has been defined as following. n
Et = ∑ Ti ⋅ | Errori |
(9)
i =1
where Ti represents the sampling point i and Errori represents the error between the delay ratio and the set point. Smaller Et means better controller performance. We also define another metric Diff to measure the performance improvement on oscillation over the PI controller. Diff =
Et ( PI ) − Et ( FuzzyPI ) Et ( PI )
(10)
Table 1 shows the Et of the classic PI controller and the fuzzy PI controller. It can be seen that the fuzzy PI controller has much smaller value of Et than the PI controller’s. And the fuzzy PI controller improved the performance by Diff = 27.2%. Table 1. Et of Classic PI controller and Fuzzy PI controller
9
PI controller Fuzzy PI controller Et
V.2
366.1
266.6
Experiment 2
This experiment demonstrated the fuzzy PI controller performed much better than the PI controller under large load disturbance. y
Server: The server is configured as the in experiment 1.
y
Client: In the first 1000 seconds, one client machine simulated 200 class 0 clients and another client machine simulated 300 class 1 clients. At the 1000th second, a new client machine simulated 200 new class 1 clients and another new client machine simulated 200 new class 0 clients. Such that the number of class 0 clients changed to 400 and number of class 1 clients changed to 500.
Fig. 6 The delay ratio of the PI controller and the fuzzy controller
The experimental results are shown in Fig.6. At the 1000th second, the delay ratios of both controllers decreased to a trough value which is almost 1.5. As number of class 1 users increased in a sudden, the delay of class 1 users increased as well. In such circumstance, the delay ratio drops to a very small value. After 200 seconds, both controllers react and the delay ratios rise. The delay ratio of fuzzy PI controller converged at around 1550th seconds. There are some low amplitude oscillations around the set point after 1550th seconds. However, the delay ratio of PI controller converged at 2000th seconds. There are some oscillations around the set point after the convergent time. Table 2 shows the Et for both controllers. It can be seen that the Et of PI controller is also much larger than the fuzzy PI controller due to its large oscillation and long settling time. The fuzzy PI controller improved performance by Diff=34.6%.
Table 2. Et of Classic PI controller and Fuzzy PI controller
10
PI controller Fuzzy PI controller Et
280.8
183.6
VI. CONCLUSION In this paper, we present a fuzzy PI controller which combines the advantages of PI controller and fuzzy controller. Its self-tuning characteristic according to the error and error rate can make it more robust to system uncertainty. The experiment results demonstrate that it performs better than the classical PI controller on settling time and oscillation proposed in earlier works. REFERENCES [1]
Apache Software Foundation. http://www.apache.org.
[2]
V. Paxson and S. Floyd, “Wide Area Traffic: the Failure of Poisson Modeling,” IEEE/ACM Transactions on Networking, 3(3): 226-244, June 1995.
[3]
C. Lu, Y. Lu, T. F. Abdelzaher, A. Stankovic, and S. H. Son, “Feedback Control Architecture and Design Methodology for Service Delay Guarantees in Web Servers,” IEEE Transactions on Parallel and Distributed Systems, vol. 17, no. 9, pp. 1014-1027, 2006.
[4]
B.-G. Hu, G.K.I. Mann, and R.G. Gosine, “A Systematic Study of Fuzzy PID Controllers – Function-based Evaluation Approach,” IEEE Transactions on Fuzzy Systems, Vol.9(5):699-712, 2001.
[5]
P. Pivonka, “Comparative Analysis of Fuzzy PI/PD/PID Controller Based on Classical PID Controller Approach,” In Proceedings of the 2002 IEEE World Congress on Computational Intelligence, USA, 2002, pp. 541-546
[6]
A. Kamra, V. Misra, and E. Nahum, “Yaksha: A Controller for Managing the Performance of 3Tiered Websites,” In Proceedings of the Twelfth IEEE International Workshop on Quality of Service (IWQoS 2004), Montreal, Canada, June, 2004.
[7]
Y. Wei, C. Lin, X.-W. Chu, T. Voigt, and F. Ren, “Fuzzy Control for Guaranteeing Absolute Delays in Web Servers,” International Journal of High Performance Computing and Networking, to appear.
[8]
M. Welsh and D. Culler, “Adaptive Overload Control for Busy Internet Servers,” In Proceedings of USITS, 2003.
[9]
Y. Lu, T. F. Abdelzaher, C. Lu, L. Sha, and X. Liu, “Feedback Control with Queuing-theoretic Prediction for Relative Delay Guarantees in Web Server,” In Proceedings of IEEE Real-Time and Embedded Technology and Applications Symposium, pp. 208-217, 2003.
[10] Y. Diao, X. Lui, S. Froehlich, J. L. Hellerstein, S. Parekh, and L. Sha, “On-line Response Time Optimization of an Apache Web Server,” In Proceedings of International Workshop on Quality of Service, Monterey, CA, June 2003. [11] P. Barford and M. E. Crovella, “Generating Representative Web Workloads for Network and Server Performance Evaluation,” In Proceedings of ACM SIGMETRICS’98, Madison WI, 1998. [12] R. Fielding, J. Gettys, J. Mogul, H. Frystyk, L. Masinter, P. Leach and T. Berners-Lee, “Hypertext Transfer Protocol—HTTP/1.1,” IETF RFC 2616, June 1999.
11