# Patent

## Title
Managing system power based on utilization statistics

## Abstract

The present invention, in various embodiments, provides techniques for managing system power. In one embodiment, system compute loads and/or system resources invoked by services running on the system consume power. To better manage power consumption, the spare capacity of a system resource is periodically measured, and if this spare capacity is outside a predefined range, then the resource operation is adjusted, e.g., the CPU speed is increased or decreased, so that the spare capacity is within the range. Further, the spare capacity is kept as close to zero as practical, and this spare capacity is determined based on the statistical distribution of a number of utilization values of the resources, which is also taken periodically. The spare capacity is also calculated based on considerations of the probability that the system resources are saturated. In one embodiment, to maintain the services required by a Service Level Agreement (SLA), a correlation between an SLA parameter and a resource utilization is determined. In addition to other factors and the correlation of the parameters, the spare capacity of the resource utilization is adjusted based on the spare capacity of the SLA parameter. Various embodiments include optimizing system performance before calculating system spare capacity, saving power for system groups or clusters, saving power for special conditions such as brown-out, high temperature, etc.

## Background
FIELD OF THE INVENTION
The present invention relates generally to system power and, more specifically, to managing such power.
BACKGROUND OF THE INVENTION
Computer systems including network servers that use electric grids generally operate at full power as long as the power is turned on regardless of the compute load, which is the amount of computation needed to be performed in order to deliver computational services to end users. Compute loads include, for example, central processing unit (CPU) cycles, disk access, memory access, input-output (I/O) access, etc. Laptop computers (laptops) and battery-powered systems entertain various modes of operation such as “sleep,” “standby,” “hibernate,” etc., which reduces power when the system is inactive. However, these power-saving modes are usually based on whether the system is or is not in use, e.g., active or inactive, but not on system performance or system loads. Further, these modes switch the system to full power operation if there is any user activity even though the activity does not require full power. Because servers are seldom completely inactive, they run at full power most of the time without greatly benefiting from the power-save modes that work acceptably for laptops and battery-powered systems. Based on the foregoing, it is desirable that mechanisms be provided to solve the above deficiencies and related problems.
SUMMARY OF THE INVENTION
The present invention, in various embodiments, provides techniques for managing system power. In one embodiment, system compute loads and/or system resources invoked by services running on the system consume power. To better manage power consumption, the spare capacity of a system resource is periodically measured, and if this spare capacity is outside a predefined range, then the resource operation is adjusted, e.g., the CPU speed is increased or decreased, so that the spare capacity is within the range. Further, the spare capacity is kept as close to zero as practical, and this spare capacity is determined based on the statistical distribution of a number of utilization values of the resources, which is also taken periodically. The spare capacity is also calculated based on considerations of the probability that the system resources are saturated.
In one embodiment, to maintain the services required by a Service Level Agreement (SLA), a correlation between an SLA parameter and a resource utilization is determined. In addition to other factors and the correlation of the parameters, the spare capacity of the resource utilization is adjusted based on the spare capacity of the SLA parameter.
Various embodiments include optimizing system performance before calculating system spare capacity, saving power for system groups or clusters, saving power for special conditions such as brown-out, high temperature, etc.



BRIEF DESCRIPTION OF THE DRAWINGS
The present invention is illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings in which like reference numerals refer to similar elements and in which:
FIG. 1 shows a network upon which embodiments of the invention may be implemented;
FIG. 2 shows an exemplary computer upon which embodiments of the invention may be implemented;
FIG. 3A shows a table for finding a probability given a parameter m;
FIG. 3B shows a table for finding a parameter m given a probability P;
FIG. 4 shows a trend line for two variables x and y;
FIG. 5A is a flowchart illustrating the steps in managing system power, in accordance with one embodiment;
FIG. 5B is a flowchart illustrating the steps in managing system power related to an SLA parameter, in accordance with one embodiment;
FIG. 6 shows a power manager in accordance with one embodiment; and
FIG. 7 is a flowchart illustrating an execution of the power management in accordance with one embodiment.



DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT
In the following description, for the purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the present invention. However, it will be apparent to one skilled in the art that the invention may be practiced without these specific details. In other instances, well-known structures and devices are shown in block diagram form in order to avoid obscuring the invention.
Network Overview
FIG. 1 shows a network 100 upon which embodiments of the invention may be implemented. Network 100 includes a server 110, a plurality of clients 120-1, 120-2, . . . , 120-N, and a communication link 150. In one embodiment, business institutions use network 100 to provide computer services to their customers in which a server 110 provides the services via client systems 120 to the customers. Usually, these institutions and their customers, based on a Service Level Agreement (SLA), set the criteria for the services to be provided, such as, within some time units, server 110 is to service a submitted request, to authenticate a number of users, to provide a certain number of web pages, etc. Network 100 is used in this document as an example, variations are within the scope of the invention. For example, server 110 can stand by itself, and thus is not on communication link 150; a plurality of servers 110 may operate in a cluster or in a load-balancing manner; network 100 can be of various network arrangements; etc.
Server 110 is any kind of computer and runs various services including, for example, web, database, mail, security, communications, accounting, load balancing, file storage services, etc. This list of services is used for illustration purposes; other services, programs, loads, and their equivalences run by server 110 are within the scope of the invention. To request services, a user or a program application sends a request from a client 120 or a server (not shown) through communication link 150 to server 110.
Communication link 150 is a mechanism for server 110 to communicate with clients 120. Communication link 150 may be a single network or a combination of networks that utilizes one or a combination of communication protocols such as the Transmission Control Protocol/Internet Protocol (TCP/IP), the Public Switched Telephone Network (PSTN), the Digital Subscriber Lines (DSL), the cable network, the satellite-compliant, the wireless-compliant, etc. Examples of communication link 150 include network media, interconnection fabrics, rings, crossbars, etc. Each client 120 may use different communication links to communicate with servers 110. In one embodiment, communication link 150 is the Internet.
Computer System Overview
FIG. 2 is a block diagram showing a computer system 200 upon which embodiments of the invention may be implemented. For example, computer system 200 may be implemented as a server 110, a client 120, etc. In one embodiment, computer system 200 includes a central processing unit (CPU) 204, random access memories (RAMs) 208, read-only memories (ROMs) 212, a storage device 216, and a communication interface 220, all of which are connected to a bus 224.
CPU 204 controls logic, processes information, and coordinates activities within computer system 200. Normally, CPU 204 executes instructions stored in RAMs 208 and ROMs 212, by, for example, coordinating the movement of data from input device 228 to display device 232. CPU 204 may include one or a plurality of processors.
RAMs 208 are usually referred to as main memory or memory system, and temporarily store information and instructions to be executed by CPU 204. RAMs 208 may be in the form of single in-line memory modules (SIMMs) or dual in-line memory module (DIMMs). Information in RAMs 208 may be obtained from input device 228 or generated by CPU 204 as part of the algorithmic processes required by the instructions that are executed by CPU 204.
ROMs 212 store information and instructions that, once written in a ROM chip, are read-only and are not modified or removed. In one embodiment, ROMs 212 store commands for configurations and initial operations of computer system 200.
Storage device 216, such as floppy disks, disk drives, or tape drives, durably stores information for use by computer system 200.
Communication interface 220 enables computer system 200 to interface with other computers or devices. Communication interface 220 may be, for example, a modem, an integrated services digital network (ISDN) card, a local area network (LAN) port, etc. Those skilled in the art will recognize that modems or ISDN cards provide data communications via telephone lines while a LAN port provides data communications via a LAN. Communication interface 220 may also allow wireless communications.
Bus 224 can be any communication mechanism for communicating information for use by computer system 200. In the example of FIG. 2, bus 224 is a media for transferring data between CPU 204, RAMs 208, ROMs 212, storage device 216, communication interface 220, etc.
Computer system 200 is typically coupled to an input device 228, a display device 232, and a cursor control 236. Input device 228, such as a keyboard including alphanumeric and other keys, communicates information and commands to CPU 204. Display device 232, such as a cathode ray tube (CRT), displays information to users of computer system 200. Cursor control 236, such as a mouse, a trackball, or cursor direction keys, communicates direction information and commands to CPU 204 and controls cursor movement on display device 232.
Computer system 200 may communicate with other computers or devices through one or more networks. For example, computer system 200, using communication interface 220, communicates through a network 240 to another computer 244 connected to a printer 248, or through the world wide web 252 to a server 256. The world wide web 252 is commonly referred to as the “Internet.” Alternatively, computer system 200 may access the Internet 252 via network 240.
Computer system 200 may be used to implement the techniques disclosed herein. In various embodiments, CPU 204 performs the steps of the techniques by executing instructions brought to RAMs 208. In alternative embodiments, hard-wired circuitry may be used in place of or in combination with software instructions to implement the described techniques. Consequently, embodiments of the invention are not limited to any one or a combination of firmware, software, hardware, or circuitry.
Instructions executed by CPU 204 may be stored in and/or carried through one or more computer-readable media, which refer to any medium from which a computer reads information. Computer-readable media may be, for example, a floppy disk, a hard disk, a zip-drive cartridge, a magnetic tape, or any other magnetic medium, a CD-ROM, a CD-RAM, a DVD-ROM, a DVD-RAM or any other optical medium, paper-tape, punch-cards, or any other physical medium having patterns of holes, a RAM, a ROM, an EPROM, or any other memory chip or cartridge. Computer-readable media may also be coaxial cables, copper wire, fiber optics, etc. As an example, the instructions to be executed by CPU 204 are in the form of one or more firmware or software programs and are initially stored in a CD-ROM being interfaced with computer system 200 via bus 224. Computer system 200 loads these instructions in RAMs 208, executes some instructions, and sends some instructions via communication interface 220, a modem, a telephone line to a network, e.g. network 240, the Internet 252, etc. A remote computer, receiving data through a network cable, executes the received instructions and sends the data to computer system 200 be stored in storage device 216.
In one embodiment, server 110, implemented as a computer 200, includes a power manager 280 responsible for managing system power of server 110. Manager 280 is implemented as a software package running on server 110. However, manager 280 can run on any other computer conveniently connected to network 100. For illustration purposes, power manager 280 is shown in memory 208 where is it executed.
Resources Consuming Power
Various components in server 110, including, for example, CPUs 204, memory 208, storage device 216, cards for connecting accessories, peripheral devices such as printers and external disks, etc., usually consume significant power. However, each of these components provides interfaces through which the power can be controlled. Depending on the component, the interface, and the manufacturers, etc., an interface can be hardware, firmware, software, hardware working in conjunction with firmware drivers and/or software, etc. Those skilled in the art will recognize that firmware can be invoked by another firmware or software program. In one embodiment, manager 280, based on instructions and specifications of the interface, controls the components and thus their power consumption.
The total power consumed by CPU 204 depends on a number of parameters such as the clock frequency at which a processor is running, the duty cycle, the number of processors active in the system, etc. Duty cycle is the time for which a processor runs at normal speed divided by the total time. Currently, under normal working conditions, to deliver the maximum computational power, CPU 204 in server 110 usually runs at its maximum clock rate. However, in accordance with the techniques of the invention, when the maximum computational power is not required, manager 280 reduces and/or adjusts one or a plurality of the above parameters to reduce the power consumed by CPU 204 and hence by server 110. For example, in one embodiment, a CPU 204 implemented as a Pentium 4 manufactured by Intel Corporation of Santa Clara, Calif., includes a Thermal Control Circuit (TCC) interface. To control the speed of CPU 204 and thus its power consumption, manager 280, through the TCC interface, follows the CPU specifications and instructions to alter the duty cycle of any processor in CPU 204. Manager 280, when appropriate, also sets this duty cycle to zero, which effectively halts CPU 204 even though it is still powered on. In another embodiment, manager 280, through an application using the ACPI interface, turns off CPU 204 implemented by the Intel's processor chips and board designs. In another embodiment, manager 280 via a CPU board interface reduces the clock speed driving CPU 204.
In one embodiment, RAMs 208 operate in a slow RAM refresh and a hibernate mode in which the data is swapped to disk. To reduce power consumption, manager 280 puts RAMs 208 in either one of those two modes because either mode requires less power than the normal operating mode. Disk drives being implemented as storage device 216 also include interfaces through which manager 280 spins down the disk drives for them to operate in a low power mode. In this mode, the disk platters stop rotating.
In one embodiment, manager 280 uses the Advanced Configuration and Power Interface (ACPI) standard to reduce the power consumption of server 110. In the S0 state, server 110 operates normally at its full power. In the S1 state, manager 280 stops CPU 204 and refreshes RAMs 208 so that server 110 runs in a low power mode. In the S2 state, manager 280 puts CPU 204 in a “no power” mode, refreshes RAMs 208, and server 110 is in a lower power mode than the S1 state. In the S3 mode, manager 280 puts CPU 204 in the “no power” state, RAMs 208 in a slow refresh state, and the power supply of server 110 in a reduced power mode. In the S4 or hibernate state, manager 280 shuts off the hardware completely and saves the system memory to disk. In the S5 state, manager 280 shuts off the hardware completely, shuts down the operating system running server 110, and server 110 requires a reboot to return to the normal operating state.
Power Management Based on System Component Loads and Independent of Program Applications
To determine system performance, in one embodiment, manager 280, independent of program applications running on server 110, measures the system load by the degree of utilization of system components, such as CPU, memory, disk drives, bus, etc. Further, CPU utilization is defined as % (100*(total time−idle time)/total time); disk and memory I/O utilization is defined as % (100*(max rate−actual rate)/max rate), and bus utilization is defined as % ((100*current data rate of the bus)/max data rate).
For illustration purposes, CPU performance is used as an example. However, the illustrative concept can be used for other components of server 110 and for performance parameters discussed below. To obtain the utilization values, manager 280, in one embodiment, uses the operating-system-provided application programming interfaces such as the Win32 API for Microsoft Windows operating system. Manager 280 then uses the obtained utilization values to calculate the mean and standard deviation of CPU utilization as:




  
    
      
        
          x
          _
        
        =
        
          
            1
            n
          
          ⁢
          
            
              ∑
              
                i
                =
                1
              
              
                i
                =
                n
              
            
            ⁢
            
              x
              i
            
          
        
      
    
    
      
        (
        1
        )
      
    
  
  
    
      
        σ
        =
        
          
            
              1
              
                (
                
                  n
                  -
                  1
                
                )
              
            
            ⁢
            
              
                ∑
                
                  i
                  =
                  1
                
                
                  i
                  =
                  n
                
              
              ⁢
              
                
                  (
                  
                    
                      x
                      i
                    
                    -
                    
                      x
                      _
                    
                  
                  )
                
                2
              
            
          
        
      
    
    
      
        (
        2
        )
      
    
  




