Concurrent flow limiting method and device, computer equipment and storage medium

By using REDIS in the financial transaction system to query real-time concurrent values ​​and compare them with thresholds, the system congestion problem caused by high concurrency is solved, the system is highly available and stable, and transaction loss is avoided, and ultra-high performance and high availability are provided.

CN119544619APending Publication Date: 2025-02-28PING AN BANK CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202411449565.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-16
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

Traditional technical solutions cannot effectively solve the system congestion problem caused by high concurrency, and once the system is closed abnormally, all transactions in the buffer will be lost.

Method used

A concurrency current limiting method is adopted to determine whether to conduct business operations for transaction requests by querying real-time concurrent values ​​in REDIS and comparing them with the thresholds recorded in the system memory. If the concurrent value exceeds the threshold, the service operation is terminated and the current limit prompt information is sent to the user terminal.

Benefits of technology

It effectively avoids system congestion caused by high concurrency, ensures system availability and stability, avoids transaction loss, and has ultra-high performance and high availability, which is suitable as a solution for realizing current limiting capabilities of financial systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119544619A_ABST
    Figure CN119544619A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of artificial intelligence, and relates to a concurrent flow limiting method and device, computer equipment and a storage medium, and the method comprises the steps: receiving a transaction processing request which is sent by a user terminal and carries transaction request data; obtaining a resource identifier corresponding to the transaction request data; querying a real-time concurrent value corresponding to the resource identifier in the REDIS; comparing the real-time concurrent numerical value with a threshold value which is recorded in a system memory and read during starting; if the real-time concurrent value is smaller than the threshold value, business operation is carried out on the transaction request data; and if the real-time concurrent value is greater than or equal to the threshold value, terminating the business operation of the transaction request data. According to the method, the transaction real-time current limiting data of the concurrent current limiter is stored in the REDIS, the current limiting bottleneck is avoided, the REDIS response delay is extremely low, the response speed is high, and too much time delay is not increased due to the fact that the current limiting function is added.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a concurrent current limiting method, device, computer equipment and storage medium. Background Art

[0002] Financial trading systems have the characteristics of large numbers of users and high concurrency. In order to ensure the availability and stability of the system, it is necessary to ensure that the system operates within the expected system capacity and capability range. Once the number of transaction requests exceeds the system capacity range, the processing speed of the trading system will slow down or other unpredictable situations will occur.

[0003] In existing technical solutions, when the number of transaction requests exceeds the system capacity, the system can be limited by increasing the buffer and letting the requests queue up for processing.

[0004] However, the applicant found that although the above solution has a certain ability to reduce peak traffic and fill valley traffic, it is easy to cause system congestion, and once the system is abnormally shut down, all transactions in the buffer will be lost.

[0005] This shows that traditional technical solutions cannot effectively solve the problem of system congestion caused by high concurrency. Summary of the invention

[0006] The purpose of the embodiments of the present application is to propose a concurrent current limiting method, device, computer equipment and storage medium to solve the problem that traditional technical solutions cannot effectively solve the problem that high concurrency easily causes system congestion.

[0007] In order to solve the above technical problems, the present application embodiment provides a concurrent current limiting method, which adopts the following technical solution:

[0008] Receiving a transaction processing request carrying transaction request data sent by a user terminal;

[0009] Obtaining a resource identifier corresponding to the transaction request data;

[0010] Querying the real-time concurrent value corresponding to the resource identifier in REDIS;

[0011] Compare the real-time concurrent value with the threshold value that has been read at startup and recorded in the system memory;

[0012] If the real-time concurrent value is less than the threshold, performing a business operation on the transaction request data;

[0013] If the real-time concurrent value is greater than or equal to the threshold, the business operation of the transaction request data is terminated.

[0014] Furthermore, before the step of comparing the real-time concurrent value with the threshold value recorded in the system memory and read at startup, the following step is also included:

[0015] Reading a system database or a configuration file, and obtaining current limiting configuration information from the system database or the configuration file;

[0016] The current limiting configuration information is saved in the system memory.

[0017] Furthermore, if the real-time concurrency value is greater than or equal to the threshold, the step of terminating the business operation of the transaction request data specifically includes the following steps:

[0018] Sending current limiting prompt information to the user terminal.

[0019] Furthermore, after the step of sending the current limiting prompt information to the user terminal, the following steps are also included:

[0020] Receiving a transaction continuation instruction sent by the user terminal;

[0021] Then, a value update process is performed on the real-time concurrent value, and a business operation is performed on the transaction request data.

[0022] Furthermore, after the step of performing value update processing on the real-time concurrent value and performing business operations on the transaction request data, the following steps are also included:

[0023] When the business operation of the transaction request data is completed, the real-time concurrent value is restored.

[0024] Furthermore, after the step of querying the real-time concurrent value corresponding to the resource identifier in REDIS, the following steps are also included:

[0025] Acquire historical transaction data corresponding to the target commodity of the transaction request data;

[0026] Performing a time series analysis operation on the historical transaction data to obtain a transaction volume trend of the target commodity;

[0027] Perform a prediction operation on the transaction volume trend according to a trend extrapolation method to obtain a predicted transaction volume;

[0028] If the predicted transaction volume is greater than the preset transaction volume threshold, dynamically adjusting the real-time concurrent value;

[0029] If the predicted transaction volume is less than or equal to the preset transaction volume threshold, no dynamic adjustment operation is performed on the real-time concurrent value.

[0030] In order to solve the above technical problems, the embodiment of the present application further provides a concurrent current limiting device, which adopts the following technical solution:

[0031] A request acquisition module, used to receive a transaction processing request carrying transaction request data sent by a user terminal;

[0032] A resource identifier acquisition module, used to acquire a resource identifier corresponding to the transaction request data;

[0033] A real-time concurrent value acquisition module, used for querying the real-time concurrent value corresponding to the resource identifier in REDIS;

[0034] A comparison module, used for comparing the real-time concurrent value with the threshold value that has been read at startup and recorded in the system memory;

[0035] A first comparison result module, configured to perform a business operation on the transaction request data if the real-time concurrent value is less than the threshold;

[0036] The second comparison result module is used to terminate the business operation of the transaction request data if the real-time concurrent value is greater than or equal to the threshold.

[0037] Furthermore, the device also includes:

[0038] A current limiting configuration information acquisition module is used to read a system database or a configuration file, and obtain the current limiting configuration information from the system database or the configuration file;

[0039] The current limiting configuration information storage module is used to save the current limiting configuration information into the system memory.

[0040] Furthermore, the second comparison result module includes:

[0041] The current limiting prompt submodule is used to send current limiting prompt information to the user terminal.

[0042] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:

[0043] It includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the concurrent current limiting method as described above when executing the computer-readable instructions.

[0044] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:

[0045] The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps of the concurrent current limiting method described above are implemented.

[0046] The present application provides a concurrent current limiting method, including: receiving a transaction processing request carrying transaction request data sent by a user terminal; obtaining a resource identifier corresponding to the transaction request data; querying the real-time concurrent value corresponding to the resource identifier in REDIS; comparing the real-time concurrent value with the threshold value that has been read at startup and recorded in the system memory; if the real-time concurrent value is less than the threshold value, performing a business operation on the transaction request data; if the real-time concurrent value is greater than or equal to the threshold value, terminating the business operation of the transaction request data. Compared with the prior art, the present application stores the transaction real-time current limiting data of the concurrent current limiter in REDIS, and REDIS can achieve a processing performance of 100,000 per second, which is much higher than the concurrent current limiting number that the transaction system can achieve, so it will not become a current limiting bottleneck. And REDIS has extremely low response delay and fast response speed, and will not increase too much time delay due to the addition of current limiting function; in addition, REDIS itself has a cluster mechanism, which can ensure that other nodes automatically take over when a single node is damaged; and the application system itself will not crash as a result. The overall availability is guaranteed; the concurrent current limiter implemented based on REDIS has the characteristics of ultra-high performance and ultra-high availability; it is suitable as a solution for implementing the current limiting capability of the financial system. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0048] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;

[0049] Figure 2 It is a flow chart for implementing the concurrent current limiting method provided in the embodiment of the present application;

