Communication method and device
By allocating service tokens in the token bucket of the main control board, the problems of small bandwidth and high CPU consumption during traffic transmission of the aggregation port member port in the prior art are solved, and even distribution of traffic and processing performance are improved.
Patent Information
- Application Number
- CN202210383464.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-13
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2042-04-13
AI Technical Summary
In the prior art, when all the traffic carried by the member port of the aggregation port is transmitted to the same business board, the bandwidth of the inter-board transmissive channel is small, resulting in a large amount of traffic being discarded, and the CPU consumption of the business board is high.
By configuring a token bucket on the main control board, it receives the service token request packets sent by the service board, and calculates the service token assigned to each service board based on the number of tokens in the token bucket and the traffic rate of the member ports. , realizes even distribution and processing of traffic.
It improves the processing performance of the token bucket, reduces the consumption of CPUs on each board and the pressure of communication between boards and frames, and ensures uniform traffic transmission, avoiding the problems of traffic discarding and excessive CPU consumption.
Smart Images

Figure CN115037692B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a communication method and device. Background Art
[0002] For network services, factors that affect the quality of service (QoS) include transmission bandwidth, transmission delay, data packet loss rate, etc. In the network, the quality of service can be improved by ensuring the transmission bandwidth, reducing the transmission delay, reducing the data packet loss rate and delay jitter, etc.
[0003] Since network resources are limited, ensuring the service quality of a certain type of business may damage the service quality of other businesses. Therefore, network managers need to plan and allocate network resources reasonably according to the characteristics of various businesses, so that network resources can be used efficiently.
[0004] QoS technologies include flow classification, traffic regulation, traffic shaping, rate limiting, congestion management, and congestion avoidance. Traffic regulation refers to the control of traffic. By monitoring the rate of traffic entering the network, the excess traffic is "punished" so that the incoming traffic is limited to a reasonable range to protect network resources and the interests of operators. For example, HTTP messages can be restricted to not occupy more than 50% of the network bandwidth. If it is determined that the traffic exceeds the specification, traffic regulation can choose to discard the excess message or reconfigure the priority of the excess message.
[0005] Currently, traffic regulation also faces some problems: Figure 1 As shown, Figure 1 The following is a schematic diagram of implementing traffic monitoring on an existing aggregation port. Figure 1 In the figure, the selected member ports of the aggregation port are located in different service boards, which means that the member ports are cross-board. When implementing traffic supervision on the aggregation port, a token bucket is set in each service board, which will cause the actual traffic to be multiple times the expected supervision. The dotted line range indicates that the aggregation port is formed by the aggregation of cross-board member ports. The traffic carried by member port 1 and the traffic carried by member port 2 are respectively limited by token buckets in their respective service boards. However, the traffic is twice the limited traffic of the aggregation port.
[0006] In order to solve the above problems, at present, all traffic carried by the member ports of the aggregation port can be transparently transmitted to the same service board to implement token bucket rate limiting, so that the actual traffic carried by each member port is consistent with the supervision. Figure 2 As shown, Figure 2 This is a schematic diagram of implementing traffic monitoring on another existing aggregation port. Figure 2In the example, a token bucket is configured on the service board where member port 2 is located. Traffic carried by member port 1 is transparently transmitted to the service board where member port 2 is located, and token bucket rate limiting is implemented on the service board where member port 2 is located.
[0007] However, the above-mentioned method of transparently transmitting all the traffic carried by the member ports of the aggregation port to the same business board also exposes the following defects: 1) The channel bandwidth for transparent transmission between business boards is small. When the traffic to be transparently transmitted is greater than the bandwidth of the transparent transmission channel between boards, a large amount of traffic will be discarded; 2) Processing the traffic carried by multiple member ports consumes a lot of CPU of the business board (business board with token bucket set). Summary of the invention
[0008] In view of this, the present application provides a communication method and device to solve the problem that in the existing method of transparently transmitting all traffic carried by the member ports of the aggregation port to the same business board, the bandwidth of the transparent transmission channel between boards is small, resulting in a large amount of traffic being discarded and high CPU consumption of the business board.
[0009] In a first aspect, the present application provides a communication method, the method is applied to a main control board, a token bucket is configured in the main control board, the token bucket includes a first number of current tokens, and the method includes:
[0010] Receive a service token request message sent by at least one service board, each service token request message includes a flow rate of a member port included in each service board, and the member ports included in each service board belong to the same aggregation port;
[0011] When receiving a service token request message sent by the service board where each member port belonging to the same aggregation port is located, calculating the second number of service tokens allocated to each service board according to the first number and the traffic rate of the member ports included in each service board;
[0012] A service token response message is sent to each service board, wherein the service token response message includes the second number of service tokens, so that the service board processes the service message according to the second number of service tokens and a preset token consumption rate.
[0013] In a second aspect, the present application provides a communication method, the method being applied to a service board, the service board including a member port belonging to an aggregation port, the method comprising:
[0014] Obtaining the flow rate of the member port within a preset time;
[0015] Sending a service token request message to the main control board, wherein the service token request message includes the traffic rate of the member port belonging to the aggregation port included in the service board, so that the main control board calculates a second number of service tokens allocated to the service board according to the built-in token bucket with a first number of current tokens and the traffic rate of the member port;
[0016] receiving a service token response message sent by the main control board, wherein the service token response message includes the second number of service tokens;
[0017] The received service message is processed according to the second number of service tokens and the preset token consumption rate.
[0018] In a third aspect, the present application provides a communication device, the device is applied to a main control board, a token bucket is configured in the main control board, the token bucket includes a first number of current tokens, and the device includes:
[0019] A receiving unit, configured to receive a service token request message sent by at least one service board, each service token request message including a flow rate of a member port included in each service board, wherein the member ports included in each service board belong to the same aggregation port;
[0020] A calculation unit, configured to calculate a second number of service tokens allocated to each service board according to the first number and the traffic rate of the member ports included in each service board when receiving a service token request message sent by the service board where each member port belonging to the same aggregation port is located;
[0021] A sending unit is used to send a business token response message to each business board, wherein the business token response message includes the second number of business tokens, so that the business board processes the business message according to the second number of business tokens and a preset token consumption rate.
[0022] In a fourth aspect, the present application provides a communication device, the device is applied to a service board, the service board includes a member port belonging to an aggregation port, and the device includes:
[0023] An acquisition unit, used to acquire the flow rate of the member port within a preset time;
[0024] A sending unit, configured to send a service token request message to a main control board, wherein the service token request message includes the traffic rate of the member port belonging to the aggregation port included in the service board, so that the main control board calculates a second number of service tokens allocated to the service board according to a built-in token bucket having a first number of current tokens and the traffic rate of the member port;
[0025] A receiving unit, configured to receive a service token response message sent by the main control board, wherein the service token response message includes the second number of service tokens;
[0026] A processing unit is used to process the received service message according to the second number of service tokens and a preset token consumption rate.
[0027] In a fifth aspect, the present application provides a network device, including a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to execute the method provided in the first aspect of the present application.
[0028] In a sixth aspect, the present application provides a network device, including a processor and a machine-readable storage medium, the machine-readable storage medium storing machine-executable instructions that can be executed by the processor, and the processor is prompted by the machine-executable instructions to execute the method provided in the second aspect of the present application.
[0029] Therefore, by applying the communication method and device provided in the present application, the main control board receives a business token request message sent by at least one business board, each business token request message includes the traffic rate of the member ports included in each business board, and the member ports included in each business board belong to the same aggregation port; when receiving a business token request message sent by the business board where each member port belonging to the same aggregation port is located, the main control board calculates the second number of business tokens allocated to each business board based on the first number and the traffic rate of the member ports included in each business board; the main control board sends a business token response message to each business board, and the business token response message includes the second number of business tokens, so that the business board processes the business message according to the second number of business tokens and the preset token consumption rate.
[0030] In this way, the tokens allocated between the main control board and the service board are only exchanged with each other, which solves the problem that the bandwidth of the inter-board transparent transmission channel is small, resulting in a large amount of traffic being discarded and the CPU consumption of the service board in the existing method of transparently transmitting all the traffic carried by the member ports of the aggregation port to the same service board. This application improves the processing performance of the token bucket, reduces the consumption of the CPU of each board and the pressure of communication between boards and frames; at the same time, it also ensures the uniform transmission of traffic. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 A schematic diagram of implementing traffic monitoring on an existing aggregation port;
[0032] Figure 2 A schematic diagram of implementing traffic monitoring on another existing aggregation port;
[0033] Figure 3 A flow chart of a communication method provided in an embodiment of the present application;
[0034] Figure 4 A schematic diagram of the network configuration of the application communication method provided in the embodiment of the present application;
[0035] Figure 5 A flowchart of another communication method provided in an embodiment of the present application;
[0036] Figure 6 A structural diagram of a communication device provided in an embodiment of the present application;
[0037] Figure 7 A structural diagram of another communication device provided in an embodiment of the present application;
[0038] Figure 8 The network device hardware structure provided in the embodiment of the present application. DETAILED DESCRIPTION
[0039] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0040] The terms used in this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in this article refers to and includes any or all possible combinations of one or more corresponding listed items.
[0041] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0042] The communication method provided in the embodiment of the present application is described in detail below. Figure 3 , Figure 3 A flow chart of a communication method provided in an embodiment of the present application. The method is applied to a main control board. The communication method provided in an embodiment of the present application may include the following steps.
[0043] Step 310: Receive a service token request message sent by at least one service board, each service token request message includes the traffic rate of the member ports included in each service board, and the member ports included in each service board belong to the same aggregation port.
[0044] Specifically, a token bucket is configured in the main control board, and the token bucket includes a first number of current tokens. For example, the first number is T. The capacity of the token bucket matches the speed limit value of the aggregation port (for example, 10M), and the first number T is not greater than the capacity of the token bucket. The above-mentioned aggregation port includes at least one member port, and each member port is distributed on different service boards.
[0045] Within the first preset time (for example, every 50ms), each service board obtains the flow rate (for example, s) of the member ports in the board. The flow rate refers to the flow rate at which the member ports receive and send the target service flow, which is a rate-limited service flow.
[0046] Each service board generates a service token request message, which includes the traffic rate of the member port. It can be understood that the member ports included in each service board belong to the same aggregation port, and the member ports are all selected ports.
[0047] Each service board sends a service token request message to the main control board. The main control board receives at least one service token request message and obtains the flow rate of each member port from each service token request message.
[0048] Step 320: When a service token request message is received from the service board where each member port belonging to the same aggregation port is located, a second number of service tokens allocated to each service board is calculated based on the first number and the traffic rate of the member ports included in each service board.
[0049] Specifically, according to the description of step 310, the main control board obtains the traffic rate of each member port. When the main control board obtains the traffic rate of all member ports of the aggregation port, that is, each service board where all member ports are located has sent a service token request message to the main control board, and the main control board calculates the second number of service tokens allocated to each service board based on the first number of current tokens included in the token bucket and the traffic rate of each member port.
[0050] Further, the main control board calculates the second number of service tokens allocated to each service board according to the first number and the traffic rate of the member ports included in each service board. The specific process is as follows:
[0051] The main control board accumulates the flow rate of each member port to obtain the current flow rate of the aggregation port; the main control board calculates the quotient of the flow rate of each member port and the current flow rate of the aggregation port; the main control board multiplies the quotient by the first quantity and uses the product as the second quantity.
[0052] For example, Figure 4 As shown, Figure 4 A schematic diagram of the network configuration of the application communication method provided in the embodiment of the present application. Figure 4 In the example, the speed limit of the aggregation port is 10M. The selected member ports of the aggregation port include: member port 1, member port 2, member port 3, and member port 4. The above 4 member ports are distributed on 4 service boards, such as service board 1, service board 2, service board 3, and service board 4.
[0053] The main control board obtains the traffic rate of each member port, such as the traffic rate of member port 1 is recorded as s1, the traffic rate of member port 2 is recorded as s2, the traffic rate of member port 3 is recorded as s3, and the traffic rate of member port 4 is recorded as s4.
[0054] The main control board accumulates the traffic rate of each member port and obtains the current traffic rate of the aggregation port as s1+s2+s3+s4. The main control board calculates the quotient of the traffic rate of each member port and the current traffic rate of the aggregation port, such as s1 / (s1+s2+s3+s4), s2 / (s1+s2+s3+s4), s3 / (s1+s2+s3+s4), and s4 / (s1+s2+s3+s4). The main control board multiplies the above quotients with the first quantity respectively, and uses the product as the second quantity allocated to each business board, such as the second number of business tokens allocated by the main control board to business board 1 is T*s1 / (s1+s2+s3+s4), the second number of business tokens allocated by the main control board to business board 2 is T*s2 / (s1+s2+s3+s4), the second number of business tokens allocated by the main control board to business board 3 is T*s3 / (s1+s2+s3+s4), and the second number of business tokens allocated by the main control board to business board 4 is T*s4 / (s1+s2+s3+s4).
[0055] Step 330: Send a service token response message to each service board, wherein the service token response message includes the second number of service tokens, so that the service board processes the service message according to the second number of service tokens and a preset token consumption rate.
[0056] Specifically, according to the description of step 320, after the main control board calculates the second number of service tokens allocated to each service board, it generates a corresponding service token response message for each service board. Each service token response message includes the second number of service tokens allocated to the corresponding service board.
[0057] The main control board sends a service token response message to each service board.
[0058] After receiving the business token response message, the business board obtains the second number of business tokens from it. The business board stores the obtained second number of business tokens in the local token bucket. Subsequently, after receiving the business message, the business board consumes the corresponding tokens from the second number of business tokens according to the preset token consumption rate, and forwards the business message.
[0059] The preset token consumption rate is to consume 1 / 50 of the total tokens every 1 ms.
[0060] It is understandable that the service board and the main control board execute the aforementioned process of step 310 to step 330 every 50 ms.
[0061] In the embodiment of the present application, before the service board obtains the second number of service tokens, some tokens exist in its local token bucket. In order to prevent the service board from being unable to continue forwarding traffic after all tokens are consumed, the service board initiates a process of requesting service tokens from the main control board again to ensure that tokens continue to exist in the local token bucket and traffic continues to flow.
[0062] The time interval between the service board and the main control board for requesting service tokens cannot be too small. The request period can be set to 50ms, that is, every 50ms, the service board requests service tokens from the main control board. In order to ensure the uniform flow of target service flow, the service board must consume service tokens evenly after obtaining them. If the request period is 50ms, the service board consumes 1 / 50 of the total tokens every 1ms.
[0063] Optionally, before step 310 of the embodiment of the present application, a process is also included in which the main control board allocates an initial token to each service board.
[0064] Specifically, after the main control board and the service board are powered on, the token bucket in the main control board includes the pre-configured third number of initial tokens. After the main control board establishes a communication connection with each service board, the local token bucket in each service board is empty, and each service board obtains the initial token from the token bucket in the main control board.
[0065] Each service board generates and sends an initial token request message to the main control board, and the main control board receives the initial token request message sent by at least one service board.
[0066] When the main control board receives the initial token request message sent by the business board where all the member ports of the aggregation port are located, the main control board calculates the fourth number of initial tokens allocated to each business board based on the third number. The main control board generates a corresponding initial token response message for each business board. Each initial token response message includes the fourth number of initial tokens allocated to the corresponding business board.
[0067] The main control board sends an initial token response message to each service board.
[0068] After receiving the initial token response message, the business board obtains the fourth number of initial tokens from it. The business board stores the fourth number of initial tokens obtained in the local token bucket. At the same time, the business board also converts the fourth number into a corresponding initial rate value, which can be the rate at which the business board generates tokens after it leaves the card slot. The business board records the initial rate value.
[0069] Subsequently, after receiving the service message, the service board consumes the corresponding token from the fourth number of initial tokens and forwards the service message.
[0070] During the process of the service board forwarding the service message, the fourth number of initial tokens gradually decreases. The service board should also replenish the tokens in the local token bucket. At this time, the service board periodically sends a service token request message to the main control board within the first preset time to request the allocation of tokens from the main control board. The main control board can refer to the description of the aforementioned steps 310-330 to allocate tokens to each service board according to the traffic rate of each member port.
[0071] Further, the aforementioned main control board calculates a fourth number of initial tokens allocated to each service board according to the third number, and the specific process is as follows:
[0072] The main control board has locally configured the information of the service board where each member port is located, including but not limited to the number of service boards, the location of the service board and other information. The main control board obtains the number of service boards where each member port belonging to the same aggregation port is located to obtain the fifth quantity. Of course, the main control board can also verify whether the initial token request message sent by the service board where all the member ports of the aggregation port are located is received through the number of service boards.
[0073] The main control board calculates a quotient of the third quantity and the fifth quantity, and uses the quotient as the fourth quantity.
[0074] For example, according to the above example, the selected member ports of the aggregation port are distributed on 4 service boards, and the fifth number is 4. The main control board uses the quotient of the third number representing the total number of tokens in the token bucket and the fifth number as the fourth number, that is, each service board obtains one-fourth of the number of tokens of the main control board. For example, if the third number is 10,000, the number of tokens obtained by each service board is 2,500.
[0075] The initial token obtained by the business board is 2500, which is converted into a corresponding initial rate value of 2.5M.
[0076] Optionally, in the embodiment of the present application, it also includes a process in which when the main control board detects that the service board where the member port is located is inserted into or removed from the card slot, the main control board updates the fourth number and notifies each service board.
[0077] Specifically, when detecting that the service board where the member port is located is inserted into or removed from the card slot, the main control board determines that the member port of the aggregation port has changed, that is, the number of service boards has changed. The main control board re-acquires the number of service boards where each member port belonging to the same aggregation port is located to obtain the sixth number.
[0078] The main control board calculates the quotient of the third quantity and the sixth quantity, and uses the quotient to update the fourth quantity. The main control board generates a notification message, which includes the updated fourth quantity. The main control board sends a notification message to each service board respectively.
[0079] For example, according to the above example, if business board 2 and business board 3 are out of the card slot among the four business boards, the sixth number is 2. The main control board uses the quotient of the third number representing the total number of tokens in the token bucket and the sixth number as the updated fourth number. For example, if the third number is 10,000, the updated fourth number is 5,000.
[0080] After receiving the notification message, the business board obtains the updated fourth quantity from it. The business board converts the updated fourth quantity into the corresponding current rate value, and uses the current rate value to update the initial rate value. The current rate value can be the generation rate of the token generated by the business board after it is separated from the card slot. The business board records the current rate value.
[0081] The fourth quantity obtained by the business board after update is 5000, which is converted into the corresponding current rate value of 5M.
[0082] Optionally, in an embodiment of the present application, the main control board also includes a process in which the main control board re-acquires the number of business boards where each member port belonging to the same aggregation port is located, and the main control board also determines whether the business board that has been detached from the card slot establishes a connection with the main control board again.
[0083] Specifically, when it is detected that the business board where the member port is located is out of the slot, the main control board determines whether the business board where the member port is located is inserted into the main control board again and establishes a connection with the main control board after reaching a second preset time (for example, the main control board starts a timer, and the preset duration of the timer is 80ms).
[0084] If the service board where the member port is located is not inserted into the main control board after the second preset time, or is inserted into the main control board but no connection is established with the main control board, the main control board determines that the service board where the member port is located enters the escape mode. Subsequently, the main control board re-acquires the number of service boards where each member port belonging to the same aggregation port is located to obtain the sixth number.
[0085] It is understandable that if the service board where the member port is located is inserted into the main control board and establishes a connection with the main control board after the second preset time, the main control board does not perform any processing.
[0086] The communication method provided in the embodiment of the present application is described in detail below. Figure 5 , Figure 5 A flowchart of another communication method provided in an embodiment of the present application. The method is applied to a service board. The communication method provided in an embodiment of the present application may include the following steps.
[0087] Step 510: Obtain the flow rate of the member port within a first preset time.
[0088] Specifically, within a first preset time (eg, every 50 ms), the service board obtains the traffic rate (eg, s) of the member ports within the board.
[0089] The member port specifically refers to the selected member port in the aggregation port. The service board can count the number of service packets received and sent by the member port of the target service flow as the traffic rate of the member port.
[0090] A local token bucket is configured in the service board, and some tokens are stored in the local token bucket. In order to prevent the service board from being unable to forward traffic when all tokens are consumed, the service board initiates a process of requesting service tokens from the main control board again to ensure that tokens continue to exist in the local token bucket and traffic continues to flow.
[0091] The time interval between the service board and the main control board for requesting service tokens cannot be too small. The request period can be set to 50ms, that is, every 50ms, the service board requests service tokens from the main control board. In order to ensure the uniform flow of target service flow, the service board must consume service tokens evenly after obtaining them. If the request period is 50ms, the service board consumes 1 / 50 of the total tokens every 1ms.
[0092] For example, service board 1 includes member port 1. Service board 1 obtains the traffic rate of member port 1.
[0093] Step 520: Send a service token request message to the main control board, wherein the service token request message includes the traffic rate of the member ports belonging to the aggregation port included in the service board, so that the main control board calculates the second number of service tokens allocated to the service board based on the built-in token bucket with a first number of current tokens and the traffic rate of the member ports.
[0094] Specifically, according to the description of step 510, after the service board obtains the flow rate of the member port, the service board generates a service token request message. The service token request message includes the flow rate of the member port. The service board sends the service token request message to the main control board.
[0095] After receiving the service token request message, the main control board obtains the traffic rate of the member port. When the main control board receives the traffic rate of all member ports of the aggregation port, the main control board calculates the second number of service tokens allocated to each service board based on the built-in token bucket with the first number of current tokens and the traffic rate of each member port.
[0096] Furthermore, a token bucket is configured in the main control board, and the token bucket includes a first number of current tokens. For example, the first number is T. The capacity of the token bucket matches the speed limit value (for example, 10M) of the aggregation port.
[0097] When the main control board obtains the traffic rate of all member ports of the aggregation port, the main control board accumulates the traffic rate of each member port to obtain the current traffic rate of the aggregation port; the main control board calculates the quotient of the traffic rate of each member port and the current traffic rate of the aggregation port; the main control board multiplies the quotient by the first quantity and uses the product as the second quantity.
[0098] For example, in Figure 4 In the example, the speed limit of the aggregation port is 10M. The selected member ports of the aggregation port include: member port 1, member port 2, member port 3, and member port 4. The above 4 member ports are distributed on 4 service boards, such as service board 1, service board 2, service board 3, and service board 4.
[0099] The main control board obtains the traffic rate of each member port, such as the traffic rate of member port 1 is recorded as s1, the traffic rate of member port 2 is recorded as s2, the traffic rate of member port 3 is recorded as s3, and the traffic rate of member port 4 is recorded as s4.
[0100] The main control board accumulates the traffic rate of each member port and obtains the current traffic rate of the aggregation port as s1+s2+s3+s4. The main control board calculates the quotient of the traffic rate of each member port and the current traffic rate of the aggregation port, such as s1 / (s1+s2+s3+s4), s2 / (s1+s2+s3+s4), s3 / (s1+s2+s3+s4), and s4 / (s1+s2+s3+s4). The main control board multiplies the above quotients with the first quantity respectively, and uses the product as the second quantity allocated to each business board, such as the second number of business tokens allocated by the main control board to business board 1 is T*s1 / (s1+s2+s3+s4), the second number of business tokens allocated by the main control board to business board 2 is T*s2 / (s1+s2+s3+s4), the second number of business tokens allocated by the main control board to business board 3 is T*s3 / (s1+s2+s3+s4), and the second number of business tokens allocated by the main control board to business board 4 is T*s4 / (s1+s2+s3+s4).
[0101] Step 530: Receive a service token response message sent by the main control board, where the service token response message includes the second number of service tokens.
[0102] Specifically, according to the description of step 520, after the main control board calculates the second number of service tokens allocated to each service board, it generates a corresponding service token response message for each service board. Each service token response message includes the second number of service tokens allocated to the corresponding service board.
[0103] The main control board sends a service token response message to each service board. After receiving the service token response message, the service board obtains the second number of service tokens therefrom.
[0104] Step 540: Process the received service message according to the second number of service tokens and the preset token consumption rate.
[0105] Specifically, according to the description of step 530, the service board stores the acquired second number of service tokens in the local token bucket. Subsequently, after receiving the service message, the service board consumes the corresponding tokens from the second number of service tokens at a preset token consumption rate and forwards the service message.
[0106] The preset token consumption rate is to consume 1 / 50 of the total tokens every 1 ms.
[0107] It is understandable that the business board and the main control board execute the aforementioned process of step 410 to step 440 every 50 ms.
[0108] Optionally, before step 510 of the embodiment of the present application, the process also includes a process in which the business board sends an initial token request message to the main control board so that the main control board allocates an initial token to each business board.
[0109] Specifically, after the main control board and the service board are powered on, the token bucket in the main control board includes the pre-configured third number of initial tokens. After the main control board establishes a communication connection with each service board, the local token bucket in each service board is empty, and each service board obtains the initial token from the token bucket in the main control board.
[0110] Each service board generates and sends an initial token request message to the main control board, and the main control board receives the initial token request message sent by at least one service board.
[0111] When the main control board receives the initial token request message sent by the business board where all the member ports of the aggregation port are located, the main control board calculates the fourth number of initial tokens allocated to each business board based on the third number. The main control board generates a corresponding initial token response message for each business board. Each initial token response message includes the fourth number of initial tokens allocated to the corresponding business board.
[0112] The main control board sends an initial token response message to each service board.
[0113] After receiving the initial token response message, the business board obtains the fourth number of initial tokens from it. The business board stores the fourth number of initial tokens obtained in the local token bucket. At the same time, the business board also converts the fourth number into a corresponding initial rate value, which can be the rate at which the business board generates tokens after it leaves the card slot. The business board records the initial rate value.
[0114] Subsequently, after receiving the service message, the service board consumes the corresponding token from the fourth number of initial tokens and forwards the service message.
[0115] During the process of the service board forwarding the service message, the fourth number of initial tokens gradually decreases. The service board should also replenish the tokens in the local token bucket. At this time, the service board periodically sends a service token request message to the main control board within a preset time to request the main control board to allocate tokens. The main control board can refer to the description of the aforementioned steps 310-330 to allocate tokens to each service board according to the traffic rate of each member port.
[0116] Further, the aforementioned main control board calculates a fourth number of initial tokens allocated to each service board according to the third number, and the specific process is as follows:
[0117] The main control board has locally configured the information of the service board where each member port is located, including but not limited to the number of service boards, the location of the service board and other information. The main control board obtains the number of service boards where each member port belonging to the same aggregation port is located to obtain the fifth quantity. Of course, the main control board can also verify whether the initial token request message sent by the service board where all the member ports of the aggregation port are located is received through the number of service boards.
[0118] The main control board calculates a quotient of the third quantity and the fifth quantity, and uses the quotient as the fourth quantity.
[0119] For example, according to the above example, the selected member ports of the aggregation port are distributed on 4 service boards, and the fifth number is 4. The main control board uses the quotient of the third number representing the total number of tokens in the token bucket and the fifth number as the fourth number, that is, each service board obtains one-fourth of the number of tokens of the main control board. For example, if the third number is 10,000, the number of tokens obtained by each service board is 2,500.
[0120] The initial token obtained by the business board is 2500, which is converted into a corresponding initial rate value of 2.5M.
[0121] Optionally, in an embodiment of the present application, the process of the business board receiving a notification message sent by the main control board is also included.
[0122] Specifically, when detecting that the service board where the member port is located is inserted into or removed from the card slot, the main control board determines that the member port of the aggregation port has changed, that is, the number of service boards has changed. The main control board re-acquires the number of service boards where each member port belonging to the same aggregation port is located to obtain the sixth number.
[0123] The main control board calculates the quotient of the third quantity and the sixth quantity, and uses the quotient to update the fourth quantity. The main control board generates a notification message, which includes the updated fourth quantity. The main control board sends a notification message to each service board respectively.
[0124] For example, according to the above example, if business board 2 and business board 3 are out of the card slot among the four business boards, the sixth number is 2. The main control board uses the quotient of the third number representing the total number of tokens in the token bucket and the sixth number as the updated fourth number. For example, if the third number is 10,000, the updated fourth number is 5,000.
[0125] After receiving the notification message, the business board obtains the updated fourth quantity from it. The business board converts the updated fourth quantity into the corresponding current rate value, and uses the current rate value to update the initial rate value. The current rate value can be the generation rate of the token generated by the business board after it is separated from the card slot. The business board records the current rate value.
[0126] The fourth quantity obtained by the business board after update is 5000, which is converted into the corresponding current rate value of 5M.
[0127] Optionally, in the embodiment of the present application, it also includes a process in which the service board where the member port is located generates tokens in the local token bucket after the service board where the member port is located is detached from the card slot.
[0128] When the service board is detached from the card slot, tokens in the local token bucket are generated within a first preset time (for example, every 50 ms) according to the initial rate value or the current rate value.
[0129] Optionally, in an embodiment of the present application, it also includes a process in which the business board determines to enter escape mode after the business board is detached from the card slot and before generating tokens in the local token bucket according to the initial rate value or the current rate value.
[0130] Specifically, when the business board is detached from the card slot and is not inserted into the main control board after a second preset time (for example, the business board starts a timer with a preset duration of 80ms), or is inserted into the main control board but no connection is established with the main control board, the business board determines that it has entered escape mode.
[0131] Similarly, after the main control board detects that the business board is out of the slot, it also determines whether the business board is inserted into the main control board again and establishes a connection with the main control board after reaching a second preset time (for example, the main control board starts a timer with a preset duration of 80ms).
[0132] If the service board is not inserted into the main control board after the second preset time, or the service board is not connected to the main control board after being inserted into the main control board, the main control board also determines that the service board enters the escape mode. Subsequently, the main control board re-acquires the number of service boards where each member port belonging to the same aggregation port is located to obtain the sixth number.
[0133] It is understandable that if the service board where the member port is located is inserted into the main control board and establishes a connection with the main control board after the second preset time, the main control board does not perform any processing.
[0134] Therefore, by applying the communication method provided in the present application, the main control board receives a business token request message sent by at least one business board, each business token request message includes the traffic rate of the member ports included in each business board, and the member ports included in each business board belong to the same aggregation port; when receiving a business token request message sent by the business board where each member port belonging to the same aggregation port is located, the main control board calculates the second number of business tokens allocated to each business board based on the first number and the traffic rate of the member ports included in each business board; the main control board sends a business token response message to each business board, and the business token response message includes the second number of business tokens, so that the business board processes the business message according to the second number of business tokens and the preset token consumption rate.
[0135] In this way, the tokens allocated between the main control board and the service board are only exchanged with each other, which solves the problem that the bandwidth of the inter-board transparent transmission channel is small, resulting in a large amount of traffic being discarded and the CPU consumption of the service board in the existing method of transparently transmitting all the traffic carried by the member ports of the aggregation port to the same service board. This application improves the processing performance of the token bucket, reduces the consumption of the CPU of each board and the pressure of communication between boards and frames; at the same time, it also ensures the uniform transmission of traffic.
[0136] Based on the same inventive concept, the present application embodiment also provides a communication device corresponding to the communication method. Figure 6 , Figure 6 A communication device structure diagram provided in an embodiment of the present application. The device is applied to a main control board, a token bucket is configured in the main control board, the token bucket includes a first number of current tokens, and the device includes:
[0137] The receiving unit 610 is used to receive a service token request message sent by at least one service board, each service token request message includes a flow rate of a member port included in each service board, and the member ports included in each service board belong to the same aggregation port;
[0138] The calculation unit 620 is used to calculate the second number of service tokens allocated to each service board according to the first number and the traffic rate of the member ports included in each service board when receiving the service token request message sent by the service board where each member port belonging to the same aggregation port is located;
[0139] A sending unit 630 is used to send a service token response message to each service board, wherein the service token response message includes the second number of service tokens, so that the service board processes the service message according to the second number of service tokens and a preset token consumption rate.
[0140] Optionally, the token bucket includes a third number of initial tokens;
[0141] The receiving unit 610 is also used to receive an initial token request message sent by at least one service board;
[0142] The calculation unit 620 is further configured to calculate a fourth number of initial tokens allocated to each service board according to the third number when the receiving unit receives an initial token request message sent by the service board where each member port of the same aggregation port is located;
[0143] The sending unit 630 is also used to send an initial token response message to each business board, and the initial token response message includes the fourth number of initial tokens, so that the business board records the fourth number of initial tokens and converts the corresponding initial rate value according to the fourth number, and the initial rate value is the token generation rate when the business board is out of the card slot.
[0144] Optionally, the calculation unit 620 is specifically configured to accumulate the traffic rates of the member ports included in each service board to obtain the current traffic rate of the aggregation port;
[0145] Calculating the quotient of the flow rate of the member ports included in each service board and the current flow rate of the aggregation port;
[0146] The quotient is multiplied by the first number, and the product is used as the second number.
[0147] Optionally, the calculation unit 620 is further specifically configured to obtain the number of service boards where each member port belonging to the same aggregation port is located, to obtain a fifth number;
[0148] A quotient of the third quantity and the fifth quantity is calculated, and the quotient is used as the fourth quantity.
[0149] Optionally, the device further includes: an acquisition unit (not shown in the figure), configured to reacquire the number of service boards where each member port belonging to the same aggregation port is located when it is detected that the service board where the member port is located is inserted into or removed from the card slot, to obtain a sixth number;
[0150] The calculation unit 620 is further configured to calculate a quotient of the third quantity and the sixth quantity, and update the fourth quantity using the quotient;
[0151] The sending unit 630 is also used to send a notification message to each business board, the notification message including the updated fourth quantity, so that each business board converts the corresponding current rate value according to the updated fourth quantity, and uses the current rate value to update the initial rate value, and the current rate value is the token generation rate when the business board is out of the slot.
[0152] Optionally, the device further includes: a judgment unit (not shown in the figure), which is used to judge whether the service board where the member port is located is inserted into the main control board again and establishes a connection with the main control board after reaching a preset time when it is detected that the service board where the member port is located is out of the card slot;
[0153] A determination unit (not shown in the figure) is used to determine that the business board where the member port is located enters the escape mode if the business board where the member port is located is not inserted into the main control board after a preset time, or is inserted into the main control board but no connection is established with the main control board.
[0154] In this way, the tokens allocated between the main control board and the service board are only exchanged with each other, which solves the problem that the bandwidth of the inter-board transparent transmission channel is small, resulting in a large amount of traffic being discarded and the CPU consumption of the service board in the existing method of transparently transmitting all the traffic carried by the member ports of the aggregation port to the same service board. This application improves the processing performance of the token bucket, reduces the consumption of the CPU of each board and the pressure of communication between boards and frames; at the same time, it also ensures the uniform transmission of traffic.
[0155] Based on the same inventive concept, the present application embodiment also provides a communication device corresponding to the communication method. Figure 7 , Figure 7 Another communication device structure diagram provided in an embodiment of the present application. The device is applied to a service board, the service board includes member ports belonging to an aggregation port, and the device includes:
[0156] An acquisition unit 710 is used to acquire the flow rate of the member port within a first preset time;
[0157] A sending unit 720 is used to send a service token request message to the main control board, wherein the service token request message includes the traffic rate of the member port belonging to the aggregation port included in the service board, so that the main control board calculates the second number of service tokens allocated to the service board according to the built-in token bucket with the first number of current tokens and the traffic rate of the member port;
[0158] The receiving unit 730 is configured to receive a service token response message sent by the main control board, wherein the service token response message includes the second number of service tokens;
[0159] The processing unit 740 is used to process the received service message according to the second number of service tokens and a preset token consumption rate.
[0160] Optionally, the sending unit 720 is further used to send an initial token request message to the main control board, wherein the initial token request message is used to enable the main control board to calculate a fourth number of initial tokens allocated to the business board according to a third number of initial tokens in the token bucket;
[0161] The receiving unit 730 is further configured to receive an initial token response message sent by the main control board, wherein the initial token request message includes the fourth number of initial tokens;
[0162] The device also includes: a conversion unit (not shown in the figure), which is used to convert the corresponding initial rate value according to the fourth number, and the initial rate value is the token generation rate when the service board is separated from the card slot.
[0163] Optionally, the receiving unit 730 is further configured to receive a notification message sent by the main control board, wherein the notification message includes the updated fourth quantity;
[0164] The conversion unit (not shown in the figure) is also used to convert the corresponding current rate value according to the updated fourth quantity, and use the current rate value to update the initial rate value. The current rate value is the token generation rate when the business board is detached from the card slot.
[0165] Optionally, the device further comprises: a recording unit (not shown in the figure), configured to record the initial rate value;
[0166] The recording unit (not shown in the figure) is also used to record the current rate value.
[0167] Optionally, the device also includes: a generation unit (not shown in the figure), which is used to generate tokens in a local token bucket according to the initial rate value or the current rate value within the first preset time when the service board is detached from the card slot.
[0168] Optionally, the device also includes: a determination unit (not shown in the figure), which is used to determine that the escape mode has been entered when the business board is detached from the card slot and is not inserted into the main control board after a second preset time, or is inserted into the main control board but no connection is established with the main control board.
[0169] In this way, the tokens allocated between the main control board and the service board are only exchanged with each other, which solves the problem that the bandwidth of the inter-board transparent transmission channel is small, resulting in a large amount of traffic being discarded and the CPU consumption of the service board in the existing method of transparently transmitting all the traffic carried by the member ports of the aggregation port to the same service board. This application improves the processing performance of the token bucket, reduces the consumption of the CPU of each board and the pressure of communication between boards and frames; at the same time, it also ensures the uniform transmission of traffic.
[0170] Based on the same inventive concept, the embodiment of the present application also provides a network device, such as Figure 8 As shown, it includes a processor 810, a transceiver 820 and a machine-readable storage medium 830, the machine-readable storage medium 830 stores machine-executable instructions that can be executed by the processor 810, and the processor 810 is prompted by the machine-executable instructions to execute the communication method provided in the embodiment of the present application. Figure 6 , Figure 7 The communication device shown can be used as Figure 8 The network device hardware structure shown is implemented.
[0171] The computer-readable storage medium 830 may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk storage. Optionally, the computer-readable storage medium 830 may also be at least one storage device located away from the processor 810.
[0172] The processor 810 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0173] In the embodiment of the present application, the processor 810 reads the machine executable instructions stored in the machine readable storage medium 830, and the machine executable instructions enable the processor 810 itself and the transceiver 820 to execute the communication method described in the aforementioned embodiment of the present application.
[0174] In addition, an embodiment of the present application provides a machine-readable storage medium 830, which stores machine-executable instructions. When called and executed by the processor 810, the machine-executable instructions prompt the processor 810 itself and the calling transceiver 820 to execute the communication method described in the aforementioned embodiment of the present application.
[0175] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0176] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.
[0177] As for the communication device and machine-readable storage medium embodiments, since the method contents involved are basically similar to the aforementioned method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0178] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A communication method, characterized in that: The method is applied to a main control board, a token bucket is configured in the main control board, the token bucket includes a first number of current tokens, and the method includes: Receive a service token request message sent by at least one service board, each service token request message includes a flow rate of a member port included in each service board, and the member ports included in each service board belong to the same aggregation port; When receiving a service token request message sent by the service board where each member port belonging to the same aggregation port is located, calculating the second number of service tokens allocated to each service board according to the first number and the traffic rate of the member ports included in each service board; Sending a service token response message to each service board, wherein the service token response message includes the second number of service tokens, so that the service board processes the service message according to the second number of service tokens and a preset token consumption rate; Wherein, the token bucket includes a third number of initial tokens; Before receiving a service token request message sent by at least one service board, the method further includes: Receive an initial token request message sent by at least one service board; When receiving an initial token request message sent by the service board where each member port belonging to the same aggregation port is located, calculating a fourth number of initial tokens allocated to each service board according to the third number; Sending an initial token response message to each of the service boards, wherein the initial token response message includes the fourth number of initial tokens, so that the service board records the fourth number of initial tokens and converts the corresponding initial rate value according to the fourth number, wherein the initial rate value is the token generation rate after the service board is out of the card slot; The step of calculating, according to the third quantity, a fourth number of initial tokens allocated to each service board specifically includes: Obtain the number of service boards where each member port belonging to the same aggregation port is located, and obtain a fifth number; calculating a quotient of the third quantity and the fifth quantity, and using the quotient as the fourth quantity; Wherein, the method further comprises: When it is detected that the service board where the member port is located is inserted into or removed from the card slot, the number of service boards where each member port belonging to the same aggregation port is located is re-acquired to obtain a sixth number; calculating a quotient of the third quantity and the sixth quantity, and using the quotient to update the fourth quantity; A notification message is sent to each of the business boards, the notification message including the updated fourth quantity, so that each of the business boards converts the corresponding current rate value according to the updated fourth quantity, and uses the current rate value to update the initial rate value, and the current rate value is the token generation rate when the business board is out of the card slot.
2. The method according to claim 1, characterized in that The calculating, according to the first quantity and the traffic rate of the member ports included in each service board, a second quantity of service tokens allocated to each service board specifically includes: Accumulating the traffic rates of the member ports included in each service board to obtain the current traffic rate of the aggregation port; Calculating the quotient of the flow rate of the member ports included in each service board and the current flow rate of the aggregation port; The quotient is multiplied by the first number, and the product is used as the second number.
3. The method according to claim 1, characterized in that Before re-obtaining the number of service boards where each member port belonging to the same aggregation port is located, the method further includes: When it is detected that the service board where the member port is located is out of the card slot, it is determined whether the service board where the member port is located is inserted into the main control board again after a preset time has elapsed and a connection is established with the main control board; If the service board where the member port is located is not inserted into the main control board after the preset time, or is inserted into the main control board but no connection is established with the main control board, it is determined that the service board where the member port is located enters the escape mode.
4. A communication method, characterized in that: The method is applied to a service board, wherein the service board includes member ports belonging to an aggregation port, and the method includes: Within a first preset time, obtaining the flow rate of the member port; Sending a service token request message to the main control board, wherein the service token request message includes the traffic rate of the member port belonging to the aggregation port included in the service board, so that the main control board calculates a second number of service tokens allocated to the service board according to the built-in token bucket with a first number of current tokens and the traffic rate of the member port; receiving a service token response message sent by the main control board, wherein the service token response message includes the second number of service tokens; Processing the received service message according to the second number of service tokens and a preset token consumption rate; Wherein, before obtaining the flow rate of the member port within the first preset time, the method further includes: Sending an initial token request message to the main control board, wherein the initial token request message is used to enable the main control board to calculate a fourth number of initial tokens allocated to the service board according to the third number of initial tokens in the token bucket; receiving an initial token response message sent by the main control board, wherein the initial token request message includes the fourth number of initial tokens; According to the fourth quantity, convert the corresponding initial rate value, the initial rate value is the token generation rate after the service board is separated from the card slot, and the initial rate value is the token generation rate after the service board is separated from the card slot; Wherein, the method further comprises: receiving a notification message sent by the main control board, wherein the notification message includes the updated fourth quantity; According to the updated fourth quantity, convert the corresponding current rate value, and use the current rate value to update the initial rate value, where the current rate value is the token generation rate after the service board is separated from the card slot; The main control board calculates the fourth number of initial tokens allocated to the service board according to the third number of initial tokens in the token bucket, which specifically includes: the main control board obtains the number of service boards where each member port belonging to the same aggregation port is located, and obtains the fifth number; the main control board calculates the quotient of the third number and the fifth number, and uses the quotient as the fourth number; Among them, the updated fourth quantity is obtained by the main control board through the following steps: when it is detected that the business board where the member port is located is inserted into or removed from the card slot, the main control board re-acquires the number of business boards where each member port belonging to the same aggregation port is located, and obtains the sixth quantity; the main control board calculates the quotient of the third quantity and the sixth quantity, and uses the quotient to update the fourth quantity.
5. The method according to claim 4, characterized in that After converting the corresponding initial rate value according to the fourth quantity, the method further includes: Recording the initial rate value; After converting the corresponding current rate value according to the updated fourth quantity, the method further includes: The current rate value is recorded.
6. The method according to claim 5, characterized in that The method further comprises: When the service board is detached from the card slot, a token in a local token bucket is generated according to the initial rate value or the current rate value within the first preset time.
7. The method according to claim 6, characterized in that Before generating tokens in the local token bucket according to the initial rate value or the current rate value within the first preset time, the method further includes: When the service board is out of the card slot and is not inserted into the main control board after a second preset time, or is inserted into the main control board but no connection is established with the main control board, it is determined to enter the escape mode.
8. A communication device, characterized in that: The device is applied to a main control board, a token bucket is configured in the main control board, the token bucket includes a first number of current tokens, and the device includes: A receiving unit, configured to receive a service token request message sent by at least one service board, each service token request message including a flow rate of a member port included in each service board, wherein the member ports included in each service board belong to the same aggregation port; A calculation unit, configured to calculate a second number of service tokens allocated to each service board according to the first number and the traffic rate of the member ports included in each service board when receiving a service token request message sent by the service board where each member port belonging to the same aggregation port is located; A sending unit, configured to send a service token response message to each service board, wherein the service token response message includes the second number of service tokens, so that the service board processes the service message according to the second number of service tokens and a preset token consumption rate; Wherein, the token bucket includes a third number of initial tokens; The receiving unit is also used to receive an initial token request message sent by at least one service board; The calculation unit is further configured to calculate a fourth number of initial tokens allocated to each service board according to the third number when the receiving unit receives an initial token request message sent by the service board where each member port belonging to the same aggregation port is located; The sending unit is further used to send an initial token response message to each of the service boards, wherein the initial token response message includes the fourth number of initial tokens, so that the service board records the fourth number of initial tokens and converts a corresponding initial rate value according to the fourth number, wherein the initial rate value is a token generation rate after the service board is separated from the card slot; The calculation unit is further specifically configured to obtain the number of service boards where each member port belonging to the same aggregation port is located, to obtain a fifth number; calculating a quotient of the third quantity and the fifth quantity, and using the quotient as the fourth quantity; The device further comprises: an acquisition unit, configured to reacquire the number of service boards where each member port belonging to the same aggregation port is located when it is detected that the service board where the member port is located is inserted into or removed from the card slot, to obtain a sixth number; The calculation unit is further used to calculate the quotient of the third quantity and the sixth quantity, and update the fourth quantity using the quotient; The sending unit is also used to send a notification message to each business board, the notification message including the updated fourth quantity, so that each business board converts the corresponding current rate value according to the updated fourth quantity, and uses the current rate value to update the initial rate value, and the current rate value is the token generation rate when the business board is out of the card slot.
9. A communication device, characterized in that: The device is applied to a service board, the service board includes a member port belonging to an aggregation port, and the device includes: An acquisition unit, used to acquire the flow rate of the member port within a preset time; A sending unit, configured to send a service token request message to a main control board, wherein the service token request message includes the traffic rate of the member port belonging to the aggregation port included in the service board, so that the main control board calculates a second number of service tokens allocated to the service board according to a built-in token bucket having a first number of current tokens and the traffic rate of the member port; A receiving unit, configured to receive a service token response message sent by the main control board, wherein the service token response message includes the second number of service tokens; a processing unit, configured to process the received service message according to the second number of service tokens and a preset token consumption rate; The sending unit is further used to send an initial token request message to the main control board, and the initial token request message is used to enable the main control board to calculate a fourth number of initial tokens allocated to the business board according to the third number of initial tokens in the token bucket; The receiving unit is further used to receive an initial token response message sent by the main control board, wherein the initial token request message includes the fourth number of initial tokens; The device further includes: a conversion unit, configured to convert a corresponding initial rate value according to the fourth quantity, wherein the initial rate value is a token generation rate after the service board is separated from the card slot; The receiving unit is further used to receive a notification message sent by the main control board, wherein the notification message includes the updated fourth quantity; The conversion unit is further used to convert the corresponding current rate value according to the updated fourth quantity, and update the initial rate value using the current rate value, wherein the current rate value is the token generation rate after the service board is separated from the card slot; The main control board calculates the fourth number of initial tokens allocated to the service board according to the third number of initial tokens in the token bucket, which specifically includes: the main control board obtains the number of service boards where each member port belonging to the same aggregation port is located, and obtains the fifth number; the main control board calculates the quotient of the third number and the fifth number, and uses the quotient as the fourth number; Among them, the updated fourth quantity is obtained by the main control board through the following steps: when it is detected that the business board where the member port is located is inserted into or removed from the card slot, the main control board re-acquires the number of business boards where each member port belonging to the same aggregation port is located, and obtains the sixth quantity; the main control board calculates the quotient of the third quantity and the sixth quantity, and uses the quotient to update the fourth quantity.
Citation Information
Patent Citations
Speed-limiting method and device for users
CN102594671A
Service message processing method and apparatus
CN108769016A