wherein

    
    
        xi=ith value of the measured CPU utilization
         x=mean CPU utilization over a set of n measurements
        σ=standard deviation

Manager 280 also calculates the spare capacity as:

s=(100−( x+m*σ))  (3)

wherein m is a tunable parameter which represents a safety margin required in terms of the number of standard deviations. Parameter m is chosen based on the probability or percentage of time acceptable to have the CPU saturated, e.g., when it reaches a predefined value of utilization. Beyond this point, the CPU or system performance is considered degraded. For illustration purposes, the CPU is considered saturated when it reaches 100% utilization. However, other values close to 100% such as, 90%, 95%, etc., are within the scope of the invention.

    
    


The relationship between parameter m and the probability of having the CPU saturated is given by the equation:




  
    
      
        
          P
          ⁡
          
            (
            m
            )
          
        
        =
        
          1
          -
          
            
              1
              
                σ
                ⁢
                
                  
                    2
                    ⁢
                    
                      
                    
                    ⁢
                    π
                  
                
              
            
            ⁢
            
              
                ∫
                
                  -
                  ∞
                
                z
              
              ⁢
              
                
                  e
                  
                    -
                    
                      
                        
                          (
                          
                            x
                            -
                            
                              x
                              _
                            
                          
                          )
                        
                        2
                      
                      
                        2
                        ⁢
                        
                          
                        
                        ⁢
                        
                          σ
                          2
                        
                      
                    
                  
                
                ⁢
                
                  d
                  x
                
              
            
          
        
      
    
    
      
        (
        4
        )
      
    
  




Alternatively, this relationship is shown in table 300A and table 300B included in FIG. 3A and FIG. 3B, respectively.

In one embodiment, manager 280 changes operation of server 110, e.g., changes the clock speed or duty cycle required to obtain the desired change in CPU utilization as:

Δc=−s+H  (5)

where H is a value desirable for the spare capacity to reach. For example, if the current spare capacity is at 10%, and it is desirable for the spare capacity to be at 0%, then manager 280 causes the clock speed to be reduced by 10%, e.g., Δc=−10%+0%=−10%. However, if the spare capacity is to be at 5%, then Δc=−10%+5%=−5%. If the spare capacity is to be at 10%, then Δc=−10%+10%=0%, etc. Alternatively, the spare capacity may be acceptable if it is within a range, e.g., from 0 to value H. For illustration purposes, the spare capacity is to be at 0%.

