1. Technical Field
The inventions described herein relate to computers and computer programs. In particular, the present invention relates to methods and devices for improving transaction performance and availability management in computers and computer programs.
2. Description of Related Art
Modern computers, particularly servers, can operate in environments where the computers are required to run many programs simultaneously or to handle vast numbers of transactions via a connection over a network, such as the Internet. A problem encountered in these heavy workload environments is that a program or connection that consumes too much of a computer's resources will likely cause other programs or connections to be processed more slowly or less efficiently. For example, if a transaction implemented over the Internet takes too much time, then a server's ability to handle other Internet transactions is reduced. In another example, if a transaction executed within an application takes too much time, then the server's ability to deal with other transactions within the server is reduced. Examples of transactions include, but are not limited to, placing an order over a network, transferring money over a network, delivering a file over a network, executing an operation within a program, executing a program within an application and any other transaction between computers or within a computer. In yet another example, if a program consumes too much of the server's resources, then the server's ability to handle other programs is reduced.
One prior method of dealing with this problem is to monitor how much of a computer's resources a program is using. If the program is consuming more resources than a selected threshold, then the program is terminated. Similarly, if a connection is taking up too much of a server's resources or is moving too slowly, then the connection is terminated.
However, this prior method has the disadvantage of denying a user access to the program or, in the case of connections, of disconnecting a user from the server. As a result, valuable time or data can be lost. Thus, it would be advantageous to have a method, apparatus and computer instructions for preventing a program from consuming too much of a computer's resources, but without terminating the user's ability to use the program.
The present invention provides a method, apparatus and computer instructions for monitoring each thread running in conjunction with an application that is running on a computer. A parameter, such as the time a thread has been running, is associated with the thread. A threshold, such as the maximum allowed time for a thread to accomplish a task, is established. If the parameter violates the threshold, then the individual thread is terminated without terminating the entire application.
The novel features believed characteristic of the invention are set forth in the appended claims. The invention itself, however, as well as a preferred mode of use, further objectives and advantages thereof, will best be understood by reference to the following detailed description of an illustrative embodiment when read in conjunction with the accompanying drawings, wherein:
In the depicted example, server 104 is connected to network 102 along with storage unit 106. In addition, clients 108, 110, and 112 are connected to network 102. These clients 108, 110, and 112 may be, for example, personal computers or network computers. In the depicted example, server 104 provides data, such as boot files, running system images, and programs to clients 108-112. Clients 108, 110, and 112 are clients to server 104. Network data processing system 100 may include additional servers, clients, and other devices not shown. In the depicted example, network data processing system 100 is the Internet with network 102 representing a worldwide collection of networks and gateways that use the Transmission Control Protocol/Internet Protocol (TCP/IP) suite of protocols to communicate with one another. At the heart of the Internet is a backbone of high-speed data communication lines between major nodes or host computers, consisting of thousands of commercial, government, educational and other computer systems that route data and messages. Of course, network data processing system 100 also may be implemented as a number of different types of networks, such as for example, an intranet, a local area network (LAN), or a wide area network (WAN).
Peripheral component interconnect (PCI) bus bridge 214 connected to I/O bus 212 provides an interface to PCI local bus 216. A number of modems may be connected to PCI local bus 216. Typical PCI bus implementations will support four PCI expansion slots or add-in connectors. Communications links to clients 108-112 in
Additional PCI bus bridges 222 and 224 provide interfaces for additional PCI local buses 226 and 228, from which additional modems or network adapters may be supported. In this manner, data processing system 200 allows connections to multiple network computers. A memory-mapped graphics adapter 230 and hard disk 232 may also be connected to I/O bus 212 as depicted, either directly or indirectly.
Those of ordinary skill in the art will appreciate that the hardware depicted in
The data processing system depicted in
An operating system runs on processor 302 and is used to coordinate and provide control of various components within data processing system 300 in
Those of ordinary skill in the art will appreciate that the hardware in
As another example, data processing system 300 may be a stand-alone system configured to be bootable without relying on some type of network communication interfaces As a further example, data processing system 300 may be a personal digital assistant (PDA) device, which is configured with ROM and/or flash ROM in order to provide non-volatile memory for storing running system files and/or user-generated data.
The depicted example in
A parameter is associated with each thread 404. Plug-in program 402 causes an individual thread 404 to be terminated when the parameter violates a threshold. In a preferred embodiment, the thread is terminated without terminating application 400 itself and without preventing execution of any other thread.
Plug-in program 402 may monitor more than one application 400. Thus, plug-in program 402 may monitor a plurality of threads within a plurality of applications. Plug-in program 402 may cause a thread to be terminated within any application without terminating any application.
As indicated above, application 400 may be an application that monitors network traffic, particularly traffic over the Internet. Such a network monitoring application may generate statistical reports on the transactions flowing through a server, such as servers 104 or 200. Plug-in program 402 is a plug-in module that operates in conjunction with the network monitoring application 400. Upon activation of network monitoring application 400, plug-in program 402 is activated and registered locally with network monitoring application 400. Plug-in program 402 uses information collected about threads monitored by network monitoring application 400. In addition, plug-in program 402 may monitor threads spun by the network monitoring application itself.
In any case, plug-in program 402 establishes one or more parameters for each thread 404 and further uses information gathered by the network monitoring program to determine whether a parameter has violated a threshold. If the parameter has violated a threshold, plug-in program 402 causes the corresponding thread to be terminated. However, network monitoring application 400 itself and other threads associated with the network monitoring application remain unaffected. Thus, threads 404 that take too much time or that consume too much of a server's resources are terminated without terminating network monitoring application 400 or any thread monitored by monitoring application 400. If the violating thread is vital to the operation of network monitoring application 400, then the network, monitoring application itself can be terminated when necessary.
In addition, plug-in program 402 may be a stand-alone program designed to operate on an individual computer. In this case, plug-in program 402 monitors one or more additional programs running on the computer and terminates threads 404 within those programs that become non-responsive or that consume too much of the computer's resources. Similarly, plug-in program 402 may be used to alert the user that a parameter associated with a thread 404 has violated a threshold and allow the user to determine the appropriate course of action. In addition, plug-in program 402 may be used to terminate an additional program if too many threads must be terminated or if the additional program becomes unstable or non-responsive.
The method described in relation to
The process begins with monitoring application 400 detecting a set of new threads running within a new program in use on the computer (step 500). Plug-in program 402 uses the information gathered by the monitoring program to register the set of threads 404 with plug-in program 402 (step 502). If monitoring application 400 does not identify operating threads, then plug-in program 402 may be provided with instructions to identify threads running in relation to application 400, or in relation to any other application to be monitored. Plug-in program 402 then registers the running threads with plug-in program 402. Similarly, plug-in program 402 uses information gathered by monitoring application 400 or by plug-in program 402 itself to establish a parameter, such as the time a thread takes to accomplish a task, to be monitored.
Plug-in program 402 then monitors whether the parameter associated with a thread violates a threshold (step 504) established by plug-in program 402. Plug-in program 402 determines whether a parameter has been violated by comparing the value of a parameter to the value of a threshold. If the value of the parameter equals or exceeds the value of the threshold, then the parameter violates the threshold.
In addition, the violation may be detected by a monitoring application 400 or by a separate monitoring program used to monitor parameters associated with the threads. In this case, the violation is reported to plug-in program 402, which either automatically terminates the thread without affecting the other threads or waits for user input to take appropriate action.
In the process of
Alternatively, the parameter may be how much of the computer's resources the thread uses. The parameter, in this example, is the percentage of resources available to the CPU (or other processor) on the computer used by the thread. In this case, the threshold is a selected percentage of the maximum resources available to the computer. The parameter violates the threshold if the percentage of resources used by the thread equals or exceeds the selected percentage.
Other parameters and thresholds may also be used in the program shown in
For example, another type of parameter that may be used is the amount of memory utilized by a thread. In this case, additional byte code insertion can be performed to track object instantiation in the context of a thread. The data generated by tracking object instantiation is used to build a memory utilization model of the thread. If the memory utilization model equals or exceeds a maximum predefined threshold model, then plug-in program 402 causes the thread to be terminated.
In addition, multiple parameters may be monitored for each thread. For example, both the time required to complete a thread and the amount of resources the thread uses may be monitored. Similarly, separate thresholds may be established for each type of threshold. Thus, a thread may be allowed to run even if it consumes much of the computer's resources, but not if it takes more than a short time to complete a task.
In addition, types of threads can be classified and sorted into groups. The same parameter for each thread in each group is monitored; however, threads in one group may receive a different threshold than threads in another group. For example, one type of thread may be a connection among a plurality of network connections to a server. Another type of thread may be running in an application. The parameter monitored in both groups is the amount of server resources a thread is consuming. However, in this example, applications are allowed more server resources than network connections. Thus, the threshold for application threads is higher than the threshold for network connection threads. Similarly, different thresholds may be established for different threads within applications and different thresholds may be established for different threads within network connections.
In any case, a determination is made whether one or more parameters associated with an individual thread have violated one or more thresholds (step 506). If not, then monitoring is continued (step 504). If so, then the thread is terminated (step 508).
Instead of terminating the thread, plug-in program 402 may alert a user that one or more parameters associated with an individual thread have violated one or more thresholds. The system then awaits input from the user, who determines the appropriate course of action.
In addition, plug-in program 402 may also be programmed to terminate entire programs or connections if too many threads within the program must be terminated or if the program or connection becomes unstable or non-responsive. Thus, plug-in program 402 can cause an entire set of network connections to terminate or can cause an entire application to terminate.
In use, the method shown in
For example, if a thread takes too much time to accomplish a task, then the thread is terminated. Similarly, if a thread is consuming too much of the resources of the computer's CPU, then the thread is terminated. Likewise, if a transaction within a connection is taking too long to accomplish a task or is consuming too much of the computer's ability to handle data, then the transaction is terminated without terminating the connection itself.
Whether automatic or manual, the thread may be terminated by one or more methods. For example, plug-in program 402 or monitoring application 400 may direct the application program interface of the computer's operating system to terminate the thread. Plug-in program 402 may terminate the thread directly. In addition, additional byte code at the program level could be used to interact with plug-in program 402. The additional byte code detects a notification from plug-in program 402 and reacts by skipping a new thread (preventing a new thread from running) or by throwing an exception to interrupt the current thread. In a deadlock scenario, for example, a mutex could be notified that the current thread is blocked. Subsequently inserted byte code could then interact with monitoring application 400 to terminate the current thread.
The inventions described herein provide for a method of automatically terminating a thread within a program, without terminating the program, when a parameter associated with the program violates a threshold. Thus, the inventions described herein solve the computer resource problem that occurs when a thread consumes too much of a computer's resources or when a thread consumes too much time.
In addition, plug-in program 402 can monitor a parameter associated with a number of transactions within a connection. Here, the connection corresponds to application 400 and each transaction corresponds to a thread 404. If the parameter of a transaction violates a threshold, then plug-in program 402 or monitoring application 400 causes the transaction to be terminated without terminating the connection.
It is important to note that while the present invention has been described in the context of a fully functioning data processing system, those of ordinary skill in the art will appreciate that the processes of the present invention are capable of being distributed in the form of a computer readable medium of instructions and a variety of forms and that the present invention applies equally regardless of the particular type of signal bearing media actually used to carry out the distribution. Examples of computer readable media include recordable-type media, such as a floppy disk, a hard disk drive, a RAM, CD-ROMs, DVD-ROMs, and transmission-type media, such as digital and analog communications links, wired or wireless communications links using transmission forms, such as, for example, radio frequency and light wave transmissions. The computer readable media may take the form of coded formats that are decoded for actual use in a particular data processing system.
The description of the present invention has been presented for purposes of illustration and description, and is not intended to be exhaustive or limited to the invention in the form disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art. The embodiment was chosen and described in order to best explain the principles of the invention, the practical application, and to enable others of ordinary skill in the art to understand the invention for various embodiments with various modifications as are suited to the particular use contemplated.