Cache management method, network device, storage medium and program product
By dynamically adjusting the cache resource upper limit in network devices according to the data flow type and queue changes of output ports, packet loss caused by burst flow is solved, and the performance and reliability of network devices are improved.
Patent Information
- Application Number
- CN202311204461.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-15
- Publication Date
- 2025-03-18
AI Technical Summary
In a network device, when a burst stream is added to the data to be output at a certain output port, the equally allocated cache resources cannot fully cache the data to be output, resulting in packet loss in the network device, affecting performance.
By receiving the data packet, determining its data flow type, determining the proportional coefficient according to the data flow type, and then determining the upper limit of the cache resource corresponding to the output port of the data packet. This method adjusts the cache resource upper limit according to the data flow type and queue changes of the output port, ensuring that high-sensitivity data flow types and burst data flows can obtain sufficient cache resources.
It reduces the packet loss rate of network equipment and improves the performance of network equipment, especially in the case of burst traffic, effectively avoids packet loss problems.
Smart Images

Figure CN119652851A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data storage, and in particular to a cache management method, a network device, a storage medium and a program product. Background Art
[0002] In modern data center networks, network devices need to exchange data with other connected network devices through ports. When the data input rate is higher than the data output rate, the output port of the network device can use shared cache resources to temporarily store the data queued at the output port in the shared cache. Since all output ports in the network device share cache resources, the shared cache needs to be allocated through a cache management solution.
[0003] Currently, the network device can determine the number of output ports that currently need to allocate cache resources and the total cache resources, and determine the cache resources available to each port by completely dividing them equally. For example, if the network device has five output ports, it can be determined that the cache resources available to each port are one-fifth of the total cache resources.
[0004] In the above-mentioned related technologies, by allocating completely equally divided total cache resources to each output port, it can be ensured that each output port can fairly use cache resources to temporarily store data packets. However, if a new burst flow is added to the data to be output of a certain output port, the currently equally distributed available cache resources cannot completely cache the data to be output, which leads to packet loss in the network device, thereby affecting the performance of the network device. Summary of the invention
[0005] The embodiments of the present application provide a cache management method, a network device, a storage medium, and a program product, which reduce the packet loss rate of the network device and improve the performance of the network device.
[0006] In a first aspect, the present application provides a cache management method, the method comprising: receiving a data packet; determining a data flow type of the data packet based on the data packet; determining a proportional coefficient based on the data flow type; the proportional coefficient is used to indicate the proportion of free cache that can be used by the output port of the data packet; based on the proportional coefficient, determining the cache resource upper limit corresponding to the output port of the data packet.
[0007] It can be understood that, based on the received data packet, the data flow type of the data packet can be determined. Since different data flow types have different packet loss sensitivities, the proportional coefficient can be determined based on the data flow type. The proportional coefficient indicates the proportion of the free cache amount that can be used by the output port of the data packet. According to the determined proportional coefficient, the cache resource upper limit corresponding to the output port of the data packet can be determined. By determining the corresponding proportional coefficient based on the data flow type, the problem of packet loss sensitivity caused by the unchanged cache resource upper limit of the output port can be avoided when the overall unused shared cache resources change little, but the packet loss sensitivity of the data flow type of the data packet is high, thereby reducing the packet loss rate of the network device and thereby improving the performance of the network device in data interaction.
[0008] In a possible implementation manner, determining the proportional coefficient based on the data flow type includes: determining the proportional coefficient based on the data flow type and a change in a queue of an output port.
[0009] It can be understood that the proportional coefficient can be comprehensively determined based on the data flow type and the queue changes of the output port, so that the proportional coefficient is not only related to the data flow type, but also to the queue changes of the output port. While reducing the packet loss rate of data packets corresponding to data flow types with higher packet loss sensitivity, it also takes into account increasing the cache resource upper limit for the output port corresponding to the continuous burst data flow, thereby reducing the overall packet loss rate of the network device and minimizing the impact of packet loss on the performance of the network device.
[0010] In a possible implementation manner, the proportional coefficient corresponding to the data packets whose data flow type is a small flow is greater than the proportional coefficient corresponding to the data packets whose data flow type is a large flow.
[0011] It can be understood that, for the case where the data flow type is a large and small flow, since the sensitivity of small flow packet loss is higher than that of large flow packet loss, that is, the performance impact caused by small flow packet loss is greater than the performance impact caused by large flow packet loss, it can be determined that the proportional coefficient corresponding to the data packet with the data flow type of small flow is greater than the proportional coefficient corresponding to the data packet with the data flow type of large flow, thereby increasing the upper limit of the cache resources allocated to the output port of the data packet of the small flow.
[0012] In a possible implementation manner, the proportional coefficient corresponding to the data message whose data flow type is a business flow is greater than the proportional coefficient corresponding to the data message whose data flow type is a non-business flow.
[0013] It can be understood that, for the case where the data flow type is business flow or non-business flow, since the packet loss sensitivity of the business flow is higher than that of the non-business flow, that is, the performance impact caused by the packet loss of the business flow is greater than the performance impact caused by the packet loss of the non-business flow, it can be determined that the proportional coefficient corresponding to the data packet whose data flow type is business flow is greater than the proportional coefficient corresponding to the data packet whose data flow type is non-business flow, thereby increasing the upper limit of the cache resources allocated to the output port of the data packet of the business flow.
[0014] In a possible implementation, at least one cache queue corresponding to an output port of a data message has a respective proportional coefficient; determining the proportional coefficient based on a data flow type includes: determining the proportional coefficient of a cache queue for temporarily storing data messages based on the data flow type.
[0015] It can be understood that since the same output port can correspond to at least one cache queue, the data packet can be temporarily stored in a cache queue corresponding to the output port, so the proportional coefficient determined according to the data packet can be the proportional coefficient of the cache queue that temporarily stores the data packet. By determining the granularity of the proportional coefficient for the cache queue, the upper limit of the cache resources allocated to the cache queue can be determined. The upper limit of the cache resources allocated to the cache queue can be accurately allocated to the cache queue according to the needs of different cache queues, thereby reducing the packet loss rate of the network device and improving the performance of the network device.
[0016] In a possible implementation, the proportional coefficient is determined based on the data flow type and the queue change of the output port, including: determining the proportional coefficient based on the data flow type; obtaining the queue change of the output port in a specified period; and adjusting the proportional coefficient based on the queue change of the output port.
[0017] It can be understood that by combining the data flow type of the data packet and the queue changes of the output port of the data packet, while reducing the packet loss rate of the data packet corresponding to the data flow type with higher packet loss sensitivity, it also takes into account the increase of the cache resource upper limit for the output port corresponding to the continuous burst data flow, thereby reducing the overall packet loss rate of the network device and minimizing the impact of packet loss on the performance of the network device.
[0018] In one possible implementation, the proportional coefficient is adjusted based on the queue change of the output port, including: if the data growth amount of the cache queue indicated by the queue change exceeds a specified threshold, the proportional coefficient is adjusted to a first proportional coefficient; wherein the adjusted first proportional coefficient is greater than the proportional coefficient before adjustment.
[0019] It can be understood that when the queue change status obtained at the output port indicates that the data growth rate of the cache queue therein exceeds a specified threshold, the proportional coefficient can be increased. That is to say, in order to avoid the problem of packet loss caused by the burst data flow temporarily stored in the cache queue exceeding the specified threshold due to exceeding the cache resource upper limit, the proportional coefficient can be increased, thereby increasing the cache resource upper limit allocated to the cache queue, thereby reducing the packet loss rate of the network device.
[0020] In a possible implementation, the method further includes: if the data growth amount of the cache queue indicated by the queue change situation exceeds a specified threshold for a specified number of consecutive times, adjusting the proportional coefficient from the first proportional coefficient to a second proportional coefficient; wherein the second proportional coefficient is greater than the first proportional coefficient.
[0021] It is understandable that when it is determined repeatedly that the currently allocated cache resources still cannot solve the problem of burst data flow packet loss, the upper limit of the cache resources allocated to the cache queue can be increased by increasing the proportional coefficient again, thereby reducing the burst data flow packet loss rate as much as possible.
[0022] In a second aspect, the present application provides a cache management method, which includes: obtaining the queue changes of the output port; determining a proportional coefficient based on the queue changes; the proportional coefficient is used to indicate the proportion of the free cache amount that the output port can use; based on the proportional coefficient, determining the cache resource upper limit corresponding to the output port.
[0023] It can be understood that in order to reserve cache resources for the output port, the queue change of the output port is obtained, and a proportional coefficient can be determined according to the queue change of the output port. The proportional coefficient indicates the proportion of the free cache amount that the output port can use. According to the determined proportional coefficient, the upper limit of the cache resources corresponding to the output port can be determined. By determining the corresponding proportional coefficient according to the queue change, it is possible to avoid the packet loss problem caused by the upper limit of the cache resources allocated to the output port remaining unchanged when the overall unused shared cache resources change little but the queue of a certain cache queue grows more. By adjusting the proportional coefficient according to the growth or decrease of the cache queue, the packet loss rate of the network device is reduced, thereby improving the performance of the network device in data interaction.
[0024] In a possible implementation, determining the proportional coefficient based on a change in the queue includes: determining the proportional coefficient based on a data flow type of a data message to be output by the output port and a change in the queue of the output port.
[0025] It can be understood that the proportional coefficient can be comprehensively determined based on the data flow type and the queue changes of the output port, so that the proportional coefficient is not only related to the data flow type, but also to the queue changes of the output port. While reducing the packet loss rate of data packets corresponding to data flow types with higher packet loss sensitivity, it also takes into account increasing the cache resource upper limit for the output port corresponding to the continuous burst data flow, thereby reducing the overall packet loss rate of the network device and minimizing the impact of packet loss on the performance of the network device.
[0026] In one possible implementation, a proportional coefficient is determined based on a data flow type of a data packet to be output from an output port and a queue change of the output port, including: determining the proportional coefficient based on the data flow type of a data packet to be output from the output port; obtaining a queue change of the output port in a specified period; and adjusting the proportional coefficient based on the queue change of the output port.
[0027] It can be understood that by combining the data flow type of the data packet and the queue changes of the output port of the data packet, while reducing the packet loss rate of the data packet corresponding to the data flow type with higher packet loss sensitivity, it also takes into account the increase of the cache resource upper limit for the output port corresponding to the continuous burst data flow, thereby reducing the overall packet loss rate of the network device and minimizing the impact of packet loss on the performance of the network device.
[0028] In a possible implementation, at least one cache queue corresponding to the output port has a respective proportional coefficient; determining the proportional coefficient based on queue changes includes: determining the proportional coefficient of the cache queue based on queue changes of the cache queue.
[0029] It can be understood that since the same output port can correspond to at least one cache queue, the proportional coefficient determined according to the queue change situation can be the proportional coefficient of the cache queue corresponding to the queue change situation. By determining the granularity of the proportional coefficient for the cache queue, the upper limit of the cache resources allocated to the cache queue can be determined. The upper limit of the cache resources allocated to the cache queue can be accurately determined according to the needs of different cache queues, thereby reducing the packet loss rate of the network device and improving the performance of the network device.
[0030] In one possible implementation, the proportional coefficient is adjusted based on the queue change of the output port, including: if the data growth amount of the cache queue indicated by the queue change exceeds a specified threshold, the proportional coefficient is adjusted to a first proportional coefficient; wherein the adjusted first proportional coefficient is greater than the proportional coefficient before adjustment.
[0031] It can be understood that when the queue change status obtained at the output port indicates that the data growth rate of the cache queue therein exceeds a specified threshold, the proportional coefficient can be increased. That is to say, in order to avoid the problem of packet loss caused by the burst data flow temporarily stored in the cache queue exceeding the specified threshold due to exceeding the cache resource upper limit, the proportional coefficient can be increased, thereby increasing the cache resource upper limit allocated to the cache queue, thereby reducing the packet loss rate of the network device.
[0032] In a possible implementation, the method further includes: if the data growth amount of the cache queue indicated by the queue change situation exceeds a specified threshold for a specified number of consecutive times, adjusting the proportional coefficient from the first proportional coefficient to a second proportional coefficient; wherein the second proportional coefficient is greater than the first proportional coefficient.
[0033] It is understandable that when it is determined repeatedly that the currently allocated cache resources still cannot solve the problem of burst data flow packet loss, the upper limit of the cache resources allocated to the cache queue can be increased by increasing the proportional coefficient again, thereby reducing the burst data flow packet loss rate as much as possible.
[0034] In a possible implementation manner, the proportional coefficient corresponding to the data packets whose data flow type is a small flow is greater than the proportional coefficient corresponding to the data packets whose data flow type is a large flow.
[0035] It can be understood that, for the case where the data flow type is a large and small flow, since the sensitivity of small flow packet loss is higher than that of large flow packet loss, that is, the performance impact caused by small flow packet loss is greater than the performance impact caused by large flow packet loss, it can be determined that the proportional coefficient corresponding to the data packet with the data flow type of small flow is greater than the proportional coefficient corresponding to the data packet with the data flow type of large flow, thereby increasing the upper limit of the cache resources allocated to the output port of the data packet of the small flow.
[0036] In a possible implementation, the proportional coefficient corresponding to the data message whose data flow type is a business flow is greater than the proportional coefficient corresponding to the data message whose data flow type is a non-business flow.
[0037] It can be understood that, for the case where the data flow type is business flow or non-business flow, since the packet loss sensitivity of the business flow is higher than that of the non-business flow, that is, the performance impact caused by the packet loss of the business flow is greater than the performance impact caused by the packet loss of the non-business flow, it can be determined that the proportional coefficient corresponding to the data packet whose data flow type is business flow is greater than the proportional coefficient corresponding to the data packet whose data flow type is non-business flow, thereby increasing the upper limit of the cache resources allocated to the output port of the data packet of the business flow.
[0038] In a third aspect, an embodiment of the present application provides a cache management device, which is used to execute any one of the cache management methods provided in the first aspect above.
[0039] In a possible implementation, the embodiment of the present application may divide the cache management device into functional modules according to the method provided in the first aspect above. For example, each functional module may be divided according to each function, or two or more functions may be integrated into one processing module. Exemplarily, the embodiment of the present application may divide the cache management device into an acquisition module and a processing module, etc. according to the function. The description of the possible technical solutions and beneficial effects executed by each of the functional modules divided above can refer to the technical solutions provided in the first aspect above or its corresponding possible implementation, and will not be repeated here.
[0040] In a fourth aspect, an embodiment of the present application provides a cache management device, which is used to execute any one of the cache management methods provided in the second aspect above.
[0041] In a possible implementation, the embodiment of the present application may divide the cache management device into functional modules according to the method provided in the second aspect above. For example, each functional module may be divided according to each function, or two or more functions may be integrated into one processing module. Exemplarily, the embodiment of the present application may divide the cache management device into an acquisition module and a processing module, etc. according to the function. The description of the possible technical solutions and beneficial effects executed by each of the functional modules divided above can refer to the technical solutions provided in the second aspect above or its corresponding possible implementation, and will not be repeated here.
[0042] In a fifth aspect, an embodiment of the present application provides a network device, which includes a processor and a memory, and the processor is coupled to the memory; the memory is used to store computer instructions, and the computer instructions are loaded and executed by the processor to enable the network device to implement the cache management method described in the above aspects.
[0043] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, in which at least one computer program instruction is stored, and the computer program instruction is loaded and executed by a processor to implement the cache management method as described in the above aspects.
[0044] In a seventh aspect, an embodiment of the present application provides a computer program product, the computer program product including computer instructions, the computer instructions stored in a computer-readable storage medium. A processor of a computing device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the network device executes the cache management method provided in various optional implementations of the first aspect or the second aspect.
[0045] For the specific description of the third to seventh aspects and their various implementations in the present application, reference may be made to the detailed description in the first aspect and its various implementations, or reference may be made to the detailed description in the second aspect and its various implementations; and, for the beneficial effects of the third to seventh aspects and their various implementations, reference may be made to the analysis of the beneficial effects in the first aspect and its various implementations, or reference may be made to the analysis of the beneficial effects in the second aspect and its various implementations, which will not be repeated here.
[0046] These and other aspects of the present application will become more apparent from the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is a schematic diagram of a scenario of network device data interaction provided by an exemplary embodiment of the present application;
[0048] Figure 2 is a schematic diagram of the structure of a switch provided by an exemplary embodiment of the present application;
[0049] Figure 3 It is a flowchart of a cache management method provided by an exemplary embodiment of the present application;
[0050] Figure 4 yes Figure 3 A schematic diagram of large and small flow identification involved in the illustrated embodiment;
[0051] Figure 5 yes Figure 3 A schematic diagram of setting a proportionality coefficient according to the priority of an output port involved in the illustrated embodiment;
[0052] Figure 6 It is a flowchart of a cache management method provided by an exemplary embodiment of the present application;
[0053] Figure 7 yes Figure 6 A schematic diagram of allocating a proportional coefficient according to a cache state of a port involved in the illustrated embodiment;
[0054] Figure 8 It is a flowchart of a cache management method provided by an exemplary embodiment of the present application;
[0055] Fig. 9 yes Figure 8 A schematic diagram of adjusting a proportionality coefficient involved in the illustrated embodiment;
[0056] Fig.10 is a schematic diagram of the structure of a cache management device provided by an exemplary embodiment of the present application;
[0057] Fig.11It is a structural diagram of a cache management device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0058] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0059] The term "multiple" as used herein refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.
[0060] Furthermore, in the description of this application, unless otherwise specified, "plurality" means two or more than two. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0061] In addition, in order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first", "second" and the like are used to distinguish the same items or similar items with substantially the same functions and effects. Those skilled in the art will understand that the words "first", "second" and the like do not limit the quantity and execution order, and the words "first", "second" and the like do not necessarily limit the differences. At the same time, in the embodiments of the present application, the words "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or design solutions. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete manner for ease of understanding.
[0062] First, the application scenarios of the embodiments of the present application are exemplarily introduced.
[0063] For modern data center networks, network devices need to exchange data with other connected network devices through ports, so that other network devices connected to the network devices can interact with each other. When the rate of data input to the input port of the network device is higher than the rate of data output at the output port of the network device, the data needs to be temporarily cached in the form of a queue, and the data is output through the output port in sequence according to the output queue. The various output ports of the network device can share cache resources. Through the shared cache resources, the data queues queued at each output port can be temporarily stored in the shared cache. Since all output ports in the network device share cache resources, the shared cache needs to be allocated through a cache management solution.
[0064] Currently, there are three cache management schemes, which can be used to determine how to allocate shared cache resources to the data queued at each output port. In the first case, the cache management scheme can be a fully shared cache scheme, which can be a fully shared cache scheme that does not restrict the output port, that is, as long as the cache does not overflow, each output port can use the free cache resources in the shared cache resources at will. In the second case, the cache management scheme can be a completely equally divided cache scheme, and the completely equally divided cache resources can ensure that all output ports can use the same amount of cache, that is, the upper limit of the cache supported by each output port is equal to the ratio of the total cache amount of the shared cache resources to the number of output ports. In the third case, the cache management scheme can be a dynamic threshold cache management scheme, which can allocate an upper limit of the available cache resources to each output port, wherein the upper limit of the cache resources can be the product of the currently unused cache resources and the specified coefficient. By determining the upper limit of the cache resources of the output port, cache can be reserved for each output port to cope with the sudden overload of the port.
[0065] In the above-mentioned related technologies, the process of allocating cache resources by using a fully shared cache solution cannot guarantee the fairness of the cache of each output port because there is no restriction on the cache resources used by the output port. For example, if the data flow transmitted in the output port is a large flow, and the output port transmitting the large flow occupies too many cache resources, this will lead to the reduction of the cache resources available to other output ports transmitting small flows, which will lead to low throughput, high latency and high packet loss rate problems in small flow transmission. Although the process of allocating cache resources by using a completely equally divided cache solution guarantees the fairness of the use of cache resources by each output port, it cannot solve the problem of packet loss caused by the inability to cache the burst data flow when burst traffic occurs, because the available cache resources of the corresponding output port have been fully used, but there are unused cache resources in other output ports. In addition, by using a dynamic threshold cache solution, the process of allocating cache resources, because the upper limit of the allocated cache resources is related to the unused cache amount of the shared cache resources as a whole, and the upper limit of the cache resources determined by all output ports is the same, the output port that is continuously in a burst state still cannot use the reserved idle cache resources, resulting in continuous packet loss.
[0066] In view of this, the embodiment of the present application can adjust the upper limit of the cache resources of each output port according to the data flow type of the data message to be output by the network device or the change of the queue of each output port, and allocate the cache resources to the corresponding output port according to the adjusted upper limit of the cache resources. In other words, according to the data flow type of the data message, the proportion of the cache resources that can be allocated to the output port can be determined, and according to the change of the queue of the output port, the proportion of the cache resources that can be allocated to the output port can also be determined, so as to determine the upper limit of the cache resources of the output port according to the determined proportion, thereby reducing the packet loss rate of the network device, and further improving the performance of the network device in data interaction.
[0067] in, Figure 1 A schematic diagram of a scenario of network device data interaction provided by an embodiment of the present application is shown. Figure 1 As shown, the network device 101 can be connected to other network devices 102. The network device 101 can be a switch, and other network devices 102 can implement data exchange through the switch.
[0068] The switch may be a device that performs data exchange functions in the network, and other network devices 102 may be servers or computing devices. When data exchange is required between other network devices 102 connected to the switch through ports, the network device sending data inputs the data through the input port of the switch, and the switch determines the output port to which the network device receiving the data is connected based on the destination address of the data frame, and the switch sends the data to the network device receiving the data through the determined output port.
[0069] Secondly, the system architecture of the embodiment of the present application is exemplarily introduced.
[0070] Figure 2 FIG. 1 shows a schematic diagram of the structure of a switch provided in an embodiment of the present application. Figure 2 As shown, for a scenario in which the network device 101 is a switch 110 , the switch 110 includes a processor 11 , a memory 12 , and a port.
[0071] The port may include an input port 13 and an output port 14. The input port 13 is used to receive data input from a network device connected to the port. The output port 14 is used to output data to the network device connected to the port.
[0072] The processor 11 may include a control switching module, which may be used to determine a port for outputting the received data according to a destination address of the received data, and control the data to be sent to the determined port. In addition, the processor 11 may also include a cache management module, which may be used to determine a cache resource upper limit of each output port 14, and control the memory 12 to allocate cache resources to data that needs to be output through the output port 14.
[0073] The memory 12 may include a shared cache of each output port 14 , and the shared cache is used to temporarily store data waiting to be output from the output port 14 .
[0074] It should be noted that the application scenarios and system architectures described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0075] For ease of understanding, the cache management method provided by the present application is exemplarily introduced below in conjunction with the accompanying drawings. The cache management method is applicable to Figure 1 The network device 101 shown, Figure 2 Switch 110 is shown.
[0076] In one possible case, in order to avoid packet loss of small flows or business flows that are sensitive to packet loss due to insufficient buffer resource upper limit of the switch, a buffer management solution as shown in the following embodiment may be provided. Figure 3 A flow chart of a cache management method provided by an exemplary embodiment of the present application is shown. The cache management method is executed by a network device, which may be a switch, and the cache management method includes the following steps:
[0077] S101, receiving a data message.
[0078] In an embodiment of the present application, the switch can obtain data packets through the input port, and the input port is used to transmit the data packets sent by the network device on the input side to the switch, so that the switch performs data interaction processing on the received data packets and outputs the data packets to the network device on the receiving side.
[0079] The data message may be data to be output from an output port of the switch.
[0080] In a possible implementation, the network device sends a data stream to the switch through an input port. The data message can be encapsulated into a data packet, and the data stream includes multiple data packets with the same four-tuple information.
[0081] S102: Determine a data flow type of the data message based on the data message.
[0082] In an embodiment of the present application, a data stream in which a data packet encapsulating a data message is located is obtained, and a data stream type of the data stream is determined to be a data stream type of a data message.
[0083] Among them, a data flow may include multiple data packets. According to the number of data packets in a data flow, the type of the data flow can be determined, such as a small flow or a large flow. The data flow type can also be determined according to the service attributes of the data flow, such as a business flow or a non-business flow. The data flow can also be a burst data flow, which is a data flow in which the amount of data in a specific time period is significantly abnormal compared to the amount of data in other time periods.
[0084] Among them, a small flow is a data flow with a number of packets less than a specified threshold; a large flow is a data flow with a number of packets greater than or equal to a specified threshold. A business flow is a data flow transmitted to perform a specified business; a non-business flow is a data flow other than a business flow.
[0085] In the actual transmission process of the switch, since the small flow contains a small number of data packets, the small flow is more sensitive to packet loss than the large flow. Therefore, if the small flow loses packets during the transmission process, it will have a greater impact on the switch performance. Similarly, since burst data flows are sensitive to packet loss, if burst data flows lose packets during the transmission process, it will also have a greater impact on the switch performance.
[0086] In a possible implementation, after the switch obtains the input data message from the input port, it can send the data message to the corresponding output port through interactive processing. If the data output speed of the output port is lower than the data input speed of the input port, the data message to be output can be queued on the output port side to wait for output, and the shared cache resource is allocated to the output port to temporarily store the data waiting to be output on the output port side.
[0087] In a possible implementation, a large and small flow is identified for a received data flow containing data packets, and the large and small flow conditions of the data packets are obtained.
[0088] The switch performs a large and small flow identification on the data flow containing data packets input through the input port, and determines whether the data flow containing data packets received by the switch is a small flow.
[0089] In a possible implementation, all data packets in the small flow can be sent to the high-priority cache queue in the output port through the large and small flow identification technology, and the remaining data packets of the large flow that are not sent to the high-priority cache queue can be sent to the low-priority cache queue in the output port.
[0090] For example, Figure 4 Schematic diagram of a large and small flow identification involved in the embodiment of the present application. Figure 4As shown, data stream 1 is input to switch 110 through input port 1, and data stream 2 is input to switch 110 through input port 2. Both data stream 1 and data stream 2 need to be output through output port 1. Since the transmission speed of the input port for small streams is greater than the transmission speed for large streams, input port 1 inputs data packet 0 and data packet 1 in data stream 1 while input port 2 inputs data packet 0 in data stream 2. Since the cache queue of the output port has a priority, data packet 0 and data packet 1 in data stream 1 and data packet 0 in data stream 2 are sequentially cached in the cache queue with a high priority in output port 1. Similarly, the next time input port 1 inputs data packet 2 and data packet 3 in data stream 1 while input port 2 inputs data packet 1 in data stream 2. Subsequently, since all the data packets of data stream 1 have been input into the cache queue with a high priority, input port 2 sequentially inputs the remaining data packets in data stream 2. When the number of data packets in the cache queue with a high priority in output port 1 reaches the number of data packets in data stream 2, the remaining data packets are sequentially cached in the cache queue with a low priority in output port 1. Therefore, the cache queue with a high priority in the output port contains all the data packets of the small flow, while the cache queue with a low priority in the output port does not contain the data packets in the small flow.
[0091] S103: Determine a proportionality coefficient based on the data stream type.
[0092] In the embodiment of the present application, the switch determines the proportionality coefficient according to the data flow type of the determined data message.
[0093] The proportional coefficient may be used to indicate the proportion of the free buffer amount that can be used by the output port of the data message.
[0094] In a possible implementation, if it is determined that the data type of the data message is a small flow, the proportionality factor may be increased to reduce the packet loss rate of the small flow and reduce the impact on the switch performance.
[0095] The proportional coefficient may be positively correlated with the upper limit of the cache resource, that is, the larger the proportional coefficient is, the larger the upper limit of the cache resource is; and the smaller the proportional coefficient is, the smaller the upper limit of the cache resource is.
[0096] In one possible implementation, if the data flow type of the data packet is a small flow, the first parameter is determined as the proportional coefficient of the cache queue for caching the data packet; if the data flow type of the data packet is a large flow, the second parameter is determined as the proportional coefficient of the cache queue for caching the data packet, and the first parameter is greater than the second parameter.
[0097] In a possible implementation manner, a first parameter and a second parameter are preconfigured in the switch, wherein the first parameter is greater than the second parameter.
[0098] Alternatively, the priority of the cache queue in the output port of the data packet can also be obtained. If the priority of the cache queue in the output port of the data packet is greater than a specified level, the first parameter is determined as the proportional coefficient of the cache queue in the output port whose priority is greater than the specified level; if the priority of the cache queue of the data packet is less than or equal to the specified level, the second parameter is determined as the proportional coefficient of the cache queue whose priority is less than or equal to the specified level.
[0099] for example, Figure 5 Schematic diagram of setting a proportionality coefficient according to the priority of an output port according to an embodiment of the present application. Figure 5 As shown, the input ports of the switch 110 include input port 0 to input port 15, and the output ports include port 0 to port 15, wherein input port 0 to input port 7 can receive small flows, and input port 8 to input port 15 can be used to receive large flows; output port 0 to output port 7 can be output ports where the data to be output includes each data packet in the small flow, and output port 8 to output port 15 can be output ports where the data to be output does not include the small flow. Therefore, a larger proportional coefficient α, such as 64, can be set for output port 0 to output port 7; and a smaller proportional coefficient α, such as 4, can be set for output port 8 to output port 15. By slightly sacrificing the packet loss rate of the large flow, the packet loss rate of the delay-sensitive small flow can be greatly reduced, thereby reducing the overall packet loss rate of the switch 110, thereby improving the performance of the switch 110.
[0100] S104: Determine the upper limit of the cache resource corresponding to the output port of the data message based on the proportional coefficient.
[0101] In the embodiment of the present application, based on the proportional coefficient, the upper limit of the cache resource corresponding to the output port of the data message can be adjusted, and the cache resource can be subsequently allocated to the output port according to the adjusted upper limit of the cache resource.
[0102] In a possible implementation, after determining the proportional coefficient corresponding to the output port, the switch can calculate the cache resource upper limit of the output port, and subsequently allocate cache resources to the output port within a range not exceeding the cache resource upper limit and a range not exceeding the total amount of shared cache resources.
[0103] Exemplarily, the cache resource upper limit may be the product of the proportional coefficient and the unused cache amount in the current shared cache.
[0104] In a possible implementation, cache resources are allocated to output ports according to the adjusted cache resource upper limit.
[0105] That is, the switch can adjust the cache resources allocated to the output port for caching data packets according to the adjusted upper limit of the cache resources.
[0106] The cache resource is less than or equal to the cache resource upper limit.
[0107] That is to say, the adjusted cache resource upper limit may be greater than the shared cache resource. In this case, the maximum cache resource allocated to the output port is the shared cache resource. If the adjusted cache resource upper limit is less than or equal to the shared cache resource, the maximum cache resource allocated to the output port is the cache resource upper limit.
[0108] For example, if the data flow type of the data packet is a small flow or a business flow, the increase in the cache resource upper limit reduces the probability that the cache resources allocated to the output port cannot completely cache the small flow or business flow, thereby reducing the packet loss rate of the small flow or business flow.
[0109] To summarize, by identifying the data flow type of the received data packet, the proportional coefficient of the output port for the small flow to be output is greater than the proportional coefficient of the output port for the large flow to be output, and the proportional coefficient of the output port for the business flow to be output is greater than the proportional coefficient of the output port for the non-business flow to be output. This can reduce the packet loss rate of delay-sensitive small flows or business flows as much as possible when allocating cache resources, thereby reducing the overall packet loss rate of the switch, thereby improving the performance of the switch.
[0110] In one possible case, in order to avoid the situation where the burst data flow sensitive to packet loss suffers continuous packet loss due to insufficient buffer resource limit of the switch, a buffer management solution according to the following embodiment can be provided. Figure 6 , Figure 6 A flow chart of a cache management method provided by an exemplary embodiment of the present application is shown. The cache management method is executed by a network device, which may be a switch, and the cache management method includes the following steps:
[0111] S201, obtaining queue changes of output ports.
[0112] In an embodiment of the present application, the switch can detect changes in queues in the output port at a specified period.
[0113] The queue change condition may be the amount of data in the cache queue of the output port that increases or decreases in a specified period.
[0114] In a possible implementation, the switch obtains a first data volume in a cache queue of an output port at a first moment, obtains a second data volume in the cache queue of the output port at a second moment, and determines a difference between the second data volume and the first data volume as a queue change status of the cache queue.
[0115] The first moment is before the second moment, and there is a specified period between the first moment and the second moment.
[0116] That is, the switch can monitor the change in the amount of data to be output that is cached in the cache queue of each output port in a specified period.
[0117] For example, the switch obtains the amount of data cached in the cache queue of the current output port. If the specified period is 2s, the amount of data cached in the cache queue of the output port can be obtained after 2s, and the increased or decreased amount of data is obtained as the data increase or decrease status of the cache queue, that is, the queue change status of the cache queue.
[0118] S202: Determine a proportional coefficient based on a change in the queue.
[0119] In the embodiment of the present application, the switch can determine the proportional coefficient of each cache queue of the output port according to the change of the queue.
[0120] In a possible implementation, if the data growth amount of the cache queue indicated by the queue change situation exceeds a specified threshold, the proportional coefficient is adjusted to the first proportional coefficient.
[0121] The adjusted first proportionality coefficient is greater than the adjusted first proportionality coefficient.
[0122] That is to say, if the queue change indicates that the increased data volume is greater than the first threshold, the third parameter is determined as the proportional coefficient of the output port; if the queue change indicates that the increased data volume is less than or equal to the first threshold, the fourth parameter is determined as the proportional coefficient of the output port, and the third parameter is greater than the fourth parameter.
[0123] In a possible implementation, a third parameter and a fourth parameter are preconfigured in the switch, wherein the third parameter is greater than the fourth parameter. If the data growth of the data in the cache queue of the output port in a specified period is greater than the first threshold, the third parameter can be determined as the proportional coefficient. If the data growth of the data in the cache queue of the output port in a specified period is less than or equal to the first threshold, the fourth parameter can be determined as the proportional coefficient.
[0124] In order to prevent the continuously growing amount of data in the cache queue of the output port from exceeding the current cache resource upper limit, the proportion coefficient of the cache queue in the output port can be adjusted in time by monitoring the queue changes of the output port, thereby adjusting the cache resource upper limit of each cache queue to avoid the problem of insufficient cache resource allocation caused by continuous reception of burst flows, thereby reducing the packet loss rate of delay-sensitive burst flows and improving the performance of the switch.
[0125] In a possible implementation, the switch obtains a correspondence between a threshold range to which a queue change condition of a cache queue of an output port belongs and each proportional coefficient, determines a target threshold range to which the queue change condition belongs, and based on the correspondence, determines the proportional coefficient corresponding to the target threshold range as the proportional coefficient of the cache queue.
[0126] Among them, the value of the threshold range is positively correlated with the proportional coefficient.
[0127] Exemplarily, a preset corresponding relationship is stored in the switch, and the corresponding relationship can be implemented as different queue change situations corresponding to respective gears according to the threshold range to which the queue change situation belongs, and each gear can correspond to its own proportional coefficient.
[0128] Exemplarily, the corresponding relationship stored in the switch may be as shown in Table 1 below.
[0129] Gear 0 1 2 3 4 5 Scale factor 4 16 64 256 1024 4096
[0130] Table 1
[0131] Among them, the corresponding relationship can include six gears from level 0 to level 5. The larger the gear, the larger the proportional coefficient corresponding to the gear. There is also a corresponding relationship between the threshold range of the queue change and each gear. The larger the upper limit value of the threshold range of the queue change, the larger the corresponding gear.
[0132] In a possible implementation, the switch obtains the cache state of the output port, and if it is determined that the cache state of the output port is in a normal state, a smaller proportional coefficient is allocated to the output port; if it is determined that the cache state of the output port is in an absorbing state, a larger proportional coefficient is allocated to the output port.
[0133] The cache state of the output port can be determined by monitoring the growth of data in the cache queue of the output port. When the growth of data monitored in a specified period exceeds a first threshold, the output port can be determined to be in an absorbing state; when the growth of data monitored in a specified period does not exceed the first threshold, the cache state of the output port can be determined to be a normal state.
[0134] By allocating a smaller proportional coefficient to the output port in the normal state and a larger proportional coefficient to the output port in the absorbing state, the output port in the absorbing state can obtain more cache resources when the shared cache resources are limited, and can better absorb burst data flows and reduce the packet loss rate of burst data flows that are sensitive to packet loss.
[0135] The output port in the absorbing state may be assigned a first designated parameter, and the output port in the normal state may be assigned a second designated parameter, wherein the first designated parameter is greater than the second designated parameter. Alternatively, the output port in the absorbing state may be determined as a high gear, and the output port in the normal state may be determined as a low gear, for example, among levels 0 to 5, levels 0 to 2 are low gears, and levels 3 to 5 are high gears. The proportional coefficient corresponding to the smallest gear among the high gear and the low gear may be determined as the proportional coefficient of the output port.
[0136] For example, Figure 7 Schematic diagram of allocating proportional coefficients according to the cache status of ports involved in an embodiment of the present application. Figure 7 As shown, if the switch 110 has four output ports, including output port 0 to output port 3, and by monitoring the queue changes of the output ports within a specified period, it can be determined that output port 0 and output port 2 are output ports in a normal state, and output port 1 and output port 3 are output ports in an absorbing state. By querying the corresponding relationship shown in Table 1, it can be determined that output port 0 and output port 2 correspond to level 0, and the proportional coefficient of output port 0 and output port 2 is 4; it can be determined that output port 1 and output port 3 correspond to level 3, and the proportional coefficient of output port 1 and output port 3 is 256.
[0137] In a possible implementation, if the data growth amount of the cache queue indicated by the queue change situation exceeds a specified threshold for a specified number of consecutive times, the proportional coefficient is adjusted from the first proportional coefficient to a second proportional coefficient; wherein the second proportional coefficient is greater than the first proportional coefficient.
[0138] That is, if it is determined that the cache state of the output port is the absorption state for n consecutive specified cycles, one gear can be added to the current gear of the output port, where n is a positive integer greater than or equal to 2.
[0139] For example, Figure 7 As shown, if the output port 3 is determined to be in the absorbing state in the first specified cycle, the gear corresponding to the output port 3 is determined to be the 3-level gear. If the cache state of the output port 3 is still determined to be the absorbing state in the next specified cycle, the gear corresponding to the output port 3 can be increased by one gear, that is, adjusted to the 4-level gear, and the proportional coefficient allocated to the output port 3 is adjusted from 256 to 1024.
[0140] In a possible implementation, if the output port in the absorbing state is determined to be adjusted to a normal state in the next specified cycle, the gear corresponding to the output port may be reduced by one gear.
[0141] For example, Figure 7 As shown, if output port 3 is determined to be in the absorbing state in the first specified cycle, the gear corresponding to output port 3 is determined to be level 3 gear. If the cache state of output port 3 is determined to be adjusted to the normal state in the next specified cycle, the gear corresponding to output port 3 can be lowered by one gear, that is, adjusted to level 2 gear, and the proportional coefficient allocated to output port 3 is adjusted from 256 to 64.
[0142] S203: Determine the upper limit of the cache resource corresponding to the output port based on the proportional coefficient.
[0143] In the embodiment of the present application, the cache resource upper limit of the output port is adjusted based on the proportional coefficient, and the cache resource is subsequently allocated to the output port according to the adjusted cache resource upper limit.
[0144] That is to say, after determining the proportional coefficient corresponding to the output port, the switch can calculate the cache resource upper limit of the output port, and subsequently allocate cache resources to the output port within the range not exceeding the cache resource upper limit and the total amount of shared cache resources.
[0145] In summary, by monitoring the queue changes in the cache queue of the output port, it can be determined whether the output port continues to receive burst data flows. If the data growth amount of the cache queue indicated by the queue changes exceeds a specified threshold, the proportional coefficient is adjusted to the first proportional coefficient. The adjusted first proportional coefficient is greater than the proportional coefficient before the adjustment. This can reduce the packet loss rate of delay-sensitive burst data flows as much as possible when allocating cache resources, and reduce the cache pressure on the output port caused by continuously receiving burst data flows, thereby reducing the overall packet loss rate of the switch, thereby improving the performance of the switch.
[0146] In one possible case, in order to avoid the situation where the switch does not have enough buffer resources, resulting in packet loss of small or service flows that are sensitive to packet loss, as well as packet loss of burst data flows that are sensitive to packet loss, a buffer management solution as shown in the following embodiment can be provided. Figure 8 , Figure 8 A flow chart of a cache management method provided by an exemplary embodiment of the present application is shown. The cache management method is executed by a network device, which may be a switch, and the cache management method includes the following steps:
[0147] S301, receiving a data message, and determining a data flow type of the data message based on the data message.
[0148] In the embodiment of the present application, the switch can obtain the data message through the input port, obtain the data flow where the data packet encapsulating the data message is located, and determine that the data flow type of the data flow is the data flow type of the data message.
[0149] The process of acquiring the data message and determining the data flow type of the data message may be as shown in S101 and S102, and will not be described in detail here.
[0150] S302: Determine a proportionality factor based on the data stream type.
[0151] The process of determining the proportionality coefficient based on the data stream type may be as shown in S103, which will not be described in detail herein.
[0152] S303, obtaining queue changes of the output port in a specified period.
[0153] The process of obtaining the queue change status of the output port in the specified period may be as shown in S201, which will not be described in detail here.
[0154] S304: Adjust the proportionality coefficient based on the queue change of the output port.
[0155] In the embodiment of the present application, since the proportional coefficient of the output port is determined first according to the data flow type of the data message, the proportional coefficient can be adjusted after monitoring for a specified period based on the queue changes of the output port in the specified period.
[0156] The manner of obtaining the queue change situation based on the output port and adjusting the proportional coefficient may be as shown in S202 and will not be described in detail here.
[0157] S305: Determine the upper limit of the cache resource corresponding to the output port based on the adjusted proportional coefficient.
[0158] For example, Fig. 9 Schematic diagram of adjusting the proportionality coefficient involved in the embodiment of the present application. Fig. 9As shown, after the input port of the switch 110 receives the data stream, the input data stream is identified by the input port monitoring module using the large and small stream identification technology, and the cache queue of the output port to which the small stream joins is determined, and the proportional coefficient of the cache queue of the small stream to be output is determined to be a larger parameter value, and the proportional coefficient of the cache queue that does not include the small stream in the output data to be output is determined to be a smaller parameter value. Then the switch 110 can also continue to monitor the queue changes of each cache queue in the output port to which the output port allocates cache resources according to the current proportional coefficient under the specified period, and determine the cache state of the output port. The proportional coefficient of the output port is adjusted according to the queue changes, wherein the proportional coefficient of the output port when the cache state is a normal state is reduced, and the proportional coefficient of the output port when the cache state is an absorption state is increased. Thereby, the upper limit of the cache resource is adjusted based on the adjusted proportional coefficient, and the cache resource is allocated to the output port according to the adjusted upper limit of the cache resource.
[0159] In summary, by combining the data flow type of the data message and the queue changes of the output port of the data message, while reducing the packet loss rate of the data message corresponding to the data flow type with high packet loss sensitivity, it also takes into account the increase of the cache resource upper limit for the output port corresponding to the continuous burst data flow, thereby reducing the packet loss rate of the switch and improving the performance of the switch in data interaction.
[0160] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the method. It can be understood that in order to realize the above functions, the cache management device includes at least one of the hardware structure and software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed in this document, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in hardware or in a computer software-driven hardware manner depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0161] The embodiment of the present application can divide the cache management device into functional units according to the above method example. For example, each functional unit can be divided according to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical functional division. There may be other division methods in actual implementation.
[0162] For example, Fig.10The schematic diagram of the structure of a cache management device 500 provided by an exemplary embodiment of the present application is shown. The cache management device 500 is applied to a switch, or the cache management device 500 can be a switch. The cache management device 500 includes:
[0163] Acquisition module 510, used for receiving data message;
[0164] Processing module 520 is used to determine the data flow type of the data message based on the data message; determine the proportional coefficient based on the data flow type; the proportional coefficient is used to indicate the proportion of the free cache amount that can be used by the output port of the data message; based on the proportional coefficient, determine the cache resource upper limit corresponding to the output port of the data message.
[0165] For example, combined with Figure 3 , the acquisition module 510 can be used to perform the following steps: Figure 3 As shown in S101, the processing module 520 can be used to perform the following steps: Figure 3 S102, S103, S104 shown.
[0166] In a possible implementation, the processing module 520 is further configured to determine the proportional coefficient based on the data flow type and the queue change of the output port.
[0167] In a possible implementation manner, the proportional coefficient corresponding to the data packets whose data flow type is a small flow is greater than the proportional coefficient corresponding to the data packets whose data flow type is a large flow.
[0168] In a possible implementation manner, the proportional coefficient corresponding to the data packets whose data flow type is a business flow is greater than the proportional coefficient corresponding to the data packets whose data flow type is a non-business flow.
[0169] In a possible implementation, at least one cache queue corresponding to the output port of the data message has a respective proportional coefficient; the acquisition module 510 is further used to determine the proportional coefficient of the cache queue temporarily storing the data message based on the data flow type.
[0170] In a possible implementation, the processing module 520 is further used to determine a proportionality coefficient based on the data flow type; obtain a queue change condition of the output port in a specified period; and adjust the proportionality coefficient based on the queue change condition of the output port.
[0171] In one possible implementation, the processing module 520 is further used to adjust the proportional coefficient to a first proportional coefficient if the data growth amount of the cache queue indicated by the queue change exceeds a specified threshold; wherein the adjusted first proportional coefficient is greater than the adjusted first proportional coefficient.
[0172] In one possible implementation, the processing module 520 is also used to adjust the proportional coefficient from the first proportional coefficient to a second proportional coefficient if the data growth amount of the cache queue indicated by the queue change exceeds the specified threshold for a specified number of consecutive times; wherein the second proportional coefficient is greater than the first proportional coefficient.
[0173] For the detailed description of the above optional methods, please refer to the above method embodiments, which will not be repeated here. In addition, the explanation of any cache management device provided above and the description of its beneficial effects can refer to the above corresponding method embodiments, which will not be repeated here.
[0174] As an example, the functions implemented in part or all of the acquisition module 510 and the processing module 520 in the cache management device can be implemented by Figure 1 Network devices in or Figure 2 The switch in is executed.
[0175] For example, Fig.11 The schematic diagram of the structure of a cache management device 600 provided by an exemplary embodiment of the present application is shown. The cache management device 600 is applied to a switch, or the cache management device 600 can be a switch. The cache management device 600 includes:
[0176] The acquisition module 610 is used to acquire the queue change status of the output port;
[0177] The processing module 620 is used to determine a proportionality coefficient based on the queue change; the proportionality coefficient is used to indicate the proportion of the free buffer that can be used by the output port; based on the proportionality coefficient, determine the buffer resource upper limit corresponding to the output port.
[0178] For example, combined with Figure 6 , the acquisition module 610 can be used to perform the following steps: Figure 6 As shown in S201, the processing module 620 can be used to perform the following steps: Figure 6 S202 and S203 shown.
[0179] In a possible implementation, the processing module 620 is further configured to determine the proportional coefficient based on a data flow type of the data message to be output by the output port and a change in a queue of the output port.
[0180] In one possible implementation, the processing module 620 is also used to determine the proportional coefficient based on the data flow type of the data packet to be output by the output port; obtain the queue change of the output port in a specified period; and adjust the proportional coefficient based on the queue change of the output port.
[0181] In a possible implementation, at least one cache queue corresponding to the output port of the data message has a respective proportional coefficient; the acquisition module 610 is further used to determine the proportional coefficient of the cache queue based on the queue change of the cache queue.
[0182] In one possible implementation, the processing module 620 is further used to adjust the proportional coefficient to a first proportional coefficient if the data growth amount of the cache queue indicated by the queue change exceeds a specified threshold; wherein the adjusted first proportional coefficient is greater than the adjusted first proportional coefficient.
[0183] In one possible implementation, the processing module 620 is also used to adjust the proportional coefficient from the first proportional coefficient to a second proportional coefficient if the data growth amount of the cache queue indicated by the queue change exceeds the specified threshold for a specified number of consecutive times; wherein the second proportional coefficient is greater than the first proportional coefficient.
[0184] In a possible implementation manner, the proportional coefficient corresponding to the data packets whose data flow type is a small flow is greater than the proportional coefficient corresponding to the data packets whose data flow type is a large flow.
[0185] In a possible implementation manner, the proportional coefficient corresponding to the data packets whose data flow type is a business flow is greater than the proportional coefficient corresponding to the data packets whose data flow type is a non-business flow.
[0186] For the detailed description of the above optional methods, please refer to the above method embodiments, which will not be repeated here. In addition, the explanation of any cache management device provided above and the description of its beneficial effects can refer to the above corresponding method embodiments, which will not be repeated here.
[0187] As an example, the functions implemented in part or all of the acquisition module 610 and the processing module 620 in the cache management device can be implemented by Figure 1 Network devices in or Figure 2 The switch in is executed.
[0188] In an exemplary embodiment, a computer-readable storage medium is also provided, which is used to store at least one instruction, at least one program, code set or instruction set, and the at least one instruction, the at least one program, the code set or instruction set is loaded and executed by a processor to implement all or part of the steps in the above-mentioned memory fault prediction method. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0189] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computing device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computing device performs the above Figure 3 , Figure 6 or Figure 8 All or part of the steps of the method shown in any embodiment.
[0190] In some embodiments, the method shown in the embodiments of the present application can be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or encoded on other non-transitory media or products.
[0191] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0192] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0193] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0194] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0195] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0196] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A cache management method, characterized in that: The method comprises: Receive data packets; Based on the data message, determining a data flow type of the data message; Determine a proportionality coefficient based on the data flow type; the proportionality coefficient is used to indicate the proportion of the free buffer amount that can be used by the output port of the data message; Based on the proportional coefficient, an upper limit of cache resources corresponding to the output port of the data message is determined.
2. The method according to claim 1, characterized in that The determining of the proportionality coefficient based on the data stream type includes: The proportional coefficient is determined based on the data flow type and the queue change of the output port.
3. The method according to claim 1 or 2, characterized in that: The proportional coefficient corresponding to the data message whose data flow type is a small flow is greater than the proportional coefficient corresponding to the data message whose data flow type is a large flow.
4. The method according to any one of claims 1 to 3, characterized in that: The proportional coefficient corresponding to the data message whose data flow type is business flow is greater than the proportional coefficient corresponding to the data message whose data flow type is non-business flow.
5. The method according to any one of claims 1 to 4, characterized in that: At least one cache queue corresponding to the output port of the data message has a respective proportional coefficient; The determining of the proportionality coefficient based on the data stream type includes: Based on the data flow type, a proportion coefficient of a cache queue for temporarily storing the data message is determined.
6. The method according to claim 2, characterized in that The determining the proportional coefficient based on the data flow type and the queue change of the output port includes: determining a scaling factor based on the data stream type; Obtain the queue change status of the output port in a specified period; The proportional coefficient is adjusted based on the change of the queue of the output port.
7. The method according to claim 6, characterized in that The adjusting the proportional coefficient based on the queue change of the output port includes: If the data growth amount of the cache queue indicated by the queue change condition exceeds a specified threshold, the proportional coefficient is adjusted to a first proportional coefficient; wherein the adjusted first proportional coefficient is greater than the adjusted first proportional coefficient.
8. The method according to claim 7, characterized in that The method further comprises: If the data growth amount of the cache queue indicated by the queue change condition exceeds the specified threshold for a specified number of consecutive times, the proportional coefficient is adjusted from the first proportional coefficient to a second proportional coefficient; wherein the second proportional coefficient is greater than the first proportional coefficient.
9. A cache management method, characterized in that: The method comprises: Get the queue changes of the output port; Determine a proportionality coefficient based on the queue change; the proportionality coefficient is used to indicate the proportion of the free buffer amount that can be used by the output port; Based on the proportionality coefficient, an upper limit of the cache resource corresponding to the output port is determined.
10. The method according to claim 9, characterized in that The determining of the proportionality coefficient based on the queue change condition includes: The proportional coefficient is determined based on the data flow type of the data message to be output by the output port and the queue change status of the output port.
11. The method according to claim 10, characterized in that The determining the proportional coefficient based on the data flow type of the data message to be output by the output port and the queue change of the output port includes: Determining a proportionality coefficient based on the data flow type of the data message to be output by the output port; Obtain the queue change status of the output port in a specified period; The proportional coefficient is adjusted based on the change of the queue of the output port.
12. The method according to any one of claims 9 to 11, characterized in that: At least one cache queue corresponding to the output port has a respective proportional coefficient; The determining of the proportionality coefficient based on the queue change condition includes: Based on the queue change condition of the cache queue, a proportional coefficient of the cache queue is determined.
13. The method according to claim 11, characterized in that The adjusting the proportional coefficient based on the queue change of the output port includes: If the data growth amount of the cache queue indicated by the queue change condition exceeds a specified threshold, the proportional coefficient is adjusted to a first proportional coefficient; wherein the adjusted first proportional coefficient is greater than the adjusted first proportional coefficient.
14. The method according to claim 13, characterized in that The method further comprises: If the data growth amount of the cache queue indicated by the queue change condition exceeds the specified threshold for a specified number of consecutive times, the proportional coefficient is adjusted from the first proportional coefficient to a second proportional coefficient; wherein the second proportional coefficient is greater than the first proportional coefficient.
15. The method according to claim 10, characterized in that The proportional coefficient corresponding to the data message whose data flow type is a small flow is greater than the proportional coefficient corresponding to the data message whose data flow type is a large flow.
16. The method according to claim 10 or 15, characterized in that The proportional coefficient corresponding to the data message whose data flow type is business flow is greater than the proportional coefficient corresponding to the data message whose data flow type is non-business flow.
17. A network device, characterized in that: The network device includes: a processor and a memory, wherein the memory is coupled to the processor, and the memory is used to store computer-readable instructions. When the processor reads the computer-readable instructions from the memory, the network device executes the cache management method as described in any one of claims 1 to 16.
18. A computer-readable storage medium, characterized in that: The computer-readable storage medium comprises a computer program, and when the computer program is executed on a network device, the network device is enabled to perform the cache management method according to any one of claims 1 to 16.
19. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. The processor of the network device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the network device executes the cache management method according to any one of claims 1 to 16.