In general, after the clock speed is adjusted according to equation (5), the parameter m translates to a probability that the CPU will be saturated during its performance. For example, if x=40%, m=2 and σ=10, then, from equation (3), s=40%, and, from equation (5), Δc=−40%. In this example, as m=2, equation (4) or table 300A provides that P(2)=2.275. That is, the probability for CPU to be saturated is 2.275%. Further, since Δc=−40%, the clock speed or duty cycle of the CPU may be reduced by 40% while still achieving the objective of not saturating the CPU for more than 2.275% of the time.
As another example, if m=3, then using the above equations and table 300, P(3)=0.135% and Δc=−30%. Alternatively speaking, there is a 0.135% probability that the CPU will be saturated after the clock speed has been reduced by 30%. If m=0, then P(0)=0.5 and Δc=−60%, or there is a 50% probability that the CPU will be saturated after the clock speed has been reduced by 60%. Thus, a higher value of parameter m implies a greater margin of safety but also reduces the opportunity for reducing the CPU speed and hence the power consumption.
Conversely, if the system load increases after the CPU speed has been reduced as illustrated above, then the CPU speed is increased as determined by equation (5). For example, if m=2, x=90, and σ=10, then, from equation (3), the spare capacity s=−10. Hence, by equation (5), Δc=10. The clock speed is thus increased by 10% to restore the desired power-performance tradeoff at the desired safety margin. Similarly, if m=3, x=90, and σ=10, then s=−20, and Δc=20. The clock speed is accordingly increased by 20% to achieve the desired tradeoff.
In one embodiment, power manager 280 periodically measures the utilization values for a system resource over a period of time, and, from those values, manager 280 approximates or determines the statistical distribution with its mean and variance. For example, for every 10 minutes, manager 280 obtains 60 values of utilization xi each at every 10 seconds, and, based on those 60 values, calculates the mean, standard deviation, spare capacity, etc. In one embodiment, the statistical distribution is acquired using the normal or Gaussian distribution. The period for acquiring the utilization values, normally referred to as the sampling period, and the number of samples xi vary depending on various factors including whether the system utilization is stable or fluctuates, which in turn may depend on the time of the day, the day of the week, etc. For example, during daytime the system loads may fluctuate more often because different working customers request different services. Consequently, the sampling period during this time is shorter than that at nighttime or weekends where system utilization is more stable. Similarly, the number of samples is higher during weekdays than during nighttime and weekends.
Generally, the value of parameter m is selected based on the probability distribution that describes the measured data and the required safety margin, which is the acceptable probability for a system resource, e.g., the CPU, to reach saturation. In one embodiment, this probability and/or parameter m is agreed in a Service Level Agreement. If the service application is critical such that system saturation must be avoided as much as possible, then parameter m is selected as high as, e.g., 5. However, if the application is not that critical, then m can be selected as 0, and, as explained above, with m equals to 0, there is a 50% chance that the CPU reaches saturation after the CPU clock rate has been adjusted as prescribed by equation (5).
In one embodiment, having the acceptable value m for the safety margin for each resource, manager 280 brings the spare capacity s corresponding to that resource to a predefined range, which is as close to zero as practical. This optimizes system power for system resources. Depending on the resources, different variables are adjusted to adjust the spare capacity. For example, in a single processor situation, the clock speed corresponding to the processor utilization is adjusted as illustrated above. In case of multiple processors, turning on and off one or more processors is applicable. For example, if 4 processors are running, and, if the spare capacity is at 50% or higher, then 2 processors may be turned off to lower the spare capacity. If the resource is a disc drive, then the spinning speed is adjusted, etc.
FIG. 3A includes table 300A showing the first relationship between parameter m and the probability P(m) that CPU utilization will reach 100%. In this table 300A, the probability P(m) can be obtained having a value m. For example, for a value of m=−2.99, row −3.0 and column 0.01 are selected in which m=−3.0+0.01=−2.99 and P=99,861. Alternatively speaking, P(−2.99)=99.861. In this example, for a value of m=−2.99, there is a probability of 99.861% that CPU utilization will reach 100%. Similarly, if m=1.01, row 1 and column 0.1 are selected in which m=1+0.1=1.01 and P=15.625; or P(1.01)=15.625. As such, for a value of m=1.01, there is a probability of 15.625% that CPU utilization will reach 100%.
FIG. 3B includes table 300B showing the second relationship between parameter m and the probability P(m) that CPU utilization will reach 100%. In this table 300B, a value of parameter m can be obtained having a probability P. For example, for a probability of 49%, row 48 and column 1 are selected in which P=48+1=49 and m=0.0251. In this example, if CPU utilization at 100% is acceptable for 49% of the time, then m=0.025 is selected for use in equation (3). Similarly, for a probability of 2.8%, then row 2 and column 0.8 are selected in which P=2+0.8=2.8, and m=1.911. As such, if CPU utilization at 100% is acceptable for 2.8% of the time, then m=1.911 is selected for use in equation (3). Those skilled in the art will recognize that table 300A and 300B are different expressions of the above equation (4).
Power Management Based on Application Performance or Service Level Agreements
Besides system resource utilization, manager 280 measures system performance based on applications running on server 110 and/or performance parameters defined by a Service Level Agreement (SLA). These parameters include, for example, the response time, the number of user authentications or the number of web pages provided per a time unit, etc. The response time may be defined in various ways such as the period of time from the time a user requests a service to the time the user receives the response, the time it takes an application to service a request, etc. Manager 280 accesses performance parameters via an application interface (API). In one embodiment, manager 280 measures the parameters by calling an appropriate API and compares them to what is required pursuant to the Service Level Agreements, which, in one embodiment, represents a threshold. If the performance delivered by server 110 is better than the threshold, then manager 280 reduces the power consumption by one or a combination of the mechanisms described above. That is, manager 280 reduces the clock speed, turns off some processors, spins down the disc drives, etc. Similarly, when server 110 cannot perform pursuant to the SLA, manager 280 increases system power so that server 110 can increase its performance and thus meet the SLA requirements.
Usually, one or a combination of resource utilization parameters affects an SLA parameter. For example, one or a combination of the CPU utilization, the disk access time, etc., affects the response time in retrieving a web page, the number of user authentications per minute, etc. In one embodiment, to meet the SLA requirements, manager 280 considers the correlation between pairs of parameters. For illustration purposes, a pair of variables x and y corresponding respectively to the mean of the CPU utilization and the mean of the response time to serve a web page is used. Manager 280 determines the correlation between variable x and variable y. In one embodiment, manager 280 uses tools such as SightLine by Fortel Inc., of Fremont, Calif. to acquire a correlation coefficient ρx,y, which indicates the degree of correlation between variable x and variable y. Coefficient ρ=1 implies that x and y are correlated, and, that is, if x changes by a percentage amount, then y changes by the same amount. For example, if x changes by 10%, then y changes by 10%. If x changes by 20%, then y changes by 20%, etc. In contrast, if ρ=0 , then x and y are independent and therefore changing one parameter has no effect on the other. However, if ρ is between 0 and 1, then there is some degree of correlation between x and y.
Manager 280 uses the following equation (6) to determine the probability distribution function for a bivariate distribution of x and y:




  
    f
    ⁢
    
      
    
    ⁢
    
      (
      
        x
        ,
        y
      
      )
    
  
  =
  
    
      1
      
        2
        ⁢
        
          
        
        ⁢
        π
        ⁢
        
          
        
        ⁢
        
          σ
          x
        
        ⁢
        
          σ
          y
        
        ⁢
        
          
            1
            -
            
              ρ
              2
            
          
        
      
    
    ⁢
    exp
    ⁢
    
      {
      
        
          
            -
            1
          
          
            2
            ⁢
            
              
            
            ⁢
            
              (
              
                1
                -
                
                  ρ
                  
                    x
                    ,
                    y
                  
                  2
                
              
              )
            
          
        
        ⁡
        
          [
          
            
              
                (
                
                  
                    x
                    -
                    
                      x
                      _
                    
                  
                  
                    σ
                    x
                  
                
                )
              
              2
            
            -
            
              2
              ⁢
              
                
              
              ⁢
              
                
                  ρ
                  
                    x
                    ,
                    y
                  
                
                ⁡
                
                  (
                  
                    
                      x
                      -
                      
                        x
                        _
                      
                    
                    
                      σ
                      x
                    
                  
                  )
                
              
              ⁢
              
                (
                
                  
                    y
                    -
                    
                      y
                      _
                    
                  
                  
                    σ
                    y
                  
                
                )
              
            
            +
            
              
                (
                
                  
                    y
                    -
                    
                      y
                      _
                    
                  
                  
                    σ
                    y
                  
                
                )
              
              2
            
          
          ]
        
      
      }
    
  




