Flow control method and device, electronic equipment and computer readable medium
By generating tokens and calling the public deposit component, the problem that the existing flow control mechanism cannot achieve fine-grained account-level global flow control, improve the accuracy and dynamic adjustment capabilities of flow control, and adapt to the performance of different current payment accounts difference.
Patent Information
- Application Number
- CN202411271958.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-09-11
AI Technical Summary
The existing flow control mechanism cannot achieve finer granular account-level global flow control, resulting in poor accuracy of flow control and cannot effectively deal with the performance differences in product and service types signed by different current payment accounts.
By receiving flow control requests, determine the flow control query account, obtain performance data based on the flow control query account and the preset flow control list table, generate a token, and call the public deposit component to execute transactions after the token is successfully obtained, realizing dynamic adjustments Differentiated control of traffic and finer granular services.
It improves the accuracy of traffic control, supports dynamic traffic adjustment, realizes accurate traffic control for different accounts, and reduces business impact.
Smart Images

Figure CN119094455A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a flow control method, device, electronic device and computer-readable medium. Background Art
[0002] After the localization of the core corporate system, the database capacity is somewhat different from that of the commercial version of the database. High-concurrency operations on the same account may cause database lock (row lock) timeouts, and it is necessary to access the components of the core system to reduce concurrency control. The same transfer service has great performance differences due to different contracted products or service types for corporate current payment accounts. For example, the transfer service performance of an ordinary current account is three times that of an account signed with a third-level real-time pool. The existing flow control mechanism is stand-alone and is for outgoing or incoming URIs or client concurrency control. It is impossible to achieve more fine-grained global flow control at the account level, and the flow control accuracy is poor. Summary of the invention
[0003] In view of this, the embodiments of the present application provide a flow control method, device, electronic device and computer-readable medium, which can solve the problem that the existing flow control mechanism cannot achieve global flow control at a finer-grained account level and the flow control accuracy is poor.
[0004] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present application, a flow control method is provided, including: receiving a flow control request, and determining a flow control query account; determining a flow control account based on the flow control query account and a preset flow control list table; in response to the flow control account not existing in the cache, obtaining performance data of each account from the preset flow control list table; based on the performance data, generating a token, refreshing the token to the cache, executing a token acquisition process, and in response to a token acquisition failure and a transaction identifier corresponding to a non-online transaction, executing a token acquisition retry process; in response to a token acquisition success, calling a corporate deposit component to execute a corresponding transaction and releasing the token.
[0005] Optionally, determining the flow control query account includes: obtaining the payment account number, and intercepting the first preset number of digits of the payment account number as the flow control query account number.
[0006] Optionally, determining the flow control account includes: in response to the flow control query account being in a preset flow control list table, querying the preset flow control list table for an account corresponding to the flow control query account; and determining the flow control account based on the account.
[0007] Optionally, based on the account, determining the flow control account includes: determining the type of the account, and in response to the type including the main account, determining the account of the main account type as the flow control account; in response to the type not including the main account, determining the account of the sub-account type as the flow control account.
[0008] Optionally, calling the public deposit component to execute the corresponding transaction includes: increasing the concurrency number and then calling the public deposit component to execute the corresponding transaction, and after the corresponding transaction is completed, reducing the concurrency number.
[0009] Optionally, a token acquisition retry process is executed, including: retrying to acquire the token at a preset interval and a preset number of attempts. If the token is still not acquired, transaction restriction information is returned; if the token is acquired after the retry, it is determined that the token acquisition is successful.
[0010] In addition, the present application also provides a flow control device, including: a receiving unit, configured to receive a flow control request and determine a flow control query account; a flow control account determination unit, which determines the flow control account based on the flow control query account and a preset flow control list table; an acquisition unit, configured to obtain performance data of each account from the preset flow control list table in response to the flow control account not existing in the cache; an execution unit, configured to generate a token based on the performance data, refresh the token into the cache, execute a token acquisition process, and execute a token acquisition retry process in response to a token acquisition failure and a transaction identifier corresponding to a non-online transaction; a token release unit, configured to call a corporate deposit component to execute a corresponding transaction and release the token in response to a successful token acquisition.
[0011] Optionally, the receiving unit is further configured to: obtain the payment account number, and intercept the first preset number of digits of the payment account number as the flow control query account number.
[0012] Optionally, the flow control account determination unit is further configured to: in response to the flow control query account being in the preset flow control list table, query the account corresponding to the flow control query account from the preset flow control list table; and determine the flow control account based on the account.
[0013] Optionally, the flow control account determination unit is further configured to: determine the type of the account, and in response to the type being configured as a primary account, determine the account of type being a primary account as a flow control account; in response to the type not being configured as a primary account, determine the account of type being a sub-account as a flow control account.
[0014] Optionally, the token release unit is further configured to: after increasing the concurrency number, call the public deposit component to execute the corresponding transaction, and after the corresponding transaction is completed, reduce the concurrency number.
[0015] Optionally, the execution unit is further configured to: retry to obtain the token at a preset time interval and a preset number of attempts, and if the token is still not obtained, return transaction restriction information; if the token is obtained after the retry, determine that the token is obtained successfully.
[0016] In addition, the present application also provides a flow control electronic device, including: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by one or more processors, the one or more processors implement the flow control method as described above.
[0017] In addition, the present application also provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, the flow control method as described above is implemented.
[0018] To achieve the above objective, according to another aspect of the embodiments of the present application, a computer program product is provided.
[0019] A computer program product according to an embodiment of the present application includes a computer program, and when the program is executed by a processor, the flow control method provided by the embodiment of the present application is implemented.
[0020] One embodiment of the above invention has the following advantages or beneficial effects: the present application determines the flow control query account by receiving a flow control request; determines the flow control account based on the flow control query account and the preset flow control list table; in response to the flow control account not existing in the cache, obtains the performance data of each account from the preset flow control list table; based on the performance data, generates a token, refreshes the token to the cache, executes the token acquisition process, and in response to the token acquisition failure and the transaction identifier corresponding to the non-online transaction, executes the token acquisition retry process; in response to the token acquisition success, calls the public deposit component to execute the corresponding transaction and releases the token. The token is used to support dynamic adjustment of the flow, and the flow control account is used to achieve more fine-grained differentiated flow control of the same service, thereby improving the accuracy of flow control.
[0021] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] The accompanying drawings are used to better understand the present application and do not constitute an improper limitation on the present application.
[0023] Figure 1 is a schematic diagram of the main process of a flow control method according to an embodiment of the present application;
[0024] Figure 2 is a schematic diagram of the main process of a flow control method according to an embodiment of the present application;
[0025] Figure 3 It is a main flow chart of a flow control method according to an embodiment of the present application;
[0026] Figure 4 is a schematic diagram of the main units of the flow control device according to an embodiment of the present application;
[0027] Figure 5 is an exemplary system architecture diagram to which the embodiments of the present application can be applied;
[0028] Figure 6 It is a structural diagram of a computer system of a terminal device or server suitable for implementing an embodiment of the present application. DETAILED DESCRIPTION
[0029] The following is a description of the exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, and they should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of known functions and structures is omitted in the following description. It should be noted that the acquisition, transmission, storage, use, and processing of data in the technical solution of the present application are in compliance with the relevant provisions of national laws and regulations. It should be noted that in the embodiments of the present application, certain software, components, models, and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or must have used the solution. In the technical solution of the present application, the collection, analysis, use, transmission, storage, and other aspects of the user's personal information involved are in compliance with the provisions of relevant laws and regulations, and are used for legal and reasonable purposes, and are not shared, leaked, or sold outside of these legal uses, and are subject to supervision and management by regulatory authorities. Take necessary measures to prevent illegal access to such personal information, ensure that persons with access to personal information comply with relevant laws and regulations, and ensure the security of personal information. Once such personal information is no longer needed, risks should be minimized by limiting or even prohibiting data collection and / or deleting data.
[0030] When used, including in certain related applications, user privacy is protected by de-identifying data, such as by removing specific identifiers when used, controlling the amount or specificity of data stored, controlling how data is stored, and / or other methods of de-identification.
[0031] Figure 1 is a schematic diagram of the main process of the flow control method according to an embodiment of the present application, such as Figure 1 As shown, the flow control method mainly includes the following steps S101 to S105.
[0032] Step S101, receiving a flow control request and determining a flow control query account.
[0033] In this embodiment, the execution subject of the flow control method (for example, a server) can receive the flow control request through a wired connection or a wireless connection. After receiving the flow control request, the execution subject can determine the flow control query account in the request through the payment account corresponding to the transaction code carried in the flow control request.
[0034] Specifically, determining the flow control query account number includes: obtaining the payment account number, and intercepting the first preset number of digits of the payment account number as the flow control query account number.
[0035] For example, the first 20 digits of the payment account number can be used as the flow control query account number to determine the flow control account number, so that the flow control can be accurately performed based on the determined flow control account number.
[0036] Step S102, determining the flow control account based on the flow control query account and the preset flow control list table.
[0037] The preset flow control list table may store key-value pairs of flow control query accounts and flow control accounts. The execution subject may search whether there is a corresponding key-value pair in the preset flow control list table according to the flow control query account corresponding to the flow control request. If so, the corresponding flow control account may be determined based on the corresponding key-value pair.
[0038] The flow control query account is used to query the flow control account, which is used for flow control during corporate deposit transactions.
[0039] Step S103, in response to the flow control account not existing in the cache, obtaining performance data of each account from a preset flow control list table.
[0040] The key-value pairs of each flow control account and token are stored in the cache. After obtaining the flow control account, the execution subject can match the obtained flow control account with each key-value pair in the cache. If there is no matching key-value pair, it means that the flow control account does not exist in the cache. At this time, the cache needs to be initialized. Specifically, the performance data of each account can be obtained from the preset flow control list. For example, the performance data of each account can include the performance level and performance of each account. The performance level of an account refers to the comprehensive evaluation of the account on the target platform, including the security level, activity, interactivity and other aspects of the account. Different platforms may have different rating systems and standards. The higher the performance level of an account, the greater the influence and activity of the account on the platform, thereby obtaining more exposure and recommendation opportunities.
[0041] Step S104, based on the performance data, generate a token, refresh the token into the cache, execute a token acquisition process, and in response to a token acquisition failure and the transaction identifier corresponding to a non-online transaction, execute a token acquisition retry process.
[0042] The performance data of the account can be encrypted and tokenized through Fernet token generation to improve security. Fernet is a lightweight secure message format designed specifically for API tokens that does not need to be stored in the database, thereby reducing disk IO and improving performance.
[0043] In addition, the account performance data can also generate tokens in the form of JWT (JSON Web Tokens). This token form is suitable for scenarios where account performance data needs to be transmitted between multiple systems.
[0044] In the embodiment of the present application, the transaction identifier may be, for example, a transaction code.
[0045] Specifically, the token acquisition retry process is executed, including: retrying to obtain the token at a preset interval and a preset number of attempts. If the token is still not obtained, transaction restriction information is returned; if the token is obtained after the retry, it is determined that the token acquisition is successful.
[0046] For example, a preset time interval, such as an interval of 200 ms, and a preset number of attempts, such as 3 attempts, are performed to retry obtaining the token.
[0047] In an embodiment of the present application, when the flow control account is not in the cache, a token is generated according to the performance data of each account in the preset flow control list table and refreshed to the cache to initialize the cache. Since the flow control account is in the preset flow control list table, there is a key-value pair of the flow control account and the token in the cache after initialization, that is, there is a flow control account determined based on the flow control query account and the preset flow control list table in the cache after initialization. At this time, the token acquisition process corresponding to the flow control account is executed, and the token acquisition retry process is executed when the token acquisition fails and the transaction identifier corresponds to a non-online transaction to ensure smooth flow control. By generating a token according to the performance data of each account in the preset flow control list table and refreshing it to the cache to initialize the cache, accurate flow control based on the flow control account can be achieved, ensuring the smoothness and accuracy of flow control execution.
[0048] Step S105, in response to the token being acquired successfully, calling the corporate deposit component to execute the corresponding transaction and releasing the token.
[0049] Specifically, calling the public deposit component to execute the corresponding transaction includes: increasing the number of concurrencies and then calling the public deposit component to execute the corresponding transaction, and after the corresponding transaction is completed, reducing the number of concurrencies.
[0050] When calling the corporate deposit component to execute the corresponding transaction, increasing the number of concurrencies means setting a lock for the corporate deposit component. After the corresponding transaction is completed, reducing the number of concurrencies means releasing the lock for the corporate deposit component, thereby improving the transaction processing capability and efficiency of the corporate deposit component and avoiding interference.
[0051] This embodiment determines the flow control query account by receiving a flow control request; determines the flow control account based on the flow control query account and the preset flow control list table; in response to the flow control account not existing in the cache, obtains the performance data of each account from the preset flow control list table; generates a token based on the performance data, refreshes the token to the cache, executes the token acquisition process, and executes the token acquisition retry process in response to the token acquisition failure and the transaction identifier corresponding to the non-online transaction; in response to the token acquisition success, calls the public deposit component to execute the corresponding transaction and releases the token. The token is used to support dynamic adjustment of the flow, and the flow control account is used to achieve more fine-grained differentiated flow control of the same service, thereby improving the accuracy of flow control.
[0052] Figure 2 FIG. 1 is a schematic diagram of the main flow chart of a flow control method according to an embodiment of the present application. Figure 2 As shown, the flow control method mainly includes the following steps S201 to S206.
[0053] Step S201, receiving a flow control request and determining a flow control query account.
[0054] Step S202, in response to the flow control query account being in the preset flow control list table, querying the preset flow control list table for an account corresponding to the flow control query account.
[0055] The preset flow control list table may be a flow control white list table. The preset flow control list table stores key-value pairs of flow control accounts that require flow control and flow control query accounts.
[0056] Step S203: determine the flow control account based on the account.
[0057] The flow control query account is used to query whether a corresponding flow control account exists in the preset flow control list table. If so, the queried flow control account is determined as the flow control account corresponding to the flow control query account corresponding to the flow control request.
[0058] Specifically, based on the account, determining the flow control account includes: determining the type of the account, and in response to the type including the main account, determining the account of the main account type as the flow control account; in response to the type not including the main account, determining the account of the sub-account type as the flow control account.
[0059] In the account returned by the preset flow control list based on the flow control query account query, if there is a main account, the main account will be used as the flow control account. If there is no main account, the returned account (which may correspond to a sub-account) can be used as the flow control account. This is to achieve compatible linkage payment scenarios.
[0060] Step S204, in response to the flow control account not existing in the cache, obtaining performance data of each account from a preset flow control list table.
[0061] If the obtained flow control account is not in the cache, cache initialization is performed to obtain performance data such as security level, activity, interactivity, etc. of each account from the preset flow control list table.
[0062] Step S205, based on the performance data, generate a token, refresh the token into the cache, execute a token acquisition process, and in response to a token acquisition failure and the transaction identifier corresponding to a non-online transaction, execute a token acquisition retry process.
[0063] The performance data is encrypted to generate a token, and the generated token is associated with each flow control account in the preset flow control list table and updated to the cache. Then, the token acquisition process is executed, and in response to the token acquisition failure and the transaction identifier corresponding to the offline transaction, the token acquisition retry process is executed.
[0064] Step S206, in response to the token being acquired successfully, calling the corporate deposit component to execute the corresponding transaction and release the token.
[0065] After successfully acquiring the token based on the updated cache, the public deposit component is called to execute the corresponding transaction and release the token, completing the flow control.
[0066] Figure 3 It is a main flow chart of the flow control method according to an embodiment of the present application. In the corporate deposit transaction processing scenario, the database capacity of the localized corporate core system is somewhat different from that of the commercial version of the database. High-concurrency operations on the same account may cause database lock (row lock) timeouts, and it is necessary to access the components of the core system to reduce concurrency control. However, the performance of the same transfer service varies greatly due to the different contracted products or service types of corporate current payment accounts. For example, the transfer service performance of an ordinary current account is three times that of an account signed with a third-level real-time pool. In order to reduce business impact and make full use of the service capabilities of the corporate core system, the components that access the core need to perform global, differentiated, and precise concurrency control according to the products signed by the account.
[0067] like Figure 3As shown, when a flow control request is received, the execution subject can determine whether the flow control switch is turned on. If not, the flow control is not executed, the original logic is maintained, and the public deposit component is called to execute the corresponding transaction, and the transaction is ended. If so, the transaction code corresponding to the flow control request is determined, and it is determined whether the corresponding transaction is in the transaction code blacklist. If so, the flow control is not executed, the original logic is maintained, and the public deposit component is called to execute the corresponding transaction, and the transaction is ended. If the corresponding transaction is not in the transaction code blacklist, the first 20 digits of the payment account (this is only an example, without specific limitation) are used as the flow control query account for querying in the flow control whitelist. Determine whether the flow control query account is in the flow control whitelist table (i.e., the preset flow control list table of this application). If it is not in the flow control whitelist table, flow control will not be executed. The original logic is maintained, and the corporate deposit component is called to execute the corresponding transaction. End. If the flow control query account is in the flow control whitelist table, the flow control account corresponding to the flow control query account is queried from the flow control whitelist table. Specifically, the flow control account can be determined based on the account returned by the query. For example, when the account returned from the flow control whitelist table based on the flow control query account contains the main account, the returned main account is used as the flow control account. If the returned account does not contain the main account but contains a sub-account, the returned sub-account is used as the flow control account. After determining the flow control account, the execution subject can determine whether the flow control account is in the cache. If the flow control account is not in the cache, the cache is initialized according to the account performance level in the flow control whitelist table, that is, the performance level and performance corresponding to each account are obtained from the flow control account whitelist table, and the token is generated and refreshed to the cache to obtain the token. If the token acquisition fails, determine whether the transaction is restricted and whether it is an online transaction. If the transaction is restricted and it is an online transaction, it returns transaction restriction. If the transaction is restricted but not an online transaction, the flow control package is called at an interval of 200ms, and it tries 3 times after sleep. If the token is not obtained, it returns transaction restriction. If the token is successfully obtained, call the public deposit component and increase the number of concurrency to execute the transfer transaction. After the transfer transaction is executed, reduce the number of concurrency for the public deposit component, and then release the token to end. If the flow control account is in the cache, determine whether the transaction is restricted and whether it is an online transaction. If the transaction is restricted and it is an online transaction, return transaction restricted. If the transaction is restricted but not an online transaction, call the flow control package at an interval of 200ms, try 3 times after sleep, and return transaction restricted if the token corresponding to the flow control account has not been obtained. If the token corresponding to the flow control account is successfully obtained, call the public deposit component and increase the concurrency to execute the transfer transaction. After the transfer transaction is executed, reduce the concurrency of the public deposit component, and then release the token, and end.
[0068] For example, the flow control method of the embodiment of the present application is:
[0069] (1) If the flow control switch is not turned on, the flow control is not performed and the original logic is maintained. Otherwise, the next step is performed.
[0070] (2) By default, all transactions are subject to flow control. If the transaction code is in the transaction code blacklist, flow control will not be applied and the original logic will remain unchanged. Otherwise, proceed to the next step.
[0071] (3) Determine whether the flow control query account is in the flow control whitelist table. If not, no flow control is required. If it is, determine the flow control account based on the returned account (i.e., the account found in the flow control whitelist table database through the flow control query account, which can be a sub-account or a main account). That is, if the top-level account (i.e., the main account) in the returned account is not empty, the top-level account is used as the flow control account. Otherwise, the customer account (i.e., the sub-account) is used as the flow control account, thereby adapting to the linkage payment scenario;
[0072] (4) Determine whether the flow control account exists in the cache. If not, obtain the performance level and performance corresponding to the account from the flow control account whitelist table, generate a token and refresh it to the cache;
[0073] (5) Get a token. If the token acquisition fails, determine whether it is an online transaction. If it is an online transaction, return "Transaction Restricted". If it is not an online transaction, try three times at an interval of 200ms. If the token is not obtained, return "Transaction Restricted". If the token acquisition succeeds, execute the transfer transaction and then release the token.
[0074] The embodiment of the present application uses the preset token of the third-party cache to achieve global precise control and support dynamic adjustment; it uses the payment account as the key of flow control to achieve differentiated control of the same service at a finer granularity. It realizes account-level flow control, and can realize dynamic adjustment of flow control strategy after the service is started.
[0075] Figure 4 Schematic diagram of the main units of the flow control device according to an embodiment of the present application. Figure 4 As shown, the flow control device 400 includes a receiving unit 401 , a flow control account determining unit 402 , an acquiring unit 403 , an executing unit 404 and a token releasing unit 405 .
[0076] The receiving unit 401 is configured to receive a flow control request and determine a flow control query account.
[0077] The flow control account determining unit 402 determines the flow control account based on the flow control query account and the preset flow control list table.
[0078] The acquisition unit 403 is configured to acquire the performance data of each account from the preset flow control list table in response to the flow control account not existing in the cache.
[0079] The execution unit 404 is configured to generate a token based on the performance data, refresh the token into the cache, execute a token acquisition process, and execute a token acquisition retry process in response to a token acquisition failure and a transaction identifier corresponding to a non-online transaction.
[0080] The token releasing unit 405 is configured to call the corporate deposit component to execute the corresponding transaction and release the token in response to successful acquisition of the token.
[0081] In some embodiments, the receiving unit 401 is further configured to: obtain the payment account number, and intercept the first preset number of digits of the payment account number as the flow control query account number.
[0082] In some embodiments, the flow control account determination unit 402 is further configured to: in response to the flow control query account being in the preset flow control list, query the account corresponding to the flow control query account from the preset flow control list; and determine the flow control account based on the account.
[0083] In some embodiments, the flow control account determination unit 402 is further configured to: determine the type of the account, and in response to the type being configured as a primary account, determine the account of type as a primary account as a flow control account; in response to the type not being configured as a primary account, determine the account of type as a sub-account as a flow control account.
[0084] In some embodiments, the token release unit 405 is further configured to: call the corporate deposit component to execute the corresponding transaction after increasing the concurrency number, and reduce the concurrency number after the corresponding transaction is completed.
[0085] In some embodiments, the execution unit 404 is further configured to: retry to obtain the token at a preset time interval and a preset number of attempts, and return transaction restriction information if the token is still not obtained; if the token is obtained after the retry, it is determined that the token is obtained successfully.
[0086] It should be noted that the flow control method and flow control device of the present application have a corresponding relationship in terms of specific implementation contents, so the repeated contents will not be described again.
[0087] Figure 5 An exemplary system architecture 500 is shown to which the flow control method or flow control device according to the embodiment of the present application can be applied.
[0088] like Figure 5As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0089] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 501, 502, 503, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0090] The terminal devices 501, 502, 503 may be various electronic devices having a flow control processing screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0091] Server 505 can be a server that provides various services, such as a background management server that provides support for flow control requests submitted by users using terminal devices 501, 502, and 503 (only as an example). The background management server can receive flow control requests and determine the flow control query account; determine the flow control account based on the flow control query account and the preset flow control list table; in response to the flow control account not existing in the cache, obtain the performance data of each account from the preset flow control list table; based on the performance data, generate a token, refresh the token to the cache, execute the token acquisition process, and in response to the failure of token acquisition and the transaction identifier corresponding to a non-online transaction, execute the token acquisition retry process; in response to the success of token acquisition, call the public deposit component to execute the corresponding transaction and release the token. Support for dynamic adjustment of traffic is achieved through tokens, and more fine-grained differentiated flow control of the same service is achieved through flow control accounts, thereby improving the accuracy of flow control.
[0092] It should be noted that the flow control method provided in the embodiment of the present application is generally executed by the server 505, and accordingly, the flow control device is generally set in the server 505.
[0093] It should be understood that Figure 5 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.
[0094] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present application. Figure 6The terminal device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0095] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the computer system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0096] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0097] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present application are executed.
[0098] It should be noted that the computer-readable medium shown in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. Computer-readable storage media may include, for example, but are not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0099] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0100] The units involved in the embodiments described in the present application may be implemented by software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes a receiving unit, a flow control account determination unit, an acquisition unit, an execution unit, and a token release unit. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0101] As another aspect, the present application also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device receives a flow control request and determines a flow control query account; determines a flow control account based on the flow control query account and a preset flow control list table; in response to the flow control account not existing in the cache, obtains performance data of each account from the preset flow control list table; based on the performance data, generates a token, refreshes the token to the cache, executes a token acquisition process, and executes a token acquisition retry process in response to a token acquisition failure and the transaction identifier corresponds to a non-online transaction; in response to a token acquisition success, calls a public deposit component to execute the corresponding transaction and releases the token.
[0102] The computer program product of the present application includes a computer program, and when the computer program is executed by a processor, the flow control method in the embodiment of the present application is implemented.
[0103] According to the technical solution of the embodiment of the present application, dynamic traffic adjustment is supported through tokens, and more fine-grained differentiated traffic control for the same service is achieved through flow control accounts, thereby improving the accuracy of flow control.
[0104] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A flow control method, characterized in that: include: Receive flow control requests and determine flow control query accounts; Determine the flow control account based on the flow control query account and the preset flow control list table; In response to the flow control account not existing in the cache, obtaining performance data of each account from the preset flow control list table; generating a token based on the performance data, refreshing the token into a cache, executing a token acquisition process, and in response to a token acquisition failure and the transaction identifier corresponding to a non-online transaction, executing a token acquisition retry process; In response to successful acquisition of the token, the corporate deposit component is called to execute the corresponding transaction and release the token.
2. The method according to claim 1, characterized in that The determining of the flow control query account includes: Obtain the payment account number, and extract the first preset number of digits of the payment account number as the flow control query account number.
3. The method according to claim 1, characterized in that The determining of the flow control account includes: In response to the flow control query account being in a preset flow control list table, querying the preset flow control list table for an account corresponding to the flow control query account; Based on the account, a flow control account is determined.
4. The method according to claim 3, characterized in that The determining the flow control account based on the account includes: Determining the type of the account, and in response to the type including a primary account, determining the account of the primary account type as a flow control account; In response to the type not including the main account, an account of the sub-account type is determined as a flow control account.
5. The method according to claim 1, characterized in that The calling of the public deposit component to execute the corresponding transaction includes: After increasing the number of concurrencies, the public deposit component is called to execute the corresponding transaction. After the corresponding transaction is completed, the number of concurrencies is reduced.
6. The method according to claim 1, characterized in that The execution token acquisition retry process includes: The token is retried after a preset time interval and a preset number of attempts. If the token is still not obtained, transaction restriction information is returned; if the token is obtained after the retry, it is determined that the token is obtained successfully.
7. A flow control device, characterized in that: include: A receiving unit is configured to receive a flow control request and determine a flow control query account; A flow control account determination unit, which determines the flow control account based on the flow control query account and a preset flow control list table; an acquisition unit, configured to acquire performance data of each account from the preset flow control list table in response to the flow control account not existing in the cache; an execution unit configured to generate a token based on the performance data, refresh the token into a cache, execute a token acquisition process, and in response to a token acquisition failure and the transaction identifier corresponding to a non-online transaction, execute a token acquisition retry process; The token releasing unit is configured to call the public deposit component to execute the corresponding transaction and release the token in response to successful acquisition of the token.
8. The device according to claim 7, characterized in that The receiving unit is further configured to: Obtain the payment account number, and extract the first preset number of digits of the payment account number as the flow control query account number.
9. The device according to claim 7, characterized in that The flow control account determination unit is further configured to: In response to the flow control query account being in a preset flow control list table, querying the preset flow control list table for an account corresponding to the flow control query account; Based on the account, a flow control account is determined.
10. The device according to claim 9, characterized in that The flow control account determination unit is further configured to: Determining the type of the account, and in response to the type being configured as a primary account, determining the account of the primary account type as a flow control account; In response to the type not being configured as a main account, an account of the sub-account type is determined as a flow control account.
11. The device according to claim 7, characterized in that The token release unit is further configured to: After increasing the number of concurrencies, the public deposit component is called to execute the corresponding transaction. After the corresponding transaction is completed, the number of concurrencies is reduced.
12. The device according to claim 7, characterized in that The execution unit is further configured to: The token is retried after a preset time interval and a preset number of attempts. If the token is still not obtained, transaction restriction information is returned; if the token is obtained after the retry, it is determined that the token is obtained successfully.
13. A flow control electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
14. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Token-based system flow control method and device, electronic equipment and storage medium
CN109412967A
Business processing method, system and device and storage medium
CN112350978A
Token bucket updating method and device, electronic equipment and storage medium
CN115297061A
Method, device and equipment for processing service request and computer readable medium
CN118520011A
Systems and methods for use in securing open service connections
US20240152635A1
Cited By
Dynamic advertisement frequency control optimization method based on multi-dimensional evaluation of family members
CN121814694A