[0050] Figure 3 is a structural schematic diagram of a concurrent current limiting device provided in an embodiment of the present application;

[0051] Figure 4 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION

[0052] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.

[0053] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0054] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.

[0055] like Figure 1 As shown, the system architecture 100 may include a terminal device 101, a network 102 and a server 103. The terminal device 101 may be a laptop 1011, a tablet computer 1012 or a mobile phone 1013. The network 102 is used to provide a medium for a communication link between the terminal device 101 and the server 103. The network 102 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0056] The user can use the terminal device 101 to interact with the server 103 through the network 102 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 101, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0057] The terminal device 101 can be any electronic device with a display screen and supporting web browsing. In addition to the laptop computer 1011, tablet computer 1012 or mobile phone 1013, the terminal device 101 can also be an e-book reader, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV), a laptop computer, a desktop computer, etc.

[0058] The server 103 may be a server that provides various services, such as a background server that provides support for a web page displayed on the terminal device 101 .

[0059] It should be noted that the concurrent current limiting method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the concurrent current limiting device is generally arranged in the server / terminal device.

[0060] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0061] Continue to refer Figure 2 , shows a flow chart of an embodiment of a concurrent current limiting method according to the present application. The concurrent current limiting method comprises: step S201, step S202, step S203, step S204, step S205 and step S206.

[0062] In step S201, a transaction processing request carrying transaction request data sent by a user terminal is received.

[0063] In the embodiments of the present application, the user terminal refers to a terminal device used to execute the image processing method for preventing document abuse provided by the present application. The user terminal can be a mobile terminal such as a mobile phone, a smart phone, a laptop computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a navigation device, etc., as well as a fixed terminal such as a digital TV, a desktop computer, etc. It should be understood that the examples of user terminals here are only for the convenience of understanding and are not used to limit the present application.

[0064] In an embodiment of the present application, a user can initiate a transaction request through his terminal device (such as a mobile phone, computer, etc.), and this request contains the data necessary for the transaction, such as transaction type, transaction amount, user information, etc.

[0065] In the embodiment of the present application, after the backend service receives this request, it starts the processing flow.

[0066] In step S202, a resource identifier corresponding to the transaction request data is obtained.

[0067] In the embodiment of the present application, when a transaction is processed, the current limiter process will be executed first before the formal business logic processing process. The current limiter first reads the transaction request data and analyzes it to obtain the resource identifier. For example, after the current transaction is analyzed, the resource identifier is A.

[0068] In the embodiment of the present application, before formally processing a transaction request, the system first needs to determine the resource associated with the request. The resource ID can be a unique identifier associated with a specific transaction type, user account, product or service, etc., wherein the resource ID is used to identify and manage concurrent access related to the transaction request in subsequent steps.

[0069] In step S203, the real-time concurrent value corresponding to the resource identifier is queried in REDIS.

[0070] In the embodiment of the present application, REDIS itself is an ultra-high performance memory database with the characteristics of high performance and high availability. It can ensure ultra-high performance while ensuring that once a single node crashes or becomes invalid, other nodes can still provide services normally, thereby avoiding single point failure.

[0071] In the embodiment of the present application, according to the obtained resource identifier, the current real-time concurrency value of A is queried in REDIS to obtain the result X.

[0072] In the embodiment of the present application, the system obtains the current real-time concurrency value by querying the value corresponding to the resource identifier in REDIS. This value reflects how many concurrent requests are currently processing this resource.

[0073] In step S204, the real-time concurrent value is compared with the threshold value that has been read at startup and recorded in the system memory.

[0074] In the embodiment of the present application, when the system is started, a series of thresholds (Threshold) are read from the configuration file. These thresholds define the maximum concurrent access that different resources or transaction types can withstand.

[0075] In the embodiment of the present application, X is compared with the threshold value 20 that has been read at startup and recorded in the memory to determine whether there is sufficient processing capacity to accept the new transaction request.

[0076] In step S205, if the real-time concurrent value is less than the threshold, a business operation is performed on the transaction request data.

