Cache management method and device

By setting multiple sets of discard probability parameters in the network switch, select discard probability parameters based on the real-time discard probability of the input port, the problem of large differences in the probability of packet discarding on different ports during network congestion is solved, and the balanced occupation of cache resources is achieved and the improvement of improved cache resources is improved. The service performance of network switching equipment.

CN115022250BActive Publication Date: 2024-11-22XEL TECH INC
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210589003.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-26
Publication Date
2024-11-22
Estimated Expiration
2042-05-26

AI Technical Summary

Technical Problem

When existing network switches are congested, the probability of discarding due to different packet lengths and timings received by different ports is large, which affects the service experience.

Method used

By setting multiple sets of discard probability parameters, select the corresponding discard probability parameters based on the real-time discard probability of the input port, including discard threshold and discard probability threshold, determine whether to discard packets, and update the real-time discard probability based on the discard result and packet byte length , to balance the cache resource usage by each input port.

Benefits of technology

It reduces the probability of discarding the input port with a higher probability of discarding, improves the probability of discarding the input port with a lower probability of discarding, reduces the difference in discarding the probability of discarding the input ports, and improves the overall service performance of network switching devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115022250B_ABST
    Figure CN115022250B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a cache management method and device, the method comprising: receiving a queue request for a message to enter the cache, the queue request comprising an input port, an output port, an output queue and a message byte length; in response to the queue request, selecting a set of discard probability parameters from multiple sets of discard probability parameters according to the real-time discard probability of the input port, each set of discard probability parameters comprising a discard threshold and a discard probability threshold; comparing the cache occupancy of the output port or the output queue with the discard threshold, judging whether the message is a message to be discarded according to the comparison result and the discard probability threshold; if the message is a message to be discarded, discarding the message, and updating the real-time discard probability according to the discard result and the message byte length; if the message is not a message to be discarded, storing the message in the cache, and updating the real-time discard probability according to the storage result and the message byte length. The present application improves the balance of message discarding.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cache management technology, and in particular to a cache management method and device. Background Art

[0002] With the rapid development of network technology, the number of ports on network switches is increasing, the port transmission rate is getting higher and higher, and network burst traffic on network switches is becoming more and more common. Cache is a buffer for network switching equipment to exchange data. When network burst traffic is generated, network switches will experience network congestion due to limited cache resources. After network congestion occurs, the network switch will discard some received messages.

[0003] In the related art, network switches usually use the WRED (Weighted Random Early Detection) mechanism to discard packets. When some ports of the network switch occupy a large amount of cache, the WRED mechanism can compare the priorities and cache occupancy of these ports, and discard some packets received by ports with lower priorities or larger cache occupancy to release cache resources. However, this WRED mechanism cannot solve the problem that the probability of packet discarding at different ports varies greatly due to factors such as different lengths of packets received at different ports and different reception times, which affects the service experience of ports with higher probability of packet discarding. Summary of the invention

[0004] In order to solve the technical problem that the probability of discarding messages at different input ports varies greatly when network congestion occurs, the present application provides a cache management method and device.

[0005] In a first aspect, the present application provides a cache management method, the method comprising:

[0006] Receive a queue request for a message to enter a cache, wherein the queue request includes an input port, an output port, an output queue, and a byte length of the message;

[0007] In response to the enqueue request, selecting a set of drop probability parameters from a plurality of sets of drop probability parameters according to the real-time drop probability of the input port, each set of drop probability parameters including a drop threshold and a drop probability threshold;

[0008] Comparing the buffer occupancy of the output port or the output queue with the discard threshold, and judging whether the message is a message to be discarded according to the comparison result and the discard probability threshold;

[0009] If the message is the message to be discarded, discard the message, and update the real-time discard probability according to the discard result and the byte length of the message;

[0010] If the message is not the message to be discarded, the message is stored in the cache, and the real-time discard probability is updated according to the storage result and the byte length of the message.

[0011] In some embodiments, selecting a set of drop probability parameters from a plurality of preset sets of drop probability parameters according to the real-time drop probability of the input port includes:

