Method, device, equipment and readable storage medium for automatically adjusting message length during speed limit

By automatically adjusting the length of the message, the problem that the message speed limit method in the prior art cannot be adjusted according to the length change is solved, and the accuracy of the traffic shaping results and the speed limit accuracy are achieved.

CN115834490BActive Publication Date: 2025-08-26SUZHOU CENTEC COMM CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111089293.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-16
Publication Date
2025-08-26
Estimated Expiration
2041-09-16

AI Technical Summary

Technical Problem

In the prior art, the message speed limit method cannot be automatically adjusted according to the change in the message length, resulting in inconsistent editing lengths of the same type of messages, resulting in inaccurate traffic shaping results.

Method used

By obtaining the length adjustment value of the first message and adjusting the length of the next message according to the value, using the inbound processing engine module and the traffic management module to classify and record the packets, the packet length can be automatically adjusted.

Benefits of technology

Reduces configuration complexity and ensures the accuracy of traffic shaping results. Even if the length of the packet of the same type changes, it can meet the speed limit accuracy requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115834490B_ABST
    Figure CN115834490B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and application for automatically adjusting message length during rate limiting. The method comprises the following steps: obtaining a first message and determining whether to perform editing processing; if so, recording a length adjustment value of the first message, and adjusting the length of a second message based on the length adjustment value, wherein the second message is the next message to be sent from the queue in which the first message is located. According to the method of automatically adjusting message length during rate limiting of the present invention, the length of the next message during traffic shaping can be automatically adjusted based on the current message length, thereby preventing the actual message sending rate from exceeding the preset sending rate during the traffic shaping process, thereby preventing inaccurate traffic shaping results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communications, and in particular to a method, device, equipment and readable storage medium for automatically adjusting message length when speed is limited. Background Art

[0002] QoS involves many aspects, including traffic classification and marking, congestion management, congestion avoidance, traffic policing and traffic shaping. General traffic shaping can shape irregular traffic or traffic that does not conform to predetermined traffic characteristics to facilitate bandwidth matching between upstream and downstream networks.

[0003] Existing technology classifies packets by presetting adjustment values ​​for different types of packets. The device then adjusts the initial rate limit based on the packet type and applies rate limiting based on the adjusted rate limit. This method is complex to configure and can only set a fixed adjustment value for packets of the same type. This can lead to inaccurate shaping results if the edited lengths of each packet of the same type are inconsistent.

[0004] The information disclosed in this background technology section is only intended to enhance understanding of the overall background of the invention and should not be regarded as an admission or any form of suggestion that the information constitutes the prior art already known to a person skilled in the art. Summary of the Invention

[0005] The purpose of the present invention is to provide a method, device, equipment and readable storage medium for automatically adjusting the length of a message when limiting the speed, which can automatically adjust the length of the next message during traffic shaping according to the current message length, thereby avoiding the actual sending rate of the message during the traffic shaping process being greater than the preset sending rate, thereby causing inaccurate traffic shaping results.

[0006] To achieve the above objectives, an embodiment of the present invention provides a method for automatically adjusting message length when rate limiting is in effect.

[0007] In one or more embodiments of the present invention, a first message is obtained and a determination is made as to whether editing is to be performed; if so, a length adjustment value of the first message is recorded, and the length of a second message is adjusted according to the length adjustment value, wherein the second message is the next message to be sent by the queue that sent the first message after completing sending the first message.

[0008] In one or more embodiments of the present invention, before determining whether to edit the first message, the method further includes: classifying the message according to priority and sending it to the corresponding priority queue; when the first message leaves the priority queue, performing traffic shaping on the first message.

[0009] In one or more embodiments of the present invention, recording the length adjustment value of the first message specifically includes: storing the length adjustment value of the first message in a recording space of a priority queue corresponding to the first message.

[0010] In one or more embodiments of the present invention, adjusting the length of the next message according to the length adjustment value specifically includes: before performing traffic shaping on the second message, reading the length adjustment value from the record space of the priority queue corresponding to the first message to adjust the length of the second message.