[0077] In the embodiment of the present application, if the current concurrent access volume is lower than the set threshold, it means that the system has sufficient processing capacity to accept and process the new transaction request. Therefore, the system will continue to execute subsequent business logic, such as verifying user information, checking account balance, executing transactions, etc.

[0078] In step S206, if the real-time concurrency value is greater than or equal to the threshold, the business operation of the transaction request data is terminated.

[0079] In the embodiment of the present application, if the current concurrent access volume has reached or exceeded the set threshold, it means that the system is already in a high load state, and continuing to accept new requests may cause service quality to deteriorate or system crash. In this case, the system will reject the new transaction request and return a corresponding error message or prompt to the user, suggesting that the user try again later.

[0080] In the embodiment of the present application, based on the above characteristics of REDIS, this solution uses REDIS as a storage for the concurrency or transaction indicators of the resources specified by the application system, updates the current latest value in real time, and compares it with the configured threshold. Once the threshold is exceeded, the transaction represented by the specified resource is rejected.

[0081] In an embodiment of the present application, a concurrent current limiting method is provided, including: receiving a transaction processing request carrying transaction request data sent by a user terminal; obtaining a resource identifier corresponding to the transaction request data; querying the real-time concurrent value corresponding to the resource identifier in REDIS; comparing the real-time concurrent value with the threshold value that has been read at startup and recorded in the system memory; if the real-time concurrent value is less than the threshold value, then the business operation of the transaction request data is performed; if the real-time concurrent value is greater than or equal to the threshold value, then the business operation of the transaction request data is terminated. Compared with the prior art, the present application stores the transaction real-time current limiting data of the concurrent current limiter in REDIS, and REDIS can achieve a processing performance of 100,000 per second, which is much higher than the concurrent current limiting number that the transaction system can achieve, so it will not become a current limiting bottleneck. And REDIS has extremely low response delay and fast response speed, and will not increase too much time delay due to the addition of current limiting function; in addition, REDIS itself has a cluster mechanism, which can ensure that in the case of damage to a single node, other nodes will automatically take over; and the application system itself will not crash as a result. The overall availability is guaranteed; the concurrent current limiter implemented based on REDIS has the characteristics of ultra-high performance and ultra-high availability; it is suitable as a solution for implementing the current limiting capability of the financial system.

[0082] In some optional implementations of the embodiments of the present application, before the step of comparing the real-time concurrency value with the threshold value that has been read at startup and recorded in the system memory, the following steps are also included:

[0083] Read the system database or configuration file, and obtain the current limiting configuration information in the system database or configuration file;

[0084] Save the current limiting configuration information to the system memory.

[0085] In the embodiment of the present application, when the application starts, the current limiting configuration will be read, and the current limiting configuration can be saved in a database or a configuration file. After reading the current limiting configuration, the relevant configuration is saved in the memory. For example, if the concurrency threshold of resource A is 20, then A=20 is recorded in the memory.

[0086] In some optional implementations of the embodiments of the present application, the step of terminating the business operation of the transaction request data if the real-time concurrency value is greater than or equal to the threshold value specifically includes the following steps:

[0087] Send current limiting prompt information to the user terminal.

[0088] In the embodiment of the present application, a clear error code and error prompt are given when the transaction is terminated, indicating that the limiter has been triggered and the transaction is terminated.

[0089] In some optional implementations of the embodiments of the present application, after the step of sending the current limiting prompt information to the user terminal, the following steps are also included:

[0090] Receiving a transaction continuation instruction sent by a user terminal;

[0091] Then the real-time concurrent values ​​are updated and business operations are performed on the transaction request data.

[0092] In the embodiment of the present application, if the transaction continues, the real-time concurrent value in REDIS will be updated first, X+1 will be saved, and then the actual business logic processing will be carried out.

[0093] In some optional implementations of the embodiments of the present application, after the step of performing value update processing on the real-time concurrent value and performing business operations on the transaction request data, the following steps are also included:

[0094] When the business operation of the transaction request data is completed, the real-time concurrent values ​​are restored.

[0095] In the embodiment of the present application, after the business logic processing is completed, the concurrent value in REDIS is updated, X-1 and saved, thus completing the transaction processing process.

