A flow control method, device, storage medium and equipment
By judging the historical reception of requests and the time when the requests were generated in the gateway, and processing the requests in order of the time of the requests, the problem of improper delay of requests caused by random selection of the gateway is solved, and orderly flow control is achieved.
Patent Information
- Application Number
- CN202110529217.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-14
- Publication Date
- 2025-11-28
- Estimated Expiration
- 2041-05-14
AI Technical Summary
In existing technologies, when a gateway performs flow control, randomly selecting requests may result in requests that have already been rejected being rejected repeatedly, while new requests are not processed in a timely manner, leading to the problem that earlier requests are processed later and later requests are processed first.
By analyzing the historical reception of each request, the system generates or updates the request identifier and request time, sorts the requests according to their chronological order, processes requests before a specified position, and rejects requests after a specified position.
This ensures that earlier requests are processed first, and later requests are processed later, thus achieving orderly flow control and avoiding duplicate rejections and undue delays.
Smart Images

Figure CN113347110B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present specification relates to the technical field of computer technology, and particularly relates to a traffic control method and device, a storage medium and equipment. BACKGROUND
[0002] With the rapid development of the Internet, a large number of concurrent requests are sent to various systems through the gateway every day, but since the number of requests that can be processed by the system each time is limited, the requests exceeding the upper limit of the system processing quantity will be accumulated. For example, when a user uses a card or a code scanning method to make a payment, a transaction request is sent to a bank system through a payment gateway. During the peak period of business, multiple transaction requests are sent to the bank system through the payment gateway. Since the number of transaction requests that can be processed by the bank system each time is limited, the transaction requests exceeding the upper limit of the bank system processing will be accumulated.
[0003] In order to solve the above request accumulation problem, in the prior art, the gateway will control the traffic of the upstream system sending the request. When multiple requests are sent through the gateway, the gateway will randomly select the number of requests that can be processed by the downstream system from the multiple requests, and reject other requests, so as to achieve the purpose of limiting the flow of the upstream system of the gateway. Subsequently, the upstream system will send the requests that have been rejected by the downstream system and new requests to the gateway again, and the gateway will still randomly select the number of requests that can be processed by the downstream system, and reject other requests.
[0004] Since the gateway randomly selects the requests from the same batch of requests, the selected requests may contain requests that have been rejected, or may contain new requests, which may cause some requests to be rejected multiple times, resulting in the problem that the requests with earlier request time are processed later, and the requests with later request time are processed first. SUMMARY
[0005] The present specification provides a traffic control method and device to partially solve the above problems existing in the prior art.
[0006] The present specification adopts the following technical solutions:
[0007] The present specification provides a traffic control method, comprising:
[0008] in response to each request received;
[0009] For each request, it is judged whether the request has been received in history or not, if yes, an identification generated in history for the request is taken as the identification of the request, and in the stored historical receiving time of each request, a historical receiving time corresponding to the identification is determined as the request time of the request, if not, the identification of the request is generated, the current time is determined as the request time of the request, the correspondence between the identification and the request time is established and stored;
[0010] According to the order of the request time, the identification corresponding to each request is sorted;
[0011] For each identification, it is judged whether the identification is before the specified position according to the sorting result;
[0012] If yes, the request corresponding to the identification is processed;
[0013] If not, the request corresponding to the identification is rejected.
[0014] Optionally, it is judged whether the request has been received in history, and the method specifically comprises:
[0015] The valid time period of the request is searched in the stored valid time period of each request;
[0016] It is judged whether the current time is in the valid time period or not;
[0017] If the current time is in the valid time period, it is determined that the request has been received in history;
[0018] If the current time is not in the valid time period, or the valid time period of the request is not searched in the stored valid time period of each request, it is determined that the request has not been received in history.
[0019] Optionally, it is determined that the request has not been received in history, and the method further comprises:
[0020] The valid time period of the request is determined and stored.
[0021] Optionally, according to the order of the request time, the identification corresponding to each request is sorted, and the method specifically comprises:
[0022] According to the order of the request time, the identification corresponding to each request is stored to a queue, and the queue is a distributed message queue.
[0023] Optionally, it is judged whether the identification is before the specified position according to the sorting result, and the method specifically comprises:
[0024] It is judged whether the identification is a specified token identification or not;
[0025] If yes, it is determined that the request is before the specified position;
[0026] If no, it is determined that the request is not in the specified position.
[0027] Optionally, the request corresponding to the identification is processed, specifically including:
[0028] The request is sent to a downstream system for processing the request;
[0029] After processing the request corresponding to the identification, the method further includes:
[0030] Determining the identification retention duration of the request;
[0031] In response to receiving the response to processing the request issued by the downstream system within the identification retention duration of the request, the identification of the request is deleted from the sorting result.
[0032] Optionally, in response to not receiving the response to processing the request issued by the downstream system within the identification retention duration of the request, the method further includes:
[0033] Determining a specified time according to the current time and the identification retention duration;
[0034] Redetermining the valid time period of the request in a determination manner that the end time of the valid time period is not earlier than the specified time;
[0035] Deleting the identification of the request from the sorting result.
[0036] The specification provides a traffic control device, including:
[0037] A receiving module for responding to each request received;
[0038] A request processing module for each request, determining whether the request has been received historically, if yes, taking the identification generated for the request historically as the identification of the request, and determining the historical receiving time corresponding to the identification among the historical receiving times of the historical received requests stored, as the request time of the request, if no, generating the identification of the request, determining the current time as the request time of the request, establishing the correspondence between the identification and the request time and storing;
[0039] A sorting module for sorting the identifications corresponding to each request in the order of the request times;
[0040] A flow limiting module for each identification, determining whether the identification is in the specified position according to the sorting result, if yes, processing the request corresponding to the identification, if no, rejecting the request corresponding to the identification.
[0041] The specification provides a computer readable storage medium, the storage medium stores a computer program, the computer program is executed by a processor to realize the flow control method.
[0042] The specification provides an electronic device, including a memory, a processor and a computer program stored on the memory and executable on the processor, the processor executes the program to realize the flow control method.
[0043] The above at least one technical solution adopted by the specification can achieve the following beneficial effects:
[0044] In the flow control method provided by the specification, for each received request, it is first judged whether the request has been received in history, in the case that the request has been received in history, the identification generated for the request in history is taken as the identification of the request, and the receiving time of the request in history is taken as the request time of the request, in the case that the request has not been received in history, the identification of the request is generated and the current time is determined as the request time, the correspondence between the identification and the request time is established and stored, then, according to the order of the request time, the request identifications are sorted, according to the sorting result, the requests corresponding to the identifications ranked before the specified position are processed, and the requests corresponding to the identifications not ranked before the specified position are rejected.
[0045] As can be seen from the above method, for each request, when the request is received for the first time, the gateway determines the identification and the request time, establishes and stores the correspondence between the identification and the request time, when the request is received by the gateway again, the gateway can also retrieve the time when the request is received for the first time and take it as the request time of the request, instead of taking the current time as the request time of the request, so that when the requests are sorted, the request can be ranked before the request with later request time, so as to ensure that the gateway controls the flow of the requests according to the order of the request time, so as to ensure that the request with earlier request time can be processed first and the request with later request time can be processed later. BRIEF DESCRIPTION OF DRAWINGS
[0046] The drawings described herein are used to provide further understanding of the specification, constitute a part of the specification, the illustrative embodiments of the specification and the description thereof are used to explain the specification, and do not constitute improper limitation on the specification. In the drawings:
[0047] Figure 1 It is a flowchart of a flow control method in the specification;
[0048] Figure 2 It is a schematic diagram of a flow control device provided by the specification;
[0049] Figure 3The electronic device schematic diagram corresponding to Figure 1 of the present specification. DETAILED DESCRIPTION
[0050] For the purpose, technical solutions and advantages of the present specification, the technical solutions of the present specification will be described in detail below in combination with specific embodiments of the present specification and corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present specification, not all embodiments. Based on the embodiments in the present specification, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present specification.
[0051] The technical solutions provided by the embodiments of the present specification will be described in detail below in combination with the drawings.
[0052] Figure 1 The flowchart of a flow control method in the present specification, specifically comprising the following steps:
[0053] S100: in response to the received requests.
[0054] The execution subject of the present method can be a gateway or other execution subject, which is not limited in the present specification. The upstream system for sending requests can send multiple requests to the downstream system for processing requests through the gateway at the same time. Since the number of requests that the downstream system for processing requests can process at a time is limited, requests exceeding the processing capacity of the downstream system will be accumulated. For example, the upstream system for sending transaction requests sends one thousand transaction requests to the bank system for processing transaction requests through the gateway at the same time, and the bank system can only process five hundred transaction requests at a time, so the other five hundred transaction requests will be accumulated.
[0055] In order to avoid the accumulation of a large number of requests, the gateway will control the flow of the upstream system for sending requests.
[0056] The upstream system sends multiple requests to the gateway at a time, and the gateway sends a response that the request has been received to the upstream system after receiving each request.
[0057] When the upstream system for sending requests receives the response that the request has been received sent by the gateway within a specified time, the upstream system no longer sends the same requests as this time; when the upstream system for sending requests does not receive the response that the request has been received sent by the gateway within a specified time, the upstream system sends the same requests as this time again.
[0058] Specifically, if the upstream system receives the response that each request has been received sent by the gateway within a specified time, the upstream system will not send the multiple requests again; if the upstream system does not receive the response that each request has been received sent by the gateway within a specified time, the upstream system can default that the multiple requests sent this time have not been received by the gateway, and send the multiple requests sent this time to the gateway again, wherein the specified time can be set as needed, and the specification does not make any limitation.
[0059] Subsequently, the gateway can perform subsequent steps of the method according to the ability of the downstream system for processing the request to perform flow control on the upstream system.
[0060] S102: For each request, it is judged whether the request has been received in history, if yes, S104 is executed, and if no, S106 is executed.
[0061] In the embodiment of the specification, in order to ensure that the gateway can achieve the purpose of orderly controlling flow, for each request, the gateway can store the time when the request is first received as the request time of the request, even if the request is rejected in this operation due to flow control, since the gateway has stored the request time of the request, when the gateway receives the request again, the request will be processed first, and other requests with later request time will be processed later.
[0062] Therefore, after the gateway receives each request, for each request, the gateway can first judge whether the request has been received in history, that is, whether the gateway is first receiving the request.
[0063] S104: The identifier generated for the request in history is taken as the identifier of the request, and the historical receiving time corresponding to the identifier is determined from the historical receiving times of the requests stored in history as the request time of the request, and S108 is executed.
[0064] Specifically, when the gateway determines that the request has been received in history through the judgment of step S102, that is, when the gateway is not first receiving the request, since the gateway has stored the identifier and the request time of the received request, the gateway can find the identifier generated for the request in history from the stored identifiers according to the parameters of the request itself, for example, when the request is a transaction request, the parameters of the request itself can be parameters such as transaction request serial number, and determine the historical receiving time of the request from the historical receiving times of the requests stored in history as the request time of the request.
[0065] S106: The identifier of the request is generated, the current time is determined as the request time of the request, the correspondence between the identifier and the request time is established and stored, and S108 is executed.
[0066] Specifically, when the gateway determines that the request has not been received in history through the judgment of step S102, i.e., the gateway is receiving the request for the first time, the current time can be determined as the request time of the request, an identifier is generated for the request, the request time and the identifier of the request are established in a corresponding relationship and stored, wherein the purpose of establishing the corresponding relationship between the request time and the identifier is that the gateway can determine the request time of the request from the identifiers of the stored requests.
[0067] For example, the gateway receives request A at 10:00 on January 1, 2021, and determines through judgment that the gateway has not received request A in history, i.e., the gateway is receiving request A for the first time. The gateway generates an identifier 20211234 for request A, determines the current time January 1, 2021, 10:00 as the request time of request A, and establishes a corresponding relationship between the identifier 20211234 of request A and the request time January 1, 2021, 10:00 and stores it. If request A is rejected by the gateway due to flow control, the upstream system will send request A again. The gateway receives request A at 11:00 on January 1, 2021, and determines through judgment that the gateway has received request A in history, i.e., the gateway is not receiving request A for the first time. The gateway uses the identifier 20211234 generated for request A in history as the identifier of request A again, and determines the historical receiving time corresponding to the identifier 20211234, i.e., January 1, 2021, 10:00, as the request time of request A from the historical receiving times of the requests received in history.
[0068] Since the memory of the gateway is limited, in order to ensure that the gateway has enough space to store the identifiers and request times of each request, the gateway can delete the request times and identifiers corresponding to the requests that have not been processed for a long time every period of time. When the request corresponding to the deleted request time and identifier is sent to the gateway again, it will be treated by the gateway as a request that has not been received in history, i.e., the gateway is receiving the request for the first time.
[0069] Specifically, the gateway can set a valid time period for each request. For each request, as long as the gateway receives the request within the valid time period of the request, it is considered that the request has been received in history, i.e., the gateway is not receiving the request for the first time. The gateway can find the identification of the request in history as the identification of the request through the above step S104, take the receiving time of the request received in history as the request time, when the gateway receives the request time is not within the valid time period of the request, the gateway can consider that the request has not been received in history, i.e., the gateway is receiving the request for the first time, a new identification is generated for the request, the current time is taken as the request time of the request, the identification and the request time of the request are stored, and a new valid time period is generated for the request and stored. The original identification and request time of the request can also be deleted from the gateway. The valid time period can be set as needed, and the present specification does not limit it.
[0070] Continuing with the above example, the gateway receives request A at 10:00 on January 1, 2021, determines that the identification of request A is 20211234, and the request time is 10:00. The identification 20211234 and the request time January 1, 2021, 10:00 are stored in a corresponding relationship, and the valid time period of request A is determined to be January 1, 2021, 10:00-12:00 and stored.
[0071] When the gateway receives request A at 11:30 on January 1, 2021, it is determined that the current time January 1, 2021, 11:30 is within the valid time period January 1, 2021, 10:00-12:00, so it is determined that request A has been received in history, i.e., the gateway is not receiving request A for the first time. The identification of request A is still 20211234, and the request time is still January 1, 2021, 10:00.
[0072] When the gateway receives request A at 12:30 on January 1, 2021, it is determined that the current time January 1, 2021, 12:30 is not within the valid time period January 1, 2021, 10:00-12:00, so the gateway determines that request A has not been received in history, i.e., the gateway is receiving request A for the first time. The gateway generates a new identification 20212345 for request A, takes the current time January 1, 2021, 12:30 as the request time of request A, establishes a corresponding relationship between the identification 20212345 of request A and the request time January 1, 2021, 12:30, and stores it, re-determines the valid time period of request A to be January 1, 2021, 12:30-14:30 and stores it, and deletes the original identification 20211234, the original request time January 1, 2021, 10:00, and the original valid time period January 1, 2021, 10:00-12:00 of request A.
[0073] S108: Sort the identifiers corresponding to the requests according to the order of the request time.
[0074] To ensure that the request with the earliest request time is processed first, the gateway can find the request with the earliest request time among the received requests by traversal and send it to the downstream system for processing requests, and then send the requests in turn to the downstream system for processing requests according to the order of the request time until the number of requests sent reaches the upper limit of the number of requests processed by the downstream system.
[0075] In addition to the above method, in the embodiments of the present specification, the gateway can also sort the received requests according to the order of the request time of each request determined above. The sorting method can be to store the identifiers of the requests into a queue. Specifically, the gateway can store the identifiers corresponding to the requests into a distributed message queue according to the order of the request time, where the distributed message queue is a queue based on Remote Dictionary Server (Redis). In addition, other methods can also be used for sorting, which is not limited in the present specification.
[0076] S110: For each identifier, determine whether the identifier is before the specified position according to the sorting result. If yes, perform S112; if no, perform S114.
[0077] Since the number of requests processed by the downstream system for processing requests is limited each time, according to the sorting result of each request obtained in step S108, the gateway can send the request corresponding to the identifier before the specified position in the queue order to the downstream system for processing requests, and reject the request corresponding to the identifier after the specified position in the queue order. The specified position can be set as needed, for example, the upper limit of the number of requests processed by the downstream system is 100, and the specified position can be set to the 100th position. The positions from the 1st to the 100th are all positions before the specified position.
[0078] Specifically, in step S108, the gateway stores the identifiers corresponding to the requests into the distributed message queue according to the order of the request time, which can be regarded as storing the requests into an ordered token bucket in turn. The identifier corresponding to each request is a token identifier, and the specified position is the position corresponding to the upper limit of the capacity of the token bucket. The gateway can take the token identifier within the capacity of the token bucket as a specified token identifier. For each request, when the identifier corresponding to the request, i.e., the token identifier, is the same as the specified token identifier, the gateway can consider that the token identifier is before the specified position. When the identifier corresponding to the request, i.e., the token identifier, is different from the specified token identifier, the gateway can consider that the token identifier is not before the specified position.
[0079] For example, the capacity of the token bucket is 100, and the token identifiers are 2021001-2021100. The request with the token identifier 2021001-2021100 in the token bucket can be considered as being queued in the specified position in the sorting result, and the request with other token identifiers can be considered as being queued after the specified position in the sorting result.
[0080] S112: Process the request corresponding to the identifier.
[0081] When it is determined that the identifier of the request is in the specified position, it means that the request is allowed to be processed. The gateway sends the request to the downstream system for processing the request. After receiving the response of the request from the downstream system for processing the request, the gateway sends a response to the upstream system that the request has been processed by the downstream system, and deletes the identifier of the request in the sorting result.
[0082] In addition, based on the same reason as step S106, in order to ensure that the memory of the gateway is sufficient, the identifier retention time of the request can be determined. If the response of the downstream system for processing the request is received within the identifier retention time, the gateway sends a response to the upstream system that the request has been processed by the downstream system, and deletes the identifier of the request from the sorting result determined in step S108. If the response of the downstream system for processing the request is not received within the identifier retention time, the gateway sends a response to the upstream system that the request has not been processed by the downstream system. When the upstream system receives the response that the request has not been processed by the downstream system sent by the gateway, the upstream system can send the request to the gateway again.
[0083] It is worth noting that when the gateway does not receive the response of the downstream system within the identifier retention time of the request, the gateway sends a response to the upstream system that the request has been released by the gateway but has not been processed by the downstream system, and deletes the identifier of the request from the sorting result. When the upstream system receives the response that the request has been released by the gateway but has not been processed, the upstream system can send the request to the gateway again. The time when the gateway receives the request again may not be within the valid time period of the request. The gateway considers that the request is received for the first time, and the request time of the request is updated to the current time. However, the request is not processed by the downstream system because the request is limited by the gateway, but because of the internal reason of the downstream system. Therefore, the gateway can process the request which is not processed due to the internal reason of the downstream system and the request which is rejected due to the limitation separately.
[0084] In the case that the request is not processed due to internal reasons of the downstream system, the valid time period of the request can be updated to ensure that the request is re-sent to the gateway by the upstream system, and the time when the gateway receives the request again is still within the valid time period of the request. The gateway can determine that the request is not received for the first time, and the request time of the request is still the time when the request is received for the first time by the gateway, so as to ensure that the request can be arranged before the request with a later request time in the arrangement. In addition, the upstream system needs a certain time to receive the response sent by the gateway that the request has been processed by the gateway but not processed by the downstream system and to send the request to the gateway again. Therefore, the end time of the updated valid time period of the request can be later than the time corresponding to the identification retention time added to the current time, so as to ensure that the time when the request is received by the gateway again is within the valid time period of the request.
[0085] Specifically, the specified time can be determined according to the current time and the identification retention time, the valid time period of the request is determined again in a manner that the end time of the valid time period is not earlier than the specified time, and the identification of the request is deleted from the arrangement result. The specified time can be the time corresponding to the identification retention time added to the current time. When the request is sent to the gateway again by the upstream system, the time when the gateway receives the request is still within the valid time period of the request, and the request time of the request can still be the time when the request is received for the first time by the gateway, so as to ensure that the request can be arranged before the request with a later request time according to the request time in the arrangement.
[0086] S114: reject the request corresponding to the identification.
[0087] When it is determined that the identification of the request is not arranged before the specified position, the gateway rejects to process the request, and the gateway can send a response rejecting the request to the upstream system for sending the request. When the upstream system for sending the request receives the response rejecting the request sent by the gateway, the upstream system sends the request again.
[0088] Specifically, after rejecting to process the request, the gateway sends a response rejecting the request to the upstream system. After receiving the response, the upstream system sends the rejected request to the gateway again, and steps S100-S110 are repeated until the request is processed by the gateway.
[0089] The traffic control method provided by one or more embodiments of the present specification is based on the same idea. The present specification also provides a corresponding traffic control device, as shown in Figure 2
[0090] Figure 2 A traffic control device provided by the present specification includes:
[0091] The receiving module 201, the request processing module 202, the sorting module 203, and the flow limiting module 204, wherein:
[0092] The receiving module 201 is configured to respond to each received request.
[0093] The request processing module 202 is configured to, for each request, determine whether the request has been received in history, if so, take an identifier generated for the request in history as an identifier of the request, and determine a historical receiving time corresponding to the identifier among historical receiving times of the requests received in history and store, as a request time of the request; if not, generate an identifier of the request, determine a current time as a request time of the request, and store a correspondence between the identifier and the request time.
[0094] The sorting module 203 is configured to sort the identifiers corresponding to the requests according to the order of the request times.
[0095] The flow limiting module 204 is configured to, for each identifier, determine whether the identifier is before a specified position according to the sorting result; if so, process the request corresponding to the identifier; if not, reject the request corresponding to the identifier.
[0096] Optionally, the request processing module 202 is specifically configured to find an effective time period of the request among the effective time periods of the requests stored; determine whether the current time is within the effective time period; if the current time is within the effective time period, determine that the request has been received in history; if the current time is not within the effective time period, or the effective time period of the request is not found among the effective time periods of the requests stored, determine that the request has not been received in history.
[0097] Optionally, the request processing module 202 is further configured to determine the effective time period of the request and store.
[0098] Optionally, the sorting module 203 is specifically configured to store the identifiers corresponding to the requests to a queue according to the order of the request times, and the queue is a distributed message queue.
[0099] Optionally, the flow limiting module 204 is specifically configured to determine whether the identifier is a specified token identifier; if so, determine that the request is before the specified position; if not, determine that the request is not before the specified position.
[0100] Optionally, the flow control module 204 is specifically configured to send the request to a downstream system for processing the request; after processing the request corresponding to the identifier, the flow control module 204 is further configured to determine an identifier retention time length of the request; and in response to receiving a response to the request sent by the downstream system within the identifier retention time length of the request, delete the identifier of the request from the sorting result.
[0101] Optionally, the flow control module 204 is further configured to determine a specified time according to the current time and the identifier retention time length; and determine the valid time period of the request again in a manner that the end time of the valid time period is not earlier than the specified time; and delete the identifier of the request from the sorting result.
[0102] The specification also provides a computer readable storage medium storing a computer program, the computer program being used to execute the above Figure 1 flow control method.
[0103] The specification also provides an electronic device Figure 3 as shown in the schematic structural diagram of the electronic device. As Figure 3 described, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory and a non-volatile memory, and of course, can also include other hardware required by a business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs to implement the above Figure 1 flow control method. Of course, in addition to the software implementation, the specification does not exclude other implementation manners, such as a logic device or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or a logic device.
[0104] In the 1990s, it was quite obvious to distinguish whether an improvement in a technology was in hardware (e.g., improvement in circuit structures of diodes, transistors, switches, etc.) or in software (improvement in method flow). However, as technology has evolved, many improvements in method flow today can be considered as direct improvements in hardware circuit structures. Designers almost always obtain the corresponding hardware circuit structures by programming the improved method flow into hardware circuits. Therefore, it cannot be said that an improvement in a method flow cannot be implemented by hardware entity modules. For example, a programmable logic device (PLD) such as a field programmable gate array (FPGA) is an integrated circuit whose logic function is determined by user programming of the device. A digital system is "integrated" on a piece of PLD by the designer programming it by himself, without having to ask a chip manufacturer to design and manufacture a special integrated circuit chip. Moreover, instead of manually fabricating an integrated circuit chip, this programming is now mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing a program, and the original code before compilation also has to be written in a specific programming language, which is called a hardware description language (HDL), and there are many types of HDL, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., and the most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should be aware that, as long as the method flow is logically programmed in the above-mentioned hardware description languages and programmed into an integrated circuit, a hardware circuit that implements the logical method flow can be easily obtained.
[0105] The controller can be implemented in any suitable way, for example, the controller can take the form of a microprocessor or processor and a computer readable medium storing computer readable program code, such as software or firmware, executable by the (micro)processor, logic gates, switches, an application specific integrated circuit (ASIC), a programmable logic controller and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that, in addition to being implemented in pure computer readable program code, the controller can equally well be implemented to perform the same functions using logic gates, switches, an application specific integrated circuit, a programmable logic controller and an embedded microcontroller, etc. by means of a logical programming of the method steps. The controller can thus be considered as a hardware component, and the means comprised therein for performing the various functions can be considered as structures within the hardware component. Alternatively, the means for performing the various functions can even be considered as both a software module implementing the method and a structure within the hardware component.
[0106] The systems, apparatuses, modules or units illustrated by the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0107] For the sake of description, the above apparatuses are described in various units by functions respectively. Of course, the functions of each unit can be implemented in the same or multiple software and / or hardware in implementing the present specification.
[0108] Those skilled in the art will understand that the embodiments of the present application can be provided as a method, a system or a computer program product. Therefore, the present application can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, the present application can take the form of a computer program product implemented on one or more computer usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer usable program code.
[0109] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or combination thereof. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or combination thereof.
[0110] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or combination thereof. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or combination thereof.
[0111] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or combination thereof. Figure 1 one or more flowcharts and / or blocks in the flowcharts and / or combination thereof.
[0112] In one typical configuration, the computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0113] The memory can include non-persistent memory and / or volatile memory, such as random access memory (RAM) and / or cache memory, non-volatile memory, such as read-only memory (ROM), EPROM, and / or flash memory. The memory is an example of computer-readable media.
[0114] Computer-readable media includes permanent and non-permanent, movable and non-movable media that can be implemented by any method or technology to store information. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device. According to the definition herein, computer-readable media does not include transitory media such as modulated data signals and carriers.
[0115] It should also be noted that the terms "comprising", "containing", or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or apparatus that comprises a list of elements does not only include those elements, but can also include other elements not expressly listed or inherent to such process, method, article or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.
[0116] Those skilled in the art will appreciate that embodiments of the present specification can be provided as methods, systems or computer program products. Therefore, the present specification can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Moreover, the present specification can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0117] The present specification can be described in the general context of computer-executable instructions, such as program modules, executed by computers. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The present specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in both local and remote computer storage media including storage devices.
[0118] The various embodiments described in this specification are described using a numbering of embodiments approach: these are each individually integrated contributions pertaining to different but related aspects of the description. Each of the various embodiments can stand on its own, and each can be combined with the subject matter of other embodiments to produce further embodiments. Where appropriate, therefore, the contents of the specification can be regarded as being incorporated by reference, including the description, drawings, claims, abstract and the like.
[0119] The above only describes the embodiments of the specification and is not intended to limit the specification. The specification can have various modifications and changes for those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the specification shall be included in the scope of claims of the specification.
Claims
1. A flow control method, characterized in that, include: Responding to each received request; For each request, determine whether the request has been received in the past. If so, use the identifier generated for the request in the past as the identifier of the request, and determine the historical reception time corresponding to the identifier in the stored historical reception times of each request in the past, and use it as the request time of the request. If not, generate the identifier of the request, determine the current time as the request time of the request, establish the correspondence between the identifier of the request and the request time and store it. Sort the identifiers corresponding to each request according to the order in which they were requested. For each identifier, determine whether the identifier precedes the specified position based on the sorting result; If so, then process the request corresponding to that identifier; If not, the request corresponding to that identifier is rejected.
2. The method as described in claim 1, characterized in that, Determining whether the request has been received in the past includes: Find the valid time period of the request among the stored valid time periods of each request; Determine whether the current time is within the valid time period; If the current time is within the valid time period, it is determined that the request has been received in the past. If the current time is not within the valid time period, or if the valid time period for the request is not found in the stored valid time periods for each request, it is determined that the request has not been received in the past.
3. The method as described in claim 2, characterized in that, The method further includes determining that the request has not been received historically: Determine and store the valid time period for the request.
4. The method as described in claim 1, characterized in that, The identifiers corresponding to each request are sorted according to the order in which they were requested, specifically including: According to the order of the requests, the identifiers corresponding to each request are stored in a queue, which is a distributed message queue.
5. The method as described in claim 1, characterized in that, Determining whether the identifier precedes a specified position based on the sorting results includes: Determine whether the identifier is the specified token identifier; If so, then determine that the request occurred before the specified location; If not, then it is determined that the request did not occur before the specified location.
6. The method as described in claim 1, characterized in that, Processing the request corresponding to this identifier specifically includes: The request is sent to the downstream system that will process it. After processing the request corresponding to the identifier, the method further includes: Determine how long the identifier for this request will be retained; In response to receiving a response from the downstream system to process the request within the retention period of the request's identifier, the identifier of the request is removed from the sorting results.
7. The method as described in claim 6, characterized in that, If no response to process the request is received from the downstream system within the specified period for which the identifier of the request is retained, the method further includes: The specified time is determined based on the current time and the duration for which the identifier is retained. The valid time period of the request is redefined in a manner that ensures the end time of the valid time period is not earlier than the specified time. Remove the identifier of the request from the sorting results.
8. A flow control device, characterized in that, include: The receiving module is used to respond to each received request; The request processing module is used to determine whether the request has been received in the past for each request. If so, it uses the identifier generated for the request in the past as the identifier of the request, and determines the historical reception time corresponding to the identifier in the stored historical reception times of each request as the request time of the request. If not, it generates the identifier of the request, determines the current time as the request time of the request, establishes and stores the correspondence between the identifier of the request and the request time. The sorting module is used to sort the identifiers corresponding to each request according to the order in which the requests were made. The rate limiting module is used to determine whether each identifier is before a specified position based on the sorting result; if so, the request corresponding to that identifier is processed; otherwise, the request corresponding to that identifier is rejected.
9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the method described in any one of claims 1 to 7.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method described in any one of claims 1 to 7.
Citation Information
Patent Citations
Multichannel data transmission method and device
CN110167084A