CN109117295B - Transaction timeout monitoring method and device - Google Patents

Transaction timeout monitoring method and device Download PDF

Info

Publication number
CN109117295B
CN109117295B CN201810790907.0A CN201810790907A CN109117295B CN 109117295 B CN109117295 B CN 109117295B CN 201810790907 A CN201810790907 A CN 201810790907A CN 109117295 B CN109117295 B CN 109117295B
Authority
CN
China
Prior art keywords
transaction
slot
array
processing
pointer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810790907.0A
Other languages
Chinese (zh)
Other versions
CN109117295A (en
Inventor
乔子木
缪海波
刘蓉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Unionpay Co Ltd
Original Assignee
China Unionpay Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Unionpay Co Ltd filed Critical China Unionpay Co Ltd
Priority to CN201810790907.0A priority Critical patent/CN109117295B/en
Publication of CN109117295A publication Critical patent/CN109117295A/en
Application granted granted Critical
Publication of CN109117295B publication Critical patent/CN109117295B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0751Error or fault detection not based on redundancy
    • G06F11/0754Error or fault detection not based on redundancy by exceeding limits
    • G06F11/0757Error or fault detection not based on redundancy by exceeding limits by exceeding a time limit, i.e. time-out, e.g. watchdogs

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The embodiment of the invention relates to the technical field of data processing, in particular to a transaction overtime monitoring method and device, which are used for reducing processing delay of overtime transactions. The embodiment of the invention comprises the following steps: determining a transaction processing duration of a transaction; dividing the transaction into monitoring groups according to the transaction processing duration of the transaction; carrying out overtime judgment on the transaction in the corresponding monitoring group at different time points; and carrying out transaction timeout processing on the transaction determined to be timeout.

Description

Transaction timeout monitoring method and device
Technical Field
The invention relates to the technical field of data processing, in particular to a transaction overtime monitoring method and device.
Background
The prior art monitors transaction timeouts and batch processes are primarily by polling the records of the database flow meters. For example, when a transaction message is stored in the database, a processing start time and a processing end time are set, and when the transaction is ended, a transaction status flag is set. A separate process exists in the transaction framework for database polling, and polling is performed every X seconds to detect whether any transaction in the database pipeline has a timeout flag that is not over, but has exceeded the processing time. For these timeout transactions, the polling process updates the timeout flag and then performs transaction timeout processing. And immediately processing the overtime transaction, and waiting for the next polling period to perform overtime judgment on the transaction which does not reach the transaction processing time length.
The prior art methods are relatively simple to implement but have significant disadvantages. The timeout polling process will poll at intervals and wait for the next polling process for transactions that have not reached the end of the process. Such a manner of operation does not properly handle transactions that are at the critical point of timeout. Assuming that the polling period is 30s, when a transaction is polled by the polling process, the difference is 1s and the processing end time is reached, and because the transaction cannot be marked as an overtime transaction, the transaction can be processed only after waiting for the next polling after 30s, so that great processing delay is generated.
Disclosure of Invention
The application provides a transaction overtime monitoring method and device, which are used for reducing processing delay of overtime transactions.
The transaction timeout monitoring method provided by the embodiment of the invention comprises the following steps:
determining a transaction processing duration of a transaction;
dividing the transaction into monitoring groups according to the transaction processing duration of the transaction;
carrying out overtime judgment on the transaction in the corresponding monitoring group at different time points;
and carrying out transaction timeout processing on the transaction determined to be timeout.
Optionally, one monitoring group is a group of slots of the time wheel timer;
the dividing the transaction into monitoring groups according to the transaction processing duration of the transaction comprises:
determining the number of the array slots corresponding to the transaction and the polling times of the transaction according to the transaction processing duration of the transaction and the array slot number of the time wheel timer;
placing the transaction into a corresponding array slot;
said determining a timeout for a transaction in a corresponding monitoring packet at a different point in time comprises:
determining an array slot to be determined pointed by a slot pointer of the time wheel timer;
judging the transaction with the polling frequency of 0 in the data slot to be judged as an overtime transaction;
the slot pointer of the time wheel timer jumps according to a specified time interval, and the slot pointer points to the next adjacent group of slots once jumping;
and when the slot pointer of the time wheel timer points to one array slot, subtracting 1 from the polling times of all transactions in the array slot pointed by the slot pointer.
Optionally, the number of the array slot corresponding to the transaction is calculated according to the following formula:
N=(T+m)mod(L·s)
calculating the number of polls for the transaction according to the following formula:
R=(T+m)div(L·s)
wherein N is a data slot number corresponding to the transaction; r is the polling times of the transaction; t is the transaction processing duration of the transaction; m is the number of the array slot pointed by the current slot pointer; l is the number of the groups of slots of the time wheel timer; s is the time interval during which the slot pointer jumps once.
Optionally, before the transaction timeout processing packet is performed on the transaction determined to be timeout, the method further includes:
receiving a transaction completion message for the transaction;
removing the transaction from the monitoring packet.
An embodiment of the present invention further provides a transaction timeout monitoring device, including:
the analysis unit is used for determining the transaction processing duration of the transaction;
the dividing unit is used for dividing the transaction into monitoring groups according to the transaction processing time length of the transaction;
the judging unit is used for carrying out overtime judgment on the transaction in the corresponding monitoring group at different time points;
and the processing unit is used for carrying out transaction timeout processing on the transaction which is judged to be timeout.
Optionally, one monitoring group is a group of slots of the time wheel timer;
the dividing unit is specifically configured to:
determining the number of the array slots corresponding to the transaction and the polling times of the transaction according to the transaction processing duration of the transaction and the array slot number of the time wheel timer;
placing the transaction into a corresponding array slot;
the determination unit is specifically configured to:
determining an array slot to be determined pointed by a slot pointer of the time wheel timer;
judging the transaction with the polling frequency of 0 in the data slot to be judged as an overtime transaction;
the slot pointer of the time wheel timer jumps according to a specified time interval, and the slot pointer points to the next adjacent group of slots once jumping;
and when the slot pointer of the time wheel timer points to one array slot, subtracting 1 from the polling times of all transactions in the array slot pointed by the slot pointer.
Optionally, the dividing unit is specifically configured to calculate the number of the array slot corresponding to the transaction according to the following formula:
N=(T+m)mod(L·s)
the dividing unit is specifically configured to calculate the polling frequency of the transaction according to the following formula:
R=(T+m)div(L·s)
wherein N is a data slot number corresponding to the transaction; r is the polling times of the transaction; t is the transaction processing duration of the transaction; m is the number of the array slot pointed by the current slot pointer; l is the number of the groups of slots of the time wheel timer; s is the time interval during which the slot pointer jumps once.
Optionally, the processing unit is further configured to:
receiving a transaction completion message for the transaction;
removing the transaction from the monitoring packet.
An embodiment of the present invention further provides an electronic device, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the above-described method.
Embodiments of the present invention also provide a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the above method.
In the embodiment of the invention, when a transaction needing overtime monitoring is received, the transaction processing time length of the transaction is firstly determined, and the transaction is divided into corresponding monitoring groups according to the transaction processing time length of the transaction. That is, all monitored transactions in the database are divided into different monitoring groups. Different monitoring groups correspond to different time points, overtime judgment is carried out on the transaction in the corresponding monitoring group at different time points, and transaction overtime processing is carried out on the transaction with overtime judgment bit. The embodiment of the invention monitors the transaction overtime aiming at different transaction processing durations, ensures the timeliness of each transaction processing and reduces the processing delay of the overtime transaction. In addition, the embodiment of the invention monitors the transactions in groups, and the transactions in one group only need to be monitored at each time point, thereby reducing the database pressure caused by the process polling the whole database.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic flow chart of a transaction timeout monitoring method according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of a timer for a time wheel according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a transaction timeout monitoring module according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a system suitable for use with embodiments of the present invention;
fig. 5 is a schematic structural diagram of a transaction timeout monitoring apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention provides a transaction timeout monitoring method. As shown in fig. 1, the transaction timeout monitoring method provided in the embodiment of the present invention includes the following steps:
step 101, determining the transaction processing time length of the transaction.
And 102, dividing the transaction into monitoring groups according to the transaction processing time length of the transaction.
And 103, carrying out overtime judgment on the transaction in the corresponding monitoring group at different time points.
And 104, performing transaction timeout processing on the transaction determined to be timeout.
In the embodiment of the invention, when a transaction needing overtime monitoring is received, the transaction processing time length of the transaction is firstly determined, and the transaction is divided into corresponding monitoring groups according to the transaction processing time length of the transaction. That is, all monitored transactions in the database are divided into different monitoring groups. Different monitoring groups correspond to different time points, overtime judgment is carried out on the transaction in the corresponding monitoring group at different time points, and transaction overtime processing is carried out on the transaction with overtime judgment bit. The embodiment of the invention monitors the transaction overtime aiming at different transaction processing durations, ensures the timeliness of each transaction processing and reduces the processing delay of the overtime transaction. In addition, the embodiment of the invention monitors the transactions in groups, and the transactions in one group only need to be monitored at each time point, thereby reducing the database pressure caused by the process polling the whole database.
In embodiments of the present invention, transactions are managed using a time-wheel timer. One supervision packet is an array slot of the time wheel timer.
The dividing the transaction into monitoring groups according to the transaction processing duration of the transaction comprises:
determining the number of the array slots corresponding to the transaction and the polling times of the transaction according to the transaction processing duration of the transaction and the array slot number of the time wheel timer;
placing the transaction into a corresponding array slot;
said determining a timeout for a transaction in a corresponding monitoring packet at a different point in time comprises:
determining an array slot to be determined pointed by a slot pointer of the time wheel timer;
judging the transaction with the polling frequency of 0 in the data slot to be judged as an overtime transaction;
the slot pointer of the time wheel timer jumps according to a specified time interval, and the slot pointer points to the next adjacent group of slots once jumping;
and when the slot pointer of the time wheel timer points to one array slot, subtracting 1 from the polling times of all transactions in the array slot pointed by the slot pointer.
The time wheel timer, as shown in fig. 2, refers to a time closed-loop crawler, each section represents equal time, each section corresponds to one group of slots, and a transaction monitoring linked list is maintained in one group of slots and is used for counting transactions requiring timeout determination at a current time point. A groove pointer rotates at the center of the track, and the rotating speed is constant. When a section is transferred, the transaction in the group of slots corresponding to the section is determined. The slot pointer in the time wheel timer jumps at regular time intervals, with the slot pointer pointing to the next adjacent array of slots once per jump. The slot pointer is always rotated, and then transactions in the group of slots can be determined at regular time intervals. In the embodiment of the invention, the transaction needing overtime monitoring is analyzed, the transaction processing time length is determined, and the array slot for maintaining the transaction and the polling frequency of the transaction are determined according to the transaction processing time length and the array slot number of the set time wheel timer.
Each time the slot pointer of the time wheel timer points to an array slot, the polling times of each transaction in the array slot pointed to by the slot pointer are reduced by 1. That is, the polling times of the transactions are used for performing timeout determination on the transactions, and the transactions with the polling times of 0 in the array slots to be determined are determined to be timeout transactions.
Specifically, the number of the array slot corresponding to the transaction is calculated according to the following formula:
n ═ T + m) mod (L · s) … … … … equation 1
Calculating the number of polls for the transaction according to the following formula:
r ═ T + m) div (L · s) … … … … equation 2
Wherein N is a data slot number corresponding to the transaction; r is the polling times of the transaction; t is the transaction processing duration of the transaction; m is the number of the array slot pointed by the current slot pointer; l is the number of the groups of slots of the time wheel timer; s is the time interval during which the slot pointer jumps once.
For example, the timer for setting the time wheel includes 30 sets of slots, and the corresponding sets of slots are numbered 0, 1, and 2 … … 29, respectively. And the slot pointer of the time wheel timer jumps to the next adjacent array slot every s seconds, and if s is 2, the slot pointer jumps once every 2 seconds. That is, second 0, the slot pointer points to array slot 0; second 2, slot pointer points to array slot 1; by analogy, at 58 seconds, the slot pointer points to array slot 29; by second 60, the slot pointer points to array slot 0 again.
If the transaction processing time of the transaction is 2 minutes, the number of the array slot pointed by the current slot pointer is 3, namely the slot pointer points to the array slot 3 at the moment of receiving the monitored transaction. The number of the array slot corresponding to the transaction is N ═ 120+3) mod (30 × 2) ═ 3, the polling frequency of the transaction is R ═ 120+3) div (30 × 2) ═ 2, that is, the transaction is put into the data slot 3, and when the slot pointer points to the data slot 3 for the second time, the polling frequency of the transaction is reduced to 0, and the transaction is judged to be over time.
And when the transaction is determined to be overtime, carrying out transaction overtime processing on the transaction. For the transaction which is subjected to transaction overtime processing, the embodiment of the invention can select to delete the information of the transaction in the array slot or select to monitor the transaction again, and if the transaction is monitored again, overtime modification is required to be carried out on the transaction. Firstly, the transaction information is analyzed, the position of the transaction in the array slot is determined, and then the new position of the transaction in the array slot is calculated according to the transaction overtime processing information of the transaction. The transaction is removed from the current array slot of the time wheel timer and inserted into a new array slot.
To facilitate locating transactions in a time wheel timer, embodiments of the present invention utilize a hash structure to manage location information for transactions. The key value uses a label of the transaction, such as a transaction serial number, and can quickly retrieve each transaction maintained in the array slot of the time wheel timer. In the embodiment of the present invention, the information maintained in the hash node for the transaction is consistent with the information maintained in the group slot for the transaction, and the structure of the information is as follows:
(1) uiMt64_ t traMs _ id; // trade serial number
(2) uiMt64_ t timeout; // time-out time
(3) struct traMs _ timer _ Mext; // Hash Table successor
(4) struct traMs _ timer _ ammchor _ ptr; // Hash Table predecessor
(5) struct traMs _ timer _ slot _ Mext; // transaction linked list successor overtime
(6) struct traMs _ timer _ slot _ aMchor _ ptr; // timeout transaction linked list predecessor
(7) TIMER _ FUMC cb; // callback function
(8) uiMt32_ t rotate; // number of time rounds
(9) uiMt8_ t slot _ idx; // time wheel index
(10) uiMt8_ t repeat; // whether or not to repeat
(11) uiMt8_ t category; // transaction type
(12) char haMdle _ svc [16 ]; // time-out handling service
In addition, in the embodiment of the present invention, before the processing the transaction timeout processing packet on the transaction determined to be timeout, the processing method further includes:
receiving a transaction completion message for the transaction;
removing the transaction from the monitoring packet.
Specifically, in the embodiment of the present invention, before the transaction is determined to be timeout, if a transaction completion message of the transaction is received, it is determined that the transaction has been normally processed and needs to be cancelled out due to timeout, that is, the transaction is removed from the array slot. Specifically, the array slot position in the time round timer where the transaction is located may be found through the transaction information maintained in the hash table. The information of the transaction in the array slot of the time wheel timer is removed first, and then the information of the transaction is deleted from the hash table.
In order to more clearly understand the present invention, the above-mentioned flow is described in detail below with specific examples. The structure of the transaction timeout monitoring module provided by the embodiment of the present invention is shown in fig. 3, and includes: the parsing submodule 301, the management submodule 302 and the processing submodule 303 adopt a single-process multi-thread structure.
The parsing submodule 301 mainly parses the received transaction that needs to be monitored overtime, determines the serial number, transaction processing duration, transaction type, and the like of the transaction, and transmits the serial number, the transaction processing duration, the transaction type, and the like to the management submodule 302 through an internal data format.
The management sub-module 302 mainly manages the timeout monitoring information of each transaction and performs time statistics. As shown in fig. 3, the management submodule 302 is composed of a time wheel timer 304 and an information table 305. The time wheel timer 304 is of an array structure, and each array slot maintains a transaction monitoring linked list for counting the transactions requiring timeout determination at the current time point. The information table 305 is stored in a hash structure, and the key value is composed of a transaction serial number and a transaction type.
The slot pointer jump timing of the time wheel timer 304 may be handled by a termfd mechanism, which may convert the time planning operation of the time wheel timer 304 into a read-write operation, and control the operation with the pipeline operation of the transaction processing response by EPOLL/kquesue, thereby avoiding the problem of lock handling by the management submodule 302 and improving the processing efficiency of the management submodule 302.
The processing submodule 303 is configured to receive the transaction processing task assigned by the management submodule 302, and the data obtained by the processing submodule 303 includes specific information of the transaction determined to be timeout, such as a transaction serial number, a transaction type, a transaction processing duration, and the like. The processing submodule 303 is dedicated to processing the transaction determined to be timeout, so as to relieve the computational pressure of the management submodule 302 and ensure the accuracy of the management submodule 302.
The embodiment of the invention also creates a plurality of pipeline descriptors for communication among the sub-modules.
In the embodiment of the invention, the management submodule 302 creates a time descriptor, generates readable state change every 1 second, and manages the request descriptor (the read end of the pipeline descriptor) and the time descriptor together through operations such as EPOLL/KQUEUE and the like. The time descriptor will respond every 1 second, updating the slot pointer pointing of the time wheel timer. When the slot pointer points to the data slot 0, the management submodule 302 traverses all transaction information in the data slot 0, and checks whether each transaction in the data slot 0 is an overtime transaction; after 1 second, the slot pointer points to the data slot 1, the management submodule 302 traverses all transaction information in the data slot 1, and checks whether each transaction in the data slot 1 is an overtime transaction; after 1 second, the slot pointer points to the data slot 2, the management submodule 302 traverses all transaction information in the data slot 2, checks whether each transaction in the data slot 2 is an overtime transaction, and so on.
The specific work flow of the three sub-modules is as follows:
the analysis submodule 301 receives a transaction timeout monitoring request sent from the outside, analyzes the request, determines information such as a transaction serial number, a transaction processing duration, a transaction type and the like of a transaction, and transmits the information to the management submodule 302 through a pipeline.
The management submodule 302 receives the transaction timeout monitoring request sent by the parsing submodule 301, adds transaction information to the information table 305 according to the serial number and the transaction type of the transaction, and calculates the array slots required to be inserted for the transaction according to the array slot number and the transaction processing time length of the current time round timer 304.
The management submodule 302 determines the transaction in the array of slots pointed by the slot pointer, and when a transaction timeout is detected, sends the timeout transaction to the processing submodule 303.
The processing sub-module 303 processes the timeout transaction. After the processing submodule 303 determines the transaction serial number of the overtime transaction, a transaction overtime flag needs to be set to ensure that the normal processing flow can be terminated normally after the transaction processing duration is exceeded, and then normal transaction processing can be performed.
If the transaction is normally processed before the transaction processing time length is reached, the parsing sub-module 301 receives a transaction completion message. After the analysis submodule 301 analyzes the transaction completion message, the transaction completion message is forwarded to the management submodule 302. Management submodule 302 finds the transaction from information table 305 based on the received transaction serial number. The transaction is first removed from the array slot of the time wheel timer 304 and then deleted from the information table 305.
A system to which embodiments of the present invention are applicable is shown in fig. 4, and includes one or more computers in which the transaction timeout monitoring module is deployed. If the system includes multiple computers, the transaction may be processed online.
When the computer 401 sends the transaction to an external system, the transaction timeout monitoring module on the computer 401 performs clock statistics and performs transaction timeout monitoring on internally managed transactions according to the period of the time wheel timer. When the transaction feedback is responded according to the original route, the transaction processing module of the computer 401 deletes or modifies the registered overtime transaction by interacting with the transaction overtime monitoring module, so that the transaction is forwarded again or is finished.
When a transaction is sent to an external system and cross-machine processing is generated during transaction feedback, the computer 402 processing the transaction first obtains the address of the computer 401 monitoring the transaction overtime. After the transaction processing module of the computer 402 acquires the address of the computer 401 of the timeout monitoring module of the transaction, a cross-machine request is generated to update the transaction information of the current transaction in the timeout monitoring module of the computer 401.
An embodiment of the present invention further provides a transaction timeout monitoring device, as shown in fig. 5, including:
the analysis unit 501 is configured to determine a transaction processing duration of a transaction;
a dividing unit 502, configured to divide the transaction into monitoring groups according to the transaction processing duration of the transaction;
a determining unit 503, configured to perform timeout determination on the transactions in the corresponding monitoring packets at different time points;
and a processing unit 504, configured to perform transaction timeout processing on the transaction determined to be timeout.
Optionally, one monitoring group is a group of slots of the time wheel timer;
the dividing unit 502 is specifically configured to:
determining the number of the array slots corresponding to the transaction and the polling times of the transaction according to the transaction processing duration of the transaction and the array slot number of the time wheel timer;
placing the transaction into a corresponding array slot;
the determination unit 503 is specifically configured to:
determining an array slot to be determined pointed by a slot pointer of the time wheel timer;
judging the transaction with the polling frequency of 0 in the data slot to be judged as an overtime transaction;
the slot pointer of the time wheel timer jumps according to a specified time interval, and the slot pointer points to the next adjacent group of slots once jumping;
and when the slot pointer of the time wheel timer points to one array slot, subtracting 1 from the polling times of all transactions in the array slot pointed by the slot pointer.
Optionally, the dividing unit 502 is specifically configured to calculate the number of the array slot corresponding to the transaction according to the following formula:
N=(T+m)mod(L·s)
the dividing unit is specifically configured to calculate the polling frequency of the transaction according to the following formula:
R=(T+m)div(L·s)
wherein N is a data slot number corresponding to the transaction; r is the polling times of the transaction; t is the transaction processing duration of the transaction; m is the number of the array slot pointed by the current slot pointer; l is the number of the groups of slots of the time wheel timer; s is the time interval during which the slot pointer jumps once.
Optionally, the processing unit 504 is further configured to:
receiving a transaction completion message for the transaction;
removing the transaction from the monitoring packet.
Based on the same principle, the present invention also provides an electronic device, as shown in fig. 6, including:
the system comprises a processor 601, a memory 602, a transceiver 603 and a bus interface 604, wherein the processor 601, the memory 602 and the transceiver 603 are connected through the bus interface 604;
the processor 601 is configured to read the program in the memory 602, and execute the following methods:
determining a transaction processing duration of a transaction;
dividing the transaction into monitoring groups according to the transaction processing duration of the transaction;
carrying out overtime judgment on the transaction in the corresponding monitoring group at different time points;
and carrying out transaction timeout processing on the transaction determined to be timeout.
Further, the processor 601 is specifically configured to:
determining the number of the array slots corresponding to the transaction and the polling times of the transaction according to the transaction processing duration of the transaction and the array slot number of the time wheel timer;
placing the transaction into a corresponding array slot;
determining an array slot to be determined pointed by a slot pointer of the time wheel timer;
judging the transaction with the polling frequency of 0 in the data slot to be judged as an overtime transaction;
the slot pointer of the time wheel timer jumps according to a specified time interval, and the slot pointer points to the next adjacent group of slots once jumping;
and when the slot pointer of the time wheel timer points to one array slot, subtracting 1 from the polling times of all transactions in the array slot pointed by the slot pointer.
Further, the processor 601 is specifically configured to:
calculating the number of the array slots corresponding to the transaction according to the following formula:
N=(T+m)mod(L·s)
calculating the number of polls for the transaction according to the following formula:
R=(T+m)div(L·s)
wherein N is a data slot number corresponding to the transaction; r is the polling times of the transaction; t is the transaction processing duration of the transaction; m is the number of the array slot pointed by the current slot pointer; l is the number of the groups of slots of the time wheel timer; s is the time interval during which the slot pointer jumps once.
Further, the processor 601 is specifically configured to:
receiving a transaction completion message for the transaction;
removing the transaction from the monitoring packet.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (6)