[0096] In summary, the real-time transaction flow limiting data of the concurrent flow limiter is stored in REDIS. REDIS can achieve a processing performance of 100,000 per second, which is much higher than the concurrent flow limiting number that the trading system can achieve, so it will not become a flow limiting bottleneck. In addition, REDIS has extremely low response delay and fast response speed, and will not increase too much time delay due to the addition of flow limiting function; in addition, REDIS itself has a cluster mechanism, which can ensure that other nodes automatically take over when a single node is damaged. The application system itself will not crash as a result. The overall availability is guaranteed; the concurrent flow limiter implemented based on REDIS has the characteristics of ultra-high performance and ultra-high availability. It is suitable as a solution for implementing the flow limiting capability of the financial system.

[0097] In some optional implementations of the embodiments of the present application, after the step of querying the real-time concurrent value corresponding to the resource identifier in REDIS, the following steps are also included:

[0098] Acquire historical transaction data corresponding to the target product of the transaction request data;

[0099] Perform time series analysis on historical transaction data to obtain the transaction volume trend of the target product;

[0100] The trading volume trend is predicted by trend extrapolation to obtain the predicted trading volume;

[0101] If the predicted transaction volume is greater than the preset transaction volume threshold, the real-time concurrent value is dynamically adjusted;

[0102] If the predicted transaction volume is less than or equal to the preset transaction volume threshold, no dynamic adjustment will be performed on the real-time concurrent value.

[0103] In an embodiment of the present application, when a transaction request is received, it will first identify which product (i.e., the target product) the request is for, and then search and obtain all transaction records of the target product over a period of time in the past. These records constitute historical transaction data, which may include information such as the transaction timestamp, transaction volume, and transaction price.

[0104] In the embodiments of the present application, time series analysis is mainly used to study the patterns of data series that change over time. The present application will perform time series analysis on the transaction volume in historical transaction data to identify the trend of transaction volume changes over time. The trend may appear to be rising, falling or stable, reflecting changes in market demand for the target product.

[0105] In the embodiments of the present application, trend extrapolation is a prediction method, which assumes that future trends are the same or similar to those in the past. The present application uses the trend extrapolation method to predict the transaction volume in the future based on the identified transaction volume trend. The predicted transaction volume is an estimated value, which indicates the transaction volume that the system believes may be achieved for the target product in a certain period of time in the future.

[0106] In the embodiment of the present application, the preset transaction volume threshold is a pre-set value used to determine whether the predicted transaction volume has reached a level that requires adjustment of the system processing capacity. If the predicted transaction volume is greater than this threshold, it means that a higher concurrent processing capacity may be required to cope with the upcoming transaction peak. Therefore, the system will dynamically adjust the real-time concurrency value as needed, such as increasing the number of servers or improving processing capacity to ensure that transactions can proceed smoothly.

[0107] In an embodiment of the present application, if the predicted transaction volume does not reach the preset transaction volume threshold, it means that the current concurrent processing capacity is sufficient to cope with future transaction needs. In this case, the system will not perform any dynamic adjustment operations to save resources and costs.

[0108] In an embodiment of the present application, future transaction volume is predicted through historical data, and the processing capacity of the system is dynamically adjusted according to the prediction results to ensure that the system can remain efficient and stable under different transaction requirements.

[0109] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0110] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0111] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0112] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0113] Further references Figure 3 , as a response to the above Figure 2 The present application provides an embodiment of a concurrent current limiting device, and the device embodiment is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0114] like Figure 3 As shown, the concurrent current limiting device 200 of the embodiment of the present application includes:

[0115] The request acquisition module 210 is used to receive a transaction processing request carrying transaction request data sent by a user terminal;

[0116] A resource identifier acquisition module 220, used to acquire a resource identifier corresponding to the transaction request data;

[0117] A real-time concurrent value acquisition module 230 is used to query the real-time concurrent value corresponding to the resource identifier in REDIS;

[0118] A comparison module 240 is used to compare the real-time concurrent value with the threshold value that has been read at startup and recorded in the system memory;

