Message sending method, device, equipment and storage medium

By introducing a message cache queue into the CAR mechanism and setting the message withdrawal rate, the problem of unsatisfactory speed limit in the CAR mechanism in the case of network traffic accidents is solved, and a more uniform message transmission rate and a more ideal speed limit effect are achieved.

CN115987901BActive Publication Date: 2025-03-28CHINA MOBILE COMM GRP TIBET CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111201661.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-14
Publication Date
2025-03-28
Estimated Expiration
2041-10-14

AI Technical Summary

Technical Problem

The existing CAR mechanism has poor speed limiting effect in network traffic emergencies. The CBS/PBS settings of the token bucket are difficult to meet different network scenarios, resulting in the speed limit not meeting the standard or the token overflow and waste.

Method used

After receiving the message to be sent, the message to be sent is stored through the message cache queue, and the message to be sent is retrieved according to the set message withdrawal rate is less than or equal to the peak information rate of the token bucket, and then the flow control is performed through the token bucket to ensure that the burst flow is not greater than the peak information rate.

Benefits of technology

The correlation between the CBS/PBS setting value of the token bucket and the traffic speed limit is reduced, so that the average rate of message transmission in a short period of time is relatively uniform, and the speed limit effect is ideal, while avoiding token overflow and waste caused by burst traffic.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115987901B_ABST
    Figure CN115987901B_ABST
Patent Text Reader

Abstract

The present invention discloses a message sending method, device, equipment and storage medium, which belongs to the field of smart home. The message sending method includes: if a message to be sent is received, then determining the token bucket corresponding to the message to be sent; wherein the token bucket has a corresponding message cache queue; storing the message to be sent in the message cache queue; according to the set message extraction rate, taking out the message to be sent in the message cache queue to obtain a sendable message, wherein the set message extraction rate is less than or equal to the peak information rate of the token bucket; if the length of the sendable message is less than or equal to the number of tokens in the token bucket, then sending the sendable message. The present invention not only makes the average rate of message sending of the CAR mechanism in a short time more uniform, and the speed limit effect is more ideal, but also there will be no token overflow waste for burst traffic, resulting in speed limit failure.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a message sending method, device, equipment and medium. Background Art

[0002] In the Committed Access Rate (CAR) mechanism, since the traffic bursts of the network are different, the initial value of the token bucket size CBS (Committed Burst Size) and / or PBS (Peak Burst Size) is difficult to meet different network scenarios. If the CBS / PBS is set too large, the speed limit effect will be too large; if the CBS / PBS is set too small, the traffic burst will cause invalid overflow of the token and cause the speed limit to fail to meet the standard, that is, the existing CAR mechanism has the problem of unsatisfactory speed limit. Summary of the invention

[0003] The main purpose of the present invention is to provide a message sending method, device, equipment and storage medium, aiming to solve the problem of unsatisfactory speed limit in the existing CAR mechanism.

[0004] To achieve the above object, in a first aspect, the present invention provides a message sending method, comprising:

[0005] If a message to be sent is received, a token bucket corresponding to the message to be sent is determined; wherein the token bucket has a corresponding message cache queue;

[0006] Storing the message to be sent in the message cache queue;

[0007] According to a set message extraction rate, the to-be-sent message in the message cache queue is extracted to obtain a sendable message, wherein the set message extraction rate is less than or equal to the peak information rate of the token bucket;

[0008] If the length of the transmittable message is less than or equal to the number of tokens in the token bucket, the transmittable message is transmitted.

[0009] In one embodiment, before taking out the to-be-sent messages in the message cache queue according to the set message taking-out rate to obtain the sendable messages, the method further includes:

[0010] Detecting an average message length of at least one of the messages to be sent in the message cache queue;

[0011] Obtaining a message fetching frequency according to the average message length and the peak information rate;

[0012] The set message fetching rate is obtained according to the message fetching frequency.

[0013] In one embodiment, before obtaining the average message length of at least one message to be sent in the message cache queue, the method further includes:

[0014] Detecting the current usage length and current number of messages of the message buffer queue;

[0015] The ratio of the current message usage length to the current message number is used as the average message length.

[0016] In one embodiment, the committed burst size CBS of the token bucket satisfies: CBS=PIR*n, and the peak burst size PBS satisfies: PBS=n*PIR;

[0017] Wherein, PIR is the peak information rate, n is the duration in seconds, and n≤1.5s.

[0018] In one embodiment, n=0.001 s.

[0019] In one embodiment, if a message to be sent is received, determining a token bucket corresponding to the message to be sent includes:

[0020] If a message to be sent is received, extracting the target address of the message to be sent;

[0021] According to the target address, the token bucket corresponding to the target address is determined.

[0022] In a second aspect, the present invention further provides a message sending device, comprising:

[0023] A queue determination module, for determining a token bucket corresponding to a message to be sent if a message to be sent is received; wherein the token bucket has a corresponding message cache queue;

[0024] A message storage module, used for storing the message to be sent in the message cache queue;

[0025] A message fetching module, used for fetching the to-be-sent messages in the message cache queue according to a set message fetching rate to obtain sendable messages, wherein the set message fetching rate is less than or equal to the peak information rate of the token bucket;

[0026] The message sending module is used to send the sendable message if the length of the sendable message is less than or equal to the number of tokens in the token bucket.

[0027] In one embodiment, it further includes:

[0028] A detection module, used to detect an average message length of at least one message to be sent in the message cache queue;

[0029] A frequency determination module, used to obtain a message fetching frequency according to the average message length and the peak information rate;

[0030] The rate determination module is used to obtain the set message extraction rate according to the message extraction frequency.

[0031] In a third aspect, the present invention further provides a message sending device, comprising: a memory, a processor, and a message sending program stored in the memory and executable on the processor, wherein the message sending program is configured to implement the steps of the message sending method as described above.

[0032] In a fourth aspect, the present invention further provides a computer-readable storage medium, on which a message sending program is stored, and when the message sending program is executed by a processor, the steps of the message sending method as described above are implemented.

[0033] The present invention provides a message sending method, device, equipment and storage medium. The message sending method stores the message to be sent in the message cache queue corresponding to the token bucket after receiving the message to be sent and determining the token bucket, and then sequentially takes out the message to be sent at the message extraction rate, and then executes the CAR message sending mechanism. Therefore, before executing the CAR mechanism, the present invention stores the message to be sent through a message cache queue, and then takes out the message to be sent through a set message extraction rate not greater than the peak information rate, and then performs flow control through the token bucket, so that the burst flow of each token bucket is additionally limited by setting the message extraction rate, ensuring that the burst flow is not greater than the peak information rate, thereby reducing the correlation between the specific setting value of the CBS / PBS of the token bucket and the flow rate limit, not only making the average rate of message sending of the CAR mechanism in a short time more uniform, the speed limit effect is more ideal, and there will be no token overflow waste for burst flow, resulting in speed limit failure. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] Figure 1 It is a structural schematic diagram of a message sending device of the present invention;

[0035] Figure 2 A schematic diagram of a flow chart of a first embodiment of a message sending method of the present invention;

[0036] Figure 3 This is a flow chart of a second embodiment of a message sending method of the present invention;

[0037] Figure 4 It is a module schematic diagram of the message sending device of the present invention.

[0038] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0039] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0040] In the related technology, the CAR (Committed Access Rate) mechanism can monitor the rate of traffic entering the network to limit the traffic and improve the efficiency of network resource use, thereby ensuring that limited network resources provide better network services.

[0041] The CAR (Committed Access Rate) mechanism is implemented through token buckets. A token bucket can be seen as a container for storing tokens, with a preset capacity. The system places tokens into the bucket at a given rate, and when the bucket is full, the excess tokens overflow.

[0042] Among them, the token bucket algorithm has three modes: single-rate single bucket, single-rate double bucket and double-rate double bucket.

[0043] The following takes dual-speed dual-bucket as an example for specific description.

[0044] The token buckets include C bucket and P bucket. C bucket and P bucket put tokens into two token buckets at their respective fixed rates CIP (Committed Information Rate) and PIR (Peak Information Rate).

[0045] The CIR indicates the rate at which tokens are placed in bucket C, that is, the average rate at which bucket C allows packets to be transmitted or forwarded.

[0046] PIR is the rate at which tokens are placed in the P bucket, that is, the peak rate at which the P bucket allows packets to be transmitted or forwarded. The PIR value should be greater than the CIR (there may be enough service cards but not enough access cards).

[0047] PBS (Peak Burst Size): Peak burst size, which indicates the capacity of the P bucket, that is, the peak burst flow that the P bucket can pass instantly.

[0048] CBS (Committed Burst Size): Committed burst size, which indicates the capacity of bucket C, that is, the committed burst traffic that bucket C can pass instantly.

[0049] In the dual-speed and dual-bucket mode, the system injects tokens into bucket P at the PIR rate and into bucket C at the CIR rate. If the total number of available tokens (Tp) in bucket P is less than PBS, the number of tokens in bucket P increases. If the total number of available tokens (Tc) in bucket C is less than CBS, the number of tokens in bucket C increases.

[0050] For an arriving packet (packet size is B), if Tp < B, the packet is marked red, and neither Tc nor Tp decreases. If Tc < B ≤ Tp, the packet is marked yellow, and Tp decreases by B while Tc remains unchanged. If B ≤ Tc, the packet is marked green, and both Tp and Tc decrease by B.

[0051] It is not difficult to see that due to the different traffic burst situations of the network, it is very difficult for the initial values of CBS or PBS of the token bucket to meet different network scenarios. If set too large, the speed limit effect will be too large; if set too small, the traffic burst will cause invalid overflow of tokens, resulting in the speed limit not being met. At this time, the unmet speed limit will cause the burst traffic of one user within a certain period of time in the same packet sending device to affect the packet sending of other users.

[0052] Therefore, this application provides a packet sending method. Before executing the CAR mechanism, the packets to be sent are stored in a packet cache queue, and then the packets to be sent are taken out at a set packet extraction rate not greater than the peak information rate and then passed through the token bucket for traffic control. Thus, the burst traffic of each token bucket is additionally limited by setting the packet extraction rate, ensuring that the burst traffic is not greater than the peak information rate, and further reducing the correlation between the specific setting values of CBS / PBS of the token bucket and the traffic speed limit. This not only makes the average rate of packet sending by the CAR mechanism more uniform in a short time and the speed limit effect more ideal, but also there will be no situation where token overflow waste leads to the unmet speed limit for burst traffic.

[0053] Refer to Figure 1 , Figure 1 which is a schematic structural diagram of a packet sending device for the hardware operating environment involved in the embodiment solution of this application.

[0054] As shown in Figure 1As shown, the router may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (WIreless-FIdelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM) memory, or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0055] Those skilled in the art will understand that Figure 1 The structure shown in the figure does not constitute a limitation on the message sending device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0056] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a data storage module, a Bluetooth communication module, a user interface module and a message sending program.

[0057] exist Figure 1 In the message sending device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the message sending device of the present invention can be set in the message sending device, and the message sending device calls the message sending program stored in the memory 1005 through the processor 1001, and executes the message sending method provided in the embodiment of the present application.

[0058] Based on the above hardware device but not limited to the above hardware device, a first embodiment of a message sending method of the present application is proposed. Figure 2 , Figure 2 This is a flow chart of the first embodiment of the message sending method of the present application.

[0059] In this embodiment, the method includes:

[0060] Step S101: If a message to be sent is received, a token bucket corresponding to the message to be sent is determined; wherein the token bucket has a corresponding message cache queue.

[0061] In this embodiment, the execution subject of the message sending method is a message sending device, such as a gateway. When the gateway receives the message to be sent sent by the sender, it needs to send the message to be sent to the receiving end. And it can be understood that in the gateway, for any receiving end, a corresponding token bucket is configured. Each receiving end implements traffic speed limit through the corresponding token bucket C bucket and P pass.

[0062] In this embodiment, a plurality of cache queues are configured on the network, and each receiving end is mapped and allocated with an independent cache queue, so that each receiving end has a corresponding token bucket and message cache queue.

[0063] As an embodiment, step S101 includes:

[0064] Step A10: If a message to be sent is received, extract the target address of the message to be sent.

[0065] The corresponding target IP address is stored in the message header of the message to be sent, so that the target address can be extracted to determine the receiving end of the message to be sent.

[0066] Step A20: Determine the token bucket corresponding to the target address according to the target address.

[0067] Each receiving end in the gateway is allocated with a corresponding token bucket, so that after the destination address is determined, the token bucket of the message to be sent can be determined from the multiple token buckets configured in the gateway, that is, the CARID of the message to be sent can be determined, and then the message cache queue corresponding to the message to be sent can be determined from the multiple message cache queues through the CARID and message cache queue mapping table stored in the gateway.

[0068] Step S102: storing the message to be sent in the message buffer queue.

[0069] After determining the message cache queue corresponding to the message to be sent, the message to be sent is stored in the message cache queue.

[0070] It can be understood that in this step, for multiple service messages that need to be sent to a certain receiving end, the gateway stores the service messages received at irregular intervals in a message cache queue corresponding to the receiving end in the order in which they are received.

[0071] Step S103: According to the set message extraction rate, extract the to-be-sent messages in the message buffer queue to obtain sendable messages, where the set message extraction rate is less than or equal to the peak information rate of the token bucket.

[0072] Specifically, a scheduler is configured in the gateway, and the scheduler is used to periodically extract messages in the message buffer queue according to the set message extraction rate.

[0073] Among them, the set message rate is less than or equal to the peak information rate of the token bucket, so that the service messages received at irregular intervals in the message buffer queue are periodically extracted according to the set message rate, and then sent out through the existing CAR mechanism.

[0074] Step S104: If the length of the sendable message is less than or equal to the number of tokens in the token bucket, send the sendable message.

[0075] This step is the existing CAR mechanism. Specifically, for the arriving message (message size is B), if Tp < B, the message is marked as red, and neither Tc nor Tp decreases, and the message is not sent. If Tc < B ≤ Tp, the message is marked as yellow, and Tp decreases by B, Tc does not decrease, and the message is sent. If B ≤ Tc, the message is marked as green, and both Tp and Tc decrease by B, and the message is sent. Since the CAR mechanism is an existing technology, it will not be elaborated here.

[0076] In this embodiment, a message buffer queue is used to store the to-be-sent messages, and then the to-be-sent messages are periodically extracted through the set message extraction rate that is not greater than the peak information rate, and then traffic control is performed via the token bucket. Thus, the burst traffic of each token bucket is additionally limited by the set message extraction rate to ensure that the burst traffic is not greater than the peak information rate, and further reduce the correlation between the specific setting value of the CBS / PBS of the token bucket and the traffic speed limit. This not only makes the average rate of message sending by the CAR mechanism relatively uniform in a short time and the speed limit effect is relatively ideal, but also there will be no situation where token overflow and waste lead to non-compliance with the speed limit for burst traffic.

[0077] It can be understood that the set message extraction rate can be a fixed preset value, and this fixed preset value is less than or equal to the peak information rate, so that the scheduler can evenly extract the to-be-sent messages from the message buffer queue, or the set message extraction rate can also be updated according to the specific situation of the messages in the queue. Specifically, based on the above embodiment, a second embodiment of the message sending method of the present application is proposed. Refer to Figure 3 , Figure 3 is the flow schematic diagram of the second embodiment of the message sending method of the present application.

[0078] In this embodiment, the packet extraction rate is set to be determined by the following method:

[0079] Step S201: Detect an average message length of at least one message to be sent in the message buffer queue.

[0080] The gateway stores all service messages received at irregular intervals in the message cache queue, so that the message cache queue stores at least one message to be sent. The at least one message to be sent has a corresponding average message length.

[0081] It is understandable that for any message cache queue, since the messages to be sent are taken out regularly, and new messages to be sent are received irregularly and stored in, the average message length in any message cache queue changes in real time.

[0082] Step S202: Obtain a message fetching frequency according to the average message length and the peak information rate.

[0083] The peak information rate PIR is a register parameter in the CAR table corresponding to the CARID and can be directly obtained. The average message length can be obtained according to the following steps:

[0084] Step B10: Detect the current usage length of the message buffer queue and the current number of messages.

[0085] Step B20: Obtain the average message length according to the current message usage length and the current number of messages.

[0086] The gateway monitors the current usage length and current number of messages in the message buffer queue in real time, and then uses the ratio of the two: current usage length / current number of messages as the average message length.

[0087] After obtaining the peak information rate PIR and the average message length, a ratio of the peak information rate PIR / average message length can be used as the message fetching frequency, in units of 1 / s.

[0088] The caller can regularly fetch the messages to be sent based on the message fetching frequency.

[0089] Step S203: Obtain the set message fetching rate according to the message fetching frequency.

[0090] It is understandable that for the same type of business messages, they are divided into segments when sent, so their message size is relatively fixed. At this time, the set message retrieval rate can be calculated by multiplying the segment length of the business message and the message retrieval frequency.

[0091] It is worth mentioning that steps S201 to S203 may be performed before step S101, or may be performed before step S103, and this embodiment does not limit this.

[0092] In this embodiment, the message retrieval rate is updated in real time according to the current average message length in the message cache queue, so that the message retrieval rate is more consistent with the actual situation in the cache queue, thereby making the average rate of messages passing through CAR in unit time very accurate.

[0093] In the prior art, the initial value of the CBS or PBS of the token bucket is currently set by default to accommodate messages with a passing rate of about 1.5 seconds to 2 seconds: 1.5~2.0 (seconds) × PIR, so the average speed limit effect in a short period of time will be larger, because the token bucket has an initial value, and the tokens that initialize the token bucket are additional tokens outside the average rate filling tokens. It can be understood that by setting the message retrieval rate, the burst flow of each token bucket is additionally limited to ensure that the burst flow is not greater than the peak information rate, thereby reducing the correlation between the specific setting value of the CBS / PBS of the token bucket and the flow speed limit. Therefore, the third embodiment of the message sending method of the present application can be proposed.

[0094] In this embodiment, the committed burst size CBS of the token bucket satisfies: CBS=PIR*n, and the peak burst size PBS satisfies: PBS=n*PIR.

[0095] Wherein, n is the duration in seconds, and n≤1.5s.

[0096] Since the correlation between the specific setting value of CBS / PBS of the token bucket and the traffic speed limit is reduced in this embodiment, the initial value of CBS or PBS can be set to be relatively small, so that there will be no token overflow waste and speed limit failure during burst traffic.

[0097] In one embodiment, n=0.001 s.

[0098] Specifically, CBS or PBS is set to a rate message that only requires 1 millisecond to pass.

[0099] Based on the same inventive concept, refer to Figure 4 , the present application also proposes a message sending device, comprising:

[0100] A queue determination module, for determining a token bucket corresponding to a message to be sent if a message to be sent is received; wherein the token bucket has a corresponding message cache queue;

[0101] A message storage module, used for storing the message to be sent in the message cache queue;

[0102] A message fetching module, used for fetching the to-be-sent messages in the message cache queue according to a set message fetching rate to obtain sendable messages, wherein the set message fetching rate is less than or equal to the peak information rate of the token bucket;

[0103] The message sending module is used to send the sendable message if the length of the sendable message is less than or equal to the number of tokens in the token bucket.

[0104] In one embodiment, the message sending device further includes:

[0105] A detection module, used to detect an average message length of at least one message to be sent in the message cache queue;

[0106] A frequency determination module, used to obtain a message fetching frequency according to the average message length and the peak information rate;

[0107] The rate determination module is used to obtain the set message extraction rate according to the message extraction frequency.

[0108] In one embodiment, the message sending device further includes

[0109] A queue detection module, used to detect the current usage length and current number of messages of the message buffer queue;

[0110] The length calculation module is used to obtain the average message length according to the current message usage length and the current message number.

[0111] In one embodiment, the committed burst size CBS of the token bucket satisfies: CBS=PIR*n, and the peak burst size PBS satisfies: PBS=n*PIR;

[0112] Wherein, n is the duration in seconds, and n≤1.5s.

[0113] In one embodiment, n=0.001 s.

[0114] In one embodiment, the queue determination module includes:

[0115] An address determination unit, configured to extract a target address of a message to be sent if a message to be sent is received;

[0116] The token bucket determining unit is used to determine the token bucket corresponding to the target address according to the target address.

[0117] In this embodiment, other embodiments and implementations of the message sending device can refer to the above method embodiments and will not be described in detail here.

[0118] In addition, an embodiment of the present invention further proposes a computer storage medium, on which a message sending program is stored, and when the message sending program is executed by a processor, the steps of the message sending method as described above are implemented. Therefore, it will not be described in detail here. In addition, the description of the beneficial effects of adopting the same method will not be described in detail. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, the program instructions can be deployed to be executed on one computing device, or on multiple computing devices located at one location, or on multiple computing devices distributed at multiple locations and interconnected by a communication network.

[0119] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the above-mentioned storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0120] It should also be noted that the device embodiments described above are merely 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 scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.

[0121] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present invention can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present invention, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform the methods of various embodiments of the present invention.

[0122] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A message sending method, characterized in that: include: If a message to be sent is received, a token bucket corresponding to the message to be sent is determined; wherein the token bucket has a corresponding message cache queue; Storing the message to be sent in the message cache queue; According to a set message extraction rate, the to-be-sent message in the message cache queue is extracted to obtain a sendable message, wherein the set message extraction rate is less than or equal to the peak information rate of the token bucket; If the length of the transmittable message is less than or equal to the number of tokens in the token bucket, then the transmittable message is transmitted; Before taking out the to-be-sent messages in the message cache queue according to the set message taking-out rate to obtain the sendable messages, the method further comprises: Detecting an average message length of at least one of the messages to be sent in the message cache queue; Obtaining a message fetching frequency according to the average message length and the peak information rate; The set message fetching rate is obtained according to the message fetching frequency.

2. The message sending method according to claim 1, characterized in that: Before detecting the average message length of at least one message to be sent in the message cache queue, the method further includes: Detecting the current usage length and current number of messages of the message buffer queue; The average message length is obtained according to the current message usage length and the current message number.

3. The message sending method according to claim 1 or 2, characterized in that: The committed burst size CBS of the token bucket satisfies: CBS=PIR*n, and the peak burst size PBS satisfies: PBS=n*PIR; Wherein, PIR is the peak information rate, n is the duration in seconds, and n≤1.5s.

4. The message sending method according to claim 3, characterized in that: n=0.001s.

5. The message sending method according to claim 1, characterized in that: If a message to be sent is received, determining a token bucket corresponding to the message to be sent includes: If a message to be sent is received, extracting the target address of the message to be sent; According to the target address, the token bucket corresponding to the target address is determined.

6. A message sending device, characterized in that: include: A queue determination module, for determining a token bucket corresponding to a message to be sent if a message to be sent is received; wherein the token bucket has a corresponding message cache queue; A message storage module, used for storing the message to be sent in the message cache queue; A message fetching module, used for fetching the to-be-sent messages in the message cache queue according to a set message fetching rate to obtain sendable messages, wherein the set message fetching rate is less than or equal to the peak information rate of the token bucket; A message sending module, configured to send the sendable message if the length of the sendable message is less than or equal to the number of tokens in the token bucket; A detection module, used to detect an average message length of at least one of the messages to be sent in the message cache queue; A frequency determination module, used to obtain a message fetching frequency according to the average message length and the peak information rate; The rate determination module is used to obtain the set message extraction rate according to the message extraction frequency.

7. A message sending device, characterized in that: include: A memory, a processor, and a message sending program stored in the memory and executable on the processor, wherein the message sending program is configured to implement the message sending method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a message sending program, and when the message sending program is executed by the processor, the message sending method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Flow control method and device

    CN105897610A

  • Traffic control method and related equipment

    CN108768873A