Business flow control methods, devices, electronic equipment and readable storage media
By determining the effective token resource quantity by acquiring the service priority and matching the token bucket resource quantity, the problem of high-priority services being affected by low-priority services in the existing technology is solved, thereby improving the transmission efficiency and bandwidth of high-priority services.
Patent Information
- Application Number
- CN202110721848.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-28
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2041-06-28
AI Technical Summary
Existing flow control schemes cannot distinguish between services of different priorities, which may cause the transmission of high-priority services to be affected, dropped, or delayed by low-priority services.
By acquiring the priority of a service, its effective token resource quantity is determined and matched with the current token resource quantity in the token bucket. Control operations are performed based on the matching results to ensure that the effective token resource quantity of high-priority services is less than that of low-priority services, thereby increasing the probability of allowing high-priority services to proceed.
It enables the differentiation of services with different priorities during the flow control process, improves the transmission bandwidth and approval probability of high-priority services, and optimizes the allocation of network resources.
Smart Images

Figure CN115604191B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to a service flow control method, apparatus, electronic device, and readable storage medium. Background Technology
[0002] With the rapid development of network technology, network-based applications are becoming increasingly numerous and complex. A wide variety of applications are consuming ever more network resources. In particular, the penetration of media such as online video, personal media, and traditional television into the internet has led to a dramatic increase in network traffic. Flow control is used to optimize or ensure performance, improve latency, and / or increase the latency of certain types of data packets to meet available bandwidth under certain conditions. Flow control can be understood as using certain methods to control the amount of data sent to the network within a specified time (bandwidth limit), or to control the maximum rate at which data traffic is sent.
[0003] The token bucket algorithm is a commonly used algorithm for flow control. During the execution of this algorithm, the maximum number of tokens that the token bucket can hold is fixed, and tokens are added to the token bucket according to the pre-configured bandwidth. Services that need to be allowed to pass need to obtain the number of tokens corresponding to the amount of service data from the token bucket. The token bucket will only send a token to the service when there are enough tokens in the token bucket. Therefore, the maximum service traffic depends on the bandwidth for adding tokens to the token bucket. By adjusting this bandwidth value, service traffic can be controlled.
[0004] In scenarios where multiple services with different priorities are deployed together, the current traffic control scheme cannot distinguish the priorities of the services, so it is necessary to improve the existing service traffic control methods. Summary of the Invention
[0005] The purpose of this application is to at least solve one of the aforementioned technical defects. The technical solution provided by the embodiments of this application is as follows:
[0006] In a first aspect, embodiments of this application provide a service traffic control method, including:
[0007] In response to a business processing request, obtain the priority of the business corresponding to the business processing request;
[0008] The effective token resource quantity corresponding to the business is determined based on priority, and the current token resource quantity is obtained from the token bucket. The effective token resource quantity represents the minimum token resource quantity required to allow and process the business. The effective token resource quantity of high-priority businesses is less than that of low-priority businesses. The current token resource quantity represents the token resource quantity in the token bucket when the business processing request is received.
[0009] The system matches the available token resources with the current token resources and performs corresponding control operations on the business based on the matching results.
[0010] In one optional embodiment of this application, the service processing request includes the amount of service demand token resources, and corresponding control operations are performed on the service based on the matching result, including:
[0011] If the current token resource quantity is not less than the valid token resource quantity and the required token resource quantity, then the business execution will be allowed and processed.
[0012] If the current token resource quantity is not less than the valid token resource quantity, but less than the required token resource quantity, and the priority level of the business is not less than the preset level, then the business will be allowed and processed directly.
[0013] If the current token resource quantity is less than the valid token resource quantity, the business processing request will be discarded or added to the waiting queue.
[0014] In one optional embodiment of this application, determining the effective token resource quantity corresponding to the service based on priority includes:
[0015] Based on priority, the effective token resource quantity for the business is determined by the pre-defined correspondence between each priority and the effective token resource quantity.
[0016] In one optional embodiment of this application, the correspondence between each priority level and the amount of effective token resources is obtained in the following manner:
[0017] Obtain the guaranteed bandwidth and the maximum token resource amount of the token bucket for each priority service. The guaranteed bandwidth is the minimum bandwidth for normal operation of the service, and the guaranteed bandwidth of the higher priority service is greater than that of the lower priority service. The maximum token resource amount represents the maximum bandwidth of the service that can be released and processed.
[0018] The maximum token resource amount is divided according to the guaranteed bandwidth size of the service corresponding to each priority, so as to obtain the effective token resource amount corresponding to each priority.
[0019] In one optional embodiment of this application, the maximum token resource amount is divided according to the guaranteed bandwidth size of the service corresponding to each priority, to obtain the effective token resource amount corresponding to each priority, including:
[0020] For each priority, obtain the proportion of the sum of the guaranteed bandwidth of services corresponding to other priorities to the sum of the guaranteed bandwidth of services corresponding to all priorities;
[0021] Multiply the ratio by the maximum token resource amount to obtain the effective token resource amount corresponding to that priority.
[0022] In one optional embodiment of this application, the service processing request includes a service identifier, and obtaining the priority of the service corresponding to the service processing request includes:
[0023] Obtain the business identifier from the business processing request, and determine the priority of the business based on the business identifier and the pre-defined correspondence between the business identifier and the priority.
[0024] In one optional embodiment of this application, the service identifier includes the protocol type of the service processing request, the Internet Protocol IP address of the sending end, or the port number of the sending end.
[0025] In one optional embodiment of this application, the token bucket increases token resources at predetermined time intervals. During an idle state where no new service processing requests are received, the method further includes:
[0026] The following processing steps are applied to pending business processing requests in the waiting queue until there are no more pending business processing requests in the waiting queue:
[0027] Based on the priority of the pending business processing request, determine the effective token resource quantity corresponding to the pending business, and obtain the current token resource quantity from the current token bucket.
[0028] The system matches the valid token resources corresponding to the pending business with the current token resources, and performs corresponding control operations on the business based on the matching results.
[0029] Secondly, embodiments of this application provide a service traffic control device, including:
[0030] The priority acquisition module is used to respond to business processing requests and obtain the priority of the business corresponding to the business processing request.
[0031] The token resource quantity acquisition module is used to determine the effective token resource quantity corresponding to the business based on the priority, and to obtain the current token resource quantity from the token bucket. The effective token resource quantity represents the minimum token resource quantity required to allow and process the business, and the effective token resource quantity of high-priority businesses is less than that of low-priority businesses. The current token resource quantity represents the token resource quantity in the token bucket when the business processing request is received.
[0032] The flow control module is used to match the valid token resource quantity with the current token resource quantity, and to perform corresponding control operations on the business based on the matching result.
[0033] In one optional embodiment of this application, the service processing request includes the service's demand token resource amount, and the flow control module is specifically used for:
[0034] If the current token resource quantity is not less than the valid token resource quantity and the required token resource quantity, then the business execution will be allowed and processed.
[0035] If the current token resource quantity is not less than the valid token resource quantity, but less than the required token resource quantity, and the priority level of the business is not lower than the preset level, then the business will be allowed and processed directly.
[0036] If the current token resource quantity is less than the valid token resource quantity, the business processing request will be discarded or added to the waiting queue.
[0037] In one optional embodiment of this application, the token resource acquisition module is specifically used for:
[0038] Based on priority, the effective token resource quantity for the business is determined by the pre-defined correspondence between each priority and the effective token resource quantity.
[0039] In an optional embodiment of this application, the device may further include a correspondence acquisition module, used for:
[0040] Obtain the guaranteed bandwidth and the maximum token resource amount of the token bucket for each priority service. The guaranteed bandwidth is the minimum bandwidth for normal operation of the service, and the guaranteed bandwidth of the higher priority service is greater than that of the lower priority service. The maximum token resource amount represents the maximum bandwidth of the service that can be released and processed.
[0041] The maximum token resource amount is divided according to the guaranteed bandwidth size of the service corresponding to each priority, so as to obtain the effective token resource amount corresponding to each priority.
[0042] In one optional embodiment of this application, the correspondence acquisition module is specifically used for:
[0043] For each priority, obtain the proportion of the sum of the guaranteed bandwidth of services corresponding to other priorities to the sum of the guaranteed bandwidth of services corresponding to all priorities;
[0044] Multiply the ratio by the maximum token resource amount to obtain the effective token resource amount corresponding to that priority.
[0045] In one optional embodiment of this application, the priority acquisition module is specifically used for:
[0046] Obtain the business identifier from the business processing request, and determine the priority of the business based on the business identifier and the pre-defined correspondence between the business identifier and the priority.
[0047] In one optional embodiment of this application, the service identifier includes the protocol type of the service processing request, the Internet Protocol IP address of the sending end, or the port number of the sending end.
[0048] In an optional embodiment of this application, the device may further include a waiting queue processing module for:
[0049] The token bucket increases token resources at predetermined time intervals. When the token bucket is idle and no new business processing requests are received, the pending business processing requests in the waiting queue are processed as follows until there are no more pending business processing requests in the waiting queue:
[0050] Based on the priority of the pending business processing request, determine the effective token resource quantity corresponding to the pending business, and obtain the current token resource quantity from the current token bucket.
[0051] The system matches the valid token resources corresponding to the pending business with the current token resources, and performs corresponding control operations on the business based on the matching results.
[0052] Thirdly, embodiments of this application provide an electronic device, including a memory and a processor;
[0053] The memory contains computer programs;
[0054] A processor for executing computer programs to implement the methods provided in the first aspect embodiment or any alternative embodiment of the first aspect.
[0055] Fourthly, embodiments of this application provide a computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, it implements the method provided in the first aspect embodiment or any optional embodiment of the first aspect.
[0056] Fifthly, embodiments of this application provide a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method provided in the first aspect embodiment or any optional embodiment of the first aspect.
[0057] The beneficial effects of the technical solution provided in this application are:
[0058] After receiving a service processing request, the effective token resource quantity is determined based on the priority of the corresponding service and matched with the current token resource quantity in the token bucket. Finally, the control operation corresponding to the service is performed based on the matching result. Since the effective token resource quantity related to the service priority is considered when deciding whether to allow a service during the flow control process, and the effective token resource quantity is smaller for services with higher priority, it is possible to distinguish between services with different priorities. This can increase the probability of allowing high-priority services during the flow control process, thereby increasing the transmission bandwidth of high-priority services. Attached Figure Description
[0059] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below.
[0060] Figure 1 A schematic diagram of a service traffic control system provided in this application embodiment;
[0061] Figure 2 for Figure 1 A schematic diagram illustrating the information interaction between the nodes in the diagram;
[0062] Figure 3 for Figure 1 Schematic diagram of the flow control node in the middle;
[0063] Figure 4 A flowchart illustrating a service traffic control method provided in an embodiment of this application;
[0064] Figure 5 A schematic diagram illustrating the execution process of a service traffic control method provided in this application embodiment;
[0065] Figure 6 A schematic diagram illustrating the execution process of another service traffic control method provided in this application embodiment;
[0066] Figure 7 A schematic diagram illustrating the execution process of another service flow control method provided in this application embodiment;
[0067] Figure 8 This is a schematic diagram illustrating an application scenario of a service traffic control method as exemplified in one embodiment of this application.
[0068] Figure 9 A structural block diagram of a service flow control device provided in an embodiment of this application;
[0069] Figure 10 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0070] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application.
[0071] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this application means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.
[0072] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0073] In the embodiments of the prior art and this application, the system architecture on which the service flow control scheme relies for implementation is as follows: Figure 1 As shown, service origination node 101 generates a service processing request. This service origination end can be a user terminal device, a server, etc. Service origination node 101 sends the generated service processing request to traffic control node 102. Traffic control node 102 can be an edge node in a distributed system close to the user terminal device. Traffic control node 102 can be a server, specifically a server positioned before the service processing server, used to control service traffic. A token bucket is set up in traffic control node 102. Based on the traffic control scheme, traffic control node 102 determines whether to allow and process the service corresponding to the service processing request. If it determines to allow the service, it instructs the token bucket to issue a token for the service and sends the service to service processing node 103 for corresponding processing. Service processing node 103 can be a server, a user terminal device, etc. If it determines not to allow the service, it discards the service processing request or adds it to a waiting queue.
[0074] It should be noted that the business occurrence node 101 and the business processing node 103 can also be included in the flow control node 102, that is, business generation, release and corresponding processing are all carried out in the flow control node.
[0075] like Figure 2 The diagram shown illustrates the information interaction between nodes in business flow control, which may include the following steps:
[0076] (1) The service occurrence node sends a service processing request to the flow control node;
[0077] (2) The flow control node determines whether to allow the business corresponding to the business processing request based on the business processing request;
[0078] (3) If the flow control node determines to allow the service, then the service is allowed to be processed by the service processing node.
[0079] (4) If the flow control node determines that the service should not be allowed, the flow control node will discard the service processing request or put it into the waiting queue.
[0080] like Figure 3 As shown, the flow control node 102 can be further divided into a token bucket 1021 and a release determination module 1022. The release determination module 1022 can know the number of tokens in the token bucket 1021 in real time, and at the same time receive the service processing request. Based on the information carried in the service processing request and the number of tokens obtained from the token bucket 1021 (corresponding to the token resource quantity in the following text), it determines whether to release the service. Similarly, if it is determined to release the service, it instructs the token bucket 1021 to issue a token for the service. If it is determined not to release the service, it discards the service processing request or adds it to the waiting queue.
[0081] In the prior art, the release determination module 1022 obtains the number of tokens required for the corresponding service from the received service processing request (corresponding to the required token resource amount mentioned later). If the current number of tokens in the token bucket 1021 is sufficient, that is, the current number of tokens is greater than the number of tokens required by the service, it is determined that the service should be released. The release determination module 1022 then instructs the token bucket 1021 to hold the required number of tokens for the service. However, in scenarios where multiple priority services are deployed together, i.e., multiple services of different priorities share the bandwidth of the same token bucket, if the service processing request of a low-priority service arrives first and consumes the tokens in the token bucket, it may cause the subsequent arrival of a high-priority service to require more tokens than the current number of tokens. Consequently, the service processing request of the high-priority service may be dropped. In other words, whether services of different priorities are released depends on their arrival order, and there may be a situation where the service processing request of a high-priority service that arrives later is dropped.
[0082] To address the aforementioned problems in the prior art, this application provides a service traffic control scheme to increase the probability that high-priority services are given priority during traffic control in mixed service scenarios. The scheme of this application will be described in detail below.
[0083] Figure 4 This is a flowchart illustrating a service traffic control method provided in an embodiment of this application. The execution entity of this method can be the traffic control node (the release determination module in the control node) mentioned above, such as... Figure 1 As shown, the method may include:
[0084] Step S401: In response to the business processing request, obtain the priority of the business corresponding to the business processing request.
[0085] When a traffic control node receives a service processing request, it needs to determine whether to allow and process the service corresponding to the request. If it decides to allow, it will then allow the service and perform the appropriate processing. The service processing request may include the service identifier and the amount of demand token resources for the corresponding service.
[0086] Specifically, after receiving a service processing request, the flow control node determines the priority of the corresponding service based on the request. Specifically, the service priority can be determined based on pre-configured information in the flow control node. This pre-configured information may include a pre-configured correspondence between service identifiers and priorities, in which case the service processing request must contain the service identifier; the pre-configured information may also include pre-configured priority level determination rules, in which case the service processing request must contain the data required for the priority level determination rules.
[0087] Step S402: Determine the effective token resource quantity corresponding to the service based on priority, and obtain the current token resource quantity from the token bucket. The effective token resource quantity represents the minimum token resource quantity required to allow and process the service. The effective token resource quantity of high-priority services is less than that of low-priority services. The current token resource quantity represents the token resource quantity in the token bucket when the service processing request is received. The token resource quantity allocated to the service per unit time corresponds to the bandwidth of the service that can be allowed and processed.
[0088] In flow control, token resources can be understood as the number of bytes occupied by a token, or more figuratively, the number of tokens. Generally, the amount of token resources allocated or issued to a service per unit of time corresponds to the bandwidth of the service that can be allowed and processed. For example, if issuing one token allows a service to process 2 bytes of data, and 5 tokens are issued to a service within 1 second, then the bandwidth corresponding to that service is 10 bytes / second.
[0089] In this context, the effective token resource quantity can be understood as the number of effective tokens. Each priority service corresponds to a specific number of effective tokens. This number represents the minimum number of tokens required in the token bucket for the service to be allowed and processed. In other words, the service may be allowed only if the token bucket contains more than this number of effective tokens. Furthermore, to increase the probability of high-priority services being allowed priority, the number of effective tokens for high-priority services is less than that for low-priority services. For example, for three priority services A, B, and C, with their priority levels decreasing from high to low, to implement the solution provided in this application embodiment, corresponding effective token resource quantities can be set for services A, B, and C according to preset rules. These preset rules must at least satisfy the following: the effective token resource quantity for high-priority services is less than that for low-priority services, and the effective token resource quantity for each priority level service is not greater than the maximum token resource quantity of the corresponding token bucket. Therefore, assuming the maximum token bucket quantity is 500, the corresponding effective token resource quantities for services A, B, and C can be set to 100, 300, and 450, respectively. It is important to note that the effective token resource quantity for a business is set according to preset rules, while the required token resource quantity for a business, as discussed later, is determined by the business itself. Obviously, there is a difference between the two.
[0090] Specifically, after obtaining the priority of a service, the effective resource quantity corresponding to that service is obtained based on the priority, and the token resource quantity contained in the token bucket at that time is also obtained. Specifically, the effective token resource quantity of a service can be determined based on pre-configured information in the traffic control node. This pre-configured information may include the correspondence between different priorities and effective token resource quantities, so the effective token resource quantity corresponding to the service can be determined based on the priority. This pre-configured information may also include rules for determining the effective token resource quantity; therefore, in addition to the priority, other parameters required for the rules for determining the effective token resource quantity also need to be obtained.
[0091] Step S403: Match the valid token resource quantity with the current token resource quantity, and perform corresponding control operations on the business based on the matching result.
[0092] Specifically, the available token resources corresponding to a service are matched with the current token resources in the token bucket. Based on this matching result, it is determined whether to allow the service, discard its processing request, or add it to the waiting queue. When determining the specific control operation, the available token resources for each service are considered. Since services with different priorities have different available token resources, the priority of the service is taken into account during the specific control operation.
[0093] The solution provided in this application, after receiving a service processing request, determines the amount of valid token resources based on the priority of the corresponding service and matches it with the current amount of token resources in the token bucket. Finally, based on the matching result, it performs control operations on the corresponding service. Since the effective token resources related to the service priority are considered when deciding whether to allow a service during the flow control process, and the effective token resources are smaller for services with higher priority, it can distinguish between services with different priorities. This can increase the probability of allowing high-priority services during the flow control process, thereby increasing the transmission bandwidth of high-priority services.
[0094] like Figure 5 The diagram shown illustrates the execution process of a service flow control method provided in this application embodiment. First, based on the received service processing request, the priority corresponding to the service is obtained. Then, based on the priority, the number of valid tokens corresponding to the service is obtained. At the same time, the current number of tokens in the token bucket is obtained. Then, the current number of tokens and the number of valid tokens are compared. If the current number of tokens is greater than or equal to the number of valid tokens, the service is allowed. If the current number of tokens is less than the number of valid tokens, the service processing request is discarded or added to the waiting queue.
[0095] In one optional embodiment of this application, the service processing request includes the amount of service demand token resources, and corresponding control operations are performed on the service based on the matching result, including:
[0096] If the current token resource quantity is not less than the valid token resource quantity and the required token resource quantity, then the business execution will be allowed and processed.
[0097] If the current token resource quantity is not less than the valid token resource quantity, but less than the required token resource quantity, and the priority level of the business is not lower than the preset level, then the business will be allowed and processed directly.
[0098] If the current token resource quantity is less than the valid token resource quantity, the business processing request will be discarded or added to the waiting queue.
[0099] The required token resource quantity for a service is related to the size of the data packet to be processed for that service. Specifically, after determining the relationship between the unit token resource quantity and the size of the corresponding executable data packet, the required token resource quantity for the service can be determined based on the size of the service's data packet. For example, if a token can allow 5 bytes of data to pass through, and the data packet size for a certain service is 100 bytes, then the required token resource quantity for that service is 20 bytes. It is understood that the above example is only an illustrative illustration of the required token resource quantity, and this application is not limited thereto.
[0100] Specifically, when determining the specific content of the control operation for the business, in addition to the matching result between the effective token resource quantity of the business and the current token resource quantity, the required token resource quantity of the business can also be considered.
[0101] Specifically, if the matching result indicates that the current token resource quantity is not less than the valid token resource quantity, it means that the minimum requirement for processing the service is met. If the current token resource quantity is not less than the required token resource quantity for the service, the service is allowed and processed, and the token bucket is instructed to issue the corresponding token resource quantity, that is, the token bucket consumes the required token resource quantity for the service.
[0102] If the matching result indicates that the current token resource quantity is not less than the valid token resource quantity, it means that the minimum requirement for allowing and processing the service is met. However, if the current token resource quantity is less than the required token resource quantity for the service, it means that the current token resource quantity is insufficient to cover the required token quantity. In this case, if the service's priority is higher than the preset priority, to increase the probability of higher priority services being allowed first, the service can be directly allowed and processed. Simultaneously, since the current token resource quantity in the token bucket is less than the required token resource quantity for the service, the token bucket is instructed to issue the current token resource quantity and add the difference in token resource quantity to the token bucket (this difference is equal to the difference between the current token resource quantity and the required token resource quantity for the service). Subsequent injection of new tokens into the token bucket will need to offset this difference. If the service's priority is not higher than the preset priority, the service request for that service will be discarded or added to the waiting queue. The preset priority can be set according to actual needs. For example, it can be set to the second priority. If the current token resource quantity is not less than the effective token resource quantity of the service, but less than the required token resource quantity of the service, and the priority of the service is the first priority which is higher than the second priority, then the service will be allowed and processed directly.
[0103] If the matching result indicates that the current token resource quantity is less than the valid token resource quantity, it means that the minimum requirements for releasing and processing the service are not met, and the service processing request for the service will be discarded or added to the waiting queue.
[0104] like Figure 6The diagram illustrates the execution process of a service flow control method provided in this embodiment. First, based on the received service processing request, the priority corresponding to the service is obtained. Then, based on the priority, the number of valid tokens corresponding to the service is obtained. Simultaneously, the current number of tokens in the token bucket and the required number of tokens for the service are obtained. Next, the current number of tokens and the number of valid tokens are compared. If the current number of tokens is greater than or equal to the number of valid tokens and greater than or equal to the required number of tokens, a token is issued, allowing the service to proceed and be processed. If the current number of tokens is greater than or equal to the number of valid tokens and less than the required number of tokens, the service is directly allowed to proceed and be processed. If the current number of tokens is less than the number of valid tokens, the service processing request is discarded or added to a waiting queue.
[0105] In one optional embodiment of this application, determining the effective token resource quantity corresponding to the service based on priority includes:
[0106] Based on priority, the effective token resource quantity for the business is determined by the pre-defined correspondence between each priority and the effective token resource quantity.
[0107] Specifically, after obtaining the priority from the business processing request, the effective token resource quantity for the business is determined based on the priority and a pre-defined correspondence between each priority and the effective token resource quantity. Specifically, the pre-defined correspondence between each priority and the effective token resource quantity can be stored in a first pre-defined correspondence database of the traffic management node. Each time a priority is obtained, the corresponding effective token resource quantity can be found in the first pre-defined correspondence database. It should be noted that these correspondences are pre-set and can be added or deleted according to actual needs.
[0108] In one optional embodiment of this application, the correspondence between each priority level and the amount of effective token resources is obtained in the following manner:
[0109] Obtain the guaranteed bandwidth and the maximum token resource amount of the token bucket for each priority service. The guaranteed bandwidth is the minimum bandwidth for normal operation of the service, and the guaranteed bandwidth of the higher priority service is greater than that of the lower priority service. The maximum token resource amount represents the maximum bandwidth of the service that can be released and processed.
[0110] The maximum token resource amount is divided according to the guaranteed bandwidth size of the service corresponding to each priority, so as to obtain the effective token resource amount corresponding to each priority.
[0111] As described above, the amount of token resources allocated or issued to a service per unit time corresponds to the bandwidth required for the service to be released and processed. The guaranteed bandwidth for a service refers to the minimum bandwidth required for the service to operate normally. This guaranteed bandwidth can be configured according to actual needs, ensuring that the guaranteed bandwidth for high-priority services is greater than that for low-priority services.
[0112] The maximum token bucket capacity is an inherent attribute of the token bucket, representing the maximum amount of tokens it can hold. Furthermore, the maximum token bucket capacity can also determine the volume of one-time traffic. In other words, the maximum capacity determines the maximum bandwidth of traffic that can be allowed to pass through. That is, the larger the maximum token bucket capacity, the greater the maximum bandwidth of traffic that can be allowed to pass through and be processed.
[0113] Specifically, determining the effective token resource quantity for a service requires that it not exceed the maximum token resource quantity in the token bucket. Simultaneously, it must be ensured that the effective token resource quantity for high-priority services is less than that for low-priority services. The effective token quantity determined according to these principles will meet the requirements. The guaranteed bandwidth of a service indicates its priority; therefore, the maximum token resource quantity in the token bucket can be divided based on the service's guaranteed bandwidth to determine the effective token resource quantity that reflects service priority and does not exceed the maximum token resource quantity.
[0114] Furthermore, the maximum token resource amount is divided according to the guaranteed bandwidth size of the service corresponding to each priority, resulting in the effective token resource amount corresponding to each priority, including:
[0115] For each priority, obtain the proportion of the sum of the guaranteed bandwidth of services corresponding to other priorities to the sum of the guaranteed bandwidth of services corresponding to all priorities;
[0116] Multiply the ratio by the maximum token resource amount to obtain the effective token resource amount corresponding to that priority.
[0117] For example, given three priorities, priority 1, priority 2, and priority 3, with priority levels decreasing in descending order, and a guaranteed bandwidth of t1 for priority 1, t2 for priority 2, and t3 for priority 3, and a maximum token resource quantity of w in the token bucket, the effective token resource quantities w1, w2, and w3 for each priority can be calculated using the following formula:
[0118]
[0119] Specifically, each priority level and its corresponding effective token resource quantity calculated by the above formula are stored in a first preset correspondence database for use in subsequent traffic control processes. It should be noted that in practical applications, for the highest priority level, its effective token resource quantity can be directly set to 0, meaning that the highest priority service will be allowed and processed under any circumstances.
[0120] In one optional embodiment of this application, the service processing request includes a service identifier, and obtaining the priority of the service corresponding to the service processing request includes:
[0121] Obtain the business identifier from the business processing request, and determine the priority of the business based on the business identifier and the pre-defined correspondence between the business identifier and the priority.
[0122] Specifically, after obtaining the service identifier from the service processing request, the service priority is determined based on the service identifier and a pre-defined correspondence between service identifiers and priorities. Specifically, the pre-defined correspondence between service identifiers and priorities can be stored in a second pre-defined correspondence database on the traffic management node. Each time a service identifier is obtained, the corresponding priority can be found in the second pre-defined correspondence database using that priority. It should be noted that these correspondences are pre-set and can be added or deleted according to actual needs.
[0123] Furthermore, the service identifier includes the protocol type of the service processing request, the Internet Protocol address (IP address) of the sending end, or the port number of the sending end. Specifically, the priority of a service can be determined based on the source and destination of the service processing request, and the source and destination of the service processing request can be indicated by the aforementioned service identifier.
[0124] In one optional embodiment of this application, the token bucket increases token resources at predetermined time intervals. During an idle state where no new service processing requests are received, the method further includes:
[0125] The pending business processing requests in the waiting queue are processed as follows until there are no more pending business processing requests in the waiting queue: Based on the priority of the pending business corresponding to the pending business processing request, the effective token resource quantity corresponding to the pending business is determined, and the current token resource quantity is obtained from the current token bucket.
[0126] The system matches the valid token resources corresponding to the pending business with the current token resources, and performs corresponding control operations on the business based on the matching results.
[0127] Specifically, during flow control, service processing requests added to the waiting queue will be reprocessed when the flow control node is idle and no new service processing requests are received. For multiple pending service processing requests in the waiting queue, they can be processed sequentially according to the order in which they were added to the queue, and the processing procedure is consistent with the processing procedure for newly received service processing requests in the aforementioned embodiment. It should be noted that when processing multiple pending service processing requests in the waiting queue sequentially, if a new service processing request is received, it will be processed immediately after the currently processing pending service processing request is completed.
[0128] like Figure 7 The diagram illustrates the execution process of a service flow control method provided in this embodiment of the application. First, based on the received service processing request, the priority corresponding to the service is obtained. Then, based on the priority, the number of valid tokens corresponding to the service is obtained. Simultaneously, the current number of tokens in the token bucket and the required number of tokens for the service are obtained. Next, the current number of tokens and the number of valid tokens are compared. If the current number of tokens is greater than or equal to the number of valid tokens and greater than or equal to the required number of tokens, a token is issued, allowing the service to proceed and be processed. If the current number of tokens is greater than or equal to the number of valid tokens and less than the required number of tokens, the service is directly allowed to proceed and be processed. If the current number of tokens is less than the number of valid tokens, the service processing request is discarded or added to a waiting queue. During the flow control process, when the flow control node is idle and has not received any new service processing requests, service processing requests added to the waiting queue are reprocessed.
[0129] The following example further illustrates the solution of this application, such as... Figure 8 As shown, User A generates a service processing request 1 by operating application 1 on user device 8011. The service identifier 1 of this service processing request 1 is the identifier of the application, and the service content is to upload an image to the cloud storage server 803 and store it. User device 801 sends this service processing request 1 to the traffic control server 802. In the traffic control server 802, the traffic control module queries the second preset correspondence database through the service identifier 1 in the service processing request 1 to find that the priority of the service is priority X. The traffic control module finds that the required token quantity for this service is 50, and then queries the first preset correspondence database through priority X to find that the valid token quantity for this service is 150. At the same time, the traffic control module finds that the current token quantity in the token bucket is 80. After comparison, it is found that the current token quantity is less than the valid token quantity for this service. Therefore, the service processing request 1 is discarded, and a network busy upload failure message is sent to user device 8011.
[0130] Subsequently, User B generates a service processing request 2 by operating application 2 on user device 8012. The service identifier 2 of this service processing request 2 is the identifier of the application, and the service content is to upload an image to the cloud storage server 803 and store it. User device 801 sends this service processing request 2 to the traffic control server 802. In the traffic control server 802, the traffic control module queries the second preset correspondence database through the service identifier 2 in the service processing request 2 to find that the priority of the service is priority Y (priority Y has a higher priority level than priority X). The traffic control module finds that the required token quantity for this service is 80 through the service processing request 2, and then queries the first preset correspondence database through priority Y to find that the valid token quantity for this service is 100. At the same time, the traffic control module finds that the current token quantity in the token bucket is 105. After comparison, it is found that the current token quantity is greater than the valid token quantity and the required token quantity for this service. Therefore, the service is allowed and forwarded to the cloud storage server 803.
[0131] As can be seen from this example, the priority of the business processing request 2 is higher than that of the business processing request 1. If the existing flow control method is followed, the flow control module will allow the business processing request 1 to pass, which will consume 50 tokens in the token bucket. As a result, the business processing request 2 that follows will be dropped or added to the waiting queue. That is, the high priority cannot upload data first. However, the solution of this application can ensure that the high priority business processing request 2 is allowed to pass and complete the data upload, which improves the probability of allowing the high priority business to pass compared with the existing technology.
[0132] It should be noted that the solution design in this application is cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to realize the computing, storage, processing, and sharing of data.
[0133] Cloud technology is a collective term for network technologies, information technologies, integration technologies, management platform technologies, and application technologies applied to the cloud computing business model. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will all require robust system support, which can only be achieved through cloud computing.
[0134] Specifically, the solution proposed in this application can be applied to cloud computing. Cloud computing refers to the delivery and usage model of IT infrastructure, which means obtaining the required resources in an on-demand and easily scalable manner through the network. In a broader sense, cloud computing refers to the delivery and usage model of services, which means obtaining the required services in an on-demand and easily scalable manner through the network. These services can be IT and software related, internet-related, or other services. Cloud computing is a product of the development and integration of traditional computer and network technologies such as grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, and load balancing.
[0135] With the development of the internet, real-time data streams, and the diversification of connected devices, as well as the demands for search services, social networks, mobile commerce, and open collaboration, cloud computing has rapidly developed. Unlike previous parallel distributed computing, cloud computing will fundamentally revolutionize the entire internet model and enterprise management model.
[0136] Specifically, the solution proposed in this application can be applied to cloud storage solutions. Cloud storage is a new concept that is extended and developed from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as a storage system) refers to a storage system that uses cluster applications, grid technology and distributed storage file systems to bring together a large number of storage devices of various types in the network (storage devices are also called storage nodes) to work together through application software or application interfaces to jointly provide data storage and business access functions to the outside world.
[0137] Currently, the storage method of storage systems is as follows: Logical volumes are created. During the creation of a logical volume, physical storage space is allocated to each logical volume. This physical storage space may consist of a single storage device or the disks of several storage devices. Clients store data on a logical volume, which means storing the data on the file system. The file system divides the data into many parts, each part being an object. Each object contains not only the data but also additional information such as a data identifier (ID, ID entity). The file system writes each object to the physical storage space of that logical volume and records the storage location information of each object. Therefore, when a client requests access to data, the file system can allow the client to access the data based on the storage location information of each object.
[0138] The process by which a storage system allocates physical storage space to a logical volume is as follows: the physical storage space is pre-divided into strips according to the capacity estimate of the objects stored in the logical volume (this estimate often has a large margin relative to the actual capacity of the objects to be stored) and the grouping of Redundant Array of Independent Disks (RAID). A logical volume can be understood as a strip, thus allocating physical storage space to the logical volume.
[0139] The solution proposed in this application can be applied to database solutions. A database, simply put, can be viewed as an electronic filing cabinet—a place to store electronic files, where users can perform operations such as adding, querying, updating, and deleting data. A "database" is a collection of data stored together in a certain way, capable of being shared by multiple users, with minimal redundancy, and independent of application programs.
[0140] A Database Management System (DBMS) is a computer software system designed to manage databases, generally possessing basic functions such as storage, retrieval, security, and backup. DBMSs can be classified according to the database model they support, such as relational or XML (Extensible Markup Language); or according to the type of computer they support, such as server clusters or mobile devices; or according to the query language used, such as SQL (Structured Query Language) or XQuery; or according to performance priorities, such as maximum scale or maximum operating speed; or other classification methods. Regardless of the classification method used, some DBMSs can cross categories, for example, simultaneously supporting multiple query languages.
[0141] Figure 9 A structural block diagram of a service flow control device provided in this application embodiment is shown below. Figure 9 As shown, the device 900 may include: a priority acquisition module 901, a token resource acquisition module 902, and a flow control module 903, wherein:
[0142] The priority acquisition module 901 is used to respond to business processing requests and acquire the priority of the business corresponding to the business processing request;
[0143] The token resource acquisition module 902 is used to determine the effective token resource quantity corresponding to the service based on the priority, and to obtain the current token resource quantity from the token bucket. The effective token resource quantity represents the minimum token resource quantity required to allow and process the service. The effective token resource quantity of a high-priority service is less than that of a low-priority service. The current token resource quantity represents the token resource quantity in the token bucket when the service processing request is received.
[0144] The flow control module 903 is used to match the valid token resource quantity with the current token resource quantity, and to perform corresponding control operations on the service based on the matching result.
[0145] The solution provided in this application, after receiving a service processing request, determines the amount of valid token resources based on the priority of the corresponding service and matches it with the current amount of token resources in the token bucket. Finally, based on the matching result, it performs control operations on the corresponding service. Since the flow control process considers the amount of valid token resources related to the priority of the service to determine whether to allow the service, and the amount of valid token resources for services with higher priority is smaller, it can distinguish between services with different priorities. This can increase the probability of allowing high-priority services during the flow control process, thereby increasing the transmission bandwidth of high-priority services.
[0146] In one optional embodiment of this application, the service processing request includes the service's demand token resource amount, and the flow control module is specifically used for:
[0147] If the current token resource quantity is not less than the valid token resource quantity and the required token resource quantity, then the business execution will be allowed and processed.
[0148] If the current token resource quantity is not less than the valid token resource quantity, but less than the required token resource quantity, and the priority level of the business is not lower than the preset level, then the business will be allowed and processed directly.
[0149] If the current token resource quantity is less than the valid token resource quantity, the business processing request will be discarded or added to the waiting queue.
[0150] In one optional embodiment of this application, the token resource acquisition module is specifically used for:
[0151] Based on priority, the effective token resource quantity for the business is determined by the pre-defined correspondence between each priority and the effective token resource quantity.
[0152] In an optional embodiment of this application, the device may further include a correspondence acquisition module, used for:
[0153] Obtain the guaranteed bandwidth and the maximum token resource amount of the token bucket for each priority service. The guaranteed bandwidth is the minimum bandwidth for normal operation of the service, and the guaranteed bandwidth of the higher priority service is greater than that of the lower priority service. The maximum token resource amount represents the maximum bandwidth of the service that can be released and processed.
[0154] The maximum token resource amount is divided according to the guaranteed bandwidth size of the service corresponding to each priority, so as to obtain the effective token resource amount corresponding to each priority.
[0155] In one optional embodiment of this application, the correspondence acquisition module is specifically used for:
[0156] For each priority, obtain the proportion of the sum of the guaranteed bandwidth of services corresponding to other priorities to the sum of the guaranteed bandwidth of services corresponding to all priorities;
[0157] Multiply the ratio by the maximum token resource amount to obtain the effective token resource amount corresponding to that priority.
[0158] In one optional embodiment of this application, the priority acquisition module is specifically used for:
[0159] Obtain the business identifier from the business processing request, and determine the priority of the business based on the business identifier and the pre-defined correspondence between the business identifier and the priority.
[0160] In one optional embodiment of this application, the service identifier includes the protocol type of the service processing request, the Internet Protocol IP address of the sending end, or the port number of the sending end.
[0161] In an optional embodiment of this application, the device may further include a waiting queue processing module for:
[0162] The token bucket increases token resources at predetermined time intervals. When the token bucket is idle and no new business processing requests are received, the pending business processing requests in the waiting queue are processed as follows until there are no more pending business processing requests in the waiting queue:
[0163] Based on the priority of the pending business processing request, determine the effective token resource quantity corresponding to the pending business, and obtain the current token resource quantity from the current token bucket.
[0164] The system matches the valid token resources corresponding to the pending business with the current token resources, and performs corresponding control operations on the business based on the matching results.
[0165] The following is for reference. Figure 10 It illustrates an electronic device suitable for implementing embodiments of this application (e.g., performing...). Figure 4The diagram illustrates the structure of the terminal device or server 1000 of the method shown. The electronic devices in this application embodiment may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle terminals (e.g., vehicle navigation terminals), wearable devices, and fixed terminals such as digital TVs and desktop computers. Figure 10 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0166] The electronic device includes a memory and a processor. The memory stores a program for executing the methods described in the various method embodiments above. The processor is configured to execute the program stored in the memory. The processor may be referred to as processing device 1001 as described below. The memory may include at least one of read-only memory (ROM) 1002, random access memory (RAM) 1003, and storage device 1008 as described below, as specifically shown below:
[0167] like Figure 10 As shown, the electronic device 1000 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 into a random access memory (RAM) 1003. The RAM 1003 also stores various programs and data required for the operation of the electronic device 1000. The processing unit 1001, ROM 1002, and RAM 1003 are interconnected via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0168] Typically, the following devices can be connected to the I / O interface 1005: input devices 1006 including, for example, a touchscreen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 1007 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1008 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. Communication device 1009 allows electronic device 1000 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 10 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown. More or fewer devices may be implemented or have instead.
[0169] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 1009, or installed from storage device 1008, or installed from ROM 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of embodiments of this application.
[0170] It should be noted that the computer-readable storage medium described above in this application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0171] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0172] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0173] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to:
[0174] In response to a service processing request, the system obtains the priority of the service corresponding to the request; based on the priority, it determines the effective token resource quantity corresponding to the service and retrieves the current token resource quantity from the token bucket. The effective token resource quantity represents the minimum token resource quantity required to allow and process the service, and the effective token resource quantity for higher-priority services is less than that for lower-priority services. The current token resource quantity represents the token resource quantity in the token bucket when the service processing request is received, the token resource quantity allocated to the service per unit time, and the bandwidth corresponding to the service that can be allowed and processed; the system matches the effective token resource quantity with the current token resource quantity and performs corresponding control operations on the service based on the matching result.
[0175] Computer program code for performing the operations of this application can be written in one or more programming languages or a combination thereof. These programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0176] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0177] The modules or units described in the embodiments of this application can be implemented in software or hardware. The names of modules or units do not necessarily limit the specific unit; for example, a first constraint acquisition module can also be described as a "module for acquiring the first constraint".
[0178] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0179] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0180] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific methods implemented by the computer-readable medium described above when executed by an electronic device can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0181] This application provides a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the following actions:
[0182] In response to a business processing request, the system obtains the priority of the business corresponding to the request; determines the effective token resource quantity corresponding to the business based on the priority, and retrieves the current token resource quantity from the token bucket. The effective token resource quantity represents the minimum token resource quantity required to allow and process the business, and the effective token resource quantity of higher priority businesses is less than that of lower priority businesses. The current token resource quantity represents the token resource quantity in the token bucket when the business processing request is received; the system matches the effective token resource quantity with the current token resource quantity, and performs corresponding control operations on the business based on the matching result.
[0183] It should be understood that although the steps in the flowcharts of the accompanying figures are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the accompanying figures may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0184] The above description is only a partial embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method of traffic flow control, characterized by, The method comprises: in response to a service processing request, obtaining a priority of a service corresponding to the service processing request; based on the priority, determining an effective token resource amount corresponding to the service, and obtaining a current token resource amount from a token bucket, wherein the effective token resource amount represents a minimum token resource amount required for releasing and processing the service, and the effective token resource amount of a high-priority service is smaller than that of a low-priority service, and the current token resource amount represents a token resource amount in the token bucket when the service processing request is received; matching the effective token resource amount with the current token resource amount, and performing a corresponding control operation on the service based on a matching result, including: if the current token resource amount is not smaller than the effective token resource amount, but is smaller than a required token resource amount of the service, and the priority of the service is not lower than a preset level, releasing and processing the service; the required token resource amount is obtained through the service processing request, and is related to a size of a data packet to be processed corresponding to the service; wherein the effective token resource amount is determined through a first preset correspondence between the priority and the effective token resource amount, and the first preset correspondence is obtained by: obtaining a guaranteed bandwidth of a service corresponding to each priority and a maximum token resource amount of the token bucket, the guaranteed bandwidth being a minimum bandwidth for normal operation of the service, and the guaranteed bandwidth of a high-priority service being greater than that of a low-priority service, and the maximum token resource amount representing a maximum bandwidth of a service that can be released and processed; dividing the maximum token resource amount according to the guaranteed bandwidth of the service corresponding to each priority to obtain the effective token resource amount corresponding to each priority.
2. The method of claim 1, wherein, The corresponding control operation on the service based on the matching result further comprises: if the current token resource amount is not smaller than the effective token resource amount and the required token resource amount, releasing and processing the service; if the current token resource amount is smaller than the effective token resource amount, discarding the service processing request or adding the service processing request to a waiting queue.
3. The method of claim 1, wherein, The determination of the first preset correspondence comprises: obtaining the guaranteed bandwidth of the service corresponding to each priority and the maximum token resource amount of the token bucket; for each priority, obtaining a proportion of a sum of the guaranteed bandwidths of the services corresponding to other priorities except the priority to a sum of the guaranteed bandwidths of the services corresponding to all priorities, multiplying the proportion by the maximum token resource amount to obtain the effective token resource amount corresponding to the priority.
4. The method of claim 2, wherein, The method further comprises: in a case where the current token resource amount is not smaller than the effective token resource amount, but is smaller than the required token resource amount, and the priority of the service is higher than a preset level, instructing the token bucket to issue the current token resource, and adding a difference of token resource amounts to the token bucket, the difference being a difference between the current token resource amount and the required token resource amount.
5. The method of claim 4, wherein, When injecting a new token into the token bucket, offsetting the difference of token resource amounts.
6. The method of claim 1, wherein, The service processing request contains a service identifier of the service, and the priority of the service corresponding to the service processing request is obtained, including: The service identifier is obtained from the service processing request, and the priority of the service is determined based on the service identifier through a second preset correspondence relationship between the service identifier and the priority.
7. The method of claim 6, wherein, The service identifier includes a protocol type of the service processing request, an Internet Protocol (IP) address of a sending end, or a port number of the sending end.
8. The method of claim 2, wherein, The token bucket increases token resources at a predetermined time interval, and when there is no new service processing request received in an idle state, the method further includes: For a plurality of service processing requests to be processed in the waiting queue, the following processing is performed in the order of the service processing requests joining the queue, until there is no service processing request to be processed in the waiting queue: Based on the priority of the service to be processed corresponding to the service processing request to be processed, the effective token resource amount corresponding to the service to be processed is determined, and the current token resource amount is obtained from the token bucket; The effective token resource amount corresponding to the service to be processed is matched with the current token resource amount, and a corresponding control operation is performed on the service based on the matching result.
9. A traffic flow control apparatus characterized by comprising: Including: The priority acquisition module is configured to obtain the priority of the service corresponding to the service processing request in response to the service processing request; The token resource amount acquisition module is configured to determine the effective token resource amount corresponding to the service based on the priority, and obtain the current token resource amount from the token bucket, wherein the effective token resource amount represents the minimum token resource amount required for the service to be processed, and the effective token resource amount of a high-priority service is less than the effective token resource amount of a low-priority service, and the current token resource amount represents the token resource amount in the token bucket when the service processing request is received; The flow control module is configured to match the effective token resource amount with the current token resource amount, and perform a corresponding control operation on the service based on the matching result, including: if the current token resource amount is not less than the effective token resource amount, but less than the required token resource amount of the service, and the priority of the service is not lower than a preset level, the service is released and processed; the required token resource amount is obtained through the service processing request, and is related to the size of the data packet to be processed corresponding to the service; The effective token resource amount is determined through a first preset correspondence relationship between the priority, and the first preset correspondence relationship is obtained by: obtaining the guaranteed bandwidth of the service corresponding to each priority and the maximum token resource amount of the token bucket, the guaranteed bandwidth being the minimum bandwidth for normal operation of the service, and the guaranteed bandwidth of a high-priority service being greater than the guaranteed bandwidth of a low-priority service, and the maximum token resource amount representing the maximum bandwidth of the service to be processed; the maximum token resource amount is divided according to the guaranteed bandwidth of the service corresponding to each priority, to obtain the effective token resource amount corresponding to each priority.
10. The apparatus of claim 9, wherein, The flow control module is further configured to: If the current token resource amount is not less than the valid token resource amount and the demand token resource amount, the traffic is released and processed; If the current token resource amount is less than the valid token resource amount, the traffic processing request is discarded or added to the waiting queue.
11. The apparatus of claim 9, wherein, The determination of the first preset correspondence includes: Obtaining the guarantee bandwidth of the service corresponding to each priority and the maximum token resource amount of the token bucket; For each priority, obtaining the proportion of the sum of the guarantee bandwidths of the services corresponding to the other priorities except the priority in the sum of the guarantee bandwidths of the services corresponding to all priorities, multiplying the proportion by the maximum token resource amount to obtain the valid token resource amount corresponding to the priority.
12. The apparatus of claim 10, wherein, The traffic control module is further configured to, in a case where the current token resource amount is not less than the valid token resource amount but is less than the demand token resource amount and the priority of the traffic is higher than a preset level, instruct the token bucket to issue the current token resource and add a difference of token resource amounts to the token bucket, the difference being a difference between the current token resource amount and the demand token resource amount.
13. The apparatus of claim 12, wherein, The traffic control module is further configured to offset the difference of token resource amounts when injecting new tokens into the token bucket.
14. The apparatus of claim 9, wherein, The priority obtaining module is specifically configured to: Obtain a service identifier from the traffic processing request, and determine the priority of the service based on the service identifier and a second preset correspondence between the service identifier and the priority.
15. The apparatus of claim 14, wherein, The service identifier includes a protocol type of the traffic processing request, an Internet Protocol (IP) address of a sending end, or a port number of the sending end.
16. The apparatus of claim 10, wherein, The device further includes a waiting queue processing module configured to: The token bucket increases token resources at a predetermined time interval, and in an idle state where no new traffic processing request is received, the waiting queue processing module processes a plurality of to-be-processed traffic processing requests in the waiting queue in a sequence in which the traffic processing requests are added to the queue, until there is no to-be-processed traffic processing request in the waiting queue: Determine the valid token resource amount corresponding to a to-be-processed service based on the priority of the to-be-processed service, and obtain a current token resource amount from the token bucket; Match the valid token resource amount corresponding to the to-be-processed service with the current token resource amount, and perform a corresponding control operation on the service based on a matching result.
17. An electronic device, comprising: The device includes a memory and a processor; The memory stores a computer program; The processor is configured to execute the computer program to implement the method in any one of claims 1 to 8.
18. A computer-readable storage medium, characterized in that, The computer program is stored on the computer readable storage medium and is executed by the processor to implement the method in any one of claims 1 to 8.
19. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the method in any one of claims 1 to 8.
Citation Information
Patent Citations
Service scheduling method and device
CN102035732A
Business data processing method and device
CN112866136A