A method in a data processing system for detecting and reducing database contention and deadlock caused from within an application server. A determination is made as to whether a set of parameters in a statistical model indicates contention. If the set of parameters in the statistical model indicates contention, an application server administrator is notified of the contention and the number of threads in an application server pool is reduced. If the set of parameters in the statistical model indicates contention is reduced, the number of threads in the application server pool is increased.
|
1. A data processing system for detecting and reducing database contention caused from within an application server, the data processing system comprising:
a bus system;
a memory connected to the bus system, wherein the memory includes computer usable program code; and
a processing unit connected to the bus system, wherein the processing unit executes the computer usable program code to determine if a set of parameters in a statistical model indicates contention, wherein the statistical model includes a parameter for level and type of workload; responsive to determining the set of parameters in the statistical model indicates contention, reduce a number of threads in an application server pool; establish whether the set of parameters in the statistical model indicates contention is reduced for a specified period of continuous time; responsive to establishing the set of parameters in the statistical model does not indicate contention is reduced for the specified period of continuous time, return to the reducing step; responsive to establishing the set of parameters in the statistical model indicates contention is reduced for the specified period of continuous time, increase the number of threads in the application server pool; verify whether the number of threads is less than a normal number of threads; responsive to verifying the number of threads is not less than the normal number of threads, return to the determining step; responsive to verifying the number of threads is less than the normal number of threads, resolve if the set of parameters in the statistical model indicates contention; responsive to resolving the set of parameters in the statistical model indicates contention, return to the reducing step; and responsive to resolving the set of parameters in the statistical model does not indicate contention, return to the increasing step.
8. A computer program product on a non-transitory recordable-type medium for use in a data processing system for detecting and reducing database contention caused from within an application server, the computer program product comprising:
first instructions for determining if a set of parameters in a statistical model indicates contention, wherein the statistical model includes a parameter for level and type of workload;
responsive to determining the set of parameters in the statistical model indicates contention, second instructions for reducing a number of threads in an application server pool;
third instructions for establishing whether the set of parameters in the statistical model indicates contention is reduced for a specified period of continuous time;
responsive to establishing the set of parameters in the statistical model does not indicate contention is reduced for the specified period of continuous time, fourth instructions for returning to the reducing step;
responsive to establishing the set of parameters in the statistical model indicates contention is reduced for the specified period of continuous time, fifth instructions for increasing the number of threads in the application server pool;
sixth instructions for verifying whether the number of threads is less than a normal number of threads;
responsive to verifying the number of threads is not less than the normal number of threads, seventh instructions for returning to the determining step;
responsive to verifying the number of threads is less than the normal number of threads, eighth instructions for resolving if the set of parameters in the statistical model indicates contention;
responsive to resolving the set of parameters in the statistical model indicates contention, ninth instructions for returning to the reducing step; and
responsive to resolving the set of parameters in the statistical model does not indicate contention, tenth instructions for returning to the increasing step.
2. The data processing system of
3. The data processing system of
4. The data processing system of
5. The data processing system of
6. The data processing system of
7. The data processing system of
|
This application is a continuation of application Ser. No. 11/095,985, filed Mar. 31, 2005, status allowed.
1. Technical Field
The present invention relates generally to an improved data processing system and, in particular, to a method, system and computer program product for optimizing performance in a data processing system. Still more particularly, the present invention provides a method, system, and computer program product for enhancing performance by detecting and reducing database contention and deadlock caused from within an application server.
2. Description of Related Art
An application server is a program that handles all application operations between users and an organization's backend business applications or databases. Application servers are typically used for complex transaction-based applications. The application server works as a translator, allowing, for example, a customer with a browser to search an online retailer's database for pricing information. To support high-end needs, an application server has to have built-in redundancy, monitors for high-availability, high-performance distributed application services and support for complex database access. Many application servers also offer features such as transaction management, clustering and failover, and load balancing.
As the flow of transactions in application server software running on application server hardware increases, the applications can introduce deadlocks, or serious contention issues in the database. Deadlock occurs when two processes that are sharing some resource, such as read access to a table, but then both decide to wait for exclusive access, such as write access. Contention is competition for resources that results in delayed access to resources. Such contention in the database can cause the application server to perform very poorly.
The increase in transactions can introduce a performance problem in the database, a component that the application developer and the application server administrator do not have good knowledge about or control over. The application developer may not even be aware of the major contention issues and only may be aware that an application is not scaling under load. If the database administrator is made aware of the problem, then the administrator can usually determine where in the database the problem lies, but it is difficult for the database administrator to understand or solve the problem where it originated, in the application server.
Customers need a solution that detects contention issues before a crisis occurs and then alerts the application server administrator, while keeping the applications functional.
Current solutions to the performance problems alone include code analysis, detection procedures, and transaction rollbacks. Because code analysis to detect deadlock potential does not happen during runtime, it does not provide an adequate solution. Code analysis focuses on obvious deadlocks caused by poor coding practices, which are different from deadlocks introduced through non-optimal tuning.
Procedures and code execution for database deadlock detection are normally conducted by database administrators and are not a part of the application server. A database administrator can often devise database solutions, but such solutions are usually not runtime changes. Database administrators may not communicate a problem to the application server administrator, and will seldom be motivated to make simple effective tuning changes with the application server.
A transaction rollback occurs when the application server administrator receives SQL code for a deadlock. This solution does not handle contention, and is not clean. Deadlocks and contention issues tend to pile up on each other and it is unlikely that the application server administrator will have the knowledge (or the time if they are debugging a deadlock) to tune the application server in a way that will reduce deadlock potential while the situation is resolved.
None of the current solutions deal with contention issues that do not ultimately result in a deadlock. Therefore, it would be advantageous to have an improved method, system, and computer program product for detecting and reducing contention and deadlock caused from within an application server.
The present invention provides a method, system, and computer program product in a data processing system for detecting and reducing database contention and deadlock caused from within an application server. A determination is made as to whether a set of parameters in a statistical model indicates contention. If the set of parameters in the statistical model indicates contention, an application server administrator is notified of the contention and the number of threads in an application server pool is reduced. If the set of parameters in the statistical model indicates contention is reduced, the number of threads in the application server pool is increased.
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:
With reference now to the figures and in particular with reference to
With reference now to
An operating system runs on processor 202 and is used to coordinate and provide control of various components within data processing system 200 in
Those of ordinary skill in the art will appreciate that the hardware in
For example, data processing system 200, if optionally configured as a network computer, may not include SCSI host bus adapter 212, hard disk drive 226, tape drive 228, and CD-ROM 230. In that case, the computer, to be properly called a client computer, includes some type of network communication interface, such as LAN adapter 210, modem 222, or the like. As another example, data processing system 200 may be a stand-alone system configured to be bootable without relying on some type of network communication interface, whether or not data processing system 200 comprises some type of network communication interface. As a further example, data processing system 200 may be a personal digital assistant (PDA), which is configured with ROM and/or flash ROM to provide non-volatile memory for storing operating system files and/or user-generated data.
The depicted example in
The processes of the present invention are performed by processor 202 using computer implemented instructions, which may be located in a memory such as, for example, main memory 204, memory 224, or in one or more peripheral devices 226-230.
Using components of a data processing system, such as the example in
The set of parameters in the statistical model that indicate contention could be a selected combination of parameters. As another example, over a selected time period the amount of time spent waiting for a response is a certain amount, such as 10%, greater than the average wait time, but less than the selected percentage greater, such as 25%, than the average wait time. The parameter that represents time spent waiting for a response specifies that although the wait time for a response is 10% greater than average, the wait time for a response is not sufficiently greater (25%) to indicate contention by itself. However, if this parameter indicates that the wait time for a response is 10% greater than average and the parameter that represents thread pool use indicates thread pool use that is a certain amount, such as 20%, greater than average, but insufficient to indicate contention by itself, then the set of both parameters may be sufficient to indicate that the level of contention reached is undesirable.
As an another example, if an application server is subject to a consistent type of workload whose level is slightly increased, such as 15%, and that slight increase results in a significant increase in response time from the database, such as 200%, then the set of both parameters may be sufficient to indicate that the application has introduced an undesirable level of contention in the database.
If the set of specified parameters in the statistical model indicates that a level of contention is reached that is undesirable, the mechanism of the present invention notifies the application server administrator, as shown in step 504. The mechanism of the present invention also attempts to maintain application server functionality while the root cause is determined. The notification of the application server administrator and the attempts to temporarily resolve the situation can also be triggered by a set of trends involving specified parameters in the statistical model, not just the set of specified parameters in the statistical model.
Actions that the mechanism of the present invention can take to resolve the situation include, in addition to notifying the application server administrator, as shown in step 504, generally reducing the level of contention in the database and in application server pools. The general idea is to allow only enough threads to service inexpensive (quickly processed) and expensive (slowly processed) incoming requests. By reducing the number of threads in an application server pool to this minimal level, contention is often significantly reduced, as shown in step 506.
When contention is sufficiently reduced for a specified period of continuous time, the mechanism of the present invention will perform incremental increases in thread pool sizes periodically until a normal mode of operation is reached, or until an undesirable level of contention is established. If a thread pool size is reached that results in an undesirable level of contention the threads will again be reduced below that point of contention. The mechanism of the present invention establishes if the statistical model that initially indicated contention no longer indicates contention for a specified period of continuous time, as shown in step 508. If the statistical model that initially indicated contention continues to indicate contention, the mechanism of the present invention continues to reduce the number of threads in an application server pool. If the statistical model that initially indicated contention no longer indicates contention for a specified period of continuous time, the mechanism of the present invention increases the number of threads in an application server pool, as shown in step 510. If the number of threads equals the normal number of threads, the mechanism of the present invention returns to normal operation, as shown in step 512. If the number of threads does not equal the normal number of threads, the mechanism of the present invention resolves if the statistical model that initially indicated contention no longer indicates contention, as shown in step 514. If the statistical model that initially indicated contention no longer indicates contention, the mechanism of the present invention increases the number of threads. If the statistical model that initially indicated contention indicates contention, the mechanism of the present invention decreases the number of threads.
Optionally, the return to normal is executed by the application server administrator when this individual decides that the root case of contention has not only been determined, but also remedied, or the root cause of contention needs to be reproduced for further analysis.
Therefore, the mechanism of the present invention, described above, detects and reduces database contention and deadlock caused from within an application server by notifying application server administrators and tuning the application server during runtime.
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.
Norton, Carolyn Haibt, Laonipon, Bert Vincent, Minshall, Robbie John, Rangaswamy, Srinvasan K.
Patent | Priority | Assignee | Title |
Patent | Priority | Assignee | Title |
5175852, | Feb 13 1987 | EMOTIONMIRROR LIMITED | Distributed file access structure lock |
5377351, | Jun 20 1990 | Oki Electric Industry Co., Ltd. | Device for controlling multiple transactions contending concurrently for the same resource in a distributed database system |
5787409, | May 17 1996 | International Business Machines Corporation | Dynamic monitoring architecture |
5913060, | Oct 11 1995 | Citrix Systems, Inc | Method for deadlock avoidance in a distributed process system using a synchronous procedure call |
6981260, | May 25 2000 | International Business Machines Corporation | Apparatus for minimizing lock contention in a multiple processor system with multiple run queues when determining the threads priorities |
20050182582, | |||
20050183084, | |||
20060064426, |
Executed on | Assignor | Assignee | Conveyance | Frame | Reel | Doc |
Jul 29 2008 | International Business Machines Corporation | (assignment on the face of the patent) | / |
Date | Maintenance Fee Events |
May 29 2015 | REM: Maintenance Fee Reminder Mailed. |
Oct 18 2015 | EXP: Patent Expired for Failure to Pay Maintenance Fees. |
Date | Maintenance Schedule |
Oct 18 2014 | 4 years fee payment window open |
Apr 18 2015 | 6 months grace period start (w surcharge) |
Oct 18 2015 | patent expiry (for year 4) |
Oct 18 2017 | 2 years to revive unintentionally abandoned end. (for year 4) |
Oct 18 2018 | 8 years fee payment window open |
Apr 18 2019 | 6 months grace period start (w surcharge) |
Oct 18 2019 | patent expiry (for year 8) |
Oct 18 2021 | 2 years to revive unintentionally abandoned end. (for year 8) |
Oct 18 2022 | 12 years fee payment window open |
Apr 18 2023 | 6 months grace period start (w surcharge) |
Oct 18 2023 | patent expiry (for year 12) |
Oct 18 2025 | 2 years to revive unintentionally abandoned end. (for year 12) |