[0011] In one or more embodiments of the present invention, the priority is the QoS priority carried by the current message.

[0012] In one or more embodiments of the present invention, if the length of the second message is adjusted to reduce the length of the second message, the length of the second message is adjusted to not exceed the length of the second message.

[0013] In another aspect of the present invention, a device for automatically adjusting message length when rate limiting is implemented is provided, which includes an inbound processing engine module, an outbound processing engine module, and a traffic management module.

[0014] The inbound processing engine module is used to obtain the first message and determine whether to perform editing processing.

[0015] The outgoing processing engine module is used to record the length adjustment value of the first message and adjust the length of the second message according to the length adjustment value, wherein the second message is the next message to be sent by the queue that sends the first message after completing sending the first message.

[0016] The traffic management module is used to perform traffic shaping on the first message when the first message leaves the priority queue.

[0017] In one or more embodiments of the present invention, the inbound processing engine module is further configured to classify the messages according to their priorities and send them to corresponding priority queues before determining whether to perform editing processing on the first message.

[0018] In one or more embodiments of the present invention, the traffic management module is further configured to record the length adjustment value of the first message, specifically including: storing the length adjustment value of the first message in a record space of a priority queue corresponding to the first message.

[0019] In one or more embodiments of the present invention, the traffic management module is also used to adjust the length of the next message according to the length adjustment value, specifically including: before performing traffic shaping on the second message, reading the length adjustment value from the record space of the priority queue corresponding to the first message to adjust the length of the second message.

[0020] In one or more embodiments of the present invention, if the length of the second message is adjusted to reduce the length of the second message, the length of the second message is adjusted to not exceed the length of the second message.

[0021] In another aspect of the present invention, an electronic device is provided, comprising: at least one processor; and a memory, wherein the memory stores instructions, which, when executed by the at least one processor, enable the at least one processor to perform the method of automatically adjusting the message length during speed limiting as described above.

[0022] In another aspect of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for automatically adjusting the message length when limiting the speed are implemented.

[0023] Compared with the prior art, the method, apparatus, device and readable storage medium for automatically adjusting the message length during speed limiting according to the embodiments of the present invention can record the length adjustment value of the message and feed it back to the next message, thereby realizing the recording and use of the length change after the message is edited, reducing the configuration complexity; the chip automatically adjusts to the next message according to the change in message length, making the speed limit more accurate. Even different messages of the same type have different length changes after editing. Automatically adjusting the message length can meet the accuracy requirements of the speed limit. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 is a flow chart of a method for automatically adjusting message length when limiting speed according to an embodiment of the present invention;

[0025] Figure 2 This is an example diagram of traffic shaping for a method of automatically adjusting message length during rate limiting according to an embodiment of the present invention;

[0026] Figure 3 This is an example diagram of message editing in a method for automatically adjusting message length when rate limiting according to an embodiment of the present invention;

[0027] Figure 4 2 is a structural diagram of a device for automatically adjusting message length when limiting speed according to an embodiment of the present invention;

[0028] Figure 54 is a hardware structure diagram of a device for calculating automatic adjustment of message length when limiting speed according to an embodiment of the present invention. DETAILED DESCRIPTION

[0029] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings, but it should be understood that the protection scope of the present invention is not limited by the specific embodiments.

[0030] Unless expressly stated otherwise, throughout the specification and claims, the term "comprise" or variations such as "include" or "comprising", etc., will be understood to include the stated elements or components but not to exclude other elements or other components.

[0031] The technical solutions provided by various embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0032] Example 1

[0033] like Figure 1 As shown, a method for automatically adjusting message length when limiting speed in an embodiment of the present invention is introduced, and the method includes the following steps.

[0034] In step S101, a first message is obtained and it is determined whether to perform editing processing.

[0035] Specifically, when a message is edited, the message length must be adjusted based on the message's changes to ensure that the actual rate of message transmission does not exceed the preset rate. Adjusting the message length also affects the number of messages that can pass through per second. When a message is not edited, the actual transmission rate will not exceed the preset rate, and the message can be sent normally.