1. A transaction timeout monitoring method, comprising:
determining a transaction processing duration of a transaction;
determining the number of the array slots corresponding to the transaction and the polling times of the transaction according to the transaction processing duration of the transaction and the array slot number of the time wheel timer;
placing the transaction into a corresponding array slot;
determining an array slot to be determined pointed by a slot pointer of the time wheel timer;
judging the transaction with the polling frequency of 0 in the array slot to be judged as overtime transaction;
the slot pointer of the time wheel timer jumps according to a specified time interval, and the slot pointer points to the next adjacent group of slots once jumping;
when the slot pointer of the time wheel timer points to one array slot, subtracting 1 from the polling times of each transaction in the array slot pointed by the slot pointer;
performing transaction overtime processing on the transaction determined to be overtime;
calculating the number of the array slots corresponding to the transaction according to the following formula:
N=(T+m)mod(L·s)
calculating the number of polls for the transaction according to the following formula:
R=(T+m)div(L·s)
wherein N is a data slot number corresponding to the transaction; r is the polling times of the transaction; t is the transaction processing duration of the transaction; m is the number of the array slot pointed by the current slot pointer; l is the number of the groups of slots of the time wheel timer; s is the time interval during which the slot pointer jumps once.
2. The method of claim 1, wherein before the transaction determined to be timed out is subject to a transaction timeout processing package, further comprising:
receiving a transaction completion message for the transaction;
removing the transaction from the monitoring packet.
3. A transaction timeout monitoring device, comprising:
the analysis unit is used for determining the transaction processing duration of the transaction;
the dividing unit is used for determining the number of the array slots corresponding to the transaction and the polling times of the transaction according to the transaction processing duration of the transaction and the array slot number of the time wheel timer;
placing the transaction into a corresponding array slot;
the judging unit is used for determining the array slot to be judged to which the slot pointer of the time wheel timer points;
judging the transaction with the polling frequency of 0 in the array slot to be judged as overtime transaction;
the slot pointer of the time wheel timer jumps according to a specified time interval, and the slot pointer points to the next adjacent group of slots once jumping;
when the slot pointer of the time wheel timer points to one array slot, subtracting 1 from the polling times of each transaction in the array slot pointed by the slot pointer;
the processing unit is used for carrying out transaction overtime processing on the transaction which is judged to be overtime;
the dividing unit is specifically configured to calculate an array slot number corresponding to the transaction according to the following formula:
N=(T+m)mod(L·s)
the dividing unit is specifically configured to calculate the polling frequency of the transaction according to the following formula:
R=(T+m)div(L·s)
wherein N is a data slot number corresponding to the transaction; r is the polling times of the transaction; t is the transaction processing duration of the transaction; m is the number of the array slot pointed by the current slot pointer; l is the number of the groups of slots of the time wheel timer; s is the time interval during which the slot pointer jumps once.
4. The apparatus of claim 3, wherein the processing unit is further to:
receiving a transaction completion message for the transaction;
removing the transaction from the monitoring packet.
5. An electronic device, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of claim 1 or 2.
6. A non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the method of claim 1 or 2.
CN201810790907.0A 2018-07-18 2018-07-18 Transaction timeout monitoring method and device Active CN109117295B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810790907.0A CN109117295B (en) 2018-07-18 2018-07-18 Transaction timeout monitoring method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810790907.0A CN109117295B (en) 2018-07-18 2018-07-18 Transaction timeout monitoring method and device