[0119] The first comparison result module 250 is used to perform a business operation on the transaction request data if the real-time concurrent value is less than a threshold;

[0120] The second comparison result module 260 is used to terminate the business operation of the transaction request data if the real-time concurrent value is greater than or equal to the threshold.

[0121] In the embodiments of the present application, the user terminal refers to a terminal device used to execute the image processing method for preventing document abuse provided by the present application. The user terminal can be a mobile terminal such as a mobile phone, a smart phone, a laptop computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a navigation device, etc., as well as a fixed terminal such as a digital TV, a desktop computer, etc. It should be understood that the examples of user terminals here are only for the convenience of understanding and are not used to limit the present application.

[0122] In an embodiment of the present application, a user can initiate a transaction request through his terminal device (such as a mobile phone, computer, etc.), and this request contains the data necessary for the transaction, such as transaction type, transaction amount, user information, etc.

[0123] In the embodiment of the present application, after the backend service receives this request, it starts the processing flow.

[0124] In the embodiment of the present application, when a transaction is processed, the current limiter process will be executed first before the formal business logic processing process. The current limiter first reads the transaction request data and analyzes it to obtain the resource identifier. For example, after the current transaction is analyzed, the resource identifier is A.

[0125] In the embodiment of the present application, before formally processing a transaction request, the system first needs to determine the resource associated with the request. The resource ID can be a unique identifier associated with a specific transaction type, user account, product or service, etc., wherein the resource ID is used to identify and manage concurrent access related to the transaction request in subsequent steps.

[0126] In the embodiment of the present application, REDIS itself is an ultra-high performance memory database with the characteristics of high performance and high availability. It can ensure ultra-high performance while ensuring that once a single node crashes or becomes invalid, other nodes can still provide services normally, thereby avoiding single point failure.

[0127] In the embodiment of the present application, according to the obtained resource identifier, the current real-time concurrency value of A is queried in REDIS to obtain the result X.

[0128] In the embodiment of the present application, the system obtains the current real-time concurrency value by querying the value corresponding to the resource identifier in REDIS. This value reflects how many concurrent requests are currently processing this resource.

[0129] In the embodiment of the present application, when the system is started, a series of thresholds (Threshold) are read from the configuration file. These thresholds define the maximum concurrent access that different resources or transaction types can withstand.

[0130] In the embodiment of the present application, X is compared with the threshold value 20 that has been read at startup and recorded in the memory to determine whether there is sufficient processing capacity to accept the new transaction request.

[0131] In the embodiment of the present application, if the current concurrent access volume is lower than the set threshold, it means that the system has sufficient processing capacity to accept and process the new transaction request. Therefore, the system will continue to execute subsequent business logic, such as verifying user information, checking account balance, executing transactions, etc.

[0132] In the embodiment of the present application, if the current concurrent access volume has reached or exceeded the set threshold, it means that the system is already in a high load state, and continuing to accept new requests may cause service quality to deteriorate or system crash. In this case, the system will reject the new transaction request and return a corresponding error message or prompt to the user, suggesting that the user try again later.

[0133] In the embodiment of the present application, based on the above characteristics of REDIS, this solution uses REDIS as a storage for the concurrency or transaction indicators of the resources specified by the application system, updates the current latest value in real time, and compares it with the configured threshold. Once the threshold is exceeded, the transaction represented by the specified resource is rejected.

[0134] In the embodiment of the present application, a concurrent current limiting device 200 is provided, including: a request acquisition module 210, for receiving a transaction processing request carrying transaction request data sent by a user terminal; a resource identifier acquisition module 220, for acquiring a resource identifier corresponding to the transaction request data; a real-time concurrent value acquisition module 230, for querying the real-time concurrent value corresponding to the resource identifier in REDIS; a comparison module 240, for comparing the real-time concurrent value with the threshold value that has been read at startup and recorded in the system memory; a first comparison result module 250, for performing a business operation on the transaction request data if the real-time concurrent value is less than the threshold value; a second comparison result module 260, for terminating the business operation of the transaction request data if the real-time concurrent value is greater than or equal to the threshold value. Compared with the prior art, the present application stores the transaction real-time current limiting data of the concurrent current limiter in REDIS, and REDIS can achieve a processing performance of 100,000 per second, which is much higher than the concurrent current limiting number that the transaction system can achieve, and therefore will not become a current limiting bottleneck. Moreover, REDIS has extremely low response delay and fast response speed, and will not increase too much time delay due to adding current limiting function. In addition, REDIS itself has a cluster mechanism, which can ensure that in the case of a single node damage, other nodes will automatically take over, and the application system itself will not crash. The overall availability is guaranteed; the concurrent current limiter based on REDIS has the characteristics of ultra-high performance and ultra-high availability, and is suitable as a solution for implementing the current limiting capability of the financial system.