where:

    
    
        x=mean value of the first variable, e.g., mean of CPU utilization values
         x=mean of the mean values of x
        y=mean value of the second variable, e.g., mean of response time values for serving a web page
         y=mean of the mean values of y
        σx=standard deviation of x
        σy=standard deviation of y
        ρx,y=correlation coefficient between x and y
    
    


To establish function ƒ(x,y) in equation (6), manager 280 periodically measures a plurality of corresponding pairs of response time and CPU utilization, and, for each set of the measured values, calculates the corresponding means. Similarly, manager 280, from a plurality of sets of values, or a plurality of the means, calculates the means of the means and corresponding standard deviations.
Function ƒ(x,y) may be represented in a 3-axis graph including coordinates x, y, and ƒ(x,y) in which the x-axis and the y-axis form an x-y plane. From equation (6), a trend line representing the relationship between variable x and variable y is obtained. This trend line is the locus of the maximum points of ƒ(x,y) projected onto the x-y plane and is determined using the equation




  
    
      ∂
      
        f
        ⁡
        
          (
          
            x
            ,
            y
          
          )
        
      
    
    
      ∂
      y
    
  
  =
  0.




Based on mathematical calculations, this trend line is represented by the equation:





  
    
      
        Y
        =
        
          
            
              ρ
              
                x
                ,
                y
              
            
            ⁢
            
              
                σ
                y
              
              
                σ
                x
              
            
            ⁢
            X
          
          -
          
            
              ρ
              
                x
                ,
                y
              
            
            ⁢
            
              
                σ
                y
              
              
                σ
                x
              
            
            ⁢
            
              X
              _
            
          
          +
          
            Y
            _
          
        
      
    
    
      
        (
        7
        )
      
    
  




and thus provides a slope:





  
    
      
        p
        =
        
          
            ρ
            
              x
              ,
              y
            
          
          ⁢
          
            
              σ
              y
            
            
              σ
              x
            
          
        
      
    
    
      
        (
        8
        )
      
    
  




FIG. 4 shows an example of a trend line 400 in which the x-axis represents the mean of the CPU utilization while the y-axis represents the mean of the response time in second. On trend line 400, point U indicates that, for 50% of the time, the response time is at one second or less while CPU utilization is at 80%; point V indicates that, for 50% of the time, the response time is at 1.25 seconds or less while CPU utilization is at 100%, etc.
Manager 280, based on the Service Level Agreement, establishes a desired value D for variable y, and a confidence level associated with this desired value D. This confidence level indicates the probability for variable y to be at or below value D. For illustration purposes, D is at one second, and if the confidence level is 60%, 70%, or 80%, then there is a probability that 60%, 70%, and 80%, respectively, that the mean of the response time is one second or less. Those skilled in the art will recognize that if the confidence level is 50%, then value D corresponds to a point on trend line 400, which, is point U. Further, the corresponding CPU utilization value is 80%, or value E, on the x-axis. However, if it is desirable to achieve the desired value D 95% of the time, then manager 280 selects a target response time T on the y-axis that is faster than one second. This target value T provides the margin so that 95%, instead of 50%, of the time the response time is below the desired value D of one second. In one embodiment, manager 280 uses variable m to determine the probability of 95%, which, in table 300B yields that m equals to 1.6449. Variable m is also the number of standard deviations below the desired value D to achieve value T. The relationship between value T and value D is

T=D−(m*σy)  (9)

Manager 280 uses the following equation to determine the spare capacity expressed in terms of the number m of standard deviations of variable y:




  
    
      
        
          S
          
            σ
            v
          
        
        =
        
          
            
              (
              
                T
                -
                A
              
              )
            
            
              σ
              y
            
          
          -
          m
        
      
    
    
      
        (
        10
        )
      
    
  