Publications (2)

Publication Number Publication Date
CN109117295A CN109117295A (en) 2019-01-01
CN109117295B true CN109117295B (en) 2022-02-18

Family

ID=64862942

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810790907.0A Active CN109117295B (en) 2018-07-18 2018-07-18 Transaction timeout monitoring method and device

Country Status (1)

Country Link
CN (1) CN109117295B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111309548B (en) * 2020-02-03 2024-04-12 中国银联股份有限公司 Timeout monitoring method and device and computer readable storage medium
CN113365084B (en) * 2021-05-12 2022-06-10 烽火通信科技股份有限公司 Method and device for controlling sending speed by using time wheel
CN114430396B (en) * 2022-04-06 2022-07-05 中国光大银行股份有限公司 Transaction frequency control method and device, storage medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103677976A (en) * 2013-12-09 2014-03-26 大唐移动通信设备有限公司 Event handling method and device based on time wheel timer
CN104361692A (en) * 2014-11-21 2015-02-18 中国建设银行股份有限公司 Transaction monitoring method, ATM (Automatic Teller Machine) front-end system and ATM transaction system
CN105760378A (en) * 2014-12-15 2016-07-13 阿里巴巴集团控股有限公司 Transaction state monitor method and device
CN107169744A (en) * 2017-05-27 2017-09-15 北京思特奇信息技术股份有限公司 The time limit monitoring method and system of a kind of electronic work order
US9880893B2 (en) * 2013-07-01 2018-01-30 International Business Machines Corporation Failure interval determination

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9880893B2 (en) * 2013-07-01 2018-01-30 International Business Machines Corporation Failure interval determination
CN103677976A (en) * 2013-12-09 2014-03-26 大唐移动通信设备有限公司 Event handling method and device based on time wheel timer
CN104361692A (en) * 2014-11-21 2015-02-18 中国建设银行股份有限公司 Transaction monitoring method, ATM (Automatic Teller Machine) front-end system and ATM transaction system
CN105760378A (en) * 2014-12-15 2016-07-13 阿里巴巴集团控股有限公司 Transaction state monitor method and device
CN107169744A (en) * 2017-05-27 2017-09-15 北京思特奇信息技术股份有限公司 The time limit monitoring method and system of a kind of electronic work order