[0135] In some optional implementations of the embodiments of the present application, the concurrent current limiting device 200 further includes:

[0136] A current limiting configuration information acquisition module is used to read a system database or a configuration file and obtain the current limiting configuration information in the system database or the configuration file;

[0137] The current limiting configuration information storage module is used to save the current limiting configuration information into the system memory.

[0138] In some optional implementations of the embodiments of the present application, the second comparison result module includes:

[0139] The current limiting prompt submodule is used to send current limiting prompt information to the user terminal.

[0140] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of a computer device according to an embodiment of the present application.

[0141] The computer device 300 includes a memory 310, a processor 320, and a network interface 330 that are interconnected and communicated through a system bus. It should be noted that the figure only shows a computer device 300 having components 310-330, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.

[0142] The computer device may be a computing device such as a desktop computer, a notebook, a PDA, a cloud server, etc. The computer device may interact with a user through a keyboard, a mouse, a remote controller, a touch pad, or a voice control device.

[0143] The memory 310 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 310 can be an internal storage unit of the computer device 300, such as a hard disk or memory of the computer device 300. In other embodiments, the memory 310 can also be an external storage device of the computer device 300, such as a plug-in hard disk equipped on the computer device 300, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card, etc. Of course, the memory 310 can also include both the internal storage unit of the computer device 300 and its external storage device. In the embodiment of the present application, the memory 310 is generally used to store the operating system and various application software installed on the computer device 300, such as computer-readable instructions of the concurrent current limiting method, etc. In addition, the memory 310 can also be used to temporarily store various data that have been output or are to be output.

[0144] The processor 320 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor 320 is generally used to control the overall operation of the computer device 300. In the embodiment of the present application, the processor 320 is used to run the computer-readable instructions stored in the memory 310 or process data, such as computer-readable instructions for running the concurrent current limiting method.

[0145] The network interface 330 may include a wireless network interface or a wired network interface. The network interface 330 is generally used to establish a communication connection between the computer device 300 and other electronic devices.

[0146] The computer device provided by this application stores the real-time transaction flow limiting data of the concurrent flow limiter in REDIS. REDIS can achieve a processing performance of 100,000 per second, which is much higher than the concurrent flow limiting number that the trading system can achieve, so it will not become a flow limiting bottleneck. In addition, REDIS has extremely low response delay and fast response speed, and will not increase too much time delay due to the addition of flow limiting function; in addition, REDIS itself has a cluster mechanism, which can ensure that in the event of a single node being damaged, other nodes will automatically take over; and the application system itself will not crash as a result. The overall availability is guaranteed; the concurrent flow limiter implemented based on REDIS has the characteristics of ultra-high performance and ultra-high availability; it is suitable as a solution for implementing the flow limiting capability of the financial system.

[0147] The present application also provides another implementation, namely, providing a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the concurrent current limiting method as described above.

[0148] The computer-readable storage medium provided by the present application stores the real-time transaction flow limiting data of the concurrent flow limiter in REDIS. REDIS can achieve a processing performance of 100,000 per second, which is much higher than the concurrent flow limiting number that the trading system can achieve, so it will not become a flow limiting bottleneck. In addition, REDIS has extremely low response delay and fast response speed, and will not increase too much time delay due to the addition of flow limiting function; in addition, REDIS itself has a cluster mechanism, which can ensure that in the event of a single node being damaged, other nodes will automatically take over; and the application system itself will not crash as a result. The overall availability is guaranteed; the concurrent flow limiter implemented based on REDIS has the characteristics of ultra-high performance and ultra-high availability; it is suitable as a solution for implementing the flow limiting capability of the financial system.