where:

    
    
        Sσy=spare capacity
        T=target value for y
        A=actual value for y
        σy=standard deviation for y
        m=the number of standard deviations corresponding to a desired confidence
    
    


In equation (10), value A represents the actual or real time value of variable y that is normally acquired soon before calculating equation (10). In embodiments where variable y is the mean of the response time, this value A is determined based of a plurality of values of response time that are measured periodically.
Based on value T, manager 280 determines a corresponding CPU utilization R, which indicates that when CPU runs at value R, there is a 95% confidence level that the response time is at or below value D, or one second in the above example.
Using trend line 400, Δx, the change in variable x from value E to value R that corresponds to the change from value D to value T, is calculated as:




  
    Δ
    ⁢
    
      
    
    ⁢
    x
  
  =
  
    
      S
      
        σ
        y
      
    
    p
  




where, p is the slope of trend line 400, which is defined in equation (8) above. Δx may be referred to as the spare capacity of variable x, or the spare capacity of CPU utilization.

In one embodiment, manager 280 changes operation of server 110, e.g., changes the clock speed or duty cycle required to obtain the desired change in CPU utilization as:

Δc=−Δx+G 

where G is a value desirable for the spare capacity to reach. For example, if the current spare capacity is 10%, and it is desirable for the spare capacity to be at zero, then manager 280 causes the clock speed to be reduced by 10%, e.g., Δc=−10%+0%=10%. However, if the spare capacity is to be at 5%, then Δc=−10%+5%=−5%. If the spare capacity is to be at 3%, then Δc=−10%+3%=−7%, etc. Alternatively, the spare capacity is acceptable if it is within a range, e.g., from 0 to value G.

