Message processing method and apparatus, and device and storage medium

By dynamically adjusting the protocol message sending rate and adjusting the switch's message processing strategy according to the CPU resource utilization rate, the network problems caused by busy CPUs are solved, and more stable and efficient network service response is achieved.

WO2024239743A1PCT designated stage expired Publication Date: 2024-11-28INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/078895
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-05-24
Filing Date
2024-02-28
Publication Date
2024-11-28

AI Technical Summary

Technical Problem

The CPU of the switch is prone to being busy when processing a large number of protocol messages, resulting in unstable operation. The existing protocol speed limit mechanism cannot be effectively dynamically adjusted to adapt to changes in CPU resource utilization, resulting in delays in network service response or failure.

Method used

By obtaining the priority order and resource utilization of various types of protocol messages sent by the CPU, dynamically adjust the transmission rate of protocol messages, reduce or increase the total packet collection rate of the CPU, so as to keep CPU resource utilization within a reasonable range, and avoid The CPU is too busy or too idle.

Benefits of technology

It effectively avoids network failures and service delays caused by busy CPUs, improves network response speed and stability, makes the network more comfortable, and improves the CPU's processing capabilities in idle state.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024078895_28112024_PF_FP_ABST
    Figure CN2024078895_28112024_PF_FP_ABST
Patent Text Reader

Abstract

The embodiments of the present application relate to the technical field of computers. Provided are a message processing method and apparatus, and a device and a storage medium. The method comprises: acquiring a priority order of a plurality of types of protocol messages, which are sent to a CPU; during the process of sending the protocol messages to the CPU, detecting a resource utilization rate of the CPU; if the resource utilization rate of the CPU is greater than a first threshold value, decreasing the sending rate of at least one type of protocol messages among the plurality of types of protocol messages according to the priority order, such that the total packet receiving rate of the CPU is decreased to a first target packet receiving rate; and if the resource utilization rate of the CPU is less than a second threshold value, increasing the sending rate of at least one type of protocol messages among the plurality of types of protocol messages according to the priority order, such that the total packet receiving rate of the CPU is increased to a second target packet receiving rate. By means of the present application, the capability of a CPU to process a protocol message in an idle state is improved, thereby avoiding a network fault caused by a system being unstable due to the CPU being excessively busy.
Need to check novelty before this filing date? Find Prior Art

Description

A message processing method, device, equipment and storage medium

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on May 24, 2023, with application number 202310588905.4, and application name “A message processing method, device, equipment and storage medium”, all contents of which are incorporated by reference into this application. Technical Field

[0003] The present application relates to the field of computer technology, and in particular to a message processing method, apparatus, device, and non-volatile readable storage medium. Background Art

[0004] As a transmission device in the network, the switch must, on the one hand, maintain and manage hardware resources such as switching chips, network interfaces, fans and power supplies, and on the other hand, identify and process various protocol messages and send them to the CPU (Central Processing Unit). When the number of messages to be processed is too large, the CPU will be busy, and the CPU needs to be protected. In related technologies, the switch's protocol speed limit mechanism is generally used to protect the CPU's operation. However, this mechanism may have the problem of excessive speed limit, which will cause the CPU to remain busy and unstable; too small a speed limit will cause the CPU to be too idle, and the switch will not be able to perform at its best.

[0005] Summary of the Invention

[0006] In view of the above problems, some embodiments of the present application are proposed to provide a message processing method, apparatus, device and non-volatile readable storage medium that overcome the above problems or at least partially solve the above problems.

[0007] To solve the above problems, an embodiment of the present application discloses a message processing method, which is applied to a switch. The switch includes a central processing unit (CPU). The method includes:

[0008] Obtain the priority order of various types of protocol packets sent to the CPU;

[0009] While sending protocol packets to the CPU, the CPU resource utilization is detected.

[0010] If the CPU resource utilization is greater than the first threshold, the sending rate of at least one type of protocol message among the multiple types of protocol messages is reduced according to the priority order, so that the total packet receiving rate of the CPU is reduced to the first target packet receiving rate;

[0011] If the CPU resource utilization is less than the second threshold, the sending rate of at least one type of protocol message among the multiple types of protocol messages is increased according to the priority order, so that the total packet receiving rate of the CPU increases to the second target packet receiving rate.

[0012] In some embodiments, reducing the sending rate of at least one type of protocol message among multiple types of protocol messages according to the priority order includes:

[0013] The sending rate of at least one type of protocol packets among multiple types of protocol packets is reduced in ascending order of priority.

[0014] In some embodiments, increasing the sending rate of at least one type of protocol message among multiple types of protocol messages according to a priority order includes:

[0015] Increase the sending rate of at least one type of protocol packets among multiple types of protocol packets in descending order of priority.

[0016] In some embodiments, reducing the sending rate of at least one type of protocol message among multiple types of protocol messages in order of priority from low to high includes:

[0017] Get the current rate limit and current sending rate of various types of protocol packets;

[0018] Determine, according to the current rate limit value and the current sending rate, a first target protocol message whose sending rate reaches the current rate limit value among multiple types of protocol messages;

[0019] The sending rate of the first target protocol message is reduced in order of priority from low to high.

[0020] In some embodiments, reducing the sending rate of the first target protocol message includes:

[0021] Obtaining a minimum sending rate and a maximum sending rate of a first target protocol message;

[0022] Determine a base rate for the first target protocol message based on the minimum sending rate, the maximum sending rate, and CPU resource utilization;

[0023] According to the reference rate, the sending rate of the first target protocol message is reduced.

[0024] In some embodiments, reducing the sending rate of the first target protocol message according to the reference rate includes:

[0025] Determining a lowered sending rate of the first target protocol message based on a current sending rate of the first target protocol message and a reference rate;

[0026] The sending rate of the first target protocol message is reduced according to the reducible sending rate of the first target protocol message.

[0027] In some embodiments, reducing the sending rate of the first target protocol message according to the reducible sending rate of the first target protocol message includes:

[0028] Determine the packet receiving rate that the CPU needs to reduce based on the total packet receiving rate value of the CPU and the first target packet receiving rate;

[0029] If the sum of the sending rates that can be reduced for the first target protocol message is less than the packet receiving rate that the CPU needs to reduce, it is determined that the sending rate still needs to be reduced;

[0030] After the sending rate of the first target protocol message is reduced to the reference rate, the sending rates of the protocol messages with lower priorities in the first target protocol message are reduced according to the sending rates that still need to be reduced.

[0031] In some embodiments, determining the packet receiving rate that the CPU needs to reduce based on the total packet receiving rate value of the CPU and the first target rate includes:

[0032] Calculating a first ratio based on the CPU resource utilization and a first threshold;

[0033] Calculate the product of the total CPU packet receiving rate and the first ratio to obtain a first target packet receiving rate;

[0034] The difference between the total CPU packet receiving rate and the first target packet receiving rate is calculated to obtain the packet receiving rate that needs to be reduced for the CPU.

[0035] In some embodiments, the method further comprises:

[0036] Determining a first target sending rate value of the first target protocol message according to the reduced sending rate of the first target protocol message;

[0037] The current rate limit value of the first target protocol message is updated to the first target sending rate value.

[0038] In some embodiments, increasing the sending rate of at least one type of protocol message among multiple types of protocol messages in descending order of priority includes:

[0039] Get the current rate limit and current sending rate of various types of protocol packets;

[0040] Determining, according to the current rate limit value and the current sending rate, a second target protocol message whose sending rate reaches the current rate limit value among the multiple types of protocol messages;

[0041] The sending rate of the second target protocol message is increased in descending order of priority.

[0042] In some embodiments, increasing the sending rate of the second target protocol message includes:

[0043] Obtaining the minimum sending rate and the maximum sending rate of the second target protocol message;

[0044] Determine a reference rate for the second target protocol message based on the minimum sending rate, the maximum sending rate, and CPU resource utilization;

[0045] The sending rate of the second target protocol message is increased according to the reference rate.

[0046] In some embodiments, increasing the sending rate of the second target protocol message according to the base rate includes:

[0047] Obtain the current sending rate of the second target protocol message;

[0048] Determining an increaseable sending rate of the second target protocol message according to a current sending rate of the second target protocol message and a reference rate;

[0049] According to the increaseable sending rate of the second target protocol message, the sending rate of the second target protocol message is increased.

[0050] In some embodiments, obtaining a current sending rate of the second target protocol message includes:

[0051] Obtain the number of second target protocol packets sent to the CPU during a preset time period;

[0052] A current sending rate of the second target protocol messages is determined according to the number of the second target protocol messages sent to the CPU in the preset time period.

[0053] In some embodiments, increasing the sending rate of the second target protocol message according to the increaseable sending rate of the second target protocol message includes:

[0054] Determine the CPU's packet receiving rate that needs to be increased based on the CPU's total packet receiving rate and the second target packet receiving rate.

[0055] If the sum of the increase in the sending rate of the second target protocol message is less than the packet receiving rate that the CPU needs to increase, it is determined that the sending rate still needs to be increased;

[0056] After the sending rate of the second target protocol messages increases to the reference rate, the sending rates of the protocol messages with higher priorities in the second target protocol messages are increased according to the sending rates that still need to be increased.

[0057] In some embodiments, determining the packet receiving rate that the CPU needs to increase based on the total packet receiving rate value of the CPU and the second target packet receiving rate includes:

[0058] Calculate a second ratio based on the total packet receiving rate of the CPU and the second threshold;

[0059] Calculate the product of the total packet receiving rate of the CPU and the second ratio to obtain a second target packet receiving rate;

[0060] The difference between the total packet receiving rate of the CPU and the second target packet receiving rate is calculated to obtain the packet receiving rate that needs to be increased by the CPU.

[0061] In some embodiments, the method further comprises:

[0062] Determining a second target sending rate value of the second target protocol message according to the increased sending rate of the second target protocol message;

[0063] The current rate limit value of the second target protocol message is updated to the second target sending rate value.

[0064] In some embodiments, before the step of obtaining the priority order of multiple types of protocol messages sent to the CPU, the step further includes:

[0065] Set the rate limit information for various types of protocol messages, including the minimum sending rate, maximum sending rate, current rate limit value, and priority order of each type of protocol message;

[0066] Sends various types of protocol packets to the CPU according to the rate limit information.

[0067] The present application also discloses a message processing device, which is applied to a switch. The switch includes a central processing unit (CPU). The device includes:

[0068] An acquisition module is used to obtain the priority order of various types of protocol messages sent to the CPU;

[0069] A detection module is used to detect the resource utilization of the CPU during the process of sending protocol messages to the CPU;

[0070] a reducing module configured to reduce a sending rate of at least one type of protocol message among the multiple types of protocol messages according to a priority order if the CPU resource utilization is greater than a first threshold, so that the total packet receiving rate of the CPU is reduced to a first target packet receiving rate;

[0071] An adding module is used to increase the sending rate of at least one type of protocol message among multiple types of protocol messages according to the priority order if the CPU resource utilization is less than the second threshold, so that the total packet receiving rate of the CPU increases to the second target packet receiving rate.

[0072] In some embodiments, the lowering module comprises:

[0073] The reducing submodule is used to reduce the sending rate of at least one type of protocol message among the multiple types of protocol messages in order of priority from low to high.

[0074] In some embodiments, the module is added, including:

[0075] The added submodule is used to increase the sending rate of at least one type of protocol message among multiple types of protocol messages in order of priority from high to low.

[0076] In some embodiments, the lowering submodule includes:

[0077] A first acquisition unit is used to obtain current rate limits and current sending rates of multiple types of protocol packets;

[0078] A first determining unit is configured to determine, according to the current rate limit value and the current sending rate, a first target protocol message whose sending rate reaches the current rate limit value among the multiple types of protocol messages;

[0079] The reducing unit is configured to reduce the sending rate of the first target protocol message in order of priority from low to high.

[0080] In some embodiments, the lowering unit comprises:

[0081] A first acquisition subunit, configured to acquire a minimum sending rate and a maximum sending rate of a first target protocol message;

[0082] A first determining subunit, configured to determine a reference rate of a first target protocol message according to a minimum sending rate, a maximum sending rate, and CPU resource utilization;

[0083] The first reducing subunit is configured to reduce the sending rate of the first target protocol message according to the reference rate.

[0084] In some embodiments, the first lowering subunit comprises:

[0085] A second determining subunit, configured to determine a sending rate of the first target protocol message that can be reduced according to a current sending rate of the first target protocol message and a reference rate;

[0086] The second reducing subunit is configured to reduce the sending rate of the first target protocol message according to the reducible sending rate of the first target protocol message.

[0087] In some embodiments, the second lowering subunit comprises:

[0088] a third determining subunit, configured to determine a packet receiving rate that the CPU needs to reduce based on the total packet receiving rate value of the CPU and the first target packet receiving rate;

[0089] a fourth determining subunit, configured to determine a further reduction in the sending rate if the sum of the sending rates of the first target protocol packets that can be reduced is less than the packet receiving rate that the CPU needs to reduce;

[0090] The third reducing subunit is configured to reduce the sending rates of protocol messages with lower priorities in the first target protocol messages according to the sending rates that need to be reduced after the sending rate of the first target protocol messages is reduced to the reference rate.

[0091] In some embodiments, the third determining subunit includes:

[0092] A first calculation subunit, configured to calculate a first ratio according to a CPU resource utilization and a first threshold;

[0093] The second calculation subunit is configured to calculate the product of the total CPU packet receiving rate and the first ratio to obtain a first target packet receiving rate;

[0094] The third calculation subunit is configured to calculate the difference between the total packet receiving rate of the CPU and the first target packet receiving rate, and obtain the packet receiving rate that the CPU needs to reduce.

[0095] In some embodiments, the apparatus further comprises:

[0096] A first determining module, configured to determine a first target sending rate value of the first target protocol message according to the reduced sending rate of the first target protocol message;

[0097] The first updating module is configured to update the current rate limit value of the first target protocol message to a first target sending rate value.

[0098] In some embodiments, submodules are added, including:

[0099] The second acquisition unit is used to obtain the current rate limit value and current sending rate of multiple types of protocol messages;

[0100] A second determining unit is configured to determine, according to the current rate limit value and the current sending rate, a second target protocol message whose sending rate reaches the current rate limit value among the multiple types of protocol messages;

[0101] The increasing unit is used to increase the sending rate of the second target protocol message in order of priority from high to low.

[0102] In some embodiments, the adding unit includes:

[0103] A second acquisition subunit is used to obtain the minimum sending rate and the maximum sending rate of the second target protocol message;

[0104] a fifth determining subunit, configured to determine a reference rate of the second target protocol message according to the minimum sending rate, the maximum sending rate, and the resource utilization of the CPU;

[0105] The first increasing subunit is configured to increase the sending rate of the second target protocol message according to the reference rate.

[0106] In some embodiments, the first adding subunit includes:

[0107] A third acquisition subunit is used to obtain a sending rate of a second target protocol message;

[0108] a sixth determining subunit, configured to determine an increaseable sending rate of the second target protocol message according to the current sending rate of the second target protocol message and the reference rate;

[0109] The second increasing subunit is configured to increase the sending rate of the second target protocol message according to the increaseable sending rate of the second target protocol message.

[0110] In some embodiments, the third acquisition subunit includes:

[0111] A fourth acquisition subunit is used to acquire the number of second target protocol packets sent to the CPU in a preset time period;

[0112] The seventh determining subunit is configured to determine a sending rate of the second target protocol messages according to the number of the second target protocol messages sent to the CPU within a preset time period.

[0113] In some embodiments, the second adding subunit includes:

[0114] An eighth determining subunit, configured to determine a packet receiving rate that the CPU needs to increase according to the total packet receiving rate value of the CPU and the second target packet receiving rate;

[0115] a ninth determining subunit, configured to determine a further increase in the sending rate if the sum of the second target protocol message sending rates that can be increased is less than the packet receiving rate that the CPU needs to increase;

[0116] The third increasing subunit is configured to increase the sending rate of the protocol messages with higher priorities in the second target protocol messages according to the sending rate that needs to be increased after the sending rate of the second target protocol messages increases to the reference rate.

[0117] In some embodiments, the eighth determining subunit includes:

[0118] The first calculation subunit is configured to calculate a second ratio according to the total packet receiving rate of the CPU and a second threshold;

[0119] The second calculation subunit is configured to calculate the product of the total packet receiving rate of the CPU and the second ratio to obtain a second target packet receiving rate;

[0120] The third calculation subunit is configured to calculate the difference between the total packet receiving rate of the CPU and the second target packet receiving rate, and obtain the packet receiving rate that the CPU needs to increase.

[0121] In some embodiments, the apparatus further comprises:

[0122] A second determining module, configured to determine a second target sending rate value of the second target protocol message according to the increased sending rate of the second target protocol message;

[0123] The second updating module is configured to update the current rate limit value of the second target protocol message to a second target sending rate value.

[0124] In some embodiments, the apparatus further comprises:

[0125] The setting module is used to set the speed limit information of various types of protocol messages. The speed limit information includes the minimum sending rate, maximum sending rate, current speed limit value, and priority order of various types of protocol messages;

[0126] The sending module is used to send various types of protocol messages to the CPU according to the rate limit information.

[0127] The present application also discloses an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the steps of the message processing method described above are implemented.

[0128] The present application also discloses a non-volatile readable storage medium, characterized in that a computer program is stored on the non-volatile readable storage medium, and when the computer program is executed by a processor, the steps of the message processing method as described above are implemented.

[0129] The embodiments of the present application include the following advantages:

[0130] This application can dynamically adjust the rate at which protocol messages are sent to the CPU according to the CPU resource utilization. When the CPU resource utilization is very high, the sending rate of at least one type of protocol message among multiple types of protocol messages is reduced, thereby reducing the CPU resource utilization, thereby avoiding the CPU being too busy and causing key network services to not respond and causing network failures; when the CPU resource utilization is low, the sending rate of at least one type of protocol message among multiple types of protocol messages is increased, thereby increasing the protocol messages processed by the CPU, which can speed up the response of network services and make the network more comfortable. BRIEF DESCRIPTION OF THE DRAWINGS

[0131] FIG1 is a flowchart of a message processing method provided by some embodiments of the present application;

[0132] FIG2 is a flowchart of another message processing method provided in some embodiments of the present application;

[0133] FIG3 is a structural block diagram of a message processing device provided in some embodiments of the present application;

[0134] FIG4 is a structural block diagram of an electronic device provided in some embodiments of the present application;

[0135] FIG5 is a structural block diagram of a non-volatile readable storage medium provided in some embodiments of the present application. DETAILED DESCRIPTION

[0136] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0137] As a transmission device in the network, the switch must, on the one hand, maintain and manage hardware resources such as switching chips, network interfaces, fans and power supplies, and on the other hand, identify and process various protocol messages, such as ARP (Address Resolution Protocol) messages, which are used to learn host routing services; OSPF (Open Shortest Path First) protocol, which is used to transmit routing table information and select the best forwarding path; Telnet (Remote Login System) messages, which provide services for users to manage switches; SNMP (Simple Network Management Protocol) protocol, etc. Due to the limited processing power of the CPU of the switch, when the number of protocol messages that need to be processed increases, it may cause the CPU to be busy. Especially when there are a large number of attack messages in the network, if these messages are allowed to be sent to the CPU, the CPU will not be able to operate normally, resulting in users failing to access the network and the administrator being unable to manage the switch properly.

[0138] To address this situation, the CPU needs to be protected. In related technologies, this is typically done by matching protocol message characteristics with the switch chip's ACL (Access Control List) resources. The messages are then sent to the CPU for processing based on pre-defined actions. A meter rate limit table (primarily used for network speed limiting) is also bound to implement speed limiting. Messages within the speed limit are allowed to be sent to the CPU, while messages exceeding the speed limit are not. This type of rate limiting based on message type is called protocol rate limiting.

[0139] Because the network environment is constantly changing, the CPU's operating status also fluctuates. When the CPU is idle, it can process more protocol packets. However, the rate limit setting prevents protocol packets exceeding the rate limit from being sent to the CPU in a timely manner, resulting in delayed network service responses. On the other hand, when the CPU is busy, even if no protocol packets exceed their rate limit, the simultaneous sending of many protocol packets to the CPU can still cause the CPU to become even more busy and malfunction, preventing certain critical network services from being able to function and causing network failures. Therefore, fixed rate limits cannot meet the needs of a dynamically changing network environment.

[0140] Based on this, the present application creatively proposes a message processing method, which can dynamically adjust the rate at which protocol messages are sent to the CPU according to the CPU resource utilization. When the CPU resource utilization is very high, the sending rate of at least one type of protocol message among multiple types of protocol messages is reduced, thereby reducing the CPU resource utilization, thereby avoiding the CPU being too busy and causing key network services to not respond and causing network failures; when the CPU resource utilization is low, the sending rate of at least one type of protocol message among multiple types of protocol messages is increased, thereby increasing the protocol messages processed by the CPU, which can speed up the response of network services and make the network more comfortable.

[0141] 1 , a flowchart of a message processing method according to some embodiments of the present application is shown. The method is applied to a switch including a central processing unit (CPU). The method may include the following steps:

[0142] Step 101: Obtain the priority order of multiple types of protocol messages sent to the CPU.

[0143] In some embodiments of the present application, different types of protocol messages correspond to different priority orders, and the protocol message with the higher priority is sent first. In one example, the multiple types of messages sent to the CPU include ARP, OSPF, Telnet, and SNMP. The priority level corresponding to ARP is 1, the priority level corresponding to OSPF is 2, the priority level corresponding to Telnet is 3, and the priority level corresponding to SNMP is 4, which means that SNMP has the highest priority level. Then, the sending order of these four protocols is SNMP, Telnet, OSPF, and ARP. That is, the host computer can obtain the priority order of the multiple types of protocol messages sent to the CPU, and then send the multiple types of messages in the order of priority.

[0144] It should be noted that the priority order of various types of protocol messages can be set according to user needs and is not limited here.

[0145] Step 102: In the process of sending the protocol message to the CPU, the resource utilization of the CPU is detected.

[0146] In some embodiments of the present application, the resource utilization of the CPU can be used to represent the busyness of the CPU. The higher the resource utilization of the CPU, the busier the CPU is, and the lower the resource utilization of the CPU, the idler the CPU is.

[0147] In some examples, the resource utilization of the CPU can be detected through a preset interface of the switch.

[0148] Step 103: If the CPU resource utilization is greater than the first threshold, the sending rate of at least one type of protocol message among the multiple types of protocol messages is reduced according to the priority order, so that the total packet receiving rate of the CPU is reduced to the first target packet receiving rate.

[0149] In some embodiments of the present application, the first threshold is a standard for determining whether the CPU is busy, and can be set according to user needs. It is not limited here. The first target packet receiving rate refers to the total packet receiving rate of the CPU when the CPU resource utilization is not greater than the first threshold.

[0150] In some examples, if the first threshold is 90%, if the CPU utilization detected through the preset interface of the switch is 95, and the CPU resource utilization is greater than the first threshold at this time, it is determined that the CPU is in a busy state at this time, and the sending rate of at least one type of protocol message among the multiple types of protocol messages can be reduced according to the priority order, from high to low or from low to high, so that the total packet receiving rate of the CPU is reduced to the first target packet receiving rate, thereby reducing the CPU utilization to below the first threshold.

[0151] Step 104: If the CPU resource utilization is less than the second threshold, increase the sending rate of at least one type of protocol message among the multiple types of protocol messages according to the priority order, so that the total packet receiving rate of the CPU increases to the second target packet receiving rate.

[0152] In some embodiments of the present application, the second threshold is a standard for determining whether the CPU is idle, and can be set according to user needs. It is not limited here. The second target packet receiving rate refers to the total packet receiving rate of the CPU when the CPU resource utilization is not less than the second threshold.

[0153] In some examples, if the second threshold is 80%, if the resource utilization of the CPU detected through the preset interface of the switch is 50%, and the resource utilization of the CPU is less than the second threshold at this time, the CPU is determined to be in an idle state, and the sending rate of at least one type of protocol message among the multiple types of protocol messages can be increased from high to low or from low to high according to the priority order of the multiple types of messages obtained, so that the total packet receiving rate of the CPU is increased to the second target packet receiving rate, thereby increasing the resource utilization of the CPU to above the second threshold.

[0154] In some embodiments of the present application, if the resource utilization of the CPU is between the second threshold and the first threshold, it means that the CPU is in a normal working state and the CPU does not need to be processed.

[0155] This application can dynamically adjust the rate at which protocol messages are sent to the CPU according to the CPU resource utilization. When the CPU resource utilization is very high, the sending rate of at least one type of protocol message among multiple types of protocol messages is reduced, thereby reducing the CPU resource utilization, thereby avoiding the CPU being too busy and causing key network services to not respond and causing network failures; when the CPU resource utilization is low, the sending rate of at least one type of protocol message among multiple types of protocol messages is increased, thereby increasing the protocol messages processed by the CPU, which can speed up the response of network services and make the network more comfortable.

[0156] 2 , a flowchart of another message processing method proposed in some embodiments of the present application is shown. The method is applied to a switch including a central processing unit (CPU). The method may include the following steps:

[0157] Step 201: Obtain the priority order of multiple types of protocol messages sent to the CPU.

[0158] Step 202: In the process of sending the protocol message to the CPU, the resource utilization of the CPU is detected.

[0159] Step 203: If the CPU resource utilization is greater than the first threshold, the sending rate of at least one type of protocol message among the multiple types of protocol messages is reduced in order of priority from low to high, so that the total packet receiving rate of the CPU is reduced to the first target packet receiving rate.

[0160] In some embodiments of the present application, in order to ensure that the sending rate of protocol messages with high priority is not affected, when the CPU is determined to be busy, the sending rate of protocol messages with low priority can be preferentially reduced, that is, the sending rate of at least one type of protocol message among multiple types of protocol messages can be reduced in order from low to high priority, so that the total packet receiving rate of the CPU is reduced to the first target packet receiving rate.

[0161] In some embodiments of the present application, reducing the sending rate of at least one type of protocol message among multiple types of protocol messages in order of priority from low to high may include the following sub-steps:

[0162] Sub-step S21, obtaining current rate limits and current sending rates of multiple types of protocol messages.

[0163] In some embodiments of the present application, various protocol messages correspond to different current speed limit values, and the current speed limit value is used to limit the rate at which the protocol messages are sent. In one example, if the current speed limit value of the protocol message SNMP is 200PPS (packets per second), it means that the rate at which the protocol messages are sent cannot exceed 200PPS.

[0164] The current sending rate of various types of protocol packets can be obtained by dividing the number of various protocol packets sent in a preset time period by the preset time. In some examples, if OSPF sends 1200 packets within 3 seconds, it means that the current rate of OSPF is 400 PPS.

[0165] Sub-step S22, determining a first target protocol message having a sending rate reaching the current rate limit value among the multiple types of protocol messages according to the current rate limit value and the current sending rate.

[0166] In some embodiments of the present application, the first target protocol message refers to a protocol message whose sending rate reaches the current speed limit value. The first target protocol message among various types of protocol messages can be determined based on the current speed limit value and current sending rate of various types of protocol messages.

[0167] In some examples, multiple protocol messages include STP (Spanning Tree Protocol), LACP (Link Aggregation Control Protocol), and BGP (Border Gateway Protocol). The current speed limit value of STP is 200PPS, and the current sending rate is 150PPS. The current speed limit value of LACP is 1000PPS, and the current sending rate is 1000PPS. The current speed limit value of BGP is 600PPS, and the current sending rate is 500PPS. It can be determined that the first target protocol message is LACP.

[0168] Sub-step S23, reducing the sending rate of the first target protocol message in order of priority from low to high.

[0169] In some embodiments of the present application, when the first target protocol message includes a single one, the sending rate of the first target protocol message can be directly reduced; when the first target protocol message includes multiple ones, after determining the first target protocol message, the sending rate of the first target protocol message can be reduced in order of priority from low to high.

[0170] In some embodiments of the present application, reducing the sending rate of the first target protocol message includes:

[0171] Step S231: Acquire the minimum sending rate and the maximum sending rate of the first target protocol message.

[0172] In some embodiments of the present application, various protocol messages correspond to different minimum sending rates and maximum sending rates. The minimum sending rate can be 0, indicating that the message is not sent to the CPU. The maximum sending rate does not exceed the total packet receiving speed limit of the CPU. The minimum sending rate and the maximum sending rate can be set according to the processing capacity of the CPU and the possible rate of each protocol message in the network environment.

[0173] In some examples, the first target protocol message is BGP, the minimum sending rate of BGP is 100 PPS, and the maximum sending rate is 1000 PPS.

[0174] Step S232: Determine a reference rate for the first target protocol message according to the minimum sending rate, the maximum sending rate, and the CPU resource utilization.

[0175] In some embodiments of the present application, the base rate of the first target protocol message can be calculated by the following formula: V 基准1 =V min1 +(V max1 -V min1 )*(1-Pcpu )*alpha formula (1)

[0176] Among them, V 基准1 is the base rate of the first target protocol message, V min1 is the minimum sending rate of the first target protocol message, V max1 is the maximum sending rate of the first target protocol message, alpha is the adjustment factor, P CPU Refers to the CPU resource utilization.

[0177] In one example, the first target protocol message is IP2ME, V min1 For 100PPS, V max1 is 2000, alpha is 10, and the CPU resource utilization is 95%. Then, the base rate of the first target protocol message calculated according to formula (1) is 1050 PPS.

[0178] Step S233: Reduce the sending rate of the first target protocol message according to the reference rate.

[0179] In some embodiments of the present application, after determining the reference rate of the first target protocol message, the rate value to which the first target protocol message can be specifically reduced may be determined.

[0180] In some embodiments of the present application, step S233 may include:

[0181] Step S2331: Determine a lowerable sending rate of the first target protocol message according to the current sending rate and the reference rate of the first target protocol message.

[0182] In some examples, according to some of the above examples, the first target protocol message is IP2ME, the base rate is 1050PPS, and the current sending rate is 1100PPS, which means that the sending rate of the first target protocol message can be reduced to 50PPS.

[0183] Step S2332: Reduce the sending rate of the target protocol message according to the target protocol message's reducible sending rate.

[0184] In some embodiments of the present application, after determining the lowerable sending rate of the first target protocol message, the sending rate of the first target protocol message may be reduced to 1050 PPS.

[0185] In some embodiments of the present application, step S2332 may include:

[0186] The packet receiving rate that the CPU needs to reduce is determined based on the total packet receiving rate value of the CPU and the first target packet receiving rate; if the sum of the sending rates that can be reduced for the first target protocol messages is less than the packet receiving rate that the CPU needs to reduce, the sending rate that needs to be reduced is determined; after the sending rate of the first target protocol messages is reduced to the reference rate, the sending rates of the protocol messages with lower priorities in the first target protocol messages are reduced based on the sending rates that need to be reduced.

[0187] In some embodiments of the present application, the total packet receiving rate value of the CPU can be subtracted from the first target packet receiving rate to obtain the packet receiving rate that the CPU needs to reduce. If the sum of the sending rates that can be reduced for the first target protocol messages is less than the packet receiving rate that the CPU needs to reduce, it means that when the current sending rate of the first target protocol messages is reduced to the benchmark rate, the resource utilization of the CPU has not yet been reduced to the first threshold, and at this time, the sending rate of the first target protocol messages needs to be further reduced.

[0188] In some examples, when the CPU needs to reduce the packet receiving rate to 450PPS, the first target protocol messages include two, OSPF and SNMP, the sending rate that OSPF can reduce is 150PPS, the sending rate that SNMP can reduce is 150PPS, the priority of OSPF is 5, and the sending rate of SNMP is 4. After the sending rate of OSPF is reduced by 150PPS and the sending rate of SNMP is reduced by 150PPS, since the priority of SNMP is lower, the sending rate of SNMP is further reduced by 450-150-150=150PPS.

[0189] In some embodiments of the present application, determining the packet receiving rate that the CPU needs to reduce based on the total packet receiving rate value of the CPU and the first target packet receiving rate includes:

[0190] A first ratio is calculated based on the CPU resource utilization and a first threshold; a first target packet receiving rate is obtained by multiplying the total CPU packet receiving rate by the first ratio; and a difference between the total CPU packet receiving rate and the first target packet receiving rate is calculated to obtain a packet receiving rate that the CPU needs to reduce.

[0191] In some embodiments of the present application, the first target packet receiving rate can be calculated by the following formula (2): V 目标1 =V cpu *(1+T1-P cpu ) Formula (2)

[0192] Among them, V 目标1 is the first target packet receiving rate, V CPU is the total packet receiving rate of the CPU, T1 is the first threshold, P CPU Indicates the CPU resource utilization.

[0193] The packet receiving rate that the CPU needs to reduce can be calculated using the following formula (3): V Δ1 =V cpu -V 目标1 Formula (3)

[0194] Among them, V △1 The CPU needs to reduce the packet receiving rate.

[0195] In an example, as shown in Table 1, the various types of protocol messages sent by the switch to the CPU are STP, LACP, BGP, OSPF, DHCP (Dynamic Host Configuration Protocol), ARP, and IP2ME. The first threshold is 90%, the CPU resource utilization is 95%, and the alpha value is 10.

[0196] Table 1

[0197] According to the current sending rate of various protocol messages, the total packet receiving rate of the CPU can be determined to be 3000 PPS. The first target packet receiving rate V can be calculated by formula (2): 目标1 =3000*(100%+90%-95%)=2850PPS, then V △1 =3000-2850=150PPS. According to Table 1, only the current sending rate of IP2ME reaches the current speed limit, that is, the first target protocol message is IP2ME. According to formula (1), the base rate is calculated to be 1050. Then, the sending rate of the first target protocol message that can be reduced is 1100-1050=50PPS. It can be seen that 50PPS<150PPS, that is, the sending rate of the first target protocol message needs to be further reduced. The sending rate of the first target protocol message that needs to be reduced is 150-50=100PPS, that is, the rate of the first target protocol message IP2ME is reduced from 1050PPS to 950PPS by 100PPS.

[0198] In some embodiments of the present application, the method further includes:

[0199] According to the reduced sending rate of the first target protocol message, a first target sending rate value of the first target protocol message is determined; and a current rate limit value of the first target protocol message is updated to the first target sending rate value.

[0200] In some embodiments of the present application, since the current speed limit value of the first target protocol message IP2ME is 1100PPS, in order to ensure that the sending rate of the first target protocol message IP2ME does not exceed 950PPS, the first target sending rate value of the first target protocol message can be determined according to the reduced sending rate of the first target protocol message. In the above Table 1, the reduced sending rate of the first target protocol message IP2ME is 50+100=150PPS, and the first target sending rate value of the first target protocol message is 1100-150=950PPS. Then, the current speed limit value of the first target protocol message can be updated to 950PPS. The present application can reduce the burden on the CPU through a speed reduction strategy when the CPU is busy, thereby avoiding network failures caused by system instability due to the CPU being too busy.

[0201] Step 204: If the CPU resource utilization is less than the second threshold, the sending rate of at least one type of protocol message among the multiple types of protocol messages is increased in descending order of priority, so that the total packet receiving rate of the CPU increases to the second target packet receiving rate.

[0202] In some embodiments of the present application, when it is determined that the CPU is in an idle state, the sending rate of protocol messages with high priority levels can be increased preferentially, that is, the sending rate of at least one type of protocol message among multiple types of protocol messages can be increased in order of priority from high to low, so that the total packet receiving rate of the CPU is increased to the second target packet receiving rate.

[0203] In some embodiments of the present application, increasing the sending rate of at least one type of protocol message among multiple types of protocol messages in descending order of priority may include:

[0204] S24, obtaining current rate limits and current sending rates of multiple types of protocol messages.

[0205] In some embodiments of the present application, various protocol messages correspond to different current speed limit values, and the current speed limit value is used to limit the rate at which the protocol messages are sent. In some examples, if the current speed limit value of the protocol message STP is 100PPS (packets per second), it means that the rate at which the protocol messages are sent cannot exceed 100PPS.

[0206] The current sending rate of various types of protocol packets can be obtained by dividing the number of various protocol packets sent in a preset time period by the preset time. In some examples, OSPF sends 0 packets within 3 seconds, which means that the current sending rate of OSPF is 0 PPS.

[0207] S25 , determining, according to the current rate limit value and the current sending rate, a second target protocol message whose sending rate reaches the current rate limit value among the multiple types of protocol messages.

[0208] In some embodiments of the present application, the second target protocol message refers to a protocol message whose sending rate reaches the current speed limit value. The first target protocol message among various types of protocol messages can be determined based on the current speed limit value and current sending rate of various types of protocol messages.

[0209] In an example, multiple protocol messages include STP (Spanning Tree Protocol), LACP (Link Aggregation Control Protocol), BGP (Border Gateway Protocol), and ARP. The current speed limit value of STP is 200PPS, and the current sending rate is 150PPS. The current speed limit value of LACP is 1000PPS, and the current sending rate is 900PPS. The current speed limit value of BGP is 600PPS, and the current sending rate is 500PPS. The current speed limit value of ARP is 1000PPS, and the current sending rate is 1000PPS. It can be determined that the second target protocol message is ARP.

[0210] It should be noted that if the sending rate of multiple types of protocol packets does not reach the current rate limit, no operation is performed.

[0211] S26: Increase the sending rate of the second target protocol message in descending order of priority.

[0212] In some embodiments of the present application, when the second target protocol message includes a single one, the sending rate of the second target protocol message can be directly increased; when the second target protocol message includes multiple ones, after determining the second target protocol message, the sending rate of the second target protocol message can be increased in order of priority from high to low.

[0213] In some embodiments of the present application, increasing the sending rate of the second target protocol message includes:

[0214] S261: Acquire a minimum sending rate and a maximum sending rate of a second target protocol message.

[0215] In an embodiment of the present application, various protocol messages correspond to different minimum sending rates and maximum sending rates. The minimum sending rate can be 0, indicating that the message is not sent to the CPU, and the maximum sending rate does not exceed the total packet receiving speed limit of the CPU. The minimum sending rate and the maximum sending rate can be set according to the processing capacity of the CPU and the possible rate of each protocol message in the network environment.

[0216] In some examples, the minimum sending rate and the maximum sending rate of DHCP are 100 PPS and 2000 PPS respectively, which means that the sending rate of DHCP may be 100 to 2000 PPS.

[0217] S262: Determine a reference rate for the second target protocol message according to the minimum sending rate, the maximum sending rate, and the CPU resource utilization.

[0218] In some embodiments of the present application, the base rate of the second target protocol message can be calculated by the following formula (4): V 基准2 =V min2 +(V max2 -V min2 )*(1-P cpu )*alpha formula (4)

[0219] Among them, V 基准2 is the reference rate of the second target protocol message, V min2 is the minimum sending rate of the second target protocol message, V max2 is the maximum sending rate of the second target protocol message, alpha is the adjustment factor, P CPU Refers to the CPU resource utilization.

[0220] In one example, the second target protocol message is ARP, V min2 For 100PPS, V max2 is 2000, alpha is 1, and the CPU resource utilization is 50%. Then, the base rate of the first target protocol message calculated according to formula (4) is 1050 PPS.

[0221] S263: Increase the sending rate of the second target protocol message according to the reference rate.

[0222] In some embodiments of the present application, after determining the baseline rate of the second target protocol message, a specific rate value that the second target protocol message can be increased by may be determined.

[0223] In some embodiments of the present application, S263 may include:

[0224] S2631: Obtain a sending rate of a second target protocol message.

[0225] In some embodiments of the present application, the sending rate of the second target protocol message can be calculated based on the number of messages generated per unit time.

[0226] In some embodiments of the present application, S2631 may include:

[0227] The number of second target protocol messages sent to the CPU during the preset time period is obtained, and a current sending rate of the second target protocol messages is determined according to the number of second target protocol messages sent to the CPU during the preset time period.

[0228] In some embodiments of the present application, the number of second target protocol messages sent to the CPU within 5 seconds is 5000 packets, and the current sending rate of the second target protocol messages is 1000 PPS.

[0229] S2632: Determine an increaseable sending rate of the second target protocol message based on the current sending rate of the second target protocol message and the reference rate.

[0230] In some embodiments of the present application, according to the above example, the second target protocol message is ARP, the base rate is 1050PPS, and the current sending rate is 1000PPS, which means that the sending rate of the second target protocol message can be increased by 50PPS.

[0231] S2633: Increase the sending rate of the target protocol message according to the increaseable sending rate of the target protocol message.

[0232] In some embodiments of the present application, after determining the increaseable sending rate of the second target protocol message, the sending rate of the second target protocol message may be increased to 1050 PPS.

[0233] In some embodiments of the present application, S2633 may include:

[0234] The packet receiving rate that the CPU needs to increase is determined based on the total packet receiving rate value of the CPU and the second target packet receiving rate; if the sum of the sending rates that can be increased for the second target protocol messages is less than the packet receiving rate that the CPU needs to increase, it is determined that the sending rate still needs to be increased; after the sending rate of the second target protocol messages is increased to the baseline rate, the sending rate of the protocol messages with higher priorities in the second target protocol messages is increased based on the sending rate that still needs to be increased.

[0235] In some embodiments of the present application, the second target packet receiving rate minus the total packet receiving rate of the CPU can be used to obtain the packet receiving rate that the CPU needs to increase. If the sum of the sending rates that the second target protocol messages can increase is less than the packet receiving rate that the CPU needs to increase, it means that when the current sending rate of the second target protocol messages is increased to the baseline rate, the resource utilization of the CPU has not yet increased to the second threshold, and at this time, the sending rate of the second target protocol messages needs to be further increased.

[0236] In some examples, when the CPU needs to increase the packet receiving rate to 500PPS, the second target protocol messages include two, OSPF and ARP, the OSPF sending rate can be increased to 150PPS, the ARP sending rate can be increased to 100PPS, the OSPF priority is 5, and the ARP priority is 4. After the OSPF sending rate is increased by 150PPS and the ARP sending rate is increased by 100PPS, since OSPF has a higher priority, the OSPF sending rate is further increased by 500-150-100=250PPS.

[0237] In some embodiments of the present application, determining the packet receiving rate that the CPU needs to increase based on the total packet receiving rate value of the CPU and the second target packet receiving rate includes:

[0238] A second ratio is calculated based on the total packet receiving rate of the CPU and the second threshold; the product of the total packet receiving rate of the CPU and the second ratio is calculated to obtain a second target packet receiving rate; and the difference between the total packet receiving rate of the CPU and the second target packet receiving rate is calculated to obtain the packet receiving rate that the CPU needs to increase.

[0239] In some embodiments of the present application, the second target packet receiving rate can be calculated by the following formula (5): V 目标2 =V cpu *(1+T2-Pcpu) Formula (5)

[0240] Among them, V 目标2 is the second target packet receiving rate, V CPU is the total packet receiving rate of the CPU, T2 is the second threshold, P cpu Indicates the CPU resource utilization.

[0241] The packet receiving rate that the CPU needs to increase can be calculated using the following formula (3): V Δ2 =V 目标2 -V cpu Formula (6)

[0242] Among them, V △2 The CPU needs to increase the packet receiving rate.

[0243] As shown in Table 2, the various types of protocol packets sent by the switch to the CPU are STP, LACP, BGP, OSPF, DHCP, ARP, and IP2ME. The first threshold is 80%, the CPU resource utilization is 50%, and the alpha value is 1.

[0244] Table 2

[0245] According to the current sending rate of various protocol messages, the total packet receiving rate of the CPU can be determined to be 2000PPS. The second target packet receiving rate V can be calculated by formula (5): 目标2 =2000*(100%+80%-50%)=2600PPS, then V △2 =2600-2000=600PPS. According to Table 2, only the current sending rate of ARP reaches the current rate limit, that is, the second target protocol message is ARP. According to formula (4), the base rate is calculated to be 1050. Then, the sending rate of the second target protocol message that can be increased is 1050-1000=50PPS. It can be seen that 50PPS<600PPS, that is, the sending rate of the second target protocol message needs to be further increased. The sending rate of the second target protocol message also needs to be increased to 600-50=550PPS, that is, the sending rate of the second target protocol message ARP needs to be further increased from 1050PPS to 1600PPS.

[0246] In some embodiments of the present application, the present invention further includes:

[0247] According to the increased sending rate of the second target protocol message, a second target sending rate value of the second target protocol message is determined; and the current rate limit value of the second target protocol message is updated to the second target sending rate value.

[0248] In some embodiments of the present application, since the current speed limit value of the second target protocol message ARP is 1000PPS, in order to ensure that the sending rate of the second target protocol message ARP can reach 1600PPS, the second target sending rate value of the second target protocol message can be determined according to the increased sending rate of the second target protocol message. In the above Table 1, the increased sending rate of the second target protocol message ARP is 50+550=600PPS, and the second target sending rate value of the second target protocol message is 1050+550=1600PPS. Then, the current speed limit value of the second target protocol message can be updated to 1600PPS. The present application can reduce the burden on the CPU through a speed reduction strategy when the CPU is busy, thereby avoiding network failures caused by system instability due to the CPU being too busy.

[0249] In some embodiments of the present application, before step 201, the following steps may also be included:

[0250] Set rate limits for various protocol types. The rate limit information includes the minimum and maximum sending rates, current rate limits, and priority levels for each type of protocol. The protocol types are sent to the CPU based on the rate limit information.

[0251] In some embodiments of the present application, before sending multiple types of messages to the CPU, the switch first classifies the messages according to their protocol types and then sets rate limits for each type of message. After setting the rate limits, the switch can then send the various protocol messages to the CPU. The rate information includes the minimum and maximum sending rates, current rate limits, and priority order for each type of protocol message.

[0252] This application dynamically adjusts the rate at which protocol messages are sent to the CPU based on CPU resource utilization. When CPU resource utilization is very high, the number of protocol messages sent to the CPU is reduced through the CPU packet reception speed reduction strategy, thereby reducing CPU resource utilization and preventing the CPU from being too busy and causing critical network services to not respond, resulting in network failures. When CPU resource utilization is low, the number of protocol messages sent to the CPU is increased through the CPU packet reception acceleration strategy, thereby increasing the number of protocol messages processed by the CPU, which can speed up the response of network services and make the network smoother. This dynamic speed limit adjustment strategy improves the CPU's ability to process protocol messages in an idle state, and can better respond to network service needs. When the CPU is busy, the speed reduction strategy reduces the burden on the CPU, avoiding network failures caused by system instability due to an overly busy CPU.

[0253] FIG3 shows a block diagram of a message processing device provided in some embodiments of the present application, which is applied to a switch. The switch includes a central processing unit (CPU). The device may include:

[0254] An acquisition module 301 is configured to acquire a priority order of multiple types of protocol messages sent to the CPU;

[0255] The detection module 302 is used to detect the resource utilization of the CPU during the process of sending the protocol message to the CPU;

[0256] a reducing module 303 configured to reduce, if the CPU resource utilization is greater than a first threshold, a sending rate of at least one type of protocol message among the multiple types of protocol messages according to a priority order, so that the total packet receiving rate of the CPU is reduced to a first target packet receiving rate;

[0257] The increasing module 304 is used to increase the sending rate of at least one type of protocol message among multiple types of protocol messages according to the priority order if the CPU resource utilization is less than the second threshold, so that the total packet receiving rate of the CPU increases to the second target packet receiving rate.

[0258] In some embodiments of the present application, the reducing module 303 may include:

[0259] The reducing submodule is used to reduce the sending rate of at least one type of protocol message among the multiple types of protocol messages in order of priority from low to high.

[0260] In some embodiments of the present application, adding module 304 may include:

[0261] The added submodule is used to increase the sending rate of at least one type of protocol message among multiple types of protocol messages in order of priority from high to low.

[0262] In some embodiments of the present application, the reduction submodule may include:

[0263] A first acquisition unit is used to obtain current rate limits and current sending rates of multiple types of protocol packets;

[0264] A first determining unit is configured to determine, according to the current rate limit value and the current sending rate, a first target protocol message whose sending rate reaches the current rate limit value among the multiple types of protocol messages;

[0265] The reducing unit is configured to reduce the sending rate of the first target protocol message in order of priority from low to high.

[0266] In some embodiments of the present application, the lowering unit may include:

[0267] A first acquisition subunit, configured to acquire a minimum sending rate and a maximum sending rate of a first target protocol message;

[0268] A first determining subunit, configured to determine a reference rate of a first target protocol message according to a minimum sending rate, a maximum sending rate, and CPU resource utilization;

[0269] The first reducing subunit is configured to reduce the sending rate of the first target protocol message according to the reference rate.

[0270] In some embodiments of the present application, the first lowering subunit may include:

[0271] A second determining subunit, configured to determine a sending rate of the first target protocol message that can be reduced according to a current sending rate of the first target protocol message and a reference rate;

[0272] The second reducing subunit is configured to reduce the sending rate of the first target protocol message according to the reducible sending rate of the first target protocol message.

[0273] In some embodiments of the present application, the second lowering subunit may include:

[0274] a third determining subunit, configured to determine a packet receiving rate that the CPU needs to reduce based on the total packet receiving rate value of the CPU and the first target packet receiving rate;

[0275] a fourth determining subunit, configured to determine a further reduction in the sending rate if the sum of the sending rates of the first target protocol packets that can be reduced is less than the packet receiving rate that the CPU needs to reduce;

[0276] The third reducing subunit is configured to reduce the sending rates of protocol messages with lower priorities in the first target protocol messages according to the sending rates that need to be reduced after the sending rate of the first target protocol messages is reduced to the reference rate.

[0277] In some embodiments of the present application, the third determining subunit may include:

[0278] A first calculation subunit, configured to calculate a first ratio according to a CPU resource utilization and a first threshold;

[0279] The second calculation subunit is configured to calculate the product of the total CPU packet receiving rate and the first ratio to obtain a first target packet receiving rate;

[0280] The third calculation subunit is configured to calculate the difference between the total packet receiving rate of the CPU and the first target packet receiving rate, and obtain the packet receiving rate that the CPU needs to reduce.

[0281] In some embodiments of the present application, the following may also be included:

[0282] A first determining module, configured to determine a target sending rate value of the first target protocol message according to the reduced sending rate of the first target protocol message;

[0283] The first updating module is configured to update the current rate limit value of the first target protocol message to a target sending rate value.

[0284] In some embodiments of the present application, adding submodules may include:

[0285] The second acquisition unit is used to obtain the current rate limit value and current sending rate of multiple types of protocol messages;

[0286] A second determining unit is configured to determine, according to the current rate limit value and the current sending rate, a second target protocol message whose sending rate reaches the current rate limit value among the multiple types of protocol messages;

[0287] The increasing unit is used to increase the sending rate of the second target protocol message in order of priority from high to low.

[0288] In some embodiments of the present application, the adding unit may include:

[0289] A second acquisition subunit is used to obtain the minimum sending rate and the maximum sending rate of the second target protocol message;

[0290] a fifth determining subunit, configured to determine a reference rate of the second target protocol message according to the minimum sending rate, the maximum sending rate, and the resource utilization of the CPU;

[0291] The first increasing subunit is configured to increase the sending rate of the second target protocol message according to the reference rate.

[0292] In some embodiments of the present application, the first adding subunit may include:

[0293] A third acquisition subunit is used to obtain a sending rate of a second target protocol message;

[0294] a sixth determining subunit, configured to determine an increaseable sending rate of the second target protocol message according to the current sending rate of the second target protocol message and the reference rate;

[0295] The second increasing subunit is configured to increase the sending rate of the second target protocol message according to the increaseable sending rate of the second target protocol message.

[0296] In some embodiments of the present application, the third acquisition subunit includes:

[0297] A fourth acquisition subunit is used to acquire the number of second target protocol packets sent to the CPU in a preset time period;

[0298] The seventh determining subunit is configured to determine a current sending rate of the second target protocol messages according to the number of the second target protocol messages sent to the CPU within a preset time period.

[0299] In some embodiments of the present application, the second adding subunit may include:

[0300] An eighth determining subunit, configured to determine a packet receiving rate that the CPU needs to increase according to the total packet receiving rate value of the CPU and the second target packet receiving rate;

[0301] a ninth determining subunit, configured to determine a further increase in the sending rate if the sum of the second target protocol message sending rates that can be increased is less than the packet receiving rate that the CPU needs to increase;

[0302] The third increasing subunit is configured to increase the sending rate of the protocol messages with higher priorities in the second target protocol messages according to the sending rate that needs to be increased after the sending rate of the second target protocol messages increases to the reference rate.

[0303] In some embodiments of the present application, the eighth determining subunit may include:

[0304] The first calculation subunit is configured to calculate a second ratio according to the total packet receiving rate of the CPU and a second threshold;

[0305] The second calculation subunit is configured to calculate the product of the total packet receiving rate of the CPU and the second ratio to obtain a second target packet receiving rate;

[0306] The third calculation subunit is configured to calculate the difference between the total packet receiving rate of the CPU and the second target packet receiving rate, and obtain the packet receiving rate that the CPU needs to increase.

[0307] In some embodiments of the present application, the following may also be included:

[0308] A second determining module, configured to determine a target sending rate value of the second target protocol message according to the increased sending rate of the second target protocol message;

[0309] The second updating module is configured to update the current rate limit value of the second target protocol message to a target sending rate value.

[0310] In some embodiments of the present application, the following may also be included:

[0311] The setting module is used to set the speed limit information of various types of protocol messages. The speed limit information includes the minimum sending rate, maximum sending rate, current speed limit value, and priority order of various types of protocol messages;

[0312] The sending module is used to send various types of protocol messages to the CPU according to the rate limit information.

[0313] The present application discloses a message processing device. The invention can dynamically adjust the rate at which protocol messages are sent to the CPU according to the CPU resource utilization. When the CPU resource utilization is very high, the sending rate of at least one type of protocol message among multiple types of protocol messages is reduced, thereby reducing the CPU resource utilization, thereby avoiding the CPU being too busy and causing key network services to not respond and network failures; when the CPU resource utilization is low, the sending rate of at least one type of protocol message among multiple types of protocol messages is increased, thereby increasing the protocol messages processed by the CPU, which can speed up the response of network services and make the network more comfortable.

[0314] FIG4 shows a block diagram of an electronic device 40 provided in some embodiments of the present application, including:

[0315] Processor 401, memory 402, and a computer program 4021 stored in memory 402 and capable of running on processor 401. When the computer program 4021 is executed by processor 401, the various processes of some embodiments of the above-mentioned message processing method are implemented, and the same technical effects can be achieved. To avoid repetition, they will not be described here.

[0316] FIG5 shows a block diagram of a non-volatile readable storage medium 50 provided in some embodiments of the present application. The non-volatile readable storage medium 50 stores a computer program 501. When the computer program 501 is executed by a processor, the various processes of some embodiments of the message processing method described above are implemented, and the same technical effects are achieved. To avoid repetition, they are not described here. The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to in detail.

[0317] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0318] Those skilled in the art will appreciate that some embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM (Compact Disc Read-Only Memory), optical storage, etc.) containing computer-usable program code.

[0319] The present application embodiment is described with reference to the flow chart and / or block diagram of the method, terminal device (system), and computer program product according to the embodiment of the present application. It should be understood that each process and / or box in the flow chart and / or block diagram and the combination of the process and / or box in the flow chart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device produce a device for realizing the function specified in one process or multiple processes and / or one box or multiple boxes of the flow chart.

[0320] These computer program instructions may also be stored in a non-volatile readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the non-volatile readable storage medium produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0321] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce computer-implemented processing, so that the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0322] Although some embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they are aware of the basic creative concepts. Therefore, the appended claims are intended to be interpreted as including the preferred embodiment and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0323] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that includes a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or terminal device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or terminal device that includes the element.

[0324] The above is a detailed introduction to the message processing method, device, equipment and non-volatile readable storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, based on the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A message processing method, characterized in that: Applied to a switch, the switch includes a central processing unit (CPU), and the method includes: Obtain the priority order of various types of protocol messages sent to the CPU; In the process of sending the protocol message to the CPU, detecting the resource utilization rate of the CPU; If the resource utilization rate of the CPU is greater than the first threshold, then according to the priority order, the sending rate of at least one type of protocol message among the multiple types of protocol messages is reduced so that the total packet receiving rate of the CPU is reduced to the first target packet receiving rate; If the resource utilization of the CPU is less than the second threshold, the sending rate of at least one type of protocol message among the multiple types of protocol messages is increased according to the priority order, so that the total packet receiving rate of the CPU increases to the second target packet receiving rate.

2. The method according to claim 1, characterized in that The reducing, according to the priority order, a sending rate of at least one type of protocol message among the multiple types of protocol messages comprises: According to the order of the priorities from low to high, the sending rate of at least one type of protocol message among the multiple types of protocol messages is reduced.

3. The method according to claim 1, characterized in that The increasing, according to the priority order, a sending rate of at least one type of protocol message among the multiple types of protocol messages comprises: According to the order of the priorities from high to low, the sending rate of at least one type of protocol message among the multiple types of protocol messages is increased.

4. The method according to claim 2, characterized in that: The reducing the sending rate of at least one type of protocol message among the multiple types of protocol messages in the order of the priorities from low to high, comprises: Obtaining current rate limits and current sending rates of the multiple types of protocol messages; Determine, according to the current rate limit value and the current sending rate, a first target protocol message whose sending rate reaches the current rate limit value among the multiple types of protocol messages; According to the order of the priorities from low to high, the sending rate of the first target protocol message is reduced.

5. The method according to claim 4, characterized in that Reducing the sending rate of the first target protocol message includes: Obtaining a minimum sending rate and a maximum sending rate of the first target protocol message; Determine a reference rate of the first target protocol message according to the minimum sending rate, the maximum sending rate and the resource utilization of the CPU; According to the reference rate, the sending rate of the first target protocol message is reduced.

6. The method according to claim 5, characterized in that The step of reducing the sending rate of the first target protocol message according to the reference rate includes: Determining, according to the current sending rate of the first target protocol message and the reference rate, a sending rate at which the first target protocol message can be reduced; According to the reducible sending rate of the first target protocol message, the sending rate of the first target protocol message is reduced.

7. The method according to claim 6, characterized in that The reducing the sending rate of the first target protocol message according to the reducing sending rate of the first target protocol message includes: Determining a packet receiving rate that needs to be reduced for the CPU according to the total packet receiving rate value of the CPU and the first target packet receiving rate; If the sum of the sending rates that can be reduced for the first target protocol messages is less than the packet receiving rate that the CPU needs to reduce, determining that the sending rate still needs to be reduced; After the sending rate of the first target protocol message is reduced to the reference rate, the sending rates of the protocol messages with lower priorities in the first target protocol message are reduced according to the sending rates that still need to be reduced.

8. The method according to claim 7, characterized in that The determining, according to the total packet receiving rate value of the CPU and the first target packet receiving rate, the packet receiving rate that the CPU needs to reduce includes: Calculating a first ratio according to the resource utilization of the CPU and the first threshold; Calculate the product of the total CPU packet receiving rate and the first ratio to obtain the first target packet receiving rate; The difference between the total packet receiving rate of the CPU and the first target packet receiving rate is calculated to obtain the packet receiving rate that the CPU needs to reduce.

9. The method according to claim 7, characterized in that: The method further comprises: Determining a first target sending rate value of the first target protocol message according to the reduced sending rate of the first target protocol message; The current rate limit value of the first target protocol message is updated to the first target sending rate value.

10. The method according to claim 3, characterized in that The increasing the sending rate of at least one type of protocol message among the multiple types of protocol messages in the order of the priorities from high to low includes: Obtaining current rate limits and current sending rates of the multiple types of protocol messages; Determine, according to the current rate limit value and the current sending rate, a second target protocol message whose sending rate reaches the current rate limit value among the multiple types of protocol messages; The sending rate of the second target protocol message is increased in the order of the priorities from high to low.

11. The method according to claim 10, characterized in that The increasing the sending rate of the second target protocol message includes: Obtaining a minimum sending rate and a maximum sending rate of the second target protocol message; Determine a reference rate of the second target protocol message according to the minimum sending rate, the maximum sending rate and the resource utilization of the CPU; According to the reference rate, the sending rate of the second target protocol message is increased.

12. The method according to claim 11, characterized in that The increasing the sending rate of the second target protocol message according to the reference rate includes: Obtaining a current sending rate of the second target protocol message; Determining, according to the current sending rate of the second target protocol message and the reference rate, a sending rate at which the second target protocol message can be increased; According to the increaseable sending rate of the second target protocol message, the sending rate of the second target protocol message is increased.

13. The method according to claim 12, characterized in that The obtaining the current sending rate of the second target protocol message includes: Obtain the number of the second target protocol messages sent to the CPU in a preset time period; A current sending rate of the second target protocol message is determined according to the number of the second target protocol messages sent to the CPU in a preset time period.

14. The method according to claim 12, characterized in that The increasing the sending rate of the second target protocol message according to the sending rate that can be increased by the second target protocol message includes: Determining a packet receiving rate that needs to be increased for the CPU according to the total packet receiving rate value of the CPU and the second target packet receiving rate; If the sum of the sending rates that can be increased by the second target protocol messages is less than the packet receiving rate that the CPU needs to increase, determining that the sending rate still needs to be increased; After the sending rate of the second target protocol message increases to the reference rate, the sending rate of the protocol message with a higher priority in the second target protocol message is increased according to the sending rate that still needs to be increased.

15. The method according to claim 14, characterized in that The step of determining the packet receiving rate that needs to be increased by the CPU according to the total packet receiving rate value of the CPU and the second target packet receiving rate includes: Calculating a second ratio according to the total packet receiving rate of the CPU and the second threshold; Calculate the product of the total packet receiving rate of the CPU and the second ratio to obtain the second target packet receiving rate; The difference between the total packet receiving rate of the CPU and the second target packet receiving rate is calculated to obtain the packet receiving rate that the CPU needs to increase.

16. The method according to claim 14, characterized in that The method further comprises: Determining a second target sending rate value of the second target protocol message according to the increased sending rate of the second target protocol message; The current rate limit value of the second target protocol message is updated to the second target sending rate value.

17. The method according to claim 1, characterized in that Before the step of obtaining the priority order of the multiple types of protocol messages sent to the CPU, the method further includes: Setting the speed limit information of the multiple types of protocol messages, the speed limit information including the minimum sending rate, maximum sending rate, current speed limit value, and priority order of the various types of protocol messages; The multiple types of protocol messages are sent to the CPU according to the rate limit information.

18. A message processing device, characterized in that: Applied to a switch, the switch includes a central processing unit (CPU), and the device includes: An acquisition module, used to acquire the priority order of multiple types of protocol messages sent to the CPU; A detection module, used for detecting resource utilization of the CPU during the process of sending protocol messages to the CPU; a reducing module, configured to reduce the sending rate of at least one type of protocol message among the multiple types of protocol messages according to the priority order if the resource utilization of the CPU is greater than a first threshold, so that the total packet receiving rate of the CPU is reduced to a first target packet receiving rate; An increasing module is used to increase the sending rate of at least one type of protocol message among the multiple types of protocol messages according to the priority order if the resource utilization of the CPU is less than a second threshold, so that the total packet receiving rate of the CPU increases to the second target packet receiving rate.

19. An electronic device, characterized in that: It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when executed by the processor, the steps of the message processing method according to any one of claims 1 to 17 are implemented.

20. A non-volatile readable storage medium, characterized in that: A computer program is stored thereon, and when the program is executed by a processor, the steps of the message processing method as described in any one of claims 1-17 are implemented.

Citation Information

Patent Citations

  • Message receiving and sending protecting system and method for CPU of data communication equipment

    CN103812750A

  • Message speed limiting method and device

    CN104283643A

  • Message processing method, device and system

    CN113037691A

  • Method, system and device for optimizing switch access control and medium

    CN113315652A

  • Protocol message uploading method and system, electronic equipment and storage medium

    CN113726690A