Abnormal long transaction processing method and device and related equipment
By querying the timeout transaction information of the database server in the detection device and judging its data operation amount, the abnormal long transaction is terminated, and the business impact problem caused by transaction waiting is solved, and the timely processing of abnormal long transactions and normal operation of the business is achieved.
Patent Information
- Application Number
- CN202311743552.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-18
- Publication Date
- 2025-06-20
AI Technical Summary
In the case where multiple transactions point to the same data, if the previous transaction does not commit, the subsequent transaction will wait until it fails, resulting in large-scale business impacts, especially when an exception occurs on the request side, the transaction cannot be released.
Provides an exception long transaction processing method, through the detection device connecting to the database server, querying the timeout transaction information of the database to be monitored, determines the amount of data operation, determines whether it is an exception long transaction, and terminates its processing.
It can detect and handle abnormal long transactions in a timely manner, avoid business failures caused by transaction waiting, and ensure the normal execution of subsequent business operations.
Smart Images

Figure CN120179625A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and particularly to a method, apparatus, and related equipment for processing abnormally long transactions. Background Art
[0002] In an application scenario where data is stored based on a database, a database and multiple applications can be deployed on a server. When an application operates on data, a transaction is initiated to update the data. However, in the case where multiple transactions point to the same data, if the previous transaction is not committed, subsequent transactions will wait until they fail, which can easily cause a large-scale impact on business. Herein, a transaction can refer to an operation in which an application updates any data in the database deployed on the server.
[0003] Currently, the conventional method is to perform timeout control at the application end where the transaction request is initiated, i.e., the request side. However, if an exception occurs on the request side, that is, the application crashes or it cannot trigger the timeout mechanism due to other reasons, then the timeout mechanism cannot be used to release the transaction, affecting the normal execution of subsequent business operations. Summary of the Invention
[0004] To solve the problems in the above-mentioned prior art, embodiments of this application provide a method, apparatus, and related equipment for processing abnormally long transactions, which can detect and process abnormally long transactions in a timely manner.
[0005] In a first aspect, an embodiment of this application provides a method for processing abnormally long transactions, which is applied to a detection device connected to a database server; the method includes:
[0006] Sending a query request to the database server according to the information of the database to be monitored; the query request instructs the database server to feedback the timeout transaction information of the database to be monitored;
[0007] Receiving the timeout transaction information sent by the database server; the timeout transaction information corresponds to at least one timeout transaction;
[0008] Determining the data operation volume of each timeout transaction according to the timeout transaction information, and determining whether each timeout transaction is an abnormally long transaction according to the data operation volume;
[0009] Terminating the abnormally long transaction.
[0010] In some embodiments, the information of the database to be monitored includes the name of the database to be monitored and the time threshold corresponding to the database to be monitored; the step of sending a query request to the database server according to the information of the database to be monitored includes:
[0011] Generate a query request according to the database name of each database to be monitored and the time threshold corresponding to each database to be monitored.
[0012] Send the query request to the database server.
[0013] In some embodiments, the determining whether each timeout transaction is an abnormally long transaction according to the data operation volume includes:
[0014] For each of the timeout transactions, perform the following operations respectively:
[0015] If the data operation volume of the timeout transaction is less than or equal to the set operation volume threshold, determine that the timeout transaction is an abnormally long transaction;
[0016] If the data operation volume of the timeout transaction is greater than the operation volume threshold, determine that the timeout transaction is not an abnormally long transaction.
[0017] In some embodiments, the method further includes:
[0018] Determine the application to be processed corresponding to the abnormally long transaction, and process the application to be processed.
[0019] In some embodiments, the detection device is connected to the application server; the processing of the application to be processed includes:
[0020] If the number of applications that have been isolated among the applications running on the application server is less than the set isolation number threshold, call the corresponding interface to isolate the application to be processed according to the application type of the application to be processed.
[0021] In some embodiments, the method further includes:
[0022] Send an alarm message for the abnormally long transaction to a set account.
[0023] In a second aspect, an embodiment of the present application provides an abnormally long transaction processing device, which is applied to a detection device, and the detection device is connected to a database server; the device includes:
[0024] An abnormally long transaction determination module, configured to send a query request to the database server according to the information of the database to be monitored; the query request instructs the database server to feedback the timeout transaction information of the database to be monitored; receive the timeout transaction information sent by the database server; the timeout transaction information corresponds to at least one timeout transaction; determine the data operation volume of each timeout transaction according to the timeout transaction information, and determine whether each timeout transaction is an abnormally long transaction according to the data operation volume;
[0025] An abnormally long transaction termination module, configured to terminate the abnormally long transaction.
[0026] In a third aspect, an embodiment of the present application provides a detection device, including: at least one processor, and a memory communicatively connected to the at least one processor, wherein:
[0027] The memory stores a computer program executable by the at least one processor, and when the computer program is executed by the at least one processor, the at least one processor is enabled to execute the above-mentioned abnormal long transaction processing method.
[0028] In a fourth aspect, an embodiment of the present application provides a data storage system, the data storage system includes a detection device and a database server connected to the detection device;
[0029] The detection device is configured to send a query request to the database server according to the information of the database to be monitored; the query request includes the information of the database to be monitored;
[0030] The database server is configured to determine a target database from the databases according to the information of the database to be monitored; determine a timeout transaction from each transaction associated with the target database, and generate timeout transaction information according to the determined timeout transaction; send the timeout transaction information to the detection device;
[0031] The detection device is further configured to determine the data operation amount of each timeout transaction according to the timeout transaction information, and determine whether each timeout transaction is an abnormal long transaction according to the data operation amount; terminate the abnormal long transaction.
[0032] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium. When the computer program in the computer-readable storage medium is executed by a processor of a computing device, the computing device is capable of executing the above-mentioned abnormal long transaction processing method.
[0033] An embodiment of the present application provides an abnormal long transaction processing method, apparatus and related devices. The abnormal long transaction processing method can be executed by a detection device independently set from a database server or an application server. The detection device obtains the timeout transaction information of the database to be monitored from the database server, determines the abnormal long transactions included in the timeout transactions according to the data operation amount of each timeout transaction included in the timeout transaction information, and processes the abnormal long transactions among them. Compared with the related art in which each application monitors the transactions initiated by itself, by using a detection device independently set from a database server or an application server to detect and process abnormal long transactions, it is possible to avoid the situation where a transaction cannot be committed or released due to an application exception, and it is possible to detect and process abnormal long transactions associated with the database in a timely manner, ensuring the normal execution of subsequent business operations. Description of the Drawings
[0034] Figure 1 It is a schematic structural diagram of a data storage system in the prior art;
[0035] Figure 2 It is a schematic diagram of a method for terminating a timeout transaction in the prior art;
[0036] Figure 3 It is a schematic diagram that a transaction cannot be terminated when an abnormal situation occurs in the prior art;
[0037] Figure 4 It is a schematic structural diagram of a data storage system provided by an embodiment of the present application;
[0038] Figure 5 It is another schematic structural diagram of a data storage system provided by an embodiment of the present application;
[0039] Figure 6 It is an interaction diagram of a method for handling an abnormally long transaction provided by an embodiment of the present application;
[0040] Figure 7 It is a flowchart of a detection device for handling an abnormally long transaction provided by an embodiment of the present application;
[0041] Figure 8 It is a flowchart for isolating different applications provided by an embodiment of the present application;
[0042] Figure 9 It is a structural block diagram of a device for detecting an abnormally long transaction provided by an embodiment of the present application;
[0043] Figure 10 It is another structural block diagram of a device for detecting an abnormally long transaction provided by an embodiment of the present application;
[0044] Figure 11 It is a schematic structural diagram of a detection device provided by an embodiment of the present application;
[0045] Figure 12 It is a schematic structural diagram of a server provided by an embodiment of the present application. Detailed implementation manners
[0046] In order to make the objectives, technical solutions, and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.
[0047] It should be noted that the application scenarios described in the embodiments of the present application below are for more clearly explaining the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art know that with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0048] The abnormal long transaction processing method provided by the embodiments of the present application can be applied to a data storage system. The data storage system can store data based on a database. The database can be saved in the server of the data storage system. In addition to deploying the database, multiple different applications can also be deployed on the server. As Figure 1 shown, a database 120 is deployed on the server 100, and a first application 110, a second application 111, and a third application 112 are also deployed. If when the first application 110 needs to operate on a certain data in the database, a first transaction is started. Before the first transaction is completed, if the second application 111 needs to operate on the same data in the database and starts a second transaction, but if the first transaction cannot end and cannot be released, the subsequent second transaction will wait until it fails, affecting the normal execution of the business of the second application. For example, if the first application 110 needs to perform an update operation on the data a in the database, a first transaction will be started. Before the first transaction is completed, if the second application 111 also needs to perform an update operation on the data a, it needs to wait for the first application 110 to complete the update operation on the data a before it can perform the update operation on the data a again. However, if the update operation of the first application 110 on the data a, that is, the first transaction processing times out and cannot be released, then the second application 111 will keep waiting for the first application 110 to end the update operation on the data a. Since the first transaction cannot be released, the second transaction fails to execute.
[0049] Currently, in order to avoid the situation where subsequent transactions fail to execute due to transaction processing timeout, timeout control is usually performed on the request side, that is, the application that starts the transaction performs timeout control on the corresponding transaction, as Figure 2 shown. Both the first application and the second application need to update the data 1 in the database. When the first application needs to update the data 1 first, the steps are as follows:
[0050] Step S210, the first application starts the first transaction.
[0051] Step S211, the first application updates the data 1.
[0052] Among them, the first application updating the data 1 is the first transaction started by the first application.
[0053] In one embodiment, when the execution time of a transaction exceeds the set time threshold, the transaction can be considered a timeout transaction.
[0054] For example, assume that the time threshold for determining whether a transaction times out is 2 seconds. When the execution time of the first transaction exceeds 2 seconds, it can be concluded that the first transaction is a timed-out transaction.
[0055] Step S212, the first application releases the first transaction due to timeout.
[0056] After the first application starts the first transaction, the second application also needs to update data 1. The steps are as follows:
[0057] Step S220, the second application starts the second transaction.
[0058] Step S221, the second application waits to update data 1.
[0059] Specifically, when the first application updates data 1, if the second application also needs to update data 1, the second application needs to wait until the first transaction ends or is released before performing the data update.
[0060] Step S222, after the first application releases the first transaction, the second application updates data 1.
[0061] After waiting for the first application to release the first transaction, the second application executes the second transaction and updates data 1. The above operations are the process of timeout control on the request side. However, if an abnormal situation occurs on the request side, the timed-out transaction cannot be released. The schematic diagram of the abnormal situation where the transaction cannot be terminated in the conventional solution is as Figure 3 shown.
[0062] Step S310, the first application starts the first transaction.
[0063] Step S311, the first application updates data 1.
[0064] Step S312, the first application crashes and cannot release the first transaction.
[0065] After the first application starts the transaction, the second application also needs to update data 1. The steps are as follows:
[0066] Step S320, the second application starts the second transaction.
[0067] Step S321, the second application waits to update data 1.
[0068] Specifically, since the first application crashes and the first transaction cannot be released, the second application cannot perform the update operation on data 1, that is, the second transaction cannot be executed.
[0069] Step S322, the second transaction times out and the service fails.
[0070] In one embodiment, when the waiting time for a transaction to be executed exceeds the set time threshold, the service can be considered to have failed.
[0071] For example, if the time threshold for waiting for a transaction to be released is 2 minutes, if the first application never releases the first transaction and the second application keeps waiting, the second transaction cannot be executed either. After 2 minutes, the processing of the second transaction times out and the service processing of the second application fails.
[0072] The above operation process is too dependent on the application to release the timeout transaction. However, if the application crashes and the previous transaction cannot be released, the subsequent transactions will wait until they fail, which easily affects the services of multiple applications.
[0073] Based on this, the embodiments of the present application provide an abnormal long transaction processing method, device and related equipment. In some embodiments, as Figure 4 shown, the data storage system may include a server 100 and a detection device 400. A database 120, a first application 110, a second application 111, and a third application 112 are deployed on the server 100. The first application 110, the second application 111, and the third application 112 can run based on virtual machines or containers deployed on the server 100. The detection device 400 is connected to the server 100. The detection device 400 can obtain the timeout transaction information of the database to be monitored from the server 100, determine the abnormal long transactions included in the timeout transactions according to the data operation volume of each timeout transaction included in the timeout transaction information, and process the abnormal long transactions among them.
[0074] In other embodiments, as Figure 5 shown, the data storage system may include a server cluster 500 and a detection device 400. Among them, the server cluster 500 may include multiple servers. For example, it may include a database server 510, a first application server 521, a second application server 522, and a third application server 523. The detection device 400 can be used to obtain the timeout transaction information of the database server 510, determine the abnormal long transactions included in the timeout transactions according to the data operation volume of each timeout transaction included in the timeout transaction information, and process the abnormal long transactions among them. Among them, the servers used by the first application server 521, the second application server 522, and the third application server 523 may be the same server.
[0075] Considering the possibility of failures in both the application and the database, a detection device is newly added. The detection device can be set separately outside the database server or the application server, so that the processing of abnormal long transactions no longer depends on the requests of the application and the database, avoiding the generation of failures. Figure 6 The interaction diagram of an abnormal long transaction processing method provided by the embodiments of the present application is shown, as Figure 6As shown, the method may include the following steps:
[0076] Step S601, the detection device generates a query request according to the information of the database to be monitored.
[0077] Specifically, under normal circumstances, a transaction will be processed within a certain time threshold. If the processing duration of a certain transaction exceeds the time threshold and the transaction has not been committed yet, it indicates that the transaction may be abnormal. The detection device in the embodiments of the present application is used to identify and process abnormal transactions.
[0078] The detection device stores the database names and time thresholds of each database to be detected. Among them, the database names of each database can be the database names set in the database server. For example, assume that the detection device stores the database names of two databases, and the database names of the two databases are Database A and Database B respectively. The detection device stores the first database to be detected, and the database name of this database is Database A. The detection device also stores the second database to be detected, and the database name of this database is Database B.
[0079] The time threshold is used to determine whether each transaction associated with the corresponding database times out. In one embodiment, the time threshold can be a fixed value, that is, all databases use the same time threshold. For example, the time threshold for all databases is 2 seconds.
[0080] In another embodiment, the time threshold can be set to different values according to different needs, and different databases use different time thresholds. For example, when the transactions associated with Database A can usually be completed and committed within a relatively short operation time, a smaller time threshold can be set for Database A. Exemplarily, the time threshold for Database A can be set to 1 second; when the transactions associated with Database B usually take a relatively long operation time to complete and commit, a larger time threshold can be set for Database B. Exemplarily, the time threshold for Database B can be set to 10 seconds. By flexibly setting different time thresholds for different databases, the accuracy of screening abnormal long transactions can be improved.
[0081] The detection device can assemble the database name of each database to be monitored saved and the time threshold corresponding to each database to be monitored to generate a query request.
[0082] Step S602, the detection device sends the query request to the database server.
[0083] The query request includes the database name of each database to be monitored and the time threshold corresponding to each database to be monitored.
[0084] Step S603: The database server determines the timeout transactions from each transaction associated with the database to be detected according to the received query request, and generates timeout transaction information based on the determined timeout transactions.
[0085] In some embodiments, assume that the query request includes the names of two databases to be monitored, namely Database A and Database B, and the time threshold for both Database A and Database B is 2 seconds.
[0086] If the processing duration of the first transaction associated with Database A is 1 second and the processing duration of the second transaction associated with Database A is 3 seconds, the database server compares the processing time of the first transaction in the transactions associated with Database A with the time threshold of Database A. Since the processing time of the first transaction is less than the time threshold of Database A, the first transaction is a normally processed transaction. The database server compares the processing time of the second transaction in the transactions associated with Database A with the time threshold of Database A. Since the processing time of the second transaction is greater than the time threshold of Database A, the second transaction is a timeout transaction.
[0087] If the processing duration of the third transaction associated with Database B is 0.5 second and the processing duration of the fourth transaction associated with Database B is 6 seconds, the database server compares the processing time of the third transaction in the transactions associated with Database B with the time threshold of Database B. Since the processing time of the third transaction is less than the time threshold of Database B, the third transaction is a normally processed transaction. The database server compares the processing time of the fourth transaction in the transactions associated with Database B with the time threshold of Database B. Since the processing time of the fourth transaction is greater than the time threshold of Database B, the fourth transaction is a timeout transaction.
[0088] The database server can generate timeout transaction information based on the information of the second transaction and the fourth transaction.
[0089] In other embodiments, assume that different databases correspond to different time thresholds. For example, the time threshold for Database A is 3 seconds and the time threshold for Database B is 6 seconds.
[0090] If the processing duration of the fifth transaction associated with Database A is 2 seconds and the processing duration of the sixth transaction associated with Database A is 4 seconds, the database server compares the processing time of the fifth transaction in the transactions associated with Database A with the time threshold of Database A. Since the processing time of the fifth transaction is less than the time threshold of Database A, the fifth transaction is a normally processed transaction. The database server compares the processing time of the sixth transaction in the transactions associated with Database A with the time threshold of Database A. Since the processing time of the sixth transaction is greater than the time threshold of Database A, the sixth transaction is a timeout transaction.
[0091] If the processing duration of the seventh transaction associated with database B is 5 seconds and the processing duration of the eighth transaction associated with database B is 9 seconds, the database server compares the processing time of the seventh transaction in the transactions associated with database B with the time threshold of database B. Since the processing time of the seventh transaction is less than the time threshold of database B, the seventh transaction is a normally processed transaction. The database server compares the processing time of the eighth transaction in the transactions associated with database B with the time threshold of database B. Since the processing time of the eighth transaction is greater than the time threshold of database B, the eighth transaction is a timeout transaction.
[0092] The database server can generate timeout transaction information based on the information of the sixth transaction and the information of the eighth transaction.
[0093] Specifically, the generated timeout transaction information may include the following information for each timeout transaction: the Structured Query Language (SQL) for the specific operation on the database, the IP of the client that connects to the database, i.e., the application, and the ID of the thread generated at the database end for the transaction.
[0094] Step S604, the database server sends the timeout transaction information to the detection device.
[0095] In some embodiments, assume that the timeout transaction information may include two timeout transactions, namely the second transaction associated with database A and the fourth transaction associated with database B. The database server sending the timeout transaction information to the detection device may include the following content: the SQL statement for the specific operation on database A for the second transaction, the IP of the application corresponding to the second transaction, and the ID of the thread generated at the database end for the second transaction; the SQL statement for the specific operation on database B for the fourth transaction, the IP of the application corresponding to the fourth transaction, and the ID of the thread generated at the database end for the fourth transaction.
[0096] Step S605, the detection device determines the abnormally long transactions included in the timeout transactions according to the data operation volume of each timeout transaction.
[0097] Among them, a timeout transaction is a transaction whose processing time exceeds the time threshold. However, not all timeout transactions are abnormally long transactions. It can be determined whether the data table in the database operated by the transaction is a data table that needs to be terminated according to the data operation volume on the database.
[0098] For example, assume that the timeout transaction information includes the information of transaction a and transaction b. According to the SQL statements of transaction a's specific operations on the database included in the information of transaction a, it can be obtained that transaction a only needs to update approximately one hundred pieces of data. According to the SQL statements of transaction b's specific operations on the database included in the information of transaction b, it can be obtained that transaction b needs to update approximately one hundred thousand pieces of data. When the operation volume threshold is five thousand pieces of data, the operation volume of transaction a is lower than the operation volume threshold, so it can be considered that transaction a processes less data. The operation volume of transaction b is higher than the operation volume threshold, so it can be considered that transaction b processes more data. The processing times of both transaction a and transaction b exceed the time threshold. It can be determined that transaction a requires less time to process less data. Therefore, transaction a can be considered an abnormally long transaction and needs to be processed. However, transaction b needs to process a large amount of data and requires a long processing time. Therefore, it is possible that the processing duration of transaction b exceeding the time threshold is normal. If transaction b is processed, it will affect the normal transaction processing operations. Therefore, the detection device filters according to the pre-set rules, determines the timeout transactions similar to transaction a as abnormally long transactions, and determines the timeout transactions similar to transaction b as normal transactions without targeted processing. Among them, the operation volume threshold can be five thousand pieces of data, that is, five thousand pieces of data is the operation volume threshold for distinguishing more and less data to be processed. More data to be processed requires a longer processing time, and less data to be processed requires a shorter processing time. Since the processing time is related to aspects such as the hardware performance of the database server, the data volume, and the complexity, different data volumes can be specified according to different actual situations as the operation volume threshold for distinguishing more and less data to be processed.
[0099] Step S606, the detection device processes the abnormally long transactions included in the timeout transactions.
[0100] Exemplarily, step S606 can be implemented through Figure 7 the flowchart shown, and this process can include the following steps:
[0101] Step S6061, generate an alarm message and send the alarm message to the set account.
[0102] The detection device will send an alarm message to the set account to alarm in case of an abnormally long transaction. In one embodiment, the set account can be the email, phone number, etc. of the operation and maintenance personnel. The detection device can let the operation and maintenance personnel of the system notice the abnormally long transaction through email, text message or phone call, etc. The operation and maintenance personnel of the system can view the specific reason for the abnormality.
[0103] Step S6062, terminate the abnormally long transaction.
[0104] The detection device can call the DBA interface to release or terminate an abnormally long transaction, and send the execution status of terminating the abnormally long transaction to the client or the user's terminal device. Among them, the detection device can use the DBA interface to access the database associated with the abnormally long transaction in the database server to terminate the abnormally long transaction.
[0105] Step S6063: Determine the application to be processed corresponding to the abnormally long transaction.
[0106] The detection device can call healthCheck with the application name of the application to be processed corresponding to the abnormally long transaction.
[0107] Step S6064: Process the application to be processed.
[0108] In some embodiments, the above steps S6063 to S6064 can also be executed before step S6062.
[0109] Exemplarily, step S6064 can be implemented through Figure 8 the flowchart shown, and this process can include the following steps:
[0110] Step S801: Determine the application type of the application to be processed.
[0111] The detection device can determine the application type of the application to be processed according to the application name of the application to be processed.
[0112] Step S802: Determine whether the application to be processed is a dubbo application. If so, execute step S803; if not, execute step S808.
[0113] The application types of the application to be processed can include the dubbo type and the schedule type. Among them, dubbo applications are mainly used to build distributed applications and services. It can provide high-performance and transparent remote method calls, support multiple protocols and registration centers, and has features such as load balancing, fault tolerance, and service governance, and can be used to build a microservice architecture. Different application servers and applications communicate with each other, and the services obtained by calling can be obtained through dubbo applications and transmitted to the management personnel so as to isolate the application to be processed in subsequent operations.
[0114] The detection device can determine whether the application to be processed is a dubbo application according to the application name of the application to be processed.
[0115] Step S803: Determine whether the number of applications that have been isolated among the applications running on the application server is less than the set isolation quantity threshold. If so, execute step S804; if not, execute step S808.
[0116] In some embodiments, the set isolation quantity threshold may be 2. When none of the three applications running on the application server are isolated, the isolation quantity is 0. Therefore, the isolation operation can be performed. If there is only one application left, that is, the isolation quantity is 2, then the isolation operation cannot be performed to avoid isolating all applications and the business cannot continue.
[0117] Step S804, call the interface corresponding to the dubbo application to isolate the application to be processed.
[0118] In some embodiments, if the application to be processed is an application running on the application server, the detection device can access the application server through the interface corresponding to the dubbo application, separate the application to be processed into an independent module or an independent service to achieve the purpose of isolating the application to be processed, and use the service governance tool provided by dubbo to uniformly manage and schedule the application to be processed.
[0119] After the detection device isolates the application to be processed, it can send the isolation situation of the application to be processed to the client or the user's terminal device to notify the client or the user's terminal device not to access the application to be processed anymore.
[0120] Step S805, determine whether the application to be processed is a schedule application. If so, execute step S806; if not, execute step S808.
[0121] Among them, the schedule application refers to an application program for timing task scheduling. It can help developers execute tasks at specific time intervals or fixed time points, such as sending emails regularly, backing up data regularly, etc. The schedule application can be used to reject task distribution and isolate the application to be processed.
[0122] The detection device can determine whether the application to be processed is a schedule application according to the application name of the application to be processed.
[0123] Step S806, determine whether the quantity of the applications that have been isolated among the applications running on the application server is less than the set isolation quantity threshold. If so, execute step S807; if not, execute step S808.
[0124] Step S807, call OpenAPI to isolate the application to be processed.
[0125] In some embodiments, the detection device needs to find the OpenAPI interface related to the schedule application. If the application to be processed is an application running on the application server, the detection device can access the application server through the OpenAPI interface related to the schedule application, separate the application to be processed into an independent module or an independent service, so that the application to be processed can only access its own data and cannot access the data of other applications.
[0126] After the detection device isolates the application to be processed, it can send the isolation status of the application to be processed to the client or the user's terminal device, notifying the client or the user's terminal device not to access the application to be processed anymore.
[0127] Step S808, end.
[0128] In some embodiments, the above steps S805 to S807 may also be executed before step S802.
[0129] In the above embodiments, the database server and the application server may be the same server or different servers.
[0130] The embodiments of the present application provide an abnormal long transaction processing method, device and related equipment. The detection device obtains the timeout transaction information of the database to be monitored from the database server, determines the abnormal long transactions included in the timeout transactions according to the data operation volume of each timeout transaction included in the timeout transaction information, and processes the abnormal long transactions among them. Because there is a possibility of failures in both the application and the database, a bypass detection device deployed on a separate server is added, so that the release of abnormal long transactions no longer depends on the requests of the application and the database, avoiding the generation of failures.
[0131] Based on the same inventive concept, the embodiments of the present application also provide an abnormal long transaction detection device applied to a detection device, as Figure 9 shown. The abnormal long transaction detection device includes:
[0132] An abnormal long transaction determination module 901, according to the information of the database to be monitored, sends a query request to the database server; the query request instructs the database server to feedback the timeout transaction information of the database to be monitored; receives the timeout transaction information sent by the database server; the timeout transaction information corresponds to at least one timeout transaction; determines the data operation volume of each timeout transaction according to the timeout transaction information, and determines whether each timeout transaction is an abnormal long transaction according to the data operation volume;
[0133] An abnormal long transaction termination module 902, used to terminate the abnormal long transaction.
[0134] In some embodiments, the abnormally long transaction determination module 901 is specifically configured to:
[0135] Generate a query request according to the database name of each database to be monitored and the time threshold corresponding to each database to be monitored;
[0136] Send the query request to the database server.
[0137] In some embodiments, the abnormally long transaction determination module 901 is specifically configured to:
[0138] For each of the timeout transactions, perform the following operations respectively:
[0139] If the data operation volume of the timeout transaction is less than or equal to the set operation volume threshold, determine that the timeout transaction is an abnormally long transaction;
[0140] If the data operation volume of the timeout transaction is greater than the operation volume threshold, determine that the timeout transaction is not an abnormally long transaction.
[0141] In some embodiments, the abnormally long transaction termination module 902 is specifically configured to:
[0142] Determine the application to be processed corresponding to the abnormally long transaction, and process the application to be processed.
[0143] In some embodiments, the abnormally long transaction termination module 902 is specifically configured to:
[0144] If the number of isolated applications among the applications running on the application server is less than the set isolation number threshold, call the corresponding interface to isolate the application to be processed according to the application type of the application to be processed.
[0145] In some embodiments, the abnormally long transaction termination module 902 is specifically configured to:
[0146] Send an alarm message for the abnormally long transaction to the set account.
[0147] Based on the same inventive concept, an abnormally long transaction processing device applied to a database server is further provided in an embodiment of the present application, as Figure 10 shown. The abnormally long transaction processing device includes:
[0148] A target database determination module 1001, configured to receive the query request sent by the detection device; the query request includes information of the database to be monitored; determine a target database from the databases according to the information of the database to be monitored;
[0149] The timeout transaction determination module 1002 is configured to determine timeout transactions from each transaction associated with the target database, generate timeout transaction information based on the determined timeout transactions, and send the timeout transaction information to the detection device.
[0150] In some embodiments, the timeout transaction determination module 1002 is specifically configured to:
[0151] For each transaction associated with the target database, if the processing time of the transaction is greater than the time threshold corresponding to the database to be monitored, determine that the transaction is a timeout transaction.
[0152] Based on the same technical concept as the above method embodiments, a detection device is further provided in the embodiments of the present application. The server may be Figure 4 or Figure 5 the detection device shown in. The detection device can be used to implement the functions performed by the detection device in the above method embodiments, and thus can achieve the beneficial effects possessed by the above method embodiments.
[0153] In some embodiments, the structure of the detection device 1100 may be as shown in Figure 11 and includes a processor 1101 and a memory 1102 connected to the processor 1101. The processor 1101 and the memory 1102 may be interconnected through a bus. The processor 1101 may be a general-purpose processor, such as a microprocessor, or other conventional processors. The bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc.
[0154] Among them, the memory 1102 may be used to store software programs and modules. The processor 1101 executes various functional applications and data processing of the detection device 1100 by running the software programs and modules stored in the memory 1102, such as the abnormal long transaction processing method provided in the embodiments of the present application.
[0155] The memory 1102 may mainly include a program storage area and a data storage area. Among them, the program storage area may store an operating system, application programs of at least one application, etc.; the data storage area may be used to store user data, etc. In addition, the memory 1102 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0156] The processor 1101 in the detection device 1100 is used to run the computer instructions or programs saved in the memory 1102 and execute the functions in any of the above method embodiments. In some embodiments, the processor 1101 may include one or more processing units. Different processing units may be independent devices or integrated in one or more processors. The processor 1101 may also include a controller. The controller may generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching instructions and executing instructions.
[0157] In one embodiment, the detection device 1100 may further include a communication module, which may be the network card described above and is used to communicate with the terminal device.
[0158] It can be understood that the structure schematically shown in the embodiments of the present application does not constitute a specific limitation on the detection device. In other embodiments of the present application, the chip may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0159] Based on the same technical concept as the above method embodiments, the embodiments of the present application also provide a server. The server may be Figure 5 the database server 510 among them. The server may be used to implement the functions performed by the database server in the above method embodiments, and thus may achieve the beneficial effects possessed by the above method embodiments.
[0160] In some embodiments, the structure of the server 1200 may be as Figure 12 shown, including a processor 1201 and a memory 1202 connected to the processor 1201. The processor 1201 and the memory 1202 may be interconnected through a bus. The processor 1201 may be a general-purpose processor, such as a microprocessor, or other conventional processors. The bus may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc.
[0161] Among them, the memory 1202 may be used to store software programs and modules. The processor 1201 executes various functional applications and data processing of the server 1200 by running the software programs and modules stored in the memory 1202, such as the abnormal long transaction processing method provided in the embodiments of the present application.
[0162] The memory 1202 may mainly include a program storage area and a data storage area. Among them, the program storage area may store an operating system, application programs of at least one application, etc.; the data storage area may be used to store user data, etc. In addition, the memory 1202 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0163] The processor 1201 in the server 1200 is used to run the computer instructions or programs saved in the memory 1202 and execute the functions in any of the above method embodiments. In some embodiments, the processor 1201 may include one or more processing units. Different processing units may be independent devices or may be integrated in one or more processors. The processor 1201 may also include a controller. The controller may generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching instructions and executing instructions.
[0164] In one embodiment, the server 1200 may further include a communication module. The communication module may be the network card described above and is used to communicate with the server.
[0165] It can be understood that the structure schematically shown in the embodiments of the present application does not constitute a specific limitation on the server. In other embodiments of the present application, the chip may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0166] The embodiments of the present application further provide a data storage system, including a detection device and a database server connected to the detection device.
[0167] The detection device is used to send a query request to the database server according to the information of the database to be monitored; the query request includes the information of the database to be monitored;
[0168] The database server is used to determine a target database from the databases according to the information of the database to be monitored; determine timeout transactions from each transaction associated with the target database, and generate timeout transaction information according to the determined timeout transactions; send the timeout transaction information to the detection device;
[0169] The detection device is further used to determine the data operation volume of each timeout transaction according to the timeout transaction information, determine whether each timeout transaction is an abnormally long transaction according to the data operation volume; and terminate the abnormally long transaction.
[0170] The embodiments of the present application further provide a computer program product containing computer-executable instructions. In one embodiment, the computer-executable instructions are used to cause a computer to execute the functions in the above method embodiments.
[0171] The computer-executable instructions can be stored in a computer-readable storage medium. An embodiment of the present application also provides a computer-readable storage medium, in which executable instructions are stored. In one embodiment, the computer-executable instructions are used to cause a computer to execute the functions in the above method embodiments.
[0172] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0173] The present application is described with reference to the flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the present application. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing devices generate a device for implementing the functions specified in one Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0174] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured product including an instruction device, and the instruction device implements the functions specified in one Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0175] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0176] Obviously, those skilled in the art can make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalent technologies, this application is also intended to include these modifications and variations.
Claims
1. An abnormal long transaction processing method, characterized in that, Applied to a detection device, the detection device being connected to a database server; the method includes: Sending a query request to the database server according to the information of the database to be monitored; the query request instructs the database server to feedback the timeout transaction information of the database to be monitored; Receiving the timeout transaction information sent by the database server; the timeout transaction information corresponds to at least one timeout transaction; Determining the data operation volume of each timeout transaction according to the timeout transaction information, and determining whether each timeout transaction is an abnormally long transaction according to the data operation volume; Terminating the abnormally long transaction.
2. The method according to claim 1, characterized in that, The information of the database to be monitored includes the name of the database to be monitored and the time threshold corresponding to the database to be monitored; The sending a query request to the database server according to the information of the database to be monitored includes: Generating a query request according to the name of each database to be monitored and the time threshold corresponding to each database to be monitored; Sending the query request to the database server.
3. The method according to claim 1, characterized in that, The determining whether each timeout transaction is an abnormally long transaction according to the data operation volume includes: Performing the following operations respectively for each of the timeout transactions: If the data operation volume of the timeout transaction is less than or equal to the set operation volume threshold, determining that the timeout transaction is an abnormally long transaction; If the data operation volume of the timeout transaction is greater than the operation volume threshold, determining that the timeout transaction is not an abnormally long transaction.
4. The method according to claim 1, characterized in that, The method further includes: Determining the application to be processed corresponding to the abnormally long transaction, and processing the application to be processed.
5. The method according to claim 4, characterized in that, The detection device is connected to an application server; the processing the application to be processed includes: If the number of applications that have been isolated among the applications running on the application server is less than the set isolation number threshold, isolating the application to be processed by calling the corresponding interface according to the application type of the application to be processed.
6. The method according to claim 4 or 5, characterized in that, The method further includes: Sending an alarm message for the abnormally long transaction to a set account.
7. An abnormal long transaction processing apparatus, characterized in that, Applied to a detection device, the detection device being connected to a database server; the device includes: An abnormally long transaction determination module, configured to send a query request to the database server according to the information of the database to be monitored; the query request instructs the database server to feedback the timeout transaction information of the database to be monitored; receiving the timeout transaction information sent by the database server; the timeout transaction information corresponds to at least one timeout transaction; determining the data operation volume of each timeout transaction according to the timeout transaction information, and determining whether each timeout transaction is an abnormally long transaction according to the data operation volume; An abnormally long transaction termination module, configured to terminate the abnormally long transaction.
8. A detection device, characterized in that, Including: At least one processor, and a memory communicatively connected to the at least one processor, wherein: The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the method according to any one of claims 1 to 6.
9. A data storage system, characterized in that, The data storage system includes a detection device and a database server connected to the detection device; The detection device is used to send a query request to the database server according to the information of the database to be monitored; the query request includes the information of the database to be monitored; The database server is used to determine a target database from the databases according to the information of the database to be monitored; determine timeout transactions from each transaction associated with the target database, and generate timeout transaction information according to the determined timeout transactions; Send the timeout transaction information to the detection device; The detection device is further used to determine the data operation volume of each timeout transaction according to the timeout transaction information, and determine whether each timeout transaction is an abnormally long transaction according to the data operation volume; Terminate the abnormally long transaction.
10. A computer-readable storage medium, characterized in that, When the computer program in the computer-readable storage medium is executed by the processor of the computing device, the computing device can execute the method according to any one of claims 1 to 6.