Manager 280 also saves power by one or a combination of various techniques such as optimizing performance, combining services performed by various servers 110, satisfying predefined conditions, turning off non-essential or non-critical programs, etc.
Performance Optimization
Because performance optimization creates greater system spare capacity for a given load, power manager 280 uses performance optimization to reduce power consumption while maintaining the same system performance. In one embodiment, to periodically optimize system performance, a system administrator, depending on the operating environment, uses one of several available tools such as OpenView, GlancePlus, GlancePlus Pak 2000 by Hewlett-Packard Company of Palo Alto, Calif., Unicenter Performance Management for open VMS by Computer Associates International of Islandia, N.Y., Tivoli Application Performance Management by IBM of Armonk, N.Y., etc. Normally, soon after performance optimization, manager 280 uses one of the power-saving techniques to manage system power.
In one embodiment, performance optimization is achieved by tuning various “tunable” parameters that can be dynamic or static. Dynamic parameters can be changed during normal system operations and do not require a re-boot. Dynamic parameters include, for example, priority levels of all applications and services running on server 110, application level memory cache size for caching web pages and intermediate query results for data bases, the number concurrent users accessing a service or logins to a service, CPU time slice limit for applications, etc. Static parameters require re-booting the system to take effect, and include parameters such as Redundant Array of Independent Disk (RAID) configurations, swap page size, system memory size, system cache size, etc.
Groups and Clustered Systems
In one embodiment, when a group of servers 110 are being run in a clustered or load-balanced environment, manager 280, based on the performance of each server 110 and when appropriate, consolidates the program applications to fewer systems. For example, if two servers 110-1 and 110-2 provide web page services, and if the sum of the spare capacity of the two servers exceeds 100% then server 110-1 is put into a higher “sleep” state such as the S4 or S5 state or even shut-down, and server 110-2 executes applications of its own and of server 110-1. For another example, the spare capacity of server 110-3 is 20% with a database application running, and this capacity increases to 50% without the database application. In one embodiment, the database application on server 110-3 is turned off or transferred to e.g., a server 110-4, so that the 50% capacity of server 110-3 can be used to provide services that require 50% capacity and are being run from, e.g., server 110-5. In one embodiment, the spare capacity of a server is the spare capacity of the CPU. In many situations, service combinations result in a higher power saving than reducing the power of some resources in each server individually.
Predefined Conditions
Manager 280 executes power management also based on predefined conditions and requirements. In special or exception conditions, manager 280, based on configuration information that has been previously provided and when appropriate, turns off programs or applications that are not absolutely required or non-essential under the prevailing environment conditions. Turning off non-essential programs or non-critical services boosts the performance of other services resulting in extra capacity. Special conditions are triggered by external events such as “brown-out” conditions, excessive electricity price periods, smog and “save-the-air” advisories, local facilities air-conditioning overload due to hot weather, etc.
Steps Illustrating a Method for Managing System Power
FIG. 5A is a flowchart illustrating a method for managing system power in accordance with one embodiment.
In step 502, manager 280 periodically optimizes system performance.
In step 504, manager 280 obtains the utilization values xi of various system resources over a set of n measurements.
In step 506, manager 280 calculates the means x and standard deviation σ of xi for the corresponding resources.
In step 508, manager 280 acquires the probability acceptable for the resources to be saturated. That is, manager 280 acquires the probability P of equation (4).
In step 512, manager 280, from the probability P, acquires parameter m.
In step 516, having the values of x, σ, m, manager 280 calculates the spare capacity s.
If step 518 determines that the spare capacity is within an acceptable range, then the system is operating acceptably, and the method flows to step 502.
However, if step 518 indicates that the spare capacity s is not within the acceptable range, then manager 280 in step 520 calculates the percentage of change in resource utilization Δc.
In step 524, to reflect the change in Δc, manager 280 adjusts the system operation such as CPU clock speed. Once the resource utilization is adjusted, the spare capacity s should be in an acceptable range. The method flows to step 502 and the power managing process continues.
FIG. 5B is a flowchart illustrating a method for managing system power related to an SLA parameter, in accordance with one embodiment.
In step 526, manager 280 periodically optimizes system performance.
In step 528, manager 280 samples the response time and corresponding CPU utilization. From each set of samples, manager 280 obtains a corresponding mean value, and, from a plurality of sets of samples, manager 280 obtains the means of the means and corresponding standard deviations.
In step 530, manager 280 determines the correlation coefficient between the CPU utilization and the response time.
In step 534, manager 280 establishes a relationship, e.g., in the form of a trend line for the response time and CPU utilization.
In step 538, manager 280, based on the Service Level Agreement, establishes a desired value D for the response time, e.g., one second, and a confidence level associated with this desired value D. If the confidence level is 50%, then the CPU utilization corresponding to this desired value D can be obtained directly from equation (7). However, for illustration purposes, the confidence level is more than 50%, e.g., 95%.
In step 542, manager 280, determines a target response time value, e.g., value T, which is faster than one second so that if the response time is at value T, then there is 95% percent probability that the response time will be below the desired value D.
In step 546, manager 280, based on the target value T, calculates the spare capacity of the response time.
In step 550, manager 280 calculates the spare capacity of the CPU corresponding to the spare capacity of the response time.
If step 554 determines that the CPU spare capacity is within an acceptable range, then the system is operating acceptably, and the method flows to step 526. However, if step 554 indicates that the spare capacity is not within the acceptable range, then manager 280 in step 558 calculates the percentage of change in CPU utilization.
In step 562, manager 280 adjusts operation of server 110 including adjusting the clock speed of the CPU so that the spare capacity of CPU is at the acceptable level. The method flows to step 526 and the power managing process continues.
During the above steps in FIGS. 5A and 5B, manager 280 may turn off some programs applications as some of the predefined conditions are met, consolidating program applications, etc.
The Power Manager
FIG. 6 shows one embodiment of power manager 280 including an administrative program 610, a performance measurement program 620, a performance control program 630, a performance optimization program 640, and program scripts 650 and 660, all of which communicate via a bus 6050.
In one embodiment, program 610 is executed as a Windows Service or Unix Demon, and includes an administrative user interface 6150 and a start-up program 6160. User interface 6150 allows a user to enter configuration information, execute commands, scripts, and/or make choices in a graphic user interface (GUI). Start-up program 6160 launches performance measurement program 620, performance control program 630, and scripts at start up time and does initialization work such as reading configuration that might have been previously entered and saved via interface 6150.
Performance measurement program 620 monitors performance of system resources and of parameters included in Service Level Agreements. Performance program 620 computes the statistical mean and standard deviation of performance parameters and compares to what is required pursuant to the Service Level Agreement. Program 620 also computes the spare capacity values. Program 620, via appropriate component and application interfaces, continuously measures and records these parameters, and, when desired, signals control program 630 to take appropriate actions to manage the power.
Performance control program 630 employs one of the power-saving methods to reduce or increase power. Control program 630 includes information and interfaces required to control the system resources. For example, control program 630, via the TTC circuit, reduces or increases the effective clock speed of the CPU, spins the disc drives up or down or turning them on or off as appropriate.
Performance optimization program 640 in one embodiment builds a dynamic model for the relationship between system performance and “tunable” parameters. Based on the model, program 640 adjusts these parameters to optimize system performance, and as discussed above, once the system is optimized, measurement program 620 and control program 630, as appropriate, apply one of the various power-saving techniques discussed above.
Scripts 650 and 660 execute power management policies based on prevailing conditions and requirements. In one embodiment, script 650, executing for normal operation, implements logic to collect and analyze performance information. For example, script 650 invokes performance measurement program 620 to compute the statistical mean and standard deviations of performance parameters, to measure the spare capacity, etc. Based on the measurement results, script 650 invokes control program 630 to control power.
Script 660 provides the logic to deal with exception operating condition. Based on configuration information, script 660 turns off or on corresponding programs. For example, when the “brown-out” condition is met, script 660 invokes program control 630 for it to reduce power. Script 660 also turns off non-essential programs, etc.
Illustration of Executing the Power Manager
FIG. 7 is a flowchart illustrating a method for executing the power management in accordance with one embodiment.
In step 704, a system Administrator installs power manager 280 on server 110.
In step 708, the Administrator, via interface 6150, configures various information such as the times during the day the programs and services run on server 110. The Administrator identifies the programs that are optional but desirable to run if conditions permit, the programs that are not required to run but can be executed on demand, etc. The Administrator maps the applications to the times during which the applications may be turned off, given lower priority, or be available for execution on demand, etc. The Administrator maps script 650 to normal conditions and script 660 to exception conditions. The Administrator programs the scripts to be executed when the condition is met. The Administrator often changes the information and mapping in this step 708 as appropriate.
In step 712, after a system boot, program 610 executes scripts 650 for normal operation. Program 610 also launches program 620 and program 630 to measure and optimize system performance.
In step 716, when external environment conditions vary, the Administrator uses interface 6150 to issue commands notifying power manager 280 of the changes. Based on the new conditions, power manager 280, via program 610, executes script 650 and 660 that have been configured for the new conditions.
In the foregoing specification, the invention has been described with reference to specific embodiments. However, it will be evident that various modifications and changes may be made without departing from the broader spirit and scope of the invention. Accordingly, the specification and drawings are to be regarded as illustrative rather than as restrictive.

## Claims

1. A method of managing power of a system, comprising the steps of:
identifying a resource consuming power of the system; changing utilization of the resource affects a parameter;
representing a mean value of a plurality of utilization values of the resource by a first variable;
representing a mean value of a plurality of values of the parameter by a second variable;
determining a relationship between the first variable and the second variable;
for a selected value of the second variable, based on the relationship, selecting a corresponding value of the first variable, and
causing the resource to be utilized at a level corresponding to the selected value of the first variable; wherein
a value of the first variable is calculated from a plurality of utilization values of the resource that are periodically obtained;
a value of the second variable is calculated from a plurality of values of the parameter that are periodically obtained;
associating the selected value of the second variable with a probability for this value to be below a predetermined value;
based on this probability and the selected value of the second variable, determining a new value of the second variable; and
selecting a new value of the first variable corresponding to the new value of the second variable.

