Abstract:
The present invention discloses a computer apparatus ( 6 - 12 ) comprising a central processing unit (CPU) ( 32 ), means ( 28 ) for monitoring CPU load, and means ( 30 ) for reducing the CPU usage from at least one CPU demand source, thereby to reduce the CPU load, if the CPU monitoring means determines that a predetermined threshold CPU usage is at least reached in which the CPU usage reducing means comprises a thread clamper.

Description:
FIELD OF THE INVENTION  
         [0001]    The present invention relates to computer apparatus, terminal server apparatus and to performance management methods therefore, to computer programs for such methods and to data carriers comprising such computer programs.  
         BACKGROUND TO THE INVENTION  
         [0002]    A terminal server environment consist of one or more terminal servers to which are networked (by any suitable connection) a plurality of thin client computer nodes. Application execution, data processing and, usually, data storage occur on the terminal servers. The user&#39;s thin client computer node acts primarily as a graphical user interface and does not carry out substantive application processing. Currently implementations of this environment include Windows 2000 Terminal Services, Windows NT4.0 Terminal Server (WTS) and MetaFrame (trade mark), the last of these working with the WTS. The MetaFrame implementation permits files to be stored locally on a user&#39;s computer node, whereas WTS does not.  
           [0003]    In operation, each user logs on to a separate session with the terminal servers. Each user node uses a varying amount of terminal server central processing unit (CPU) time, or cycles. The amount of CPU time used, for instance, by a word processing application during normal typing tends to be quite small. However, if the user instructs the word processors to perform an intensive task, such as a complex macro, the application may use all of the available CPU capacity to perform the task as quickly as possible. A given application being utilised by a user&#39;s computer node typically will use a plurality of threads to interface with the CPU within any given process.  
           [0004]    Where a computer is dedicated to a single user this is usually acceptable behaviour. However, for a terminal server environment, which is accessed concurrently by many users, this behaviour can become problematic, especially when several processes are performing CPU intensive tasks. Subsequently, all users logged on to the terminal servers will encounter performance issues and unresponsive sessions. During long periods of unresponsiveness the server can become unstable, which is particularly problematic as the system administrator will be unable to determine the cause and resolve the issue due to the unresponsiveness of the server.  
           [0005]    It is an aim of preferred embodiments of the present invention to obviate or overcome a disadvantage of the prior art, whether referred to herein or otherwise.  
         SUMMARY OF THE INVENTION  
         [0006]    According to the present invention in a first aspect, there is provided a computer apparatus comprising a central processing unit (CPU), means for monitoring CPU load, and means for reducing the CPU usage from at least one CPU demand source, thereby to reduce the CPU load, if the CPU monitoring means determines that a predetermined threshold CPU usage is at least reached, in which the CPU usage reducing means comprises a thread clamper.  
           [0007]    Suitably, the CPU monitoring means comprises a CPU sampler. Suitably, the CPU sampler samples the CPU usage at a predetermined rate.  
           [0008]    Suitably, the predetermined threshold must be at least reached for a plurality of samples before the CPU usage reducing means is activated.  
           [0009]    Suitably, the predetermined threshold is 100% of the CPU capacity.  
           [0010]    Suitably, a thread is clamped by limiting the amount of CPU capacity available to that thread. Suitably, a thread is clamped by temporarily suspending the relevant thread. Suitably, a thread is clamped by or to a predetermined percentage.  
           [0011]    Suitably, the apparatus further comprises means for determining a thread to be clamped. Suitably, the thread determining means comprises means for determining the CPU usage of a process of which a thread forms a part and in which the CPU usage reducing means is only activated for the process if the CPU usage of the process at least reaches a predetermined threshold. Suitably, the thread determining means comprises means for determining the CPU usage of a thread and in which the CPU usage reducing means is only activated for the thread if the CPU usage of the thread at least reaches a predetermined threshold.  
           [0012]    Suitably, the computer apparatus is a terminal server for connecting to a plurality of user computer nodes.  
           [0013]    Suitably, each user is regarded as a CPU demand source.  
           [0014]    Suitably, the terminal server comprises part of a server farm.  
           [0015]    According to the present invention in a second aspect, there is provided a performance management method for a computer apparatus comprising a central processing unit (CPU), the method comprising the steps of monitoring the CPU usage and reducing the CPU usage from at least one CPU demand source if the CPU usage at least reaches a predetermined threshold, in which the CPU usage is reduced by thread clamping.  
           [0016]    Suitably, the CPU usage is sampled at a predetermined rate.  
           [0017]    Suitably, the predetermined threshold must be at least reached for a plurality of samples before the CPU usage is reduced.  
           [0018]    Suitably, the predetermined threshold is 100% of the CPU capacity.  
           [0019]    Suitably, a thread is clamped by temporarily suspending the relevant thread. Suitably, a thread is clamped by or to a predetermined percentage.  
           [0020]    Suitably, a thread to be clamped is selectively determined. Suitably, the method further comprises determining the CPU usage of a process of which a thread forms a part and the CPU usage is only reduced for the process if the CPU usage of the process at least reaches a predetermined threshold. Suitably, the method further comprises determining the CPU usage of a thread and in which the CPU usage is only reduced for the thread if the CPU usage of the thread at least reaches a predetermined threshold.  
           [0021]    Suitably, a thread is clamped for a predetermined period.  
           [0022]    Suitably, a user or group of users is allocated a CPU usage allocation below which CPU usage will not be reduced.  
           [0023]    Suitably, after reducing CPU usage, if the CPU usage still at least reaches a predetermined value, CPU usage is further reduced until it is below a predetermined value.  
           [0024]    Suitably, the computer apparatus is a terminal server for connecting to a plurality of user computer nodes.  
           [0025]    Suitably, the terminal server comprises part of a server farm.  
           [0026]    Suitably, each user is regarded as a CPU demand source.  
           [0027]    According to the present invention in a third aspect, there is provided a terminal server apparatus comprising a terminal server for connecting to a plurality of user computer nodes, the terminal server comprising a central processing unit (CPU), means for monitoring CPU load, and means for reducing the CPU usage from at least one user, thereby to reduce the CPU load, if the CPU monitoring means determines that a predetermined threshold CPU usage is at least reached, in which the CPU usage reducing means comprises a thread clamper.  
           [0028]    Suitably, the terminal server comprises part of a server farm.  
           [0029]    Suitably, the CPU monitoring means comprises a CPU sampler. Suitably, the CPU sampler samples the CPU usage at a predetermined rate.  
           [0030]    Suitably, the predetermined threshold must be at least reached for a plurality of samples before the CPU usage reducing means is activated.  
           [0031]    Suitably, the predetermined threshold is 100% of the CPU capacity.  
           [0032]    Suitably, a thread is clamped by limiting the amount of CPU capacity available to that thread. Suitably, a thread is clamped by temporarily suspending the relevant thread. Suitably, a thread is clamped by or to a predetermined percentage.  
           [0033]    Suitably, the apparatus further comprises means for determining a thread to be clamped. Suitably, the thread determining means comprises means for determining the CPU usage of a process of which a thread forms a part and in which the CPU usage reducing means is only activated for the process if the CPU usage of the process at least reaches a predetermined threshold. Suitably, the thread determining means comprises means for determining the CPU usage of a thread and in which the CPU usage reducing means is only activated for the thread if the CPU usage of the thread at least reaches a predetermined threshold.  
           [0034]    According to the present invention in a fourth aspect, there is provided a performance management method for a terminal server apparatus comprising a terminal server for connecting to a plurality of user computer nodes, the terminal server comprising a central processing unit (CPU), the method comprising the steps of monitoring the CPU usage and reducing the CPU usage from at least one user if the CPU usage at least reaches a predetermined threshold, in which the CPU usage is reduced by thread clamping.  
           [0035]    Suitably, the terminal server comprises part of a server farm.  
           [0036]    Suitably, the CPU usage is sampled at a predetermined rate.  
           [0037]    Suitably, the predetermined threshold must be at least reached for a plurality of samples before the CPU usage is reduced.  
           [0038]    Suitably, the predetermined threshold is 100% of the CPU capacity.  
           [0039]    Suitably, a thread is clamped by temporarily suspending the relevant thread. Suitably, a thread is clamped by or to a predetermined percentage.  
           [0040]    Suitably, a thread to be clamped is selectively determined. Suitably, the method further comprises determining the CPU usage of a process of which a thread forms a part and the CPU usage is only reduced for the process if the CPU usage of the process at least reaches a predetermined threshold. Suitably, the method further comprises determining the CPU usage of a thread and in which the CPU usage is only reduced for the thread if the CPU usage of the thread at least reaches a predetermined threshold.  
           [0041]    Suitably, a thread is clamped for a predetermined period.  
           [0042]    Suitably, a user or group of users is allocated a CPU usage allocation below which CPU usage will not be reduced.  
           [0043]    Suitably, after reducing CPU usage, if the CPU usage still at least reaches a predetermined value, CPU usage is further reduced until it is below a predetermined value.  
           [0044]    The present invention extends to computer programs for carrying out the methods and to data carriers comprising such programs. 
       
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS  
       [0045]    The present invention will now be described, by way of example only, with reference to the drawings that follow; in which:  
         [0046]    [0046]FIG. 1 is a schematic illustration of a terminal server environment according to the present invention.  
         [0047]    [0047]FIG. 2 is a schematic illustration of a performance manager of FIG. 1.  
         [0048]    [0048]FIG. 3 is a functional flow diagram illustrating operation of the present invention.  
         [0049]    [0049]FIG. 4 is a schematic illustration of a computer apparatus according to the present invention. 
     
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS  
       [0050]    Referring to FIG. 1 of the drawings that follow, there is shown a terminal server apparatus  2  comprising a server farm indicated schematically at  4 , comprising a plurality of terminal servers  6 ,  8 ,  10 ,  12 .  
         [0051]    The terminal servers  6 - 12  of server farm  4  are networked to a plurality of user computer nodes such as user computer nodes  14 ,  16 ,  18 ,  20 . User computer nodes  14 - 20  are typically computer terminals, but may be other networkable graphical user interfaces. User computer nodes  14 - 18  are networked to a terminal server  6 ,  8 ,  10  or  12  via the internet, indicated schematically at  22  whereas user node  20  has a local area network direct connection  24  to a terminal server  6 - 12 . Other users are networked to other terminal servers in the server farm  4 .  
         [0052]    Performance management software, indicated schematically at  26  is present and executed separately on each terminal server  6 - 12  as described below.  
         [0053]    In use, users log on through user nodes  14 - 20  to a terminal server  6 - 12  where applications are executed and data stored for the use of user nodes  14 - 20 . Each user node  14 - 20  is regarded as a source of CPU demand for the applications and processes for which it seeks CPU time from the relevant terminal server  6 - 12 .  
         [0054]    Referring to FIG. 2 of the drawings that follow, there is shown, as part of the performance manager software  26  a CPU sampler  28  and a CPU thread clamper  30 . The CPU is indicated schematically at  32 .  
         [0055]    Referring to FIG. 3 of the drawings that follow, operation of this embodiment of the present invention will now be described.  
         [0056]    Initially, the following parameter variables are defined:  
                                   Parameter   Description                   sample_period (seconds)   This is the rate at which CPU           samples will be collected.       samples_before_clamping   If the system CPU load remains       (integer)   at 100% for this number of           samples then the performance           manager will look for           appropriate threads to clamp.       minimum_process_cpu (%)   The performance manager will           never clamp threads that belong           to a process that is consuming           less than this percentage of the           system CPU.       mimimum_thread_cpu (%)   The performance manager will           never clamp threads that are           consuming less than this           percentage of the system CPU.       samples_to_clamp   Once the performance manager has       (integer)   started to clamp threads, this           value instructs the performance           manager to clamp the threads for           this number of samples before           releasing them.       clamp_quantity (%)   The performance manager will           clamp threads by this percentage           of the CPU capacity.                  
 
         [0057]    These parameters may be adjusted by the system administrator.  
         [0058]    In step  300 , CPU sampler  28  collects “sample_period” samples per second. In step  302  it is determined whether clamping is required. Clamping is determined to be required if for “samples_before clamping” samples the CPU load remains at the predetermined value of 100%. Other CPU usage may be set, to avoid usage reaching 100% if desired. By way of example, a “sample_before clamping” value of 3, with a “sample_period” of 1 will instruct the performance manager  26  to start clamping threads if the system CPU load remains at 100% for three seconds.  
         [0059]    If clamping is not required, the process returns to sampling the CPU load (step  300 ). If, however, clamping is required, in step  304  it is determined which of the threads currently using CPU capacity is/are to be clamped.  
         [0060]    Any given process may include a plurality of threads therein. To enable both processes and threads within them to be assessed for clamping, first the sampler determines whether the CPU load for a given process exceeds the “minimum_process CPU” value. If the “minimum_process CPU” value is not exceeded the performance manager  26  will not clamp the threads within that process regardless of the amount of CPU load the individual threads are using.  
         [0061]    The performance manager will only clamp threads that are occupying a significant percentage of the CPU load. The performance manager compares the sampled CPU load for a given thread with the “minimum_process CPU” variable and will only clamp the corresponding thread if the CPU load exceeds that percentage.  
         [0062]    Typical values for “minimum_process_cpu” and “minimum thread_cpu” are 5%.  
         [0063]    Once one or more threads has or have been determined to be clamped, the performance manager will (step  306 ) clamp the thread or threads by the “clamp_quantity” percentage of the CPU capacity for a predetermined period, being the “samples_to_clamp” number of samples before releasing them, say 10 samples.  
         [0064]    The performance manager CPU thread clamper  30  clamps threads by suspending and resuming threads at extremely small intervals (typically, millisecond rates). For instance, to clamp a set of threads at 95%, the performance manager will suspend and resume the set of threads over a short period of time (a fraction of a second) and will ensure that the threads are suspended for 5% of this time, making it impossible for the clamped threads to consume any more than 95% of the overall CPU between them. By only suspending threads for millisecond periods, those sessions in which threads are being clamped will avoid jerky responses and the clamping will hardly be noticeable to the user.  
         [0065]    Sampling then re-occurs to determine whether additional clamping is required.  
         [0066]    Thus the performance manager  26  will only clamp threads when the total system CPU load remains at 100% of the number of samples defined in the “samples_before_clamping” parameter. Once one or more sessions have been identified for clamping, the performance manager CPU thread clamper  30  will clamp any thread(s) in these sessions that are using more than the minimum levels of CPU capacity (defined by “minimum_process CPU” and “minimum_thread CPU”). It will clamp these threads by a set amount (“clamp_quantity”). For instance if the “clamp_quantity” is 5 then the performance manager will clamp all the threads to be clamped by 5%. This will ensure that all of the clamp threads are confined to 95% of the CPU capacity. If the spare CPU is consumed immediately then the performance manager will progressively apply heavier clamping, by again identifying the set of threads to clamp, but each time it will clamp by an additional “clamp_quantity” until the CPU  32  is not saturated. Once the CPU  32  has been clamped to the required level then the performance manager  26  will keep the clamp in place for the number of samples defined in the “samples_to_clamp” parameter. Once this period is complete the performance manager  26  will release the clamped threads. If however the CPU  32  returns to full load then the performance manager  26  will re-apply the clamping algorithm immediately.  
         [0067]    In a further embodiment of the present invention, each user or group of users can be assigned a CPU share factor. By default, all users have a share factor of 1. This share factor is used to determine which users are consuming too much CPU. The system account is also counted in the number of users and can also be given a factor, which also defaults to 1.  
         [0068]    For example, if four users  14 - 20  are logged on to a terminal server  6 - 12  then there are five sessions in total, if the system account (not shown) is included. If all of the users have a default share factor of 1 then they are allocated 20% (100%/5) of the CPU capacity each by the performance manager  26  when it is determining which sessions to clamp. Therefore each user can use up to 20% of the overall CPU and performance manager will not clamp any threads within that particular sessions. Some users may be allocated a greater or lesser share if desired.  
         [0069]    Although the present invention is intended primarily for use with terminal server applications, for which it is particularly advantageous, embodiments thereof, as shown in FIG. 4 of the drawings that follow may be used with and for single computer node (eg desktop) devices. In FIG. 4 a computer apparatus  34  comprises a user&#39;s computer node, which computer apparatus  34  comprises a CPU  36  and a performance manager application  38  therefor. The performance manager  38  operates as described above for terminal server applications, except in this case it monitors only local usage of the CPU  36  (CPU demand source) and the CPU runs applications and processes for the computer apparatus  34 .  
         [0070]    The present invention can be implemented on a variety of operating systems, including UNIX, WINDOWS and MACINTOSH (trade marks).  
         [0071]    The present invention is not limited to the described terminal server architecture.  
         [0072]    By implementing preferred embodiments of the present invention application performance and responsiveness can be maintained.