[0036] In step S102, the length adjustment value of the first message is recorded, and the length of the second message is adjusted according to the length adjustment value.

[0037] When a traffic-shaped packet reaches the outbound processing engine module, it undergoes editing, such as adding or removing a VLAN layer. The length adjustment value of the first packet is stored in the record space of the priority queue corresponding to the first packet. This record space is used to store the length adjustment value of the packet. Before traffic shaping is performed on the second packet, the length adjustment value is read from the record space of the priority queue corresponding to the first packet. The length of the second packet is adjusted based on the length adjustment value. The second packet is the next packet in the priority queue after the first packet.

[0038] For example, if 4 bytes are added to the first message during editing, the next message will be added with 4 bytes before traffic shaping, and the second message will be sent after length adjustment. Conversely, if 4 bytes are reduced during editing, the next message will be reduced by the corresponding number of bytes before traffic shaping, and the second message will be sent after length adjustment. If the length of the second message is adjusted to reduce the length of the second message, the length adjustment of the second message shall not exceed the length of the second message.

[0039] When editing a message after traffic shaping, this embodiment can automatically reflect the length change of each message after editing to the next message, so that the traffic shaping result can be accurate without configuring an adjustment value.

[0040] Example 2

[0041] like Figures 2 to 3 As shown, a method for automatically adjusting message length when limiting speed in another embodiment of the present invention is introduced, and the method includes the following steps.

[0042] In step S201 , the messages are classified according to their priorities and sent to corresponding priority queues; when the first message leaves the priority queue, traffic shaping is performed on the first message.

[0043] Messages are classified according to their QoS priorities and sent to the corresponding priority queues. Messages of the same type should be assigned the same priority. Depending on actual needs, several different message types can be assigned the same priority. For example, the most important messages in practical applications, such as Bridge Protocol Data Unit (BPDU) messages and routing protocol messages, can be assigned high priority, while ordinary broadcast messages and unknown messages can be assigned low priority.

[0044] When the first message leaves the priority queue, traffic shaping is performed on the first message. In this embodiment, a token bucket algorithm is used to perform traffic shaping on the message. Tokens are placed into the token bucket according to a pre-set queue shaping rate. If there are sufficient tokens in the token bucket to send the message, the message is sent directly, and the token count is reduced accordingly as the message is sent. If there are insufficient tokens in the token bucket, the message is placed into the cache queue. If the cache queue is full when the message is placed into the cache queue, the message is discarded. When there are messages in the cache queue, the system periodically removes messages from the cache queue for transmission. Each transmission is compared with the number of tokens in the token bucket until the number of tokens in the token bucket is reduced to a level that no more messages in the cache queue can be sent, or all messages in the cache queue have been sent.

[0045] Communication chips often require traffic shaping for packets to be forwarded. Traffic shaping limits the rate and volume of packets sent from the chip, ensuring a more even outbound transmission. When the inbound rate of a downstream device is lower than the outbound rate of the upstream device or when traffic bursts occur, traffic congestion may occur at the downstream device's inbound interface. In this case, you can configure traffic shaping on the outbound interface of the upstream device to smooth out the irregular upstream traffic flow and output a more even flow. This means that packets that would otherwise be discarded are buffered and, when the token bucket has sufficient tokens, these buffered packets are evenly transmitted. This alleviates congestion on the downstream device.

[0046] Specifically, at least one cache unit for traffic shaping is configured in the communication chip, and each cache unit is assigned a token bucket. The token bucket stores tokens used to instruct the communication chip to forward messages. The cache unit periodically replenishes tokens for the token bucket. The communication chip puts the message to be forwarded into the corresponding cache unit. When the number of tokens in the token bucket of the cache unit is greater than or equal to the number of bytes of the data to be forwarded, the message to be forwarded is sent. At the same time, the tokens in the token bucket are deducted, and the number of tokens deducted is the number of bytes of the message to be forwarded; when the number of tokens in the token bucket is less than the number of bytes of the message to be forwarded, the token bucket is replenished until the number of tokens is greater than or equal to the number of bytes of the message to be forwarded before sending, or the message to be forwarded is discarded.