[0012] If the real-time drop probability of the input port is less than the first probability, selecting a first set of drop probability parameters, wherein the drop probability threshold in the first set of drop probability parameters is the first threshold;

[0013] If the real-time discard probability is greater than or equal to the first probability and less than the second probability, select a second set of discard probability parameters, and the discard probability threshold in the second set of discard probability parameters is the second threshold;

[0014] If the real-time discard probability is greater than or equal to the second probability and less than the third probability, select a third set of discard probability parameters, and the discard probability threshold in the third set of discard probability parameters is the third threshold;

[0015] The first threshold is greater than the second threshold, and the second threshold is greater than the third threshold.

[0016] In some embodiments, selecting a set of drop probability parameters from a plurality of preset sets of drop probability parameters according to the real-time drop probability of the input port includes:

[0017] If the real-time drop probability of the input port is less than the first probability, selecting a first set of drop probability parameters;

[0018] If the real-time discard probability is greater than or equal to the first probability and less than the second probability, select a second set of discard probability parameters;

[0019] If the real-time discard probability is greater than or equal to the second probability and less than the third probability, select a third set of discard probability parameters;

[0020] Among them, the discard probability threshold in the first group of discard probability parameters, the discard probability threshold in the second group of discard probability parameters, and the discard probability threshold in the third group of discard probability parameters are the same, the first threshold in the first group of discard probability parameters is smaller than the first threshold in the second group of discard probability parameters, the first threshold in the second group of discard probability parameters is smaller than the first threshold in the third group of discard probability parameters, the second threshold in the first group of discard probability parameters is smaller than the second threshold in the second group of discard probability parameters, and the second threshold in the second group of discard probability parameters is smaller than the second threshold in the third group of discard probability parameters.

[0021] In some embodiments, judging whether the message is a message to be discarded according to the comparison result and the discard probability threshold includes:

[0022] If the buffer occupancy is less than the first threshold, determining that the message is not a message to be discarded;

[0023] If the cache occupancy is greater than a second threshold, determining that the message is a message to be discarded;

[0024] If the cache occupancy is greater than or equal to the first threshold and less than or equal to the second threshold, a target discard probability is calculated according to a mapping relationship between the cache occupancy and the discard probability, and whether the message is a message to be discarded is determined according to the target discard probability;

[0025] The discarding threshold includes the first threshold and the second threshold.

[0026] In some embodiments, the calculation formula of the target drop probability includes: Wherein, P represents the target drop probability, p0 represents the drop probability threshold, m represents the buffer occupancy, m1 represents the first threshold, and m2 represents the second threshold.

[0027] In some embodiments, judging whether the message is a message to be discarded is based on the target discard probability, including: comparing the target discard probability with a pseudo-random number; if the target discard probability is less than the pseudo-random number, judging that the message is not a message to be discarded; if the target discard probability is greater than or equal to the pseudo-random number, judging that the enqueue request is the request to be discarded.

[0028] In some embodiments, the pseudo-random number is updated according to a preset period.

[0029] In some embodiments, updating the real-time discard probability according to the discard result and the message byte length includes:

[0030] Updating the discarded message length according to the message byte length, wherein the discarded message length is obtained according to the message discarded by the input port within a preset time;

[0031] The updated real-time discard probability is obtained by calculating the ratio of the updated discarded message length to the total received length, where the total received length is the total message byte length of a preset number of enqueue requests received by the input port.

[0032] In some embodiments, updating the real-time discard probability according to the stored result and the message byte length includes:

[0033] The ratio of the discarded message length to the total received length is calculated to obtain an updated real-time discard probability, where the total received length is the total message byte length of a preset number of enqueue requests received by the input port.

[0034] In a second aspect, the present application provides a cache management device, the device comprising:

[0035] An enqueue request receiving module, used to receive an enqueue request for a message to enter a cache, wherein the enqueue request includes an input port, an output port, an output queue and a message byte length;

[0036] a discard probability parameter selection module, configured to select, in response to the queue entry request, a set of discard probability parameters from a plurality of sets of discard probability parameters according to the real-time discard probability of the input port, each set of discard probability parameters including a discard threshold and a discard probability threshold;

[0037] A discard judgment module, used for comparing the buffer occupancy of the output port or the output queue with the discard threshold, and judging whether the message is a message to be discarded according to the comparison result and the discard probability threshold;

[0038] A discard processing module, used for discarding the message according to the message being the message to be discarded, and updating the real-time discard probability according to the discard result and the byte length of the message;

[0039] The cache processing module is used to store the message in the cache according to the message is not the message to be discarded, and update the real-time discard probability according to the storage result and the byte length of the message.

[0040] The effective effects of the cache management method and device provided by the embodiments of the present application are:

[0041] The embodiment of the present application sets multiple groups of discard probability parameters, selects discard probability parameters according to the real-time discard probability of the input port, and the discard probability parameters include a discard threshold and a discard probability threshold. For input ports with different real-time discard probabilities, different discard probability parameters can be selected to determine whether to discard the message, which is conducive to reducing the discard probability of input ports with higher discard probability, increasing the discard probability of input ports with lower discard probability, reducing the difference in discard probability of each input port, balancing the occupation of cache resources by each input port, and improving the overall service performance of the network switching device. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solution of the present application, the drawings required for use in the embodiments are briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0043] Figure 1 A schematic diagram of a cache management method is shown in FIG.

[0044] Figure 2 A schematic diagram of a discard probability function is shown in FIG.

[0045] Figure 3 A schematic diagram of a plurality of discard probability functions is shown as an example;

[0046] Figure 4 A schematic diagram of a plurality of discard probability functions is shown as an example;

[0047] Figure 5 A schematic diagram of a process for selecting a discard probability parameter is shown in FIG.

[0048] Figure 6 A flow chart of a method for determining a message to be discarded is shown as an example;

[0049] Figure 7 A schematic diagram of the structure of a cache management device is shown in FIG. DETAILED DESCRIPTION

[0050] In order to make the purpose and implementation method of the present application clearer, the exemplary implementation method of the present application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only part of the embodiments of the present application, rather than all the embodiments.

[0051] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their common and usual meanings.

[0052] The terms "first", "second", "third", etc. in the specification and claims of this application and the above drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances.

[0053] The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.

[0054] See also Figure 1 , is a flow chart of a cache management method provided in an embodiment of the present application, such as Figure 1As shown, the cache management method may include the following steps:

[0055] Step S101: receiving an enqueue request, wherein the enqueue request includes an input port, an output port, an output queue and a message byte length.

[0056] In some embodiments, the network switching device is provided with a plurality of input ports and a plurality of output ports, the input port can be used to receive a queue request sent by a previous hop device or a source device to the network switching device, and the output port can be used to forward the message in the queue request to the next hop routing device or to the destination device corresponding to the queue request. The queue request indicates that the application needs to store the generated message in the cache of the network switching device so that the network switching device can forward the message. Each queue request may include a message and information such as the input port, output port, output queue, and byte length of the message.

[0057] Step S102: In response to the enqueue request, a group of discard probability parameters is selected from multiple groups of discard probability parameters according to the real-time discard probability of the input port, each group of discard probability parameters includes a discard threshold and a discard probability threshold.

[0058] In some embodiments, after receiving the queue request, the network switching device can obtain the input port from the queue request, and then obtain the real-time discard probability of the input port. The real-time discard probability can be updated according to the processing result of each message, or can be updated at a preset interval.

[0059] In some embodiments, multiple groups of discard probability parameters may be preset on the network switching device. Each group of discard probability parameters may include a discard threshold and a discard probability threshold. In different groups of discard probability parameters, at least one of the discard threshold and the discard probability threshold is different. The discard threshold may include a first threshold and a second threshold, and the first threshold is less than the second threshold. For example, the discard probability thresholds are different, and the first threshold and the second threshold are the same; or the discard probability thresholds are different, and the first threshold and the second threshold are different; or the discard probability thresholds are different, and the first threshold is the same, and the second threshold is different; or the discard probability thresholds are different, and the first threshold is different, and the second threshold is different; or the discard probability thresholds are different, and the first threshold is different, and the second threshold is the same; or the discard probability thresholds are the same, and the first threshold is the same, and the second threshold is different; or the discard probability thresholds are the same, and the first threshold is different, and the second threshold is the same.

[0060] Each set of drop probability parameters corresponds to a drop probability function related to the buffer occupancy. The drop probability function can represent the mapping relationship between the buffer occupancy and the drop probability. The target drop probability can be calculated based on the drop probability function. Figure 2 , is a graphical diagram of a discard probability function, such as Figure 2 As shown, the calculation formula of the target drop probability is as follows:

[0061]

[0062] In formula (1), P represents the target drop probability, p0 represents the drop probability threshold, m represents the cache occupancy, m1 represents the first threshold, and m2 represents the second threshold. The first threshold is smaller than the second threshold, and the first threshold is the lowest threshold. If the cache occupancy is smaller than the first threshold, the target drop probability is 0, and the message may not be dropped. The second threshold is the highest threshold. If the cache occupancy is larger than the second threshold, the target drop probability is 1, and the message may be directly dropped. If the cache occupancy is between the first threshold and the second threshold, a target drop probability may be calculated according to formula (1), and then whether the message needs to be dropped may be further determined according to the target drop probability.

[0063] Exemplarily, three groups of discard probability parameters may be preset on the network switching device. The discard probability threshold in the first group of discard probability parameters may be referred to as the first threshold, the discard probability threshold in the second group of discard probability parameters may be referred to as the second threshold, and the discard probability in the third group of discard probability parameters may be referred to as the third threshold.

[0064] In some embodiments, the first threshold, the second threshold, and the third threshold may be the same. The first threshold of the first set of drop probability parameters is less than the first threshold of the second set of drop probability parameters, and the first threshold of the second set of drop probability parameters is less than the first threshold of the third set of drop probability parameters. The second threshold of the first set of drop probability parameters is less than the second threshold of the second set of drop probability parameters, and the second threshold of the second set of drop probability parameters is less than the second threshold of the third set of drop probability parameters. For example, see Figure 3 , which is a diagram of multiple discard probability functions. Figure 3 In , L1 represents the drop probability function corresponding to the first set of drop probability parameters, L2 represents the drop probability function corresponding to the second set of drop probability parameters, and L3 represents the drop probability function corresponding to the third set of drop probability parameters. Figure 3 As shown, for the same cache occupancy, if the first set of discard probability parameters is selected, the calculated target discard probability is the highest, if the second set of discard probability parameters is selected, the calculated target discard probability is second, and if the third set of discard probability parameters is selected, the calculated target discard probability parameters is the lowest.

[0065] In some embodiments, the first threshold is greater than the second threshold, and the second threshold is greater than the third threshold. Figure 4 , which is a diagram of multiple discard probability functions. Figure 4 In , L1 represents the drop probability function corresponding to the first set of drop probability parameters, L2 represents the drop probability function corresponding to the second set of drop probability parameters, and L3 represents the drop probability function corresponding to the third set of drop probability parameters. Figure 4As shown, for the same cache occupancy, if the first set of discard probability parameters is selected, the calculated target discard probability is the highest, if the second set of discard probability parameters is selected, the calculated target discard probability is second, and if the third set of discard probability parameters is selected, the calculated target discard probability parameters is the lowest.

[0066] Depend on Figure 3 and Figure 4 It can be seen that the overall drop probability corresponding to the first set of drop probability parameters is greater than the overall drop probability corresponding to the second set of drop probability parameters, and the overall drop probability corresponding to the second set of drop probability parameters is greater than the overall drop probability corresponding to the third set of drop probability parameters.

[0067] In some embodiments, when the buffer occupancy is between the first threshold and the second threshold, the target discard probability and the buffer occupancy may also be a nonlinear function, for example, an exponential function.

[0068] In some embodiments, an alternative discard probability parameter may also be determined based on the total buffer occupancy of the network switching device. For example, when the total buffer occupancy of the network switching device is less than 50%, the discard probability parameter may be used. Figure 3 The multiple sets of discard probability parameters of the fixed discard probability threshold shown in FIG. 1 can be used when the total buffer occupancy of the network switching device is greater than or equal to 50%. Figure 4 Multiple sets of drop probability parameters for different drop probability thresholds are shown.

[0069] In some embodiments, the discard probability threshold, the first threshold and the second threshold of each group of discard probability parameters may also be adjusted according to actual needs.

[0070] In some embodiments, for an enqueue request, a set of drop probability parameters may be selected from multiple sets of drop probability parameters preset on a network switching device. When the drop probability of the input port is higher, a drop probability parameter with a lower overall drop probability may be selected, and then the target drop probability of the enqueue request is determined based on the selected drop probability parameters. The method for selecting the drop probability parameter may be found in Figure 5 , including the following steps:

[0071] Step S201: If the real-time drop probability of the input port is less than a first probability, a first set of drop probability parameters is selected, wherein the drop probability threshold in the first set of drop probability parameters is a first threshold.

[0072] In some embodiments, the first probability p1, the second probability p2 and the third probability p3 are preset probability thresholds, the first probability p1 is less than the second probability p2, and the second probability p2 is less than the third probability p3. If the real-time drop probability of the input port is less than the first probability p1, it means that the drop probability of the input port is too small. In order to balance the drop probability of each input port, the drop probability of the input port can be increased. Since the drop probability threshold of the first group of drop probability is greater than the drop probability threshold in the second group of drop probability parameters, and is also greater than the drop probability threshold in the third group of drop probability parameters, the target drop probability calculated by selecting the first group of drop probability parameters may be relatively large, which can meet the demand of increasing the drop probability of the input port.

[0073] Step S202: If the real-time discard probability is greater than or equal to the first probability and less than a second threshold, a second set of discard probability parameters is selected, and the discard probability threshold in the second set of discard probability parameters is the second threshold.

[0074] In some embodiments, if the real-time discard probability of the input port is greater than or equal to the first probability and less than the second probability, it means that the discard probability of the input port is moderate. In order to balance the discard probability of each input port, a second set of discard probability parameters can be selected to meet the requirement of maintaining the discard probability of the input port.

[0075] Step S203: If the real-time discard probability is greater than or equal to the second probability and less than the third probability, a third set of discard probability parameters is selected, and the discard probability threshold in the third set of discard probability parameters is the third threshold.

[0076] In some embodiments, if the real-time discard probability of the input port is greater than or equal to the second probability, it means that the discard probability of the input port is too high. In order to balance the discard probabilities of each input port, a third set of discard probability parameters can be selected to meet the requirement of reducing the discard probability of the input port.

[0077] Step S103: Compare the buffer occupancy of the output port or the output queue with the discard threshold, and determine whether the message is a message to be discarded according to the comparison result and the discard probability threshold.

[0078] In some embodiments, after selecting a set of discard probability parameters, the method for determining whether to discard a message according to the discard probability parameters can be found in Figure 6 , including the following steps:

[0079] Step S301: If the buffer occupancy is less than the first threshold, it is determined that the message is not a message to be discarded.

[0080] In some embodiments, after receiving an enqueue request, the network switching device can obtain the output port and the output queue from the enqueue request, and then obtain the cache occupancy of the output port and the cache occupancy of the output queue, compare the cache occupancy of the output port with the first threshold and the second threshold, and compare the cache occupancy of the output queue with the first threshold and the second threshold.

[0081] In some embodiments, if the buffer occupancy of the output port is less than the first threshold, and the buffer occupancy of the output queue is less than the first threshold, it indicates that the buffer occupancy of the output port and the output queue is small, and it can be determined that the message in the enqueue request is not a message to be discarded.

[0082] Step S302: If the buffer occupancy is greater than the second threshold, determine that the message is a message to be discarded.

[0083] In some embodiments, if the buffer occupancy of the output port is greater than the second threshold, or the buffer occupancy of the output queue is greater than the second threshold, it indicates that the buffer occupancy of the output port or the output queue is high, and it can be determined that the message in the enqueue request is a message to be discarded.

[0084] Step S303: If the cache occupancy is greater than or equal to the first threshold and less than or equal to the second threshold, calculate the target discard probability according to the mapping relationship between the cache occupancy and the discard probability, and determine whether the message is a message to be discarded according to the target discard probability.

[0085] In some embodiments, if the buffer occupancy of the output port is greater than or equal to the first threshold and less than or equal to the second threshold, and the buffer occupancy of the output queue is greater than or equal to the first threshold and less than or equal to the second threshold, it indicates that the buffer occupancy of the output port or the output queue is moderate, and the target discard probability can be calculated according to formula (1), and whether the message is a message to be discarded can be determined according to the target discard probability.

[0086] In some embodiments, a pseudo-random number generation thread may be provided on the network switching device to periodically generate or update a pseudo-random number in the range of 0 to 1. If the target discard probability is less than the pseudo-random number, it can be determined that the message in the queue entry request is not a message to be discarded. If the target discard probability is greater than or equal to the pseudo-random number, it can be determined that the message in the queue entry request is a message to be discarded.

[0087] Step S104: If the message is the message to be discarded, discard the message, and update the real-time discard probability according to the discard result and the byte length of the message.

[0088] In some embodiments, if it is determined that the message in the queue request is a message to be discarded, the message may be discarded, and the real-time discard probability of the input port corresponding to the queue request is updated. At this time, the calculation formula of the real-time discard probability is as follows:

[0089]

[0090] In formula (2), P' represents the real-time discard probability, (D0+B) represents the discarded message length, (A0+B) represents the received message length, D0 represents the total number of bytes of discarded messages in the messages received by the input port (n-1) times most recently before receiving the enqueue request, B represents the message byte length of the message corresponding to the enqueue request, A0 represents the total number of bytes of the messages received by the input port (n-1) times most recently before receiving the enqueue request, and n represents a preset number, which can be an adjustable parameter greater than or equal to 2. For example, n is equal to 10. It can be seen from formula (2) that after discarding the message in the enqueue request, the discarded message length and the received message length can be updated, and the real-time discard probability is obtained according to the ratio of the updated discarded message length to the updated received message length.

[0091] In some embodiments, the real-time discard probability may also be obtained based on the ratio of the total number of bytes of messages discarded by the input port within a preset time to the total number of bytes of messages received within a preset time, and the preset time may be 1 millisecond.

[0092] Step S105: If the message is not the message to be discarded, the message is stored in a cache, and the real-time discard probability is updated according to the storage result and the byte length of the message.

[0093] In some embodiments, if it is determined that the message in the queue request is a message to be discarded, the message may be discarded, and the real-time discard probability of the input port corresponding to the queue request is updated. At this time, the calculation formula of the real-time discard probability is as follows:

[0094]

[0095] It can be seen from formula (3) that after the message in the queue request is stored in the cache, the received message length can be updated, and the real-time discard probability can be obtained according to the ratio of the discarded message length and the updated received message length.

[0096] In some embodiments, after each message is received from the input port, the real-time discard probability may be updated according to formula (2) or formula (3).

[0097] In some embodiments, the real-time discard probability may be updated after each reception of a preset number of messages from the input port, so as to reduce the amount of calculation of the network switching device and ensure the performance of the network switching device.

[0098] The present application also provides a cache management device, which is a software device. Figure 7 The cache management device may include a queue request receiving module, a discard probability parameter selection module, a discard judgment module, a discard processing module and a cache processing module.

[0099] In some embodiments, the enqueue request receiving module is used to receive an enqueue request for a message to enter a cache, and the enqueue request includes an input port, an output port, an output queue, and a message byte length.

[0100] In some embodiments, the discard probability parameter selection module is used to select a set of discard probability parameters from multiple sets of discard probability parameters in response to the enqueue request according to the real-time discard probability of the input port, each set of discard probability parameters includes a discard threshold and a discard probability threshold.

[0101] In some embodiments, the discard judgment module is used to compare the buffer occupancy of the output port or the output queue with the discard threshold, and judge whether the message is a message to be discarded according to the comparison result and the discard probability threshold.

[0102] In some embodiments, the discard processing module is used to discard the message according to the message being a message to be discarded, and update the real-time discard probability according to the discard result and the byte length of the message.

[0103] In some embodiments, the cache processing module is used to store the message in the cache according to the fact that the message is not a message to be discarded, and update the real-time discard probability according to the storage result and the byte length of the message.

[0104] The functions of each module of the cache management device can be found in the relevant description of the cache management method, which will not be repeated here.

[0105] As can be seen from the above embodiments, the embodiments of the present application set multiple groups of discard probability parameters, select discard probability parameters according to the real-time discard probability of the input port, and the discard probability parameters include a discard threshold and a discard probability threshold. For input ports with different real-time discard probabilities, different discard probability parameters can be selected to determine whether to discard the message, which is conducive to reducing the discard probability of input ports with higher discard probabilities, increasing the discard probability of input ports with lower discard probabilities, and reducing the difference in discard probabilities of each input port, which is conducive to balancing the occupation of cache resources by each input port when the network is congested, and improving the overall service performance of the network switching device.

[0106] Since the above embodiments are all described by citing and combining with other embodiments, different embodiments have the same parts, and the same and similar parts between the embodiments in this specification can be referred to each other. No further detailed description is given here.

[0107] The above implementation modes of the present application do not constitute a limitation on the protection scope of the present application.

Claims

1. A cache management method, characterized in that: include: Receive a queue request for a message to enter a cache, wherein the queue request includes an input port, an output port, an output queue, and a byte length of the message; In response to the enqueue request, selecting a set of drop probability parameters from a plurality of sets of drop probability parameters according to the real-time drop probability of the input port, each set of drop probability parameters including a drop threshold and a drop probability threshold; Comparing the buffer occupancy of the output port or the output queue with the discard threshold, and judging whether the message is a message to be discarded according to the comparison result and the discard probability threshold; If the buffer occupancy is less than the first threshold, determining that the message is not a message to be discarded; If the cache occupancy is greater than a second threshold, determining that the message is a message to be discarded; If the cache occupancy is greater than or equal to the first threshold and less than or equal to the second threshold, a target discard probability is calculated according to a mapping relationship between the cache occupancy and the discard probability, and whether the message is a message to be discarded is determined according to the target discard probability; The discard threshold includes the first threshold and the second threshold; If the message is the message to be discarded, discard the message, and update the real-time discard probability according to the discard result and the byte length of the message; If the message is not the message to be discarded, the message is stored in the cache, and the real-time discard probability is updated according to the storage result and the byte length of the message.

2. The cache management method according to claim 1, characterized in that: Selecting a set of discard probability parameters from a plurality of preset sets of discard probability parameters according to the real-time discard probability of the input port, including: If the real-time drop probability of the input port is less than the first probability, selecting a first set of drop probability parameters, wherein the drop probability threshold in the first set of drop probability parameters is the first threshold; If the real-time discard probability is greater than or equal to the first probability and less than the second probability, select a second set of discard probability parameters, and the discard probability threshold in the second set of discard probability parameters is the second threshold; If the real-time discard probability is greater than or equal to the second probability and less than the third probability, select a third set of discard probability parameters, and the discard probability threshold in the third set of discard probability parameters is the third threshold; The first threshold is greater than the second threshold, and the second threshold is greater than the third threshold.

3. The cache management method according to claim 1, characterized in that: Selecting a set of discard probability parameters from a plurality of preset sets of discard probability parameters according to the real-time discard probability of the input port, including: If the real-time drop probability of the input port is less than the first probability, selecting a first set of drop probability parameters; If the real-time discard probability is greater than or equal to the first probability and less than the second probability, select a second set of discard probability parameters; If the real-time discard probability is greater than or equal to the second probability and less than the third probability, select a third set of discard probability parameters; Among them, the discard probability threshold in the first group of discard probability parameters, the discard probability threshold in the second group of discard probability parameters, and the discard probability threshold in the third group of discard probability parameters are the same, the first threshold in the first group of discard probability parameters is smaller than the first threshold in the second group of discard probability parameters, the first threshold in the second group of discard probability parameters is smaller than the first threshold in the third group of discard probability parameters, the second threshold in the first group of discard probability parameters is smaller than the second threshold in the second group of discard probability parameters, and the second threshold in the second group of discard probability parameters is smaller than the second threshold in the third group of discard probability parameters.

4. The cache management method according to claim 1, characterized in that: The calculation formula of the target drop probability includes: Wherein, P represents the target drop probability, p0 represents the drop probability threshold, m represents the buffer occupancy, m1 represents the first threshold, and m2 represents the second threshold.

5. The cache management method according to claim 1, characterized in that: Judging whether the message is a message to be discarded according to the target discard probability includes: comparing the target discard probability with a pseudo-random number, if the target discard probability is less than the pseudo-random number, judging that the message is not a message to be discarded, if the target discard probability is greater than or equal to the pseudo-random number, judging that the enqueue request is a request to be discarded.

6. The cache management method according to claim 5, characterized in that: The pseudo-random number is updated according to a preset period.

7. The cache management method according to claim 1, characterized in that: Updating the real-time discard probability according to the discard result and the message byte length includes: Updating the discarded message length according to the message byte length, wherein the discarded message length is obtained according to the message discarded by the input port within a preset time; The updated real-time discard probability is obtained by calculating the ratio of the updated discarded message length to the total received length, where the total received length is the total message byte length of a preset number of enqueue requests received by the input port.

8. The cache management method according to claim 1, characterized in that: Updating the real-time discard probability according to the stored result and the message byte length includes: The ratio of the discarded message length to the total received length is calculated to obtain an updated real-time discard probability, where the total received length is the total message byte length of a preset number of enqueue requests received by the input port.

9. A cache management device, characterized in that: include: An enqueue request receiving module, used to receive an enqueue request for a message to enter a cache, wherein the enqueue request includes an input port, an output port, an output queue and a message byte length; a discard probability parameter selection module, configured to select, in response to the queue entry request, a set of discard probability parameters from a plurality of sets of discard probability parameters according to the real-time discard probability of the input port, each set of discard probability parameters including a discard threshold and a discard probability threshold; A discard judgment module, used for comparing the buffer occupancy of the output port or the output queue with the discard threshold, and judging whether the message is a message to be discarded according to the comparison result and the discard probability threshold; If the buffer occupancy is less than the first threshold, determining that the message is not a message to be discarded; If the cache occupancy is greater than a second threshold, determining that the message is a message to be discarded; If the cache occupancy is greater than or equal to the first threshold and less than or equal to the second threshold, a target discard probability is calculated according to a mapping relationship between the cache occupancy and the discard probability, and whether the message is a message to be discarded is determined according to the target discard probability; The discard threshold includes the first threshold and the second threshold; A discard processing module, used for discarding the message according to the message being the message to be discarded, and updating the real-time discard probability according to the discard result and the byte length of the message; The cache processing module is used to store the message in the cache according to the message is not the message to be discarded, and update the real-time discard probability according to the storage result and the byte length of the message.

Citation Information

Patent Citations

  • Method and device for sending video surveillance service messages in link aggregation network

    CN102045253A

  • Port congestion management method, apparatus and device

    CN109660468A

  • Output Queue Latency Behavior For Input Queue Based Device

    US20140161135A1

  • Packet discard method and device and storage medium

    WO2017080284A1