2. The method of claim 1 wherein the relationship is based on a correlation coefficient between the first variable and the second variable; a value of the correlation coefficient indicating a degree of correlation between the first variable and the second variable.

3. The method of claim 2 wherein the correlation coefficient is based on a mean of a plurality of utilization values of the resource and a mean of a plurality of values of the parameter.

4. The method of claim 1 wherein the relationship is derived from a probability distribution function of the first variable and the second variable.

5. The method of claim 1 wherein the relationship forms a trend line having a slope based on a correlation coefficient between the first variable and the second variable, the standard deviation of the first variable, and the standard deviation of the second variable.

6. The method of claim 5 wherein the slope is determined as




  p
  =
  
    
      ρ
      
        x
        ,
        y
      
    
    ⁢
    
      
        σ
        y
      
      
        σ
        x
      
    
  



in which p represents the slope, ρx,y represents the correlation coefficient, σx represents the standard deviation of the first variable, and σy represents the standard deviation of the second variable.

7. The method of claim 1 wherein the system provides computer services to users via a computer network.

8. The method of claim 1 wherein the resource is selected from a group consisting of memory, a CPU, a storage device, a bus, a peripheral device, a card for connecting accessories, and a peripheral device of the system.

9. The method of claim 1 wherein the parameter is selected from a group consisting of a time the system takes to respond to a request for a service, from a time a user requests a service to a time the user receives the service, and amount of information provided by the system in a time unit.

10. The method of claim 1 further comprising the step of adjusting operation of the resource to achieve the new value of the first variable.

11. The method of claim 1 wherein the probability corresponds to a third variable related to the standard deviation of the second variable.

12. The method of claim 11 wherein the new value of the second variable is calculated from the equation T=D−(m*σy) in which D representing the selected value of the second variable, T representing the new value of the second variable, m representing the third variable, and σy representing the standard deviation of the second variable.

13. The method of claim 1 further comprising the steps of determining spare capacity of the second variable based on the probability, the new value for the second variable, the standard deviation of the second variable, and a value of the second variable representing a real time value of the second variable.

14. The method of claim 13 wherein Sσy represents the spare capacity, T represents the new value for the second variable, σy represents the standard deviation of the second variable, A represents the value of the second variable representing a real time of the second variable, m corresponds to the probability, and




  
    S
    
      σ
      v
    
  
  =
  
    
      
        (
        
          T
          -
          A
        
        )
      
      
        σ
        y
      
    
    -
    
      m
      .

15. The method of claim 13 further using the spare capacity of the second variable to determine a new value of the first variable corresponding to the new value of the second variable.

16. The method of claim 1 further comprising the step of periodically optimizing performance of the system.

17. The method of claim 1 further comprising the step of turning off a program running on the system upon meeting a condition that affects the power consumed by the system.

18. A method of managing power of a system, comprising the steps of:
identifying a resource consuming power of the system; changing utilization of the resource affects a parameter;
periodically determining spare capacity of the resource; and
if the spare capacity is outside a predefined range, then adjusting operation of the resource that affects power consumed by the resource to adjust the spare capacity to within the predefined range; wherein
a first variable represents a mean value of a plurality of utilization values of the resource;
a second variable represents a mean value of a plurality of values of the parameter;
the spare capacity of the resource is determined based on spare capacity of the parameter and a slope of trend line representing a relationship between the first variable and the second variable, wherein the spare capacity of the parameter is based on a first value of the second variable, a standard deviation of the second variable, a third variable representing a confidence level for the second variable not to exceed a second value, and a third value of the second variable representing a real time value of the second variable.

19. The method of claim 18 wherein Δx represents the spare capacity of the resource, Sσy represents the spare capacity of the parameter, p represents the slope of the trend line, and




  
    Δ
    ⁢
    
      
    
    ⁢
    x
  
  =
  
    
      
        S
        
          σ
          y
        
      
      p
    
    .

20. The method of claim 18 wherein Sσy represent the spare capacity of the parameter, T represents the first value of the second variable, σy represents the standard deviation of the second variable, m represents the third variable representing the confidence level for the second variable not to exceed the second value, and A representing the third value of the second variable representing a real time value of the second variable, and




  
    S
    
      σ
      y
    
  
  =
  
    
      
        (
        
          T
          -
          A
        
        )
      
      
        σ
        y
      
    
    -
    
      m
      .

21. The method of claim 18 wherein the trend line provides a slope depending on a correlation coefficient between the first variable and the second variable, the standard deviation of the first variable, and the standard deviation of the second variable.

22. The method of claim 21 wherein p represents the slope, σx,y represents the correlation coefficient, σx represents the standard deviation of the first variable, and σy represents the standard deviation of the second variable, and




  p
  =
  
    
      ρ
      
        x
        ,
        y
      
    
    ⁢
    
      
        
          σ
          y
        
        
          σ
          x
        
      
      .

23. The method of claim 18 further comprising the step of consolidating program applications based on the spare capacity of the resource.

24. The method of claim 18 wherein the system provides computer services to users via a computer network.

25. The method of claim 18 further comprising the step of turning off a program application running on the system upon meeting a condition that affects the power consumed by the system.

26. A system comprising:
a resource consuming power of the system; changing utilization of the resource affects a parameter;
a first variable representing a mean of a plurality of utilization values of the resource;
a second variable representing a mean of a plurality of values of the parameter;
means for periodically determining spare capacity of the resource based on spare capacity of the parameter and a relationship between the first variable and the second variable; and
means for adjusting operation of the system that affects power consumed by the resource in order to adjust the spare capacity of the resource to within a predefined range if the spare capacity is outside the predefined range, wherein the spare capacity of the parameter is based on a first value of the second variable, a standard deviation of the second variable, a third variable representing a confidence level for the second variable not to exceed a second value, and a third value of the second variable representing a real time value of the second variable.

27. The system of claim 26 being connected to a network.

28. The system of claim 26 wherein the parameter is determined based on a requirement of a client requesting a service from the system.