[0149] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0150] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.

Claims

1. A concurrent current limiting method, characterized in that: The steps include: Receiving a transaction processing request carrying transaction request data sent by a user terminal; Obtaining a resource identifier corresponding to the transaction request data; Querying the real-time concurrent value corresponding to the resource identifier in REDIS; Compare the real-time concurrent value with the threshold value that has been read at startup and recorded in the system memory; If the real-time concurrent value is less than the threshold, performing a business operation on the transaction request data; If the real-time concurrent value is greater than or equal to the threshold, the business operation of the transaction request data is terminated.

2. The concurrent current limiting method according to claim 1, characterized in that: Before the step of comparing the real-time concurrent value with the threshold value recorded in the system memory and read at startup, the following steps are also included: Reading a system database or a configuration file, and obtaining current limiting configuration information from the system database or the configuration file; The current limiting configuration information is saved in the system memory.

3. The concurrent current limiting method according to claim 1, characterized in that: The step of terminating the business operation of the transaction request data if the real-time concurrent value is greater than or equal to the threshold value specifically includes the following steps: Sending current limiting prompt information to the user terminal.

4. The concurrent current limiting method according to claim 3, characterized in that: After the step of sending the current limiting prompt information to the user terminal, the method further includes the following steps: Receiving a transaction continuation instruction sent by the user terminal; Then, a value update process is performed on the real-time concurrent value, and a business operation is performed on the transaction request data.

5. The concurrent current limiting method according to claim 4, characterized in that: After the step of performing value update processing on the real-time concurrent value and performing business operations on the transaction request data, the following steps are also included: When the business operation of the transaction request data is completed, the real-time concurrent value is restored.

6. The concurrent current limiting method according to claim 1, characterized in that: After the step of querying the real-time concurrent value corresponding to the resource identifier in REDIS, the following steps are also included: Acquire historical transaction data corresponding to the target commodity of the transaction request data; Performing a time series analysis operation on the historical transaction data to obtain a transaction volume trend of the target commodity; Perform a prediction operation on the transaction volume trend according to a trend extrapolation method to obtain a predicted transaction volume; If the predicted transaction volume is greater than the preset transaction volume threshold, dynamically adjusting the real-time concurrent value; If the predicted transaction volume is less than or equal to the preset transaction volume threshold, no dynamic adjustment operation is performed on the real-time concurrent value.

7. A concurrent current limiting device, characterized in that: include: A request acquisition module, used to receive a transaction processing request carrying transaction request data sent by a user terminal; A resource identifier acquisition module, used to acquire a resource identifier corresponding to the transaction request data; A real-time concurrent value acquisition module, used for querying the real-time concurrent value corresponding to the resource identifier in REDIS; A comparison module, used for comparing the real-time concurrent value with the threshold value that has been read at startup and recorded in the system memory; A first comparison result module, configured to perform a business operation on the transaction request data if the real-time concurrent value is less than the threshold; The second comparison result module is used to terminate the business operation of the transaction request data if the real-time concurrent value is greater than or equal to the threshold.

8. The concurrent current limiting device according to claim 7, characterized in that: The device also includes: A current limiting configuration information acquisition module is used to read a system database or a configuration file, and obtain the current limiting configuration information from the system database or the configuration file; The current limiting configuration information storage module is used to save the current limiting configuration information into the system memory.

9. A computer device comprising a memory and a processor, characterized in that: The memory stores computer-readable instructions, and when the processor executes the computer-readable instructions, the steps of the concurrent current limiting method according to any one of claims 1 to 6 are implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps of the concurrent current limiting method according to any one of claims 1 to 6 are implemented.

Citation Information

Cited By

  • Service flow limiting method, related device and service flow limiting system

    CN120378492A

  • Method, device and equipment for limiting flow of SQL (Structured Query Language) statement and distributed database

    CN120492479A

  • Data transaction accounting and automatic clearing system and method based on bank-enterprise business collaboration

    CN122204899A