[0047] In step S202, a first message is obtained and it is determined whether to perform editing processing.

[0048] In step S203, the length adjustment value of the first message is recorded, and the length of the second message is adjusted according to the length adjustment value.

[0049] If the outgoing processing engine module performs editing, for example, the message length of message 1 is increased and the message length of message 4 is reduced, the changed lengths are recorded in the corresponding queue record space.

[0050] Taking message 1 as an example, the preset rate of port traffic shaping is 512Mbps (i.e., 512Mbit data is transmitted in 1s, or 64Mbyte data is transmitted in 1s), and the initial size of message 1 is 64Bytes, which means that the number of messages allowed to pass in 1s is 1048576 (i.e., 1024*1024). If the number of bits passing in 1s exceeds the rate limit, the message will not be allowed to pass. Figure 2 As shown, packet 1 enters priority queue 1 according to the priority field in the packet and waits for scheduling. Generally, each port has 8 queues. Traffic shaping is performed when leaving the queue. If the speed limit is passed, it will enter the outbound processing engine module for editing and processing, as shown in the following figure. Figure 3As shown in the figure, the packet length of packet 1 is increased by 4 bytes, and the changed length is recorded in the record space of priority queue 1. When packet 2 reaches the traffic shaping process, the packet length adjustment value of 4 bytes in the record space of packet 1 is first read, and the length of packet 2 is increased by 4 bytes before traffic shaping is performed.

[0051] During traffic shaping, a corresponding number of tokens must be taken out from the token bucket each time a message is sent. If the first message is edited after traffic shaping and the message length changes, the changed length is adjusted to the second message length before the second message is sent. When the second message is sent, the number of tokens taken out from the token bucket is the length of the second message plus the changed length of the first message. This avoids inaccurate traffic shaping caused by the editing of the first message.

[0052] like Figure 4 As shown, a specific implementation of the device for automatically adjusting the message length when limiting the speed of the present invention is introduced.

[0053] In the embodiment of the present invention, the apparatus for automatically adjusting the message length when rate limiting includes an inbound engine processing module 401 , a traffic management module 402 , and an outbound engine processing module 403 .

[0054] The inbound engine processing module 401 is configured to obtain a first message and determine whether to perform editing processing.

[0055] The outgoing engine processing module 403 is configured to record the length adjustment value of the first message and adjust the length of the second message according to the length adjustment value, wherein the second message is the next message to be sent in the queue where the first message is located.

[0056] The traffic management module 402 is configured to perform traffic shaping on the first message when the first message exits the priority queue.

[0057] The inbound engine processing module 401 is further configured to classify the message according to priority and send the message to the corresponding priority queue before determining whether to perform editing processing on the first message.

[0058] The traffic management module 402 is further configured to record the length adjustment value of the first message, specifically including: storing the length adjustment value of the first message in the recording space of the priority queue corresponding to the first message.

[0059] The traffic management module 402 is further configured to adjust the length of the next message according to the length adjustment value, specifically including: before performing traffic shaping on the second message, reading the length adjustment value from the record space of the priority queue corresponding to the first message to adjust the length of the second message.

[0060] Figure 5FIG. 5 shows a hardware structure diagram of a computing device 50 for automatically adjusting message length when limiting speed according to an embodiment of the present specification. Figure 5 As shown, the computing device 50 may include at least one processor 501, a memory 502 (e.g., a non-volatile memory), a storage 503, and a communication interface 504, and the at least one processor 501, the memory 502, the storage 503, and the communication interface 504 are connected together via a bus 505. The at least one processor 501 executes at least one computer-readable instruction stored or encoded in the storage 502.

[0061] It should be understood that the computer executable instructions stored in the memory 502, when executed, cause at least one processor 501 to perform the above combined operations in various embodiments of this specification. Figure 1-5 Describes the various operations and functions.

[0062] In the embodiments of the present specification, the computing device 50 may include, but is not limited to, a personal computer, a server computer, a workstation, a desktop computer, a laptop computer, a notebook computer, a mobile computing device, a smart phone, a tablet computer, a cellular phone, a personal digital assistant (PDA), a handheld device, a messaging device, a wearable computing device, a consumer electronic device, and the like.

[0063] According to one embodiment, a program product such as a machine-readable medium is provided. The machine-readable medium may have instructions (i.e., the above-mentioned elements implemented in software form), which, when executed by a machine, causes the machine to perform the above-mentioned combined embodiments of the present specification. Figure 1-5 Specifically, a system or device equipped with a readable storage medium can be provided, on which software program codes for implementing the functions of any of the above-mentioned embodiments are stored, and a computer or processor of the system or device can be enabled to read and execute the instructions stored in the readable storage medium.

[0064] According to the method, device, equipment and readable storage medium for automatically adjusting the message length when limiting the speed according to the embodiment of the present invention, it is possible to record and use the length change of the message after editing by recording the length adjustment value of the message and feeding it back to the next message, thereby reducing the configuration complexity; the chip automatically adjusts to the next message according to the change in message length, making the speed limit more accurate. Even if different messages of the same type have different length changes after editing, the automatic adjustment of the message length can meet the accuracy requirements of the speed limit.

[0065] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Thus, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0066] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0067] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0068] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0069] The foregoing descriptions of specific exemplary embodiments of the present invention are for purposes of illustration and description. These descriptions are not intended to limit the invention to the precise forms disclosed, and it is apparent that many variations and modifications are possible in light of the foregoing teachings. The exemplary embodiments have been selected and described for the purpose of explaining the specific principles of the invention and their practical application, thereby enabling those skilled in the art to realize and utilize a variety of exemplary embodiments of the invention and various options and modifications. The scope of the invention is intended to be defined by the claims and their equivalents.

Claims

1. A method for automatically adjusting message length when speed is limited, characterized in that: The method comprises: Get the first message and determine whether to edit it; if so, Record the length adjustment value of the first message and adjust the length of the second message according to the length adjustment value, wherein the second message is the next message to be sent by the queue that sends the first message after completing sending the first message; if the length of the second message is adjusted to reduce the length of the second message, the length adjustment of the second message does not exceed the length of the second message.

2. The method for automatically adjusting message length when limiting speed according to claim 1, characterized in that: Before determining whether to edit the first message, the method further includes: Classify the messages according to their priority and send them to the corresponding priority queues; When the first message leaves the priority queue, traffic shaping is performed on the first message.

3. The method for automatically adjusting message length when limiting speed according to claim 2, characterized in that: Recording the length adjustment value of the first message specifically includes: The length adjustment value of the first message is stored in the record space of the priority queue corresponding to the first message.

4. The method for automatically adjusting message length when limiting speed according to claim 3, characterized in that: Adjusting the length of the next message according to the length adjustment value specifically includes: Before performing traffic shaping on the second message, the length adjustment value is read from the record space of the priority queue corresponding to the first message to adjust the length of the second message.

5. The method for automatically adjusting message length when limiting speed according to claim 2, characterized in that: The priority is the QoS priority carried by the current message.

6. A device for automatically adjusting message length when speed is limited, characterized in that: The device comprises: an inbound processing engine module, configured to obtain the first message and determine whether to perform editing processing; An outbound processing engine module is used to record the length adjustment value of the first message and adjust the length of the second message according to the length adjustment value, wherein the second message is the next message to be sent by the queue that sends the first message after completing sending the first message; if the length of the second message is adjusted to reduce the length of the second message, the length adjustment of the second message does not exceed the length of the second message.

7. The device for automatically adjusting message length when limiting speed according to claim 6, characterized in that: The device further comprises: The traffic management module is used to perform traffic shaping on the first message when the first message leaves the priority queue.

8. An electronic device, characterized in that: include: at least one processor; as well as A memory storing instructions, wherein when the instructions are executed by the at least one processor, the at least one processor executes the method for automatically adjusting the message length when limiting the speed according to any one of claims 1 to 5.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the method for automatically adjusting message length during speed limiting according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Multicore processor based flow control method and multicore processor

    CN101834790A

  • Traffic shaping method and data processing equipment

    CN103888372A