Also Published As

Publication number Publication date
CN109117295A (en) 2019-01-01

Similar Documents

Publication Publication Date Title
CN109117295B (en) Transaction timeout monitoring method and device
CN107301178B (en) Data query processing method, device and system
CN110262883B (en) Timer-based task processing method and device and electronic equipment
CN102957622B (en) Method, device and system for data processing
CN109033814B (en) Intelligent contract triggering method, device, equipment and storage medium
US11677769B2 (en) Counting SYN packets
CN110275992B (en) Emergency processing method, device, server and computer readable storage medium
CN107870948A (en) Method for scheduling task and device
CN108228363A (en) A kind of message method and device
CN112148493A (en) Streaming media task management method and device and data server
CN103903312B (en) The execution method and apparatus of automatic detecting
CN115328741A (en) Exception handling method, device, equipment and storage medium
CN112069195A (en) Database-based message transmission method and device, electronic equipment and storage medium
CN108833961B (en) Method, server and system for acquiring flight record data
CN112416534A (en) Agent-based task management method and device
CN108829735B (en) Synchronization method, device, server and storage medium for parallel execution plan
CN111124650A (en) Streaming data processing method and device
CN107239378B (en) Overtime monitoring method and system
CN110955460A (en) Service process starting method and device, electronic equipment and storage medium
CN104317906A (en) Processing method for large-scale storage of reported data of GPS (global positioning system) monitoring radios
US20160192110A1 (en) Method and Apparatus for Processing Operation on Endpoint Peripheral
CN115391318A (en) Expired data clearing method and device, storage medium and computer equipment
CN104468505A (en) Safety audit log playing method and device
CN111479142B (en) Program content updating method and system based on information release
US10091068B1 (en) System for modeling distributed systems

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant