Message sending method, equipment and computer program product
By dynamically adjusting the upper limit of the reporting rate to the CPU based on the impact rate and influence factors of the message flow in the network device, the problem of unsatisfactory effect of the existing speed regulation mechanism is solved, and more efficient network stability and normal service operation are achieved.
Patent Information
- Application Number
- CN202411973092.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-03-28
AI Technical Summary
The existing speed regulation mechanism is not ideal when dealing with busy CPU services, resulting in limited network stability improvement.
By implementing a message sending method in a network device, the intervention weight of each message stream is determined based on the impact rate, influence factor and weight of each message stream on the message transmission resource, and the upper limit of its reporting rate to the CPU is successively reduced.
It improves the effect of message reporting rate adjustment, effectively improves network stability, ensures the normal operation of key services, and improves users' network usage perception.
Smart Images

Figure CN119728563A_ABST
Abstract
Description
Technical Field
[0001] This document relates to the field of computers, and in particular to a message sending method, device and computer program product. Background Art
[0002] For network devices used for message forwarding (such as switches), after receiving messages, they need to identify and process various protocol messages and send them to the CPU (Central Processing Unit). When the business is abnormal or the network device is attacked, the CPU business will be busy, key processes cannot be scheduled, and major protocols cannot be processed, thus affecting the stability of the network.
[0003] In the related art, if the CPU service is detected to be busy, a message flow will be selected and the sending rate of the message flow will be limited to a fixed value to ensure the stability of the network. However, this speed regulation mechanism that limits the reporting rate of a single message flow to a fixed value is not flexible enough and may not match the service requirements, resulting in unsatisfactory speed regulation effects and limited improvement in network stability. Summary of the invention
[0004] The embodiments of the present application provide a message sending method, device and computer program product, which are used to solve the problem that the existing speed regulation mechanism has unsatisfactory speed regulation effect and limited improvement on network stability.
[0005] To solve the above technical problems, the embodiments of the present application are implemented as follows: In a first aspect, a message sending method is provided, which is applied to a network device, and the method includes: In response to a current usage of a message transmission resource of the network device exceeding a first expected usage, determining an intervention weight of each message flow according to a current impact rate of each message flow on the message transmission resource, at least one influencing factor of each message flow, and a weight corresponding to each influencing factor; According to the order of the intervention weights of the message flows from large to small, the upper limit of the reporting rate of each message flow reported to the CPU of the network device is reduced in sequence.
[0006] In a second aspect, a message sending device is provided, which is applied to a network device, and the device includes: A first response module, configured to determine, in response to a current usage of a message transmission resource of the network device exceeding a first expected usage, an intervention weight of each message flow according to a current impact rate of each message flow on the message transmission resource, at least one influencing factor of each message flow, and a weight corresponding to each influencing factor; The first adjustment module is used to reduce the upper limit of the reporting rate of each message flow reported to the CPU of the network device in sequence according to the intervention weight of each message flow from large to small.
[0007] According to a third aspect, an electronic device is provided, including: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method as described in the first aspect.
[0008] According to a fourth aspect, a computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the method described in the first aspect.
[0009] According to a fifth aspect, a computer program product comprising instructions is provided. When a computer runs the instructions of the computer program product, the computer executes the method as described in the first aspect.
[0010] In an embodiment of the present application, when the current usage of the message transmission resources of the network device exceeds the first expected usage, resulting in busy business, the intervention weight of each message flow is determined according to the current impact rate of each message flow on the message transmission resources, at least one influencing factor of each message flow and the weight corresponding to each influencing factor, and then the reporting rate upper limit of each message flow reported to the CPU of the network device is dynamically reduced in sequence according to the intervention weight of each message flow from large to small, instead of limiting the reporting rate of a single message flow to a fixed value. Therefore, when a large number of messages are sent, the message reporting rate adjustment effect can be improved, thereby effectively improving network stability, ensuring the normal operation of key services, and improving users' network usage perception. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0012] Figure 1 It is a flowchart of a message sending method provided by an embodiment of the present application.
[0013] Figure 2 It is a flowchart of a message sending method provided by another embodiment of the present application.
[0014] Figure 3 It is a flowchart of a message sending method provided by another embodiment of the present application.
[0015] Figure 4 It is a structural diagram of a message sending device provided by an embodiment of the present application.
[0016] Figure 5 It is a structural diagram of a message sending device provided by an embodiment of the present application.
[0017] Figure 6 It is a structural diagram of a message sending device provided in another embodiment of the present application.
[0018] Figure 6 It is a structural diagram of a message sending device provided in another embodiment of the present application.
[0019] Figure 7 It is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0020] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in one or more embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should fall within the scope of protection of this document.
[0021] The terms "first", "second", etc. in the present application and the claims are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the present application embodiment can be implemented in an order other than those illustrated or described here. In addition, the term "and / or" in the present application and the claims represents at least one of the connected objects, and the character " / " generally represents that the objects associated with each other before and after are a kind of "or" relationship.
[0022] In order to solve the problem that the current message reporting rate adjustment mechanism is not ideal and has limited improvement on network stability, the present application proposes a message sending method and device. The method can be executed by a network device or software installed in the network device. The network device includes but is not limited to message forwarding devices such as switches.
[0023] Taking the network device as a switch as an example, inside the switch, the control plane software or hardware of the switch reports a message to the CPU of the switch.
[0024] In some embodiments, the application scenario of a message sending method and device proposed in the embodiments of the present application is: when the switch is attacked or a large number of business messages are sent, resulting in message backlog or excessive CPU utilization, and system instability such as freezing occurs, in order to ensure that key services can run, it is necessary to limit the speed of the message flow. After the system is stable, the reporting rate of the related business can be restored.
[0025] A message sending method provided in an embodiment of the present application is described below with reference to the accompanying drawings.
[0026] An embodiment of the present application provides a message sending method, which can be applied to a network device, such as Figure 1 As shown, the method may include: Step 101, in response to the current usage of the message transmission resources of the network device exceeding the first expected usage, determine the intervention weight of each message flow according to the current impact rate of each message flow on the message transmission resources, at least one influencing factor of each message flow and the weight corresponding to each influencing factor.
[0027] Step 102 , according to the order of the intervention weight of each message flow from large to small, the upper limit of the reporting rate of each message flow reported to the CPU of the network device is lowered in sequence.
[0028] A message sending method proposed in an embodiment of the present application, when the current usage of the message transmission resources of the network device exceeds the first expected usage, resulting in busy business, can determine the intervention weight of each message flow according to the current impact rate of each message flow on the message transmission resources, at least one influencing factor of each message flow and the weight corresponding to each influencing factor, and then dynamically reduce the upper limit of the reporting rate of each message flow reported to the CPU of the network device in order from large to small according to the intervention weight of each message flow, instead of limiting the reporting rate of a single message flow to a fixed value. Therefore, when a large number of messages are sent, the message reporting rate adjustment effect can be improved, thereby effectively improving network stability, ensuring the normal operation of key services, and improving users' network usage perception.
[0029] In some embodiments, the message transmission resource may include but is not limited to at least one of a CPU and a flow channel cache.
[0030] Alternatively, if Figure 2 As shown, before step 101, a message sending method proposed in an embodiment of the present application may further include: Step 100: monitor the current usage of the message transmission resources of the network device.
[0031] In actual applications, the current usage of the message transmission resources of the network device may be monitored at a preset period.
[0032] Step 103: Determine whether the current usage of the message transmission resources of the network device exceeds the first expected usage.
[0033] In some embodiments, step 103 may include: in response to at least one of the current CPU utilization and the flow channel cache occupancy of the network device exceeding the first threshold, determining that the current usage of the message transmission resources of the network device exceeds the first expected usage; conversely, in response to the current CPU utilization and the flow channel cache occupancy of the network device not exceeding the first threshold, determining that the current usage of the message transmission resources of the network device does not exceed the first expected usage. The first threshold may be set based on experience, and the first threshold may be the same or different for different message transmission resources. For example, the first thresholds corresponding to the CPU utilization and the flow channel cache occupancy may be set to 90%, or the first thresholds corresponding to the CPU utilization may both be set to 90%, and the first threshold corresponding to the flow channel cache occupancy may be set to 85%.
[0034] In other embodiments, step 103 may include: in response to at least one of the current CPU remaining rate and the flow channel cache remaining rate of the network device being lower than a third threshold, determining that the current usage of the message transmission resources of the network device exceeds the first expected usage; conversely, in response to the current CPU remaining rate and the flow channel cache remaining rate of the network device both exceeding the third threshold, determining that the current usage of the message transmission resources of the network device does not exceed the first expected usage. Similarly, the third threshold can be set based on experience, and for different message transmission resources, the third threshold can be the same or different. For example, the third thresholds corresponding to the CPU remaining rate and the flow channel cache remaining rate can both be set to 10%, or the third threshold corresponding to the CPU remaining rate can be set to 100%, and the third threshold corresponding to the flow channel cache remaining rate can be set to 15%.
[0035] It can be understood that if any one of the CPU utilization and the flow channel buffer occupancy exceeds the corresponding first threshold (which may be called the rate limit back pressure threshold), it is determined that the business is busy and dynamic intervention of the message flow reporting rate is required.
[0036] In some embodiments, at least one influencing factor of each message flow may include, but is not limited to, at least one of the following: 1) Adaptive state factor, for example, the adaptive state factor includes at least one of the real-time rate of the flow, the maximum rate of the flow when the CPU is operating normally, the flow frequency, and the flow packet size, wherein the real-time rate of the flow may be a mandatory influencing factor, and the maximum rate of the flow when the CPU is operating normally, the flow frequency, and the flow packet size may be optional influencing factors; 2) A configurable state factor, for example, the configurable state factor includes at least one of a flow priority and a flow rate limit value, wherein the flow rate limit value (i.e., the upper limit of the reporting rate of the message flow) is usually a mandatory influencing factor, and the flow priority can be an optional influencing factor.
[0037] On this basis, in the above step 101, determining the intervention weight of each message flow according to the current impact rate of each message flow on the message transmission resource, at least one impact factor of each message flow and the weight corresponding to each impact factor includes: The intervention weight of each message flow is determined according to the current impact rate of each message flow on the message transmission resource, at least one influencing factor of each message flow and a decision model.
[0038] As a possible example, the decision model is: Intervention weight = [(stream real-time rate / stream rate limit)*a0 + stream packet size*a1 + (stream real-time rate - maximum stream rate when CPU is running normally)*a2]*(current impact rate of message flow on CPU) / (stream priority*stream frequency) Among them, the coefficient ai represents the weight of the corresponding influencing factor.
[0039] It should be noted that the above decision model is only an example given in the embodiment of the present application. In practical applications, more decision models can be designed based on the selectivity of the influencing factors and the current impact rate of the message flow on the message transmission resources. For example, the current impact rate of the message flow on the channel buffer occupancy rate is not considered in the above exemplary decision model, and the current impact rate of the message flow on the channel buffer occupancy rate can be introduced in another designed decision model.
[0040] It should also be noted that the impact rate of the message flow on the message transmission resources is used to characterize the degree of influence of the reporting rate of the message flow on the message transmission resources. It can be understood that when determining the intervention weight of each message flow, introducing the impact rate of each message flow on the message transmission resources can better ensure the adjustment effect of the reporting rate of each message flow and enable the system to reach a stable state faster.
[0041] It should also be noted that the application of a decision model may include two stages: initialization and self-learning, and optionally, may also include a manual intervention stage. The initialization of the decision model occurs when the decision model is just launched, and the self-learning of the decision model occurs during the normal operation of the decision model.
[0042] During the initialization phase of the decision model, it is necessary to set the initial values of the configurable state factors according to the application scenario, such as setting flow priority, flow initial speed limit value, flow minimum guaranteed speed limit value and other factors that need to be manually set, as well as initializing the adaptive state factor and the current impact rate of the message flow on the message transmission resources.
[0043] In the self-learning stage of the decision model, the above-mentioned adaptive state factors and the current impact rate of the message flow on the message transmission resources need to be updated in real time to dynamically and real-time determine the accurate intervention weight of each message flow.
[0044] In some embodiments, the above step 102 may include: Sorting the message flows according to the intervention weight of each message flow from large to small; Determine a predetermined number of message flows that are ranked first as a plurality of first message flows to be intervened; The upper limit of the reporting rate of each of the first message flows reported to the CPU is lowered sequentially.
[0045] That is to say, according to the intervention weight of each message flow, some message flows (a plurality of first message flows) are dynamically selected to adjust the upper limit of the reporting rate.
[0046] Of course, it is also possible not to perform dynamic election, but to reduce the upper limit of the reporting rate of each first message flow to the CPU one by one in the order of intervention weight from large to small for all message flows.
[0047] It can be understood that if the intervened flow is dynamically elected, the reporting rate upper limit of the intervened flow is gradually adjusted, and the flow election strategy is corrected in real time according to the adjusted effect (such as real-time correction of the decision model), the network device can return to a stable state more smoothly and quickly.
[0048] In addition, it can be understood that if multiple first message flows to be intervened are dynamically elected, then one round of adjustment for these multiple first message flows includes adjusting the upper limit of the reporting rate of each of the first message flows in order from large to small according to the intervention weights of the multiple first message flows. If there is no dynamic election, but all message flows are intervened (or adjusted) in order from large to small according to the intervention weights, then one round of adjustment for each of the message flows includes adjusting the upper limit of the reporting rate of each of the message flows in order from large to small according to the intervention weights of each of the message flows. Specifically, the process of one round of adjustment is similar, except that the number of message flows adjusted in one round is different. The following is an explanation of the latter one round of adjustment process.
[0049] In some embodiments, the above step 102 may include: adjusting the reporting rate upper limit of each message flow reported to the CPU in order of intervention weight from large to small to the first multiple of the current reporting rate upper limit of each message flow, wherein the first multiple is less than 1.
[0050] Optionally, the above step 102 may also include: after each lowering of the reporting rate upper limit of the message flow, determining whether the current usage of the message transmission resources exceeds the first expected usage; if so, proceeding to step 1023; otherwise, stopping executing step 102 and returning to executing step 100.
[0051] The process of determining whether the current usage of the message transmission resource exceeds the first expected usage is explained in the above explanation of step 103 and will not be repeated here.
[0052] Optionally, the above step 102 may also include: determining whether a round of adjustment for each of the message flows has been completed; if yes, in response to the current usage of the message transmission resources exceeding the first expected usage and a round of adjustment for each of the message flows has been completed, obtaining the current impact rate of each of the message flows on the message transmission resources, and returning to execute step 101 to start the next round of adjustment until the network device runs stably; otherwise, in response to the current usage of the message transmission resources exceeding the first expected usage and a round of adjustment for each of the message flows has not been completed, continuing to adjust the upper limit of the reporting rate of the next message flow reported to the CPU to the first multiple of the current upper limit of the reporting rate of the next message flow.
[0053] As described above, the round of adjustment of each message flow includes adjusting the upper limit of the reporting rate of each message flow in order from large to small according to the intervention weight of each message flow.
[0054] Optionally, a message sending method proposed in another embodiment of the present application may further include: after each reduction of the reporting rate upper limit of one of the message flows, updating the current impact rate of the message flow on the message transmission resources.
[0055] In some embodiments, updating the current impact rate of the message flow on the message transmission resource may include: Determine usage change information of the message transmission resource after lowering the upper limit of the reporting rate of the message flow and before lowering the upper limit of the reporting rate of the message flow; Determine, according to the first impact rate of the message flow on the message transmission resource before the upper limit of the reporting rate of the message flow is reduced and the usage change information, the second impact rate of the message flow on the message transmission resource after the upper limit of the reporting rate of the message flow is reduced; The current impact rate of the message flow on the message transmission resource is updated to the second impact rate.
[0056] In some embodiments, if the message transmission resources include a CPU and a flow channel cache, then the determination of the usage change information of the message transmission resources after lowering the upper limit of the reporting rate of the message flow and before lowering the upper limit of the reporting rate of the message flow includes: determining the change in CPU utilization after lowering the upper limit of the reporting rate of the message flow and before lowering the upper limit of the reporting rate of the message flow; and determining the change in the flow channel cache occupancy after lowering the upper limit of the reporting rate of the message flow and before lowering the upper limit of the reporting rate of the message flow.
[0057] As an example: The change in CPU utilization = the CPU utilization after the upper limit of the reporting rate of the message flow is reduced - the CPU utilization before the upper limit of the reporting rate of the message flow is reduced; The change in the flow channel buffer occupancy rate=the flow channel buffer occupancy rate after the upper limit of the reporting rate of the message flow is reduced−the flow channel buffer occupancy rate before the upper limit of the reporting rate of the message flow is reduced.
[0058] Accordingly, determining, according to the first impact rate of the message flow on the message transmission resource before reducing the reporting rate upper limit of the message flow and the usage change information, the second impact rate of the message flow on the message transmission resource after reducing the reporting rate upper limit of the message flow may include: Based on the first impact rate of the message flow on the message transmission resources before lowering the upper limit of the reporting rate of the message flow, the change in CPU utilization, the change in flow channel cache occupancy and the weights corresponding to each change, determine the second impact rate of the message flow on the message transmission resources after lowering the upper limit of the reporting rate of the message flow.
[0059] As an example, the second impact rate=the first impact rate+(the change in CPU utilization*C1+the change in stream channel cache occupancy*C2), where C1 and C2 are weights corresponding to the change in CPU utilization and the change in stream channel cache occupancy, respectively.
[0060] Optionally, a message sending method proposed in another embodiment of the present application may further include: Optionally, after lowering the upper limit of the reporting rate of each message flow and determining whether the current usage of the message transmission resource exceeds the first expected usage, a message sending method proposed in another embodiment of the present application may also include: in response to the current usage of the message transmission resource not exceeding the first expected usage, stopping the step of sequentially lowering the upper limit of the reporting rate of each message flow reported to the CPU of the network device, and returning to the step of determining whether the current usage of the message transmission resource exceeds the first expected usage. That is to say, in a round of adjustment process, once the network device runs stably, stop this round of adjustment, so that the system runs in the best state and as many business messages as possible are guaranteed to be reported.
[0061] Alternatively, if Figure 3 As shown, a message sending method proposed in another embodiment of the present application may further include, after step 102: Step 104, determine whether the current usage of the message transmission resource is lower than the second expected usage; if so, execute step 105; otherwise, return to step 100 and execute step 105 if the current usage of the message transmission resource is lower than the second expected usage, or go to step 101 if the current usage of the message transmission resource exceeds the first expected usage.
[0062] In some embodiments, step 104 may include: in response to at least one of the CPU utilization and the flow channel cache occupancy of the network device being lower than a second threshold, determining that the current usage of the message transmission resources of the network device is lower than the second expected usage; conversely, in response to both the CPU utilization and the flow channel cache occupancy of the network device being greater than or equal to the second threshold, determining that the current usage of the message transmission resources of the network device is not lower than the second expected usage.
[0063] In some other embodiments, step 104 may include: in response to at least one of the CPU remaining rate and the flow channel cache remaining rate of the network device being higher than a fourth threshold, determining that the current usage of the message transmission resources of the network device is lower than the second expected usage; conversely, in response to both the CPU remaining rate and the flow channel cache remaining rate of the network device being lower than the fourth threshold, determining that the current usage of the message transmission resources of the network device is not lower than the second expected usage.
[0064] It can be understood that if any one of the CPU utilization and the flow channel buffer occupancy is lower than the corresponding second threshold (which may be called the rate limit callback threshold), the service is determined to be normal and the message flow reporting rate can be dynamically improved.
[0065] Alternatively, if Figure 3 As shown, a message sending method proposed in another embodiment of the present application may further include, after step 104: Step 105, in response to the current usage of the message transmission resource being lower than the second expected usage, the reporting rate upper limit of the second message flow reported to the CPU is increased in sequence, wherein the second message flow is the message flow of which the reporting rate upper limit has been reduced among the message flows.
[0066] Among them, the second expected usage is a lower expected usage than the first expected usage. The first expected usage can be regarded as an expected usage of the speed limit back pressure, and the second expected usage can be regarded as a threshold of the speed limit callback. It is not difficult to find that in a message sending method provided in an embodiment of the present application: 1) If the current usage of the message transmission resources of the network device exceeds the first expected usage, rate limiting back pressure is required, that is, the upper limit of the reporting rate of each message flow reported to the CPU needs to be reduced; 2) If the current usage of the message transmission resources of the network device is lower than the second expected usage, a rate limit callback is required, that is, the upper limit of the reporting rate of each message flow reported to the CPU needs to be increased to ensure the normal forwarding of each service message; 3) If the current usage of the message transmission resources of the network device is between the second expected usage and the first expected usage, there is no need to adjust the upper limit of the reporting rate of each of the message flows to the CPU.
[0067] In some embodiments, the sequentially increasing the upper limit of the reporting rate for reporting the second message flow to the CPU may include: adjusting the upper limit of the reporting rate for reporting the second message flow to the CPU to the second multiple of the current upper limit of the reporting rate of the second message flow in order from small to large according to the intervention weight of each of the second message flows, wherein the second multiple is greater than 1.
[0068] Alternatively, if Figure 3 As shown, a message sending method proposed in another embodiment of the present application may further include, after step 105: Step 106, after each increase in the reporting rate upper limit of the second message flow, determine whether the current usage of the message transmission resources is lower than the second expected usage; if so, proceed to step 107, otherwise proceed to step 108.
[0069] Step 107, in response to the current usage of the message transmission resource being lower than the second expected usage, continue to adjust the upper limit of the reporting rate of reporting the next second message flow to the CPU to a second multiple of the current upper limit of the reporting rate of the next second message flow.
[0070] Alternatively, if Figure 3 As shown, a message sending method proposed in another embodiment of the present application may further include, after step 105: Step 108: In response to the current usage of the message transmission resource being greater than or equal to the second expected usage, or in response to the reporting rate upper limit of each second message flow reaching a preset upper limit, stop executing step 105. Optionally, return to executing step 100.
[0071] Alternatively, if Figure 3 As shown, a message sending method proposed in another embodiment of the present application may further include, after step 105: Step 109: after each increase in the reporting rate upper limit of the second message flow, update the current impact rate of the second message flow on the message transmission resources.
[0072] In some embodiments, updating the current impact rate of the second message flow on the message transmission resource may include: Determine usage change information of the message transmission resource after increasing the upper limit of the reporting rate of the message flow and before increasing the upper limit of the reporting rate of the message flow; Determine, according to the third impact rate of the message flow on the message transmission resource before increasing the reporting rate upper limit of the message flow and the usage change information, a fourth impact rate of the message flow on the message transmission resource after increasing the reporting rate upper limit of the message flow; The current impact rate of the message flow on the message transmission resource is updated to the fourth impact rate.
[0073] In some embodiments, if the message transmission resources include a CPU and a flow channel cache, then the determination of the usage change information of the message transmission resources after increasing the upper limit of the reporting rate of the message flow and before increasing the upper limit of the reporting rate of the message flow includes: determining the change in CPU utilization after increasing the upper limit of the reporting rate of the message flow and before increasing the upper limit of the reporting rate of the message flow; and determining the change in the flow channel cache occupancy after increasing the upper limit of the reporting rate of the message flow and before increasing the upper limit of the reporting rate of the message flow.
[0074] As an example: The change in CPU utilization = the CPU utilization after the upper limit of the reporting rate of the message flow is increased - the CPU utilization before the upper limit of the reporting rate of the message flow is increased; The change in the flow channel buffer occupancy rate=the flow channel buffer occupancy rate after the upper limit of the reporting rate of the message flow is increased-the flow channel buffer occupancy rate before the upper limit of the reporting rate of the message flow is increased.
[0075] Correspondingly, determining, according to the third impact rate of the message flow on the message transmission resource before increasing the reporting rate upper limit of the message flow and the usage change information, a fourth impact rate of the message flow on the message transmission resource after increasing the reporting rate upper limit of the message flow may include: According to the third impact rate of the message flow on the message transmission resources before the upper limit of the reporting rate of the message flow is increased, the change in CPU utilization, the change in flow channel cache occupancy and the weights corresponding to each change, determine the fourth impact rate of the message flow on the message transmission resources after the upper limit of the reporting rate of the message flow is increased.
[0076] As an example, the fourth impact rate=the third impact rate+(the change in CPU utilization*C1+the change in stream channel cache occupancy*C2), wherein C1 and C2 are weights corresponding to the change in CPU utilization and the change in stream channel cache occupancy, respectively.
[0077] pass Figure 3 The message sending method proposed in the illustrated embodiment can not only ensure the normal operation of other key businesses by reducing the upper limit of the reporting rate of some message flows when the network device is attacked or faces a large number of business messages being sent, resulting in message backlog or CPU overload and jamming, but can also gradually restore the upper limit of the reporting rate of the message flows of related businesses after the network device is operating normally, so that the network device can always operate in a stable state.
[0078] The above introduces a message sending method proposed in the present application. In response to the above message sending method, the present application also proposes a message sending device, which is briefly introduced below.
[0079] Figure 4 4 is a schematic diagram of a message sending device 400 provided in an embodiment of the present application. Figure 4 In a software implementation, the message sending device 400 may include: a first response module 401 and a first adjustment module 402.
[0080] The first response module 401 is used to respond to the current usage of the message transmission resources of the network device exceeding the first expected usage, and determine the intervention weight of each message flow according to the current impact rate of each message flow on the message transmission resources, at least one influencing factor of each message flow and the weight corresponding to each influencing factor.
[0081] The first adjustment module 402 is used to reduce the upper limit of the reporting rate of each message flow reported to the CPU of the network device in sequence according to the intervention weight of each message flow from large to small.
[0082] In some embodiments, the message transmission resource may include but is not limited to at least one of a CPU and a flow channel cache.
[0083] Alternatively, if Figure 5 As shown, a message sending device 400 proposed in an embodiment of the present application may further include: The resource monitoring module 408 is used to monitor the current usage of the message transmission resources of the network device.
[0084] In actual applications, the current usage of the message transmission resources of the network device may be monitored at a preset period.
[0085] The first judgment module 403 is used to determine whether the current usage of the message transmission resources of the network device exceeds the first expected usage.
[0086] In some embodiments, the first judgment module 403 can be used to: in response to at least one of the current CPU utilization and the flow channel cache occupancy of the network device exceeding a first threshold, determine that the current usage of the message transmission resources of the network device exceeds the first expected usage; conversely, in response to the current CPU utilization and the flow channel cache occupancy of the network device not exceeding the first threshold, determine that the current usage of the message transmission resources of the network device does not exceed the first expected usage.
[0087] In some other embodiments, the first judgment module 403 can be used to: in response to at least one of the current CPU remaining rate and the flow channel cache remaining rate of the network device being lower than a third threshold, determine that the current usage of the message transmission resources of the network device exceeds the first expected usage; conversely, in response to the current CPU remaining rate and the flow channel cache remaining rate of the network device both exceeding the third threshold, determine that the current usage of the message transmission resources of the network device does not exceed the first expected usage.
[0088] It can be understood that if any one of the CPU utilization and the flow channel buffer occupancy exceeds the corresponding first threshold (which may be called the rate limit back pressure threshold), it is determined that the business is busy and dynamic intervention of the message flow reporting rate is required.
[0089] In some embodiments, at least one influencing factor of each message flow may include, but is not limited to, at least one of the following: 1) Adaptive state factor, for example, the adaptive state factor includes at least one of the real-time rate of the flow, the maximum rate of the flow when the CPU is operating normally, the flow frequency, and the flow packet size, wherein the real-time rate of the flow may be a mandatory influencing factor, and the maximum rate of the flow when the CPU is operating normally, the flow frequency, and the flow packet size may be optional influencing factors; 2) A configurable state factor, for example, the configurable state factor includes at least one of a flow priority and a flow rate limit value, wherein the flow rate limit value (i.e., the upper limit of the reporting rate of the message flow) is usually a mandatory influencing factor, and the flow priority can be an optional influencing factor.
[0090] On this basis, in the first response module 401, determining the intervention weight of each message flow according to the current impact rate of each message flow on the message transmission resource, at least one influencing factor of each message flow and the weight corresponding to each influencing factor includes: The intervention weight of each message flow is determined according to the current impact rate of each message flow on the message transmission resource, at least one influencing factor of each message flow and a decision model.
[0091] As a possible example, the decision model is: Intervention weight = [(stream real-time rate / stream rate limit)*a0 + stream packet size*a1 + (stream real-time rate - maximum stream rate when CPU is running normally)*a2]*(current impact rate of message flow on CPU) / (stream priority*stream frequency) Among them, the coefficient ai represents the weight of the corresponding influencing factor.
[0092] It should be noted that the above decision model is only an example given in the embodiment of the present application. In practical applications, more decision models can be designed based on the selectivity of the influencing factors and the current impact rate of the message flow on the message transmission resources. For example, the current impact rate of the message flow on the channel buffer occupancy rate is not considered in the above exemplary decision model, and the current impact rate of the message flow on the channel buffer occupancy rate can be introduced in another designed decision model.
[0093] It should also be noted that the impact rate of the message flow on the message transmission resources is used to characterize the degree of influence of the reporting rate of the message flow on the message transmission resources. It can be understood that when determining the intervention weight of each message flow, introducing the impact rate of each message flow on the message transmission resources can better ensure the adjustment effect of the reporting rate of each message flow and enable the system to reach a stable state faster.
[0094] It should also be noted that the application of a decision model may include two stages: initialization and self-learning, and optionally, may also include a manual intervention stage. The initialization of the decision model occurs when the decision model is just launched, and the self-learning of the decision model occurs during the normal operation of the decision model.
[0095] During the initialization phase of the decision model, it is necessary to set the initial values of the configurable state factors according to the application scenario, such as setting flow priority, flow initial speed limit value, flow minimum guaranteed speed limit value and other factors that need to be manually set, as well as initializing the adaptive state factor and the current impact rate of the message flow on the message transmission resources.
[0096] In the self-learning stage of the decision model, the above-mentioned adaptive state factors and the current impact rate of the message flow on the message transmission resources need to be updated in real time to dynamically and real-time determine the accurate intervention weight of each message flow.
[0097] In some embodiments, the first adjustment module 402 may be used to: Sorting the message flows according to the intervention weight of each message flow from large to small; Determine a predetermined number of message flows that are ranked first as a plurality of first message flows to be intervened; The upper limit of the reporting rate of each of the first message flows reported to the CPU is lowered sequentially.
[0098] That is to say, according to the intervention weight of each message flow, some message flows (a plurality of first message flows) are dynamically selected to adjust the upper limit of the reporting rate.
[0099] Of course, it is also possible not to perform dynamic election, but to reduce the upper limit of the reporting rate of each first message flow to the CPU one by one in the order of intervention weight from large to small for all message flows.
[0100] It can be understood that if the intervened flow is dynamically elected, the reporting rate upper limit of the intervened flow is gradually adjusted, and the flow election strategy is corrected in real time according to the adjusted effect (such as real-time correction of the decision model), the network device can return to a stable state more smoothly and quickly.
[0101] In addition, it can be understood that if multiple first message flows to be intervened are dynamically elected, then one round of adjustment for these multiple first message flows includes adjusting the upper limit of the reporting rate of each of the first message flows in order from large to small according to the intervention weights of the multiple first message flows. If there is no dynamic election, but all message flows are intervened (or adjusted) in order from large to small according to the intervention weights, then one round of adjustment for each of the message flows includes adjusting the upper limit of the reporting rate of each of the message flows in order from large to small according to the intervention weights of each of the message flows. Specifically, the process of one round of adjustment is similar, except that the number of message flows adjusted in one round is different. The following is an explanation of the latter one round of adjustment process.
[0102] In some embodiments, the first adjustment module 402 may include: The first adjustment submodule is used to adjust the upper limit of the reporting rate of each message flow reported to the CPU to a first multiple of the current upper limit of the reporting rate of each message flow in order of intervention weight from large to small, wherein the first multiple is less than 1.
[0103] Optionally, the first adjustment module 402 may further include: The first judgment submodule is used to determine whether the current usage of the message transmission resources exceeds the first expected usage after each lowering of the reporting rate upper limit of the message flow. If yes, trigger the second judgment submodule, otherwise return to trigger the resource monitoring module 508.
[0104] Optionally, the first adjustment module 402 may further include: The second judgment submodule is used to determine whether a round of adjustment of each of the message flows has been completed; if yes, trigger the first acquisition module; otherwise, trigger the second adjustment submodule.
[0105] The second adjustment submodule is used to continue adjusting the upper limit of the reporting rate of the next message flow reported to the CPU to a first multiple of the current upper limit of the reporting rate of the next message flow in response to the current usage of the message transmission resources exceeding the first expected usage and a round of adjustment of each message flow has not been completed.
[0106] As described above, the round of adjustment of each message flow includes adjusting the upper limit of the reporting rate of each message flow in order from large to small according to the intervention weight of each message flow.
[0107] Optionally, the apparatus 400 may further include: a first updating module, configured to update a current impact rate of the message flow on the message transmission resource after each decrease in the reporting rate upper limit of the message flow.
[0108] In some embodiments, the first update module may be specifically used to: Determine usage change information of the message transmission resource after lowering the upper limit of the reporting rate of the message flow and before lowering the upper limit of the reporting rate of the message flow; Determine, according to the first impact rate of the message flow on the message transmission resource before the upper limit of the reporting rate of the message flow is reduced and the usage change information, the second impact rate of the message flow on the message transmission resource after the upper limit of the reporting rate of the message flow is reduced; The current impact rate of the message flow on the message transmission resource is updated to the second impact rate.
[0109] In some embodiments, if the message transmission resources include a CPU and a flow channel cache, then the determination of the usage change information of the message transmission resources after lowering the upper limit of the reporting rate of the message flow and before lowering the upper limit of the reporting rate of the message flow includes: determining the change in CPU utilization after lowering the upper limit of the reporting rate of the message flow and before lowering the upper limit of the reporting rate of the message flow; and determining the change in the flow channel cache occupancy after lowering the upper limit of the reporting rate of the message flow and before lowering the upper limit of the reporting rate of the message flow.
[0110] As an example: The change in CPU utilization = the CPU utilization after the upper limit of the reporting rate of the message flow is reduced - the CPU utilization before the upper limit of the reporting rate of the message flow is reduced; The change in the flow channel buffer occupancy rate=the flow channel buffer occupancy rate after the upper limit of the reporting rate of the message flow is reduced−the flow channel buffer occupancy rate before the upper limit of the reporting rate of the message flow is reduced.
[0111] Accordingly, determining, according to the first impact rate of the message flow on the message transmission resource before reducing the reporting rate upper limit of the message flow and the usage change information, the second impact rate of the message flow on the message transmission resource after reducing the reporting rate upper limit of the message flow may include: Based on the first impact rate of the message flow on the message transmission resources before lowering the upper limit of the reporting rate of the message flow, the change in CPU utilization, the change in flow channel cache occupancy and the weights corresponding to each change, determine the second impact rate of the message flow on the message transmission resources after lowering the upper limit of the reporting rate of the message flow.
[0112] As an example, the second impact rate=the first impact rate+(the change in CPU utilization*C1+the change in stream channel cache occupancy*C2), where C1 and C2 are weights corresponding to the change in CPU utilization and the change in stream channel cache occupancy, respectively.
[0113] Optionally, the device 400 may also include: a first acquisition module, used to obtain the current impact rate of each message flow on the message transmission resource in response to the current usage of the message transmission resources exceeding the first expected usage and a round of adjustment of each message flow has been completed, and return to trigger the first response module 401 to start the next round of adjustment until the network device operates stably.
[0114] Optionally, the device 400 may further include: a second response module, which is used to stop executing the step of sequentially reducing the upper limit of the reporting rate of each message flow reported to the CPU of the network device in response to the current usage of the message transmission resource not exceeding the first expected usage, and return to execute the step of determining whether the current usage of the message transmission resource exceeds the first expected usage. That is, in a round of adjustment process, once the network device runs stably, the current round of adjustment is stopped to make the system run in the best state and ensure that more business messages are reported as much as possible.
[0115] Alternatively, if Figure 6 As shown, the apparatus 400 includes, in addition to the resource monitoring module 408, the first determination module 403, the first response module 401 and the first adjustment module 402, further includes: The second judgment module 404 is used to determine whether the current usage of the message transmission resource is lower than the second expected usage; if so, the second adjustment module 405 is triggered; otherwise, the process returns to trigger the resource monitoring module 508.
[0116] In some embodiments, the second judgment module 404 can be used to: in response to at least one of the CPU utilization and the flow channel cache occupancy of the network device being lower than a second threshold, determine that the current usage of the message transmission resources of the network device is lower than the second expected usage; conversely, in response to both the CPU utilization and the flow channel cache occupancy of the network device being greater than or equal to the second threshold, determine that the current usage of the message transmission resources of the network device is not lower than the second expected usage.
[0117] In some other embodiments, the second judgment module 404 can be used to: in response to at least one of the CPU remaining rate and the flow channel cache remaining rate of the network device being higher than a fourth threshold, determine that the current usage of the message transmission resources of the network device is lower than the second expected usage; conversely, in response to both the CPU remaining rate and the flow channel cache remaining rate of the network device being lower than the fourth threshold, determine that the current usage of the message transmission resources of the network device is not lower than the second expected usage.
[0118] It can be understood that if any one of the CPU utilization and the flow channel buffer occupancy is lower than the corresponding second threshold (which may be called the rate limit callback threshold), the service is determined to be normal and the message flow reporting rate can be dynamically improved.
[0119] Alternatively, if Figure 6 As shown, a message sending device 400 proposed in another embodiment of the present application may also include: a second adjustment module 405, which is used to increase the upper limit of the reporting rate of the second message flow reported to the CPU in response to the current usage of the message transmission resource being lower than the second expected usage, wherein the second message flow is the message flow of each message flow whose reporting rate upper limit has been reduced.
[0120] Among them, the second expected usage is a lower expected usage than the first expected usage. The first expected usage can be regarded as an expected usage of the speed limit back pressure, and the second expected usage can be regarded as a threshold of a speed limit callback. It is not difficult to find that in a message sending device provided in an embodiment of the present application: 1) If the current usage of the message transmission resources of the network device exceeds the first expected usage, rate limiting back pressure is required, that is, the upper limit of the reporting rate of each message flow reported to the CPU needs to be reduced; 2) If the current usage of the message transmission resources of the network device is lower than the second expected usage, a rate limit callback is required, that is, the upper limit of the reporting rate of each message flow reported to the CPU needs to be increased to ensure the normal forwarding of each service message; 3) If the current usage of the message transmission resources of the network device is between the second expected usage and the first expected usage, there is no need to adjust the upper limit of the reporting rate of each of the message flows to the CPU.
[0121] In some embodiments, the second adjustment module 405 can be specifically used to: adjust the upper limit of the reporting rate of the second message flow reported to the CPU to the second multiple of the current upper limit of the reporting rate of the second message flow in order of the intervention weight of each second message flow from small to large, wherein the second multiple is greater than 1.
[0122] Alternatively, if Figure 6 As shown, a message sending device 400 proposed in another embodiment of the present application may further include: The third judgment module 406 is used to determine whether the current usage of the message transmission resources is lower than the second expected usage after each increase in the reporting rate upper limit of the second message flow; if so, transfer to the third adjustment module 407, otherwise trigger the monitoring module 408.
[0123] The third adjustment module 407 is used to continue to adjust the reporting rate upper limit of the next second message flow reported to the CPU to the second multiple of the current reporting rate upper limit of the next second message flow in response to the current usage of the message transmission resources being lower than the second expected usage.
[0124] Optionally, a message sending device proposed in another embodiment of the present application may further include: a triggering module, configured to stop triggering the second adjustment module 405 in response to the current usage of the message transmission resource being higher than or equal to the second expected usage, or in response to the reporting rate upper limit of each second message flow reaching a preset upper limit. Optionally, return to trigger the resource monitoring module 408.
[0125] Alternatively, if Figure 6 As shown, a message sending device 400 proposed in another embodiment of the present application may also include: a second update module 409, used to update the current impact rate of the second message flow on the message transmission resources after each increase in the reporting rate upper limit of the second message flow.
[0126] In some embodiments, the second updating module 409 may be used to: Determine usage change information of the message transmission resource after increasing the upper limit of the reporting rate of the message flow and before increasing the upper limit of the reporting rate of the message flow; Determine, according to the third impact rate of the message flow on the message transmission resource before increasing the reporting rate upper limit of the message flow and the usage change information, a fourth impact rate of the message flow on the message transmission resource after increasing the reporting rate upper limit of the message flow; The current impact rate of the message flow on the message transmission resource is updated to the fourth impact rate.
[0127] In some embodiments, if the message transmission resources include a CPU and a flow channel cache, then the determination of the usage change information of the message transmission resources after increasing the upper limit of the reporting rate of the message flow and before increasing the upper limit of the reporting rate of the message flow includes: determining the change in CPU utilization after increasing the upper limit of the reporting rate of the message flow and before increasing the upper limit of the reporting rate of the message flow; and determining the change in the flow channel cache occupancy after increasing the upper limit of the reporting rate of the message flow and before increasing the upper limit of the reporting rate of the message flow.
[0128] As an example: The change in CPU utilization = the CPU utilization after the upper limit of the reporting rate of the message flow is increased - the CPU utilization before the upper limit of the reporting rate of the message flow is increased; The change in the flow channel buffer occupancy rate=the flow channel buffer occupancy rate after the upper limit of the reporting rate of the message flow is increased-the flow channel buffer occupancy rate before the upper limit of the reporting rate of the message flow is increased.
[0129] Correspondingly, determining, according to the third impact rate of the message flow on the message transmission resource before increasing the reporting rate upper limit of the message flow and the usage change information, a fourth impact rate of the message flow on the message transmission resource after increasing the reporting rate upper limit of the message flow may include: According to the third impact rate of the message flow on the message transmission resources before the upper limit of the reporting rate of the message flow is increased, the change in CPU utilization, the change in flow channel cache occupancy and the weights corresponding to each change, determine the fourth impact rate of the message flow on the message transmission resources after the upper limit of the reporting rate of the message flow is increased.
[0130] As an example, the fourth impact rate=the third impact rate+(the change in CPU utilization*C1+the change in stream channel cache occupancy*C2), wherein C1 and C2 are weights corresponding to the change in CPU utilization and the change in stream channel cache occupancy, respectively.
[0131] Figure 6 The message sending device 400 proposed in the illustrated embodiment can not only ensure the normal operation of other key businesses by reducing the upper limit of the reporting rate of some message flows when the network device is attacked or faces a large number of business messages being sent, resulting in message backlog or CPU overload and jamming, but can also gradually restore the upper limit of the reporting rate of the message flows of related businesses after the network device is operating normally, so that the network device can always operate in a stable state.
[0132] The message sending device 400 provided in the embodiment of the present application can also execute Figures 1 to 3The method described in any one of the items realizes the corresponding functions and achieves the same technical effects, and the embodiments of the present application are not described in detail here.
[0133] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0134] Figure 7 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 7 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0135] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0136] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0137] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a message sending device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations: In response to a current usage of a message transmission resource of the network device exceeding a first expected usage, determining an intervention weight of each message flow according to a current impact rate of each message flow on the message transmission resource, at least one influencing factor of each message flow, and a weight corresponding to each influencing factor; According to the order of the intervention weights of the message flows from large to small, the upper limit of the reporting rate of each message flow reported to the CPU of the network device is reduced in sequence.
[0138] The above application Figure 7 The method performed by the message sending device disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor 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 gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in a decoding processor. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0139] The electronic device may also perform Figure 1 The method is implemented by the message sending device. Figures 1 to 3 The functions of any of the illustrated embodiments will not be described in detail in the embodiments of the present application.
[0140] Of course, in addition to software implementation methods, the electronic device of the present application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0141] The embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by a portable electronic device including a plurality of target application programs, enable the portable electronic device to execute Figures 1 to 3 The method of any one of the illustrated embodiments.
[0142] The present application also provides a computer program product including instructions. When a computer runs the instructions of the computer program product, the computer executes Figures 1 to 3 The method of any one of the illustrated embodiments.
[0143] In short, the above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
[0144] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0145] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0146] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0147] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
Claims
1. A message sending method, characterized in that: Applied to a network device, the method comprises: In response to a current usage of a message transmission resource of the network device exceeding a first expected usage, determining an intervention weight of each message flow according to a current impact rate of each message flow on the message transmission resource, at least one influencing factor of each message flow, and a weight corresponding to each influencing factor; According to the order of the intervention weights of the message flows from large to small, the upper limit of the reporting rate of each message flow reported to the CPU of the network device is reduced in sequence.
2. The method according to claim 1, characterized in that The method further comprises: In response to at least one of a current CPU utilization rate and a flow channel buffer occupancy rate of the network device exceeding a first threshold, it is determined that a current usage of a message transmission resource of the network device exceeds the first expected usage.
3. The method according to claim 1, characterized in that The step of sequentially reducing the upper limit of the reporting rate of each of the message flows to the CPU of the network device according to the intervention weight of each of the message flows from large to small includes: Sorting the message flows according to the intervention weight of each message flow from large to small; Determine a predetermined number of message flows that are ranked first as a plurality of first message flows to be intervened; The upper limit of the reporting rate of each of the first message flows reported to the CPU is lowered sequentially.
4. The method according to claim 1, characterized in that: The step of sequentially reducing the upper limit of the reporting rate of each of the message flows to the CPU of the network device includes: In descending order of intervention weight, the upper limit of the reporting rate of each message flow reported to the CPU is adjusted to a first multiple of the current upper limit of the reporting rate of each message flow, wherein the first multiple is less than 1.
5. The method according to claim 4, characterized in that The step of sequentially reducing the upper limit of the reporting rate of each of the message flows to the CPU of the network device further includes: After each decrease in the reporting rate upper limit of one of the message flows, determining whether the current usage of the message transmission resource exceeds the first expected usage; In response to the current usage of the message transmission resources exceeding the first expected usage and a round of adjustment of each of the message flows has not been completed, the upper limit of the reporting rate of the next message flow reported to the CPU continues to be adjusted to a first multiple of the current upper limit of the reporting rate of the next message flow, and the one round of adjustment of each of the message flows includes adjusting the upper limit of the reporting rate of each of the message flows in order from large to small according to the intervention weight of each of the message flows.
6. The method according to claim 5, characterized in that After lowering the upper limit of the reporting rate of each of the message flows, the method further includes: Update the current impact rate of the message flow on the message transmission resource.
7. The method according to claim 6, characterized in that The updating of the current impact rate of the message flow on the message transmission resource includes: Determine usage change information of the message transmission resource after lowering the upper limit of the reporting rate of the message flow and before lowering the upper limit of the reporting rate of the message flow; Determine, according to the first impact rate of the message flow on the message transmission resource before the upper limit of the reporting rate of the message flow is reduced and the usage change information, the second impact rate of the message flow on the message transmission resource after the upper limit of the reporting rate of the message flow is reduced; The current impact rate of the message flow on the message transmission resource is updated to the second impact rate.
8. The method according to claim 7, characterized in that The message transmission resource includes a CPU and a stream channel cache, wherein the determining, according to a first impact rate of the message flow on the message transmission resource before lowering the reporting rate upper limit of the message flow and the usage change information, a second impact rate of the message flow on the message transmission resource after lowering the reporting rate upper limit of the message flow includes: Based on the first impact rate of the message flow on the message transmission resources before lowering the upper limit of the reporting rate of the message flow, the change in CPU utilization, the change in flow channel cache occupancy and the weights corresponding to each change, determine the second impact rate of the message flow on the message transmission resources after lowering the upper limit of the reporting rate of the message flow.
9. The method according to claim 6, characterized in that After determining whether the current usage of the message transmission resource exceeds the first expected usage, the method further includes: In response to the current usage of the message transmission resources exceeding the first expected usage and a round of adjustment of each of the message flows has been completed, the current impact rate of each of the message flows on the message transmission resources is obtained, and the step of determining the intervention weight of each of the message flows based on the current impact rate of each of the message flows on the message transmission resources, at least one influencing factor of each of the message flows and the weight corresponding to each of the influencing factors is returned to be executed.
10. The method according to claim 5, characterized in that After determining whether the current usage of the message transmission resource exceeds the first expected usage, the method further includes: In response to the current usage of the message transmission resources not exceeding the first expected usage, stop executing the step of successively reducing the upper limit of the reporting rate of each message flow reported to the CPU of the network device, and return to execute the step of determining whether the current usage of the message transmission resources exceeds the first expected usage.
11. The method according to claim 1, characterized in that: The at least one influencing factor includes at least one of the following: An adaptive state factor, wherein the adaptive state factor includes at least one of a real-time rate of a flow, a maximum rate of a flow when the CPU is operating normally, a flow frequency, and a flow packet size; A state factor may be set, and the settable state factor includes at least one of a flow priority and a flow rate limit value.
12. The method according to claim 11, characterized in that The determining the intervention weight of each message flow according to the current impact rate of each message flow on the message transmission resource, at least one influencing factor of each message flow, and the weight corresponding to each influencing factor includes: Determining the intervention weight of each message flow according to the current impact rate of each message flow on the message transmission resource, at least one influencing factor of each message flow and a decision model; Wherein, the decision model is: Intervention weight = [(stream real-time rate / stream rate limit)*a0 + stream packet size*a1 + (stream real-time rate - maximum stream rate when CPU is running normally)*a2]*(current impact rate of message flow on CPU) / (stream priority*stream frequency) Among them, the coefficient ai represents the weight of the corresponding influencing factor.
13. The method according to any one of claims 1 to 12, characterized in that: After sequentially lowering the upper limit of the reporting rate of each of the message flows to the CPU of the network device, the method further includes: In response to the current usage of the message transmission resource being lower than the second expected usage, the reporting rate upper limit of the second message flow reported to the CPU is increased in sequence, wherein the second message flow is the message flow with the lowered reporting rate upper limit among the message flows.
14. The method according to claim 13, characterized in that The method further comprises: In response to at least one of a CPU utilization rate and a flow channel buffer occupancy rate of the network device being lower than a second threshold, it is determined that a current usage of a message transmission resource of the network device is lower than the second expected usage.
15. The method according to claim 13, characterized in that The step of sequentially increasing the upper limit of the reporting rate of reporting the second message flow to the CPU includes: In order of the intervention weight of each of the second message flows from small to large, the upper limit of the reporting rate of the second message flow reported to the CPU is adjusted to the second multiple of the current upper limit of the reporting rate of the second message flow, where the second multiple is greater than 1.
16. The method according to claim 15, characterized in that The method further comprises: After each increase in the reporting rate upper limit of the second message flow, determining whether the current usage of the message transmission resource is lower than the second expected usage; In response to the current usage of the message transmission resource being lower than the second expected usage, the reporting rate upper limit for reporting the next second message flow to the CPU continues to be adjusted to a second multiple of the current reporting rate upper limit of the next second message flow.
17. The method according to claim 15, characterized in that After increasing the reporting rate upper limit of each second message flow, the method further includes: Update the current impact rate of the second message flow on the message transmission resource.
18. The method according to claim 15, characterized in that After determining whether the current usage of the message transmission resource is lower than the second expected usage, the method further includes: In response to the current usage of the message transmission resources being higher than or equal to the second expected usage, or in response to the reporting rate upper limit of each of the second message flows reaching a preset upper limit, stop executing the step of sequentially increasing the reporting rate upper limit of reporting the second message flows to the CPU.
19. An electronic device comprising: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the method according to any one of claims 1 to 18.
20. A computer-readable storage medium, when instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the method according to any one of claims 1 to 18.
21. A computer program product comprising instructions, when a computer executes the instructions of the computer program product, the computer performs the method according to any one of claims 1 to 18.