CN103685062A - Cache management method and device - Google Patents

Cache management method and device Download PDF

Info

Publication number
CN103685062A
CN103685062A CN201310637601.9A CN201310637601A CN103685062A CN 103685062 A CN103685062 A CN 103685062A CN 201310637601 A CN201310637601 A CN 201310637601A CN 103685062 A CN103685062 A CN 103685062A
Authority
CN
China
Prior art keywords
queue
threshold value
flow
buffer memory
flow queue
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201310637601.9A
Other languages
Chinese (zh)
Inventor
魏伟
李玖江
赵兴
王钿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201310637601.9A priority Critical patent/CN103685062A/en
Publication of CN103685062A publication Critical patent/CN103685062A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

An embodiment of the invention provides a cache management method and device. The cache management method includes: judging whether a stream queue with queue length exceeding a queue cache threshold exists in first stream queues or not; if so, executing dequeuing operation to the stream queue exceeding the queue cache threshold. By the method and device, utilization rate of caches can be increased.

Description

缓存管理方法及装置Cache management method and device

技术领域technical field

本发明实施例涉及网络技术,尤其涉及一种缓存管理方法及装置。The embodiments of the present invention relate to network technologies, and in particular to a buffer management method and device.

背景技术Background technique

随着多媒体数据流需求的迅速增长,交换机的缓存管理变得格外重要。共享缓存作为交换机中常用的缓存结构,所有的输入和输出端口都共享一个缓存空间。现有技术中常用的共享缓存的管理方法,主要包括静态阈值方法和动态阈值方法。With the rapid growth of multimedia data flow requirements, the buffer management of the switch becomes extremely important. Shared cache is a commonly used cache structure in switches, and all input and output ports share a cache space. Commonly used shared cache management methods in the prior art mainly include a static threshold method and a dynamic threshold method.

静态阈值方法,为固定为每个队列和/或端口分配一定的缓存,其他缓存或端口不能抢占,虽然可保证缓存共享的公平性,但缓存的利用率较低。动态阈值方法,为每个队列和/或端口配置一定的缓存占用比例因子,在应用过程中,根据剩余的共享缓存,动态的为每个队列分配可用缓存。该方法由于配置过程较复杂而使得可提高的缓存利用率的受到一定的限制。The static threshold method allocates a certain cache for each queue and/or port, and other caches or ports cannot be preempted. Although the fairness of cache sharing can be guaranteed, the utilization rate of the cache is low. The dynamic threshold method configures a certain buffer occupation ratio factor for each queue and/or port, and dynamically allocates available buffers for each queue according to the remaining shared buffers during the application process. Due to the complex configuration process of this method, the improved cache utilization is limited to a certain extent.

现有技术中,缓存管理方法的缓存利用率较低。In the prior art, the cache utilization rate of the cache management method is low.

发明内容Contents of the invention

本发明实施例提供一种缓存管理方法及装置,以解决现有技术中缓存利用率低的问题。Embodiments of the present invention provide a cache management method and device to solve the problem of low cache utilization in the prior art.

第一方面,本发明实施例提供一种缓存管理方法,包括:In a first aspect, an embodiment of the present invention provides a cache management method, including:

判断第一流队列中是否存在队列长度超出队列缓存阈值的流队列;Judging whether there is a flow queue whose queue length exceeds the queue buffer threshold in the first flow queue;

若所述第一流队列中存在队列长度超出所述队列缓存阈值的流队列,则对所述超出所述队列缓存阈值的流队列执行出队操作。If there is a flow queue whose queue length exceeds the queue buffer threshold in the first flow queue, perform a dequeue operation on the flow queue whose queue length exceeds the queue buffer threshold.

根据第一方面,在第一方面的第一种可能实现的方式中,所述判断第一流队列的队列长度是否超出队列缓存阈值之前,还包括:According to the first aspect, in the first possible implementation manner of the first aspect, before the judging whether the queue length of the first flow queue exceeds the queue cache threshold, further includes:

判断当前系统是否存在端口长度超出端口缓存阈值的虚拟端口;Determine whether the current system has a virtual port whose port length exceeds the port cache threshold;

若所述当前系统不存在端口长度超出端口缓存阈值的虚拟端口,将所述当前系统所具有的流队列确定为所述第一流队列。If the current system does not have a virtual port whose port length exceeds the port cache threshold, determine the flow queue owned by the current system as the first flow queue.

根据第一方面的第一种可能实现的方式,在第二种可能实现的方式中,所述队列缓存阈值包括至少两个不同优先级的缓存阈值;According to the first possible implementation manner of the first aspect, in the second possible implementation manner, the queue cache threshold includes at least two cache thresholds with different priorities;

所述判断第一流队列中是否存在队列长度超出队列缓存阈值的流队列,包括:The judging whether there is a flow queue whose queue length exceeds the queue buffer threshold in the first flow queue includes:

将所述第一流队列中流队列的队列长度与所述队列缓存阈值中最高优先级的缓存阈值进行比较,判断第一流队列中是否存在队列长度超出所述最高优先级的缓存阈值的流队列;Comparing the queue length of the flow queue in the first flow queue with the highest priority cache threshold in the queue cache threshold, and determining whether there is a flow queue in the first flow queue whose queue length exceeds the highest priority cache threshold;

若所述第一流队列中存在队列长度超出所述队列缓存阈值的流队列,则对所述超出所述队列缓存阈值的流队列执行出队操作,包括:If there is a flow queue whose queue length exceeds the queue cache threshold in the first flow queue, performing a dequeue operation on the flow queue that exceeds the queue cache threshold includes:

若所述第一流队列中存在队列长度超出所述最高优先级的缓存阈值的流队列,则对所述超出所述最高优先级的缓存阈值的流队列执行出队操作。If there is a flow queue whose queue length exceeds the highest-priority cache threshold in the first flow queue, perform a dequeue operation on the flow queue that exceeds the highest-priority cache threshold.

根据第一方面的第二种可能实现的方式,在第三种可能实现的方式中,所述方法,还包括:According to the second possible implementation manner of the first aspect, in the third possible implementation manner, the method further includes:

若所述第一流队列中不存在队列长度超出所述最高优先级的缓存阈值的流队列,确定所述当前系统中端口缓存阈值与端口长度差值最小的虚拟端口,并将所述端口缓存阈值与端口长度差值最小的虚拟端口所具有的流队列确定为第二流队列;If there is no flow queue whose queue length exceeds the cache threshold of the highest priority in the first flow queue, determine the virtual port with the smallest difference between the port cache threshold and the port length in the current system, and store the port cache threshold The flow queue of the virtual port having the smallest difference with the port length is determined as the second flow queue;

按照所述队列缓存阈值中各缓存阈值的优先级顺序,依次判断所述第二流队列中是否存在队列长度超出所述队列缓存阈值中的缓存阈值的流队列;According to the priority order of each cache threshold in the queue cache threshold, sequentially determine whether there is a flow queue in the second flow queue whose queue length exceeds the cache threshold in the queue cache threshold;

若所述第二流队列中存在队列长度超出一缓存阈值的流队列,则对超出该缓存阈值的流队列执行出队操作。If there is a flow queue whose queue length exceeds a cache threshold in the second flow queue, a dequeue operation is performed on the flow queue that exceeds the cache threshold.

根据第一方面的第三种可能实现的方式,在第四种可能实现的方式中,所述方法,还包括:According to the third possible implementation manner of the first aspect, in the fourth possible implementation manner, the method further includes:

若所述第二流队列中不存在队列长度超出所述队列缓存阈值中最低优先级的缓存阈值的流队列,则发送第一告警提示信息;所述第一告警指示信息包括配置错误提示信息。If there is no flow queue whose queue length exceeds the cache threshold with the lowest priority among the queue cache thresholds in the second flow queue, then send first warning indication information; the first warning indication information includes configuration error prompt information.

根据第一方面的第二种可能实现的方式,在第五种可能实现的方式中,若所述当前系统存在端口长度超出端口缓存阈值的虚拟端口,确定所述当前系统中端口长度与端口缓存阈值差值最大的虚拟端口,并将所述端口长度与端口缓存阈值差值最大的虚拟端口所具有的流队列确定为所述第一流队列。According to the second possible implementation of the first aspect, in the fifth possible implementation, if the current system has a virtual port whose port length exceeds the port cache threshold, determine the port length and port cache threshold in the current system. the virtual port with the largest threshold difference, and determine the flow queue of the virtual port with the largest difference between the port length and the port cache threshold as the first flow queue.

根据第一方面的第五种可能实现的方式中,在第六种可能实现的方式中,所述判断第一流队列中是否存在队列长度超出队列缓存阈值的流队列,还包括:According to the fifth possible implementation manner of the first aspect, in the sixth possible implementation manner, the judging whether there is a flow queue whose queue length exceeds the queue buffer threshold in the first flow queue further includes:

若所述第一流队列中不存在队列长度超出所述最高优先级的缓存阈值的流队列,按照所述队列缓存阈值中各缓存阈值的优先级顺序,依次判断所述第一流队列中是否存在队列长度超出所述队列缓存阈值中的缓存阈值的流队列;If there is no flow queue in the first flow queue whose queue length exceeds the cache threshold of the highest priority, according to the priority order of each cache threshold in the queue cache threshold, sequentially determine whether there is a queue in the first flow queue a flow queue whose length exceeds a cache threshold in said queue cache threshold;

若所述第一流队列中存在队列长度超出所述队列缓存阈值的流队列,则对所述超出所述队列缓存阈值的流队列执行出队操作,还包括:If there is a flow queue whose queue length exceeds the queue cache threshold in the first flow queue, performing a dequeue operation on the flow queue that exceeds the queue cache threshold further includes:

若所述第一流队列中存在队列长度超出一缓存阈值的流队列,则对超出该缓存阈值的流队列执行出队操作。If there is a flow queue whose queue length exceeds a cache threshold in the first flow queue, a dequeue operation is performed on the flow queue that exceeds the cache threshold.

根据第一方面的第六种可能实现的方式,在第七种可能实现的方式中,所述方法,还包括:According to the sixth possible implementation manner of the first aspect, in the seventh possible implementation manner, the method further includes:

若所述第一流队列中不存在队列长度超出所述队列缓存阈值中最低优先级的缓存阈值的流队列,发送第二告警提示信息;所述第二告警指示信息包括配置错误提示信息。If there is no flow queue in the first flow queue whose queue length exceeds the cache threshold with the lowest priority among the queue cache thresholds, send a second warning message; the second warning message includes configuration error message.

根据第一方面的第四种或第七种可能实现的方式,在第八种可能实现的方式中,在所述判断第一流队列中是否存在队列长度超出队列缓存阈值的流队列之前,还包括:According to the fourth or seventh possible implementation manner of the first aspect, in the eighth possible implementation manner, before the judging whether there is a flow queue whose queue length exceeds the queue buffer threshold in the first flow queue, further includes :

根据所述第一流队列的优先级,设置所述队列缓存阈值。Set the queue cache threshold according to the priority of the first flow queue.

根据第一方面的第一种可能实现的方式,在第九种可能实现的方式,所述当前系统中所具有的流队列的端口缓存阈值之和小于等于共享缓存的N倍;所述当前系统的总缓存包括所述共享缓存;According to the first possible implementation manner of the first aspect, in the ninth possible implementation manner, the sum of the port cache thresholds of the flow queues in the current system is less than or equal to N times the shared cache; the current system The total cache includes the shared cache;

所述N为所述当前系统中所具有的流队列的端口缓存阈值之和与所述当前系统的实际缓存的比值。The N is the ratio of the sum of the port cache thresholds of the flow queues in the current system to the actual cache of the current system.

根据第一方面的第九种可能实现的方式,在第十种可能实现的方式中,所述判断当前系统是否存在端口长度超出端口缓存阈值的虚拟端口之前,还包括:According to the ninth possible implementation manner of the first aspect, in the tenth possible implementation manner, before the judging whether there is a virtual port whose port length exceeds the port cache threshold in the current system, it further includes:

判断所述当前系统的空闲缓存是否小于保护缓存的阈值;所述当前系统的总缓存,还包括所述保护缓存;Judging whether the free cache of the current system is smaller than the threshold of the protection cache; the total cache of the current system also includes the protection cache;

当所述当前系统的空闲缓存小于所述保护缓存的阈值时,执行判断所述当前系统是否存在端口长度超出端口缓存阈值的虚拟端口的操作。When the free cache of the current system is smaller than the threshold of the protection cache, an operation of judging whether the current system has a virtual port whose port length exceeds the threshold of the port cache is performed.

根据第一方面的第十种可能实现的方式,在第十一种可能实现的方式中,在所述判断所述当前系统的空闲缓存是否小于保护缓存阈值之前,还包括:According to the tenth possible implementation manner of the first aspect, in the eleventh possible implementation manner, before the judging whether the free cache of the current system is smaller than the protection cache threshold, the method further includes:

根据所述当前系统中处理信息的时延,对所述保护缓存进行配置。The protection cache is configured according to the time delay of processing information in the current system.

根据第一方面的第八种可能实现的方式,在第十二种可能实现的方式中,所述对所述超出队列缓存阈值的流队列执行出队操作,包括:According to the eighth possible implementation manner of the first aspect, in the twelfth possible implementation manner, the performing the dequeue operation on the flow queue exceeding the queue cache threshold includes:

在所述超出队列缓存阈值的流队列中选择一个流队列;selecting a flow queue from the flow queues exceeding the queue cache threshold;

将所述选择的流队列对应的信息传递给队列管理器,以使所述队列管理器对所述选择的流队列对应的信息中一个存储包的信息执行出队操作。The information corresponding to the selected flow queue is delivered to the queue manager, so that the queue manager performs a dequeue operation on the information of one stored packet in the information corresponding to the selected flow queue.

根据第一方面的第十二种可能实现的方式,在第十三种可能实现的方式中,所述方法,还包括:According to the twelfth possible implementation manner of the first aspect, in the thirteenth possible implementation manner, the method further includes:

根据所述选择的流队列对应的老化指示消息,判断所述选择的流队列是否为需要老化的流队列;According to the aging indication message corresponding to the selected flow queue, determine whether the selected flow queue is a flow queue that needs to be aged;

对所述需要老化的流队列执行老化操作。Perform an aging operation on the flow queue that needs to be aged.

根据第一方面的第十二种可能实现的方式,在第十四种可能实现的方式中,在所述将所述选择的流队列对应的信息传递给队列管理器之后,还包括:According to the twelfth possible implementation manner of the first aspect, in the fourteenth possible implementation manner, after transmitting the information corresponding to the selected flow queue to the queue manager, the method further includes:

根据所述队列管理器,在对所述选择的流队列对应的信息中一个存储包的信息执行出队操作,之后产生的出队指示消息,将所述选择的流队列对应的出队计数器的值加1。According to the queue manager, the dequeue operation is performed on the information of a stored packet in the information corresponding to the selected flow queue, and then the dequeue instruction message generated will set the dequeue counter corresponding to the selected flow queue value plus 1.

根据第一方面的第十四种可能实现的方式,在第十五种可能实现的方式中,所述根据所述选择的流队列对应的老化指示消息,判断所述选择的流队列是否为需要老化的流队列,包括:According to the fourteenth possible implementation manner of the first aspect, in the fifteenth possible implementation manner, according to the aging indication message corresponding to the selected flow queue, it is judged whether the selected flow queue is needed Aged flow queues, including:

若所述出队计数器的值大于出队次数阈值,将所述选择的流队列对应的老化指示消息配置为1;若所述出队计数器的值小于等于所述出队次数阈值,将所述选择的流队列对应的老化指示消息配置为0;If the value of the dequeue counter is greater than the dequeue times threshold, configure the aging indication message corresponding to the selected flow queue as 1; if the value of the dequeue counter is less than or equal to the dequeue times threshold, set the The aging indication message corresponding to the selected flow queue is configured as 0;

在预定周期内,若所述选择的流队列对应的老化指示消息持续为1,则确定所述选择的流队列为所述需要老化的流队列。Within a predetermined period, if the aging indication message corresponding to the selected flow queue continues to be 1, it is determined that the selected flow queue is the flow queue that needs to be aged.

根据第一方面的第十五种可能实现的方式,在第十六种可能实现的方式中,在所述确定所述选择的流队列为所述需要老化的流队列之后,还包括:According to the fifteenth possible implementation manner of the first aspect, in the sixteenth possible implementation manner, after determining that the selected flow queue is the flow queue that needs to be aged, the method further includes:

减少所述选择的流队列对应的队列缓存阈值的配置;reducing the configuration of the queue cache threshold corresponding to the selected flow queue;

在所述预定周期内,若所述选择的流队列对应的老化指示消息持续为0,则恢复所述选择的流队列对应的队列缓存阈值的配置。Within the predetermined period, if the aging indication message corresponding to the selected flow queue continues to be 0, restore the configuration of the queue cache threshold corresponding to the selected flow queue.

第二方面,本发明实施例还提供一种缓存管理装置,包括:In the second aspect, the embodiment of the present invention also provides a cache management device, including:

判断模块,用于判断第一流队列中是否存在队列长度超出队列缓存阈值的流队列;A judging module, configured to judge whether there is a flow queue whose queue length exceeds the queue buffer threshold in the first flow queue;

执行模块,用于若所述第一流队列中存在队列长度超出所述队列缓存阈值的流队列,对所述超出所述队列缓存阈值的流队列执行出队操作。An executing module, configured to, if there is a flow queue whose queue length exceeds the queue buffer threshold in the first flow queue, perform a dequeue operation on the flow queue whose queue length exceeds the queue buffer threshold.

根据第二方面,在第二方面的第一种可能实现的方式中,所述判断模块,还用于在所述判断第一流队列的队列长度是否超出队列缓存阈值之前,判断当前系统是否存在端口长度超出端口缓存阈值的虚拟端口;According to the second aspect, in the first possible implementation manner of the second aspect, the judging module is further configured to judge whether there is a port in the current system before judging whether the queue length of the first flow queue exceeds the queue cache threshold Virtual ports whose length exceeds the port cache threshold;

所述装置,还包括:The device also includes:

确定模块,用于若所述当前系统不存在端口长度超出端口缓存阈值的虚拟端口,将所述当前系统所具有的流队列确定为所述第一流队列。A determining module, configured to determine the flow queue of the current system as the first flow queue if the current system does not have a virtual port whose port length exceeds a port cache threshold.

根据第二方面的第一种可能实现的方式,在第二种可能实现的方式中,所述队列缓存阈值包括至少两个不同优先级的缓存阈值;According to the first possible implementation manner of the second aspect, in the second possible implementation manner, the queue cache threshold includes at least two cache thresholds with different priorities;

所述判断模块,用于将所述第一流队列中流队列的队列长度与所述队列缓存阈值中最高优先级的缓存阈值进行比较,判断第一流队列中是否存在队列长度超出所述最高优先级的缓存阈值的流队列;The judging module is configured to compare the queue length of the flow queue in the first flow queue with the cache threshold of the highest priority in the queue cache threshold, and judge whether there is a queue length exceeding the highest priority in the first flow queue flow queue for cache threshold;

所述执行模块,用于若所述第一流队列中存在队列长度超出所述最高优先级的缓存阈值的流队列,对所述超出所述最高优先级的缓存阈值的流队列执行出队操作。The execution module is configured to, if there is a flow queue whose queue length exceeds the highest-priority cache threshold in the first flow queue, perform a dequeue operation on the flow queue that exceeds the highest-priority cache threshold.

根据第二方面的第二种可能实现的方式,在第三种可能实现的方式中,所述确定模块,还用于若所述第一流队列中不存在队列长度超出所述最高优先级的缓存阈值的流队列,确定所述当前系统中端口缓存阈值与端口长度差值最小的虚拟端口,并将所述端口缓存阈值与端口长度差值最小的虚拟端口所具有的流队列确定为第二流队列;According to the second possible implementation manner of the second aspect, in the third possible implementation manner, the determining module is further configured to: if there is no buffer whose queue length exceeds the highest priority in the first flow queue Threshold flow queue, determine the virtual port with the smallest difference between the port cache threshold and port length in the current system, and determine the flow queue of the virtual port with the smallest difference between the port cache threshold and port length as the second flow queue;

所述判断模块,还用于按照所述队列缓存阈值中各缓存阈值的优先级顺序,依次判断所述第二流队列中是否存在队列长度超出所述队列缓存阈值中的缓存阈值的流队列;The judging module is further configured to sequentially judge whether there is a flow queue whose queue length exceeds the cache threshold in the queue cache threshold in the second flow queue according to the priority order of each cache threshold in the queue cache threshold;

所述执行模块,还用于若所述第二流队列中存在队列长度超出一缓存阈值的流队列,则对超出该缓存阈值的流队列执行出队操作。The execution module is further configured to, if there is a flow queue whose queue length exceeds a cache threshold in the second flow queue, perform a dequeue operation on the flow queue that exceeds the cache threshold.

根据第二方面的第三种可能实现的方式,在第四种可能实现的方式中,所述装置,还包括:According to the third possible implementation manner of the second aspect, in the fourth possible implementation manner, the device further includes:

第一发送模块,用于若所述第二流队列中不存在队列长度超出所述队列缓存阈值中最低优先级的缓存阈值的流队列,发送第一告警提示信息;所述第一告警指示信息包括配置错误提示信息。The first sending module is configured to send first alarm prompt information if there is no flow queue whose queue length exceeds the lowest priority cache threshold among the queue cache thresholds in the second flow queue; the first alarm indication information Contains information about configuration errors.

根据第二方面的第二种可能实现的方式,在第五种可能实现的方式中,所述确定模块,还用于若所述当前系统存在端口长度超出端口缓存阈值的虚拟端口,确定所述当前系统中端口长度与端口缓存阈值差值最大的虚拟端口,并将所述端口长度与端口缓存阈值差值最大的虚拟端口所具有的流队列确定为所述第一流队列。According to the second possible implementation manner of the second aspect, in the fifth possible implementation manner, the determining module is further configured to determine the The virtual port with the largest difference between the port length and the port cache threshold in the current system, and determining the flow queue of the virtual port with the largest difference between the port length and the port cache threshold as the first flow queue.

根据第二方面的第五种可能实现的方式,在第六种可能实现的方式中,所述判断模块,还用于若所述第一流队列中不存在队列长度超出所述最高优先级的缓存阈值的流队列,按照所述队列缓存阈值中各缓存阈值的优先级顺序,依次判断所述第一流队列中是否存在队列长度超出所述队列缓存阈值中的缓存阈值的流队列;According to the fifth possible implementation manner of the second aspect, in the sixth possible implementation manner, the judging module is further configured to: if there is no buffer whose queue length exceeds the highest priority in the first flow queue Threshold flow queues, according to the priority order of each cache threshold in the queue cache threshold, sequentially determine whether there is a flow queue in the first flow queue whose queue length exceeds the cache threshold in the queue cache threshold;

所述执行模块,还用于若所述第一流队列中存在队列长度超出一缓存阈值的流队列,则对超出该缓存阈值的流队列执行出队操作。The execution module is further configured to, if there is a flow queue whose queue length exceeds a cache threshold in the first flow queue, perform a dequeue operation on the flow queue exceeding the cache threshold.

根据第二方面的第六种可能实现的方式,在第七种可能实现的方式中,所述装置,还包括:According to the sixth possible implementation manner of the second aspect, in the seventh possible implementation manner, the device further includes:

第二发送模块,用于若所述第一流队列中不存在队列长度超出所述队列缓存阈值中最低优先级的缓存阈值的流队列,发送第二告警提示信息;所述第二告警指示信息包括配置错误提示信息。The second sending module is configured to send second warning prompt information if there is no flow queue whose queue length exceeds the lowest priority cache threshold among the queue cache thresholds in the first flow queue; the second warning indication information includes Configuration error message.

根据第二方面的第四种或第七种可能实现的方式,在第八种可能实现的方式中,所述装置,还包括:According to the fourth or seventh possible implementation manner of the second aspect, in the eighth possible implementation manner, the device further includes:

配置模块,用于在所述判断第一流队列中是否存在队列长度超出队列缓存阈值的流队列之前,根据所述第一流队列的优先级,设置所述队列缓存阈值。The configuration module is configured to set the queue buffer threshold according to the priority of the first flow queue before determining whether there is a flow queue whose queue length exceeds the queue buffer threshold in the first flow queue.

根据第二方面的第一种可能实现的方式,在第九种可能实现的方式中,所述当前系统中所具有的流队列的端口缓存阈值之和小于等于共享缓存的N倍;所述当前系统的总缓存包括所述共享缓存;According to the first possible implementation manner of the second aspect, in the ninth possible implementation manner, the sum of the port cache thresholds of the flow queues in the current system is less than or equal to N times the shared cache; the current The total cache of the system includes the shared cache;

所述N为所述当前系统中所具有的流队列的端口缓存阈值之和与所述当前系统的实际缓存的比值。The N is the ratio of the sum of the port cache thresholds of the flow queues in the current system to the actual cache of the current system.

根据第二方面的第九种可能实现的方式,在第十种可能实现的方式中,所述判断模块,还用于所述判断当前系统是否存在端口长度超出端口缓存阈值的虚拟端口之前,判断所述当前系统的空闲缓存是否小于保护缓存的阈值;所述当前系统的总缓存,还包括所述保护缓存;当所述当前系统的空闲缓存小于所述保护缓存的阈值时,执行判断所述当前系统是否存在端口长度超出端口缓存阈值的虚拟端口的操作。According to the ninth possible implementation manner of the second aspect, in the tenth possible implementation manner, the judging module is further configured to, before judging whether there is a virtual port whose port length exceeds the port cache threshold in the current system, judge Whether the free cache of the current system is less than the threshold of the protection cache; the total cache of the current system also includes the protection cache; when the free cache of the current system is less than the threshold of the protection cache, execute the judgment Whether the current system has a virtual port whose port length exceeds the port cache threshold.

根据第二方面的第十种可能实现的方式,在第十一种可能实现的方式中,所述配置模块,还用于在所述判断所述当前系统的空闲缓存是否小于保护缓存阈值之前,根据所述当前系统中处理信息的时延,对所述保护缓存进行配置。According to the tenth possible implementation manner of the second aspect, in the eleventh possible implementation manner, the configuration module is further configured to, before determining whether the free cache of the current system is smaller than the protection cache threshold, The protection cache is configured according to the time delay of processing information in the current system.

根据第二方面的第八种可能实现的方式,在第十二种可能实现的方式中,所述执行模块,具体用于在所述超出队列缓存阈值的流队列中选择一个流队列;According to the eighth possible implementation manner of the second aspect, in the twelfth possible implementation manner, the executing module is specifically configured to select a flow queue from the flow queues exceeding the queue cache threshold;

所述发送模块,还用于将所述选择的流队列对应的信息传递给队列管理器,以使所述队列管理器对所述选择的流队列对应的信息中一个存储包的信息执行出队操作。The sending module is further configured to transfer the information corresponding to the selected flow queue to the queue manager, so that the queue manager performs dequeuing of information of a storage packet in the information corresponding to the selected flow queue operate.

根据第二方面的第十二种可能实现的方式,在第十三种可能实现的方式中,所述判断模块,还用于根据所述选择的流队列对应的老化指示消息,判断所述选择的流队列是否为需要老化的流队列;According to the twelfth possible implementation manner of the second aspect, in the thirteenth possible implementation manner, the judging module is further configured to judge the selected flow queue according to the aging indication message corresponding to the selected flow queue. Whether the flow queue is a flow queue that needs to be aged;

所述执行模块,还用于对所述需要老化的流队列执行老化操作。The execution module is further configured to perform an aging operation on the flow queue that needs to be aged.

根据第二方面的第十二种可能实现的方式,在第十四种可能实现的方式中,所述装置,还包括:According to the twelfth possible implementation manner of the second aspect, in the fourteenth possible implementation manner, the device further includes:

计数模块,用于在所述将所述选择的流队列对应的信息传递给队列管理器之后,根据所述队列管理器,在对所述选择的流队列对应的信息中一个存储包的信息执行出队操作,之后产生的出队指示消息,将所述选择的流队列对应的出队计数器的值加1。The counting module is configured to, after the information corresponding to the selected flow queue is passed to the queue manager, according to the queue manager, execute the information of one stored packet in the information corresponding to the selected flow queue In the dequeue operation, the value of the dequeue counter corresponding to the selected flow queue is increased by 1 in the dequeue indication message generated later.

根据第二方面的第十四种可能实现的方式,在第十五种可能实现的方式中,所述配置模块,还用于若所述出队计数器的值大于出队次数阈值,将所述选择的流队列对应的老化指示消息配置为1;若所述出队计数器的值小于等于所述出队次数阈值,将所述选择的流队列对应的老化指示消息配置为0;According to the fourteenth possible implementation manner of the second aspect, in the fifteenth possible implementation manner, the configuration module is further configured to: The aging indication message corresponding to the selected flow queue is configured as 1; if the value of the dequeuing counter is less than or equal to the dequeuing times threshold, the aging indication message corresponding to the selected flow queue is configured as 0;

所述确定模块,还用于在预定周期内,若所述选择的流队列对应的老化指示消息持续为1,则确定所述选择的流队列为所述需要老化的流队列。The determining module is further configured to determine that the selected flow queue is the flow queue that needs to be aged if the aging indication message corresponding to the selected flow queue continues to be 1 within a predetermined period.

根据第二方面的第十五种可能实现的方式,在第十六种可能实现的方式中,所述配置模块,还用于在所述确定所述选择的流队列为所述需要老化的流队列之后,减少所述选择的流队列对应的队列缓存阈值的配置;在所述预定周期内,若所述选择的流队列对应的老化指示消息持续为0,则恢复所述选择的流队列对应的队列缓存阈值的配置。According to the fifteenth possible implementation manner of the second aspect, in the sixteenth possible implementation manner, the configuration module is further configured to determine that the selected flow queue is the flow that needs to be aged After queuing, reduce the configuration of the queue cache threshold corresponding to the selected flow queue; within the predetermined period, if the aging indication message corresponding to the selected flow queue continues to be 0, restore the corresponding The configuration of the queue cache threshold.

本发明实施例提供的缓存管理方法及装置,通过将第一流队列中队列长度超出队列缓存阈值的流队列执行出队操作,使得流队列所占用的缓存空间与其当前的缓存信息相适应,提高缓存利用率。The cache management method and device provided by the embodiments of the present invention perform dequeue operations on the stream queues whose queue length exceeds the queue cache threshold in the first stream queue, so that the cache space occupied by the stream queue is adapted to its current cache information, and the cache memory is improved. utilization rate.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图做一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description These are some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained according to these drawings without any creative effort.

图1为本发明实施例一所提供的缓存管理方法的流程图;FIG. 1 is a flowchart of a cache management method provided by Embodiment 1 of the present invention;

图2为本发明实施例二所提供的缓存管理方法的流程图;FIG. 2 is a flowchart of a cache management method provided in Embodiment 2 of the present invention;

图3为本发明实施例三所提供的缓存管理方法的流程图;FIG. 3 is a flow chart of a cache management method provided in Embodiment 3 of the present invention;

图4为本发明实施例四所提供的缓存管理方法的流程图;FIG. 4 is a flowchart of a cache management method provided in Embodiment 4 of the present invention;

图5为本发明实施例五所提供的缓存管理方法的流程图;FIG. 5 is a flowchart of a cache management method provided in Embodiment 5 of the present invention;

图6为本发明实施例六所提供的缓存管理方法的流程图;FIG. 6 is a flowchart of a cache management method provided in Embodiment 6 of the present invention;

图7为本发明实施例七所提供的缓存管理方法的流程图;FIG. 7 is a flowchart of a cache management method provided by Embodiment 7 of the present invention;

图8为本发明实施例八所提供的缓存管理装置的结构示意图。FIG. 8 is a schematic structural diagram of a cache management device provided by Embodiment 8 of the present invention.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

需要说明的是,本发明各实施例所涉及的缓存阈值均为推出阈值(PushOut with Threshold,简称POT),所涉及的出队操作,指的是Push Out出队,而非正常出队。正常出队指的是,将执行出队的流队列中的缓存信息移至当前系统的内存或硬盘的过程,然而Push Out出队指的是,将该执行出队的流队列中的缓存信息推出并丢弃,从而达到缓存释放的过程。It should be noted that the cache thresholds involved in each embodiment of the present invention are pushout thresholds (PushOut with Threshold, referred to as POT), and the dequeue operation involved refers to Push Out dequeue rather than normal dequeue. Normal dequeuing refers to the process of moving the cached information in the flow queue that is executed to the current system memory or hard disk, but Push Out refers to the process of moving the cached information in the flow queue that is executed to be dequeued Push out and discard, so as to achieve the process of cache release.

实施例一Embodiment one

图1为本发明实施例一所提供的缓存管理方法的流程图。该方法由缓存管理装置执行,该装置通常以硬件和/或软件的方式来实现,集成在网络交换机或路由设备中。本实施例的方法包括如下步骤:FIG. 1 is a flowchart of a cache management method provided by Embodiment 1 of the present invention. The method is executed by a cache management device, which is usually implemented in hardware and/or software and integrated in a network switch or routing device. The method of the present embodiment comprises the steps:

步骤101、判断第一流队列中是否存在队列长度超出队列缓存阈值的流队列。Step 101. Determine whether there is a flow queue whose queue length exceeds the queue cache threshold in the first flow queue.

具体地,根据用户业务需求的不同,不同的流队列(Flow Queue,简称FQ)对应不同的业务流,该不同的流队列可用于存储该不同业务流的数据信息。流队列的队列长度例如可以是流队列所存储的数据信息的比特数。流队列所存储的数据信息,随着用户当前处理业务的变化而变化,那么该流队列的队列长度也随着用户当前处理业务的变化而变化。业务流的数据信息可以是多媒体网络数据,根据用户业务需求的不同,可以是,因特网的网络数据,如语音、视频等,网络电视、网络电话等流数据信息及其相关协议报文或配置信息。Specifically, according to different service requirements of users, different flow queues (Flow Queues, FQ for short) correspond to different service flows, and the different flow queues can be used to store data information of the different service flows. The queue length of the flow queue may be, for example, the number of bits of data information stored in the flow queue. The data information stored in the flow queue changes with the change of the user's current processing business, so the queue length of the flow queue also changes with the change of the user's current processing business. The data information of the service flow can be multimedia network data. According to the different service requirements of users, it can be Internet network data, such as voice, video, etc., streaming data information such as Internet TV and Internet phone, and related protocol messages or configuration information. .

不同流队列的队列缓存阈值可以相同、也可以不同。当不同流队列所存储数据信息所对应的业务流的类型相同,则该不同流队列的队列缓存阈值相同;当不同流队列所存储数据信息所对应的业务流类型不同,则该不同流队列的队列缓存阈值不同。其中,队列缓存阈值可通过fq_thld来表示,队列长度可通过fq_qlen来表示。The queue cache thresholds of different flow queues can be the same or different. When the types of service flows corresponding to the data information stored in different flow queues are the same, the queue cache thresholds of the different flow queues are the same; when the types of service flows corresponding to the data information stored in different flow queues are different, the The queue cache thresholds are different. Wherein, the queue cache threshold can be represented by fq_thld, and the queue length can be represented by fq_qlen.

该第一流队列包括多个流队列。判断该第一流队列中是否存在队列长度超出队列缓存阈值的流队列,可以是将该多个流队列的队列长度分别与其对应的队列缓存阈值进行比较来判断,还可以是根据流队列的队列超限指示来判断。队列超限指示例如可以通过标志位1来表示该流队列的队列长度大于其对应的队列缓存阈值的流队列,对应的,可以通过标志位0来表示该流队列的队列长度小于等于其对应的队列缓存阈值的流队列。The first flow queue includes multiple flow queues. Judging whether there is a flow queue whose queue length exceeds the queue buffer threshold in the first flow queue can be determined by comparing the queue lengths of the multiple flow queues with their corresponding queue buffer thresholds, or according to the queue length of the flow queues. Judgment by limit instructions. For example, the queue overrun indication can use flag bit 1 to indicate that the queue length of the flow queue is greater than its corresponding queue buffer threshold. Correspondingly, flag bit 0 can be used to indicate that the queue length of the flow queue is less than or equal to its corresponding Flow queue for queue cache threshold.

步骤102、若第一流队列中存在队列长度超出队列缓存阈值的流队列,则对该超出队列缓存阈值的流队列执行出队操作。Step 102, if there is a flow queue whose queue length exceeds the queue buffer threshold in the first flow queue, perform a dequeue operation on the flow queue whose queue length exceeds the queue buffer threshold.

具体地,流队列的队列长度未超出队列缓存阈值,也就是当前为该流队列分配的缓存空间充足,通过该流队列缓存的信息可以正常的存储和调取,从而提高系统的处理速度,减少时延。Specifically, the queue length of the flow queue does not exceed the queue cache threshold, that is, the buffer space currently allocated for the flow queue is sufficient, and the information cached by the flow queue can be stored and retrieved normally, thereby improving the processing speed of the system and reducing delay.

对应的,流队列的队列长度超出队列缓存阈值,该流队列当前所占用的缓存空间已超出为其所配置的缓存空间,由于当前系统总的缓存空间一定,也就是说该流队列占用了原本通过配置分配给其他流队列的缓存空间,可能影响其他流队列存储缓存信息,缓存利用率较低。因此,需要对该超出队列缓存阈值的流队列执行出队操作,以腾出原本该超出队列缓存阈值的流队列所占用的其他流队列的缓存空间,在当前系统总的缓存空间一定的情况下,更好地保证缓存的利用率。Correspondingly, the queue length of the flow queue exceeds the queue cache threshold, and the cache space currently occupied by the flow queue has exceeded the configured cache space. Since the total cache space of the current system is certain, that is to say, the flow queue occupies the original By configuring the cache space allocated to other flow queues, it may affect other flow queues to store cache information, and the cache utilization is low. Therefore, it is necessary to dequeue the flow queue that exceeds the queue cache threshold to free up the cache space of other flow queues originally occupied by the flow queue that exceeds the queue cache threshold. Under the condition that the total cache space of the current system is certain , to better ensure the utilization of the cache.

对第一流队列中超出队列缓存阈值的流队列执行出队操作,可以是对该第一流队列中所有队列长度超出队列缓存阈值的流队列均执行出队操作,也可以是,在该第一流队列中队列长度超出队列缓存阈值的流队列中选择预定数目的流队列执行出队操作。Executing the dequeue operation on the flow queues in the first flow queue that exceed the queue cache threshold may be to perform dequeue operations on all flow queues in the first flow queue whose queue length exceeds the queue cache threshold, or, in the first flow queue Select a predetermined number of flow queues from the flow queues whose queue length exceeds the queue cache threshold to perform the dequeue operation.

对超出队列缓存阈值的流队列执行出队操作,指的是,将超出队列缓存阈值的流队列所存储的数据信息推出对应的流队列,可以是将该些数据信息丢弃,以对该流队列进行缓存释放,从而提高缓存利用率。Executing the dequeue operation for the flow queue exceeding the queue cache threshold refers to pushing the data information stored in the flow queue exceeding the queue cache threshold out of the corresponding flow queue, which can be discarded to replace the flow queue Perform cache release to improve cache utilization.

本实施例所提供的缓存管理方法,通过将第一流队列中队列长度超出队列缓存阈值的流队列执行出队操作,使得流队列所占用的缓存空间与其当前存储的业务流数据信息相适应,提高缓存利用率。The cache management method provided in this embodiment, by dequeuing the flow queue whose queue length exceeds the queue cache threshold in the first flow queue, makes the cache space occupied by the flow queue adapt to the service flow data information currently stored, and improves cache utilization.

同时,由于提高了缓存的利用率,从而避免缓存占满所造成的缓存数据丢弃的问题,因而本实施例方案还降低了系统的分组丢包率,可满足多媒体网络通信的服务质量要求。At the same time, since the utilization rate of the buffer is improved, the problem of buffer data discarding caused by the full buffer is avoided, so the solution of this embodiment also reduces the packet loss rate of the system, which can meet the quality of service requirements of multimedia network communication.

实施例二Embodiment two

本实施例还提供一种缓存管理方法。图2为本发明实施例二所提供的缓存管理方法的流程图。在上述实施例中步骤101中判断第一流队列中是否存在队列长度超出队列缓存阈值的流队列,之前,该方法,还包括:This embodiment also provides a cache management method. FIG. 2 is a flowchart of a cache management method provided by Embodiment 2 of the present invention. In the above embodiment, in step 101, it is judged whether there is a flow queue whose queue length exceeds the queue buffer threshold in the first flow queue. Before that, the method also includes:

步骤201、判断当前系统是否存在端口长度超出端口缓存阈值的虚拟端口。Step 201. Determine whether the current system has a virtual port whose port length exceeds the port cache threshold.

在该实施例的缓存管理方案中,将当前系统的缓存空间虚拟的划分为N个部分,该N个部分即为N个虚拟端口。每个虚拟端口对应多个流队列,该虚拟端口与流队列的对应的关系,如可以是通过配置映射关系表的方式,为每个虚拟端口配置其所对应的流队列。为每个虚拟端口配置其所对应的流队列可以是根据流队列的优先级高低,将同一或接近同一优先级的流队列映射至同一虚拟端口。流队列的优先级,可以是根据流队列所存储的业务流数据信息的类型确定,如存储协议报文或配置信息的流队列优先级较高,而存储视频类数据的流队列其优先级则较低,而对于存储语音数据的流队列的优先级,则较视频类数据的流队列的优先级高些。In the cache management solution of this embodiment, the cache space of the current system is virtually divided into N parts, and the N parts are N virtual ports. Each virtual port corresponds to a plurality of flow queues, and the corresponding relationship between the virtual port and the flow queues may be, for example, configuring the corresponding flow queues for each virtual port by configuring a mapping relationship table. Configuring the corresponding flow queues for each virtual port may be based on the priority of the flow queues, mapping the flow queues with the same priority or close to the same priority to the same virtual port. The priority of the flow queue can be determined according to the type of service flow data information stored in the flow queue. For example, the priority of the flow queue storing protocol packets or configuration information is higher, while the priority of the flow queue storing video data is lower. The priority of the flow queue for storing voice data is lower than that of the flow queue for video data.

虚拟端口的端口长度,可通过vi_qlen来表示,可以是当前该虚拟端口所对应的流队列的队列长度之和。由于每个虚拟端口所对应不同流队列,其该不同流队列的优先级不同,那么每个虚拟端口所对应的端口缓存阈值则不同。其中,端口缓存阈值可通过vi_thld来表示,而每个虚拟端口所对应的端口缓存阈值,可以是每个虚拟端口所对应的流队列的队列缓存阈值之和。The port length of the virtual port can be represented by vi_qlen, which can be the sum of the queue lengths of the current flow queues corresponding to the virtual port. Since each virtual port corresponds to different flow queues, and the priorities of the different flow queues are different, the port cache thresholds corresponding to each virtual port are different. Wherein, the port cache threshold may be represented by vi_thld, and the port cache threshold corresponding to each virtual port may be the sum of the queue cache thresholds of the flow queues corresponding to each virtual port.

根据缓存管理策略的不同,将当前系统的缓存空间虚拟的划分为不同个数的虚拟端口。According to different cache management strategies, the cache space of the current system is virtually divided into different numbers of virtual ports.

判断当前系统中是否存在端口长度超出端口缓存阈值的虚拟端口,可以是将划分的多个虚拟端口的队列长度分别与其对应的端口缓存阈值进行比较来判断,还可以是根据虚拟端口的端口超限指示来判断。端口超限指示例如可以通过标志位1来表示端口长度大于端口缓存阈值的虚拟端口,对应的,可以通过标志位0来表示端口长度小于等于端口缓存阈值的虚拟端口。To judge whether there is a virtual port whose port length exceeds the port cache threshold in the current system, it can be judged by comparing the queue lengths of multiple divided virtual ports with their corresponding port cache thresholds, or it can be judged based on the port limit of the virtual port Instructions to judge. The port overrun indication may, for example, use a flag bit 1 to indicate a virtual port whose port length is greater than the port cache threshold, and correspondingly, a flag bit 0 may indicate a virtual port whose port length is less than or equal to the port cache threshold.

步骤202、若当前系统不存在端口长度超出端口缓存阈值的虚拟端口,将该当前系统所具有的流队列确定为第一流队列。Step 202: If the current system does not have a virtual port whose port length exceeds the port cache threshold, determine the flow queue owned by the current system as the first flow queue.

端口长度未超出端口缓存阈值的虚拟端口,指的是,该虚拟端口所对应的多个流队列的队列长度之和,即端口长度,未超出该虚拟端口的端口缓存阈值,而该虚拟端口所对应的多个流队列中可能会存在队列长度超出队列缓存阈值的流队列。因此,若通过上述步骤201确定当前系统中不存在端口长度超出端口缓存阈值的虚拟端口,还需要将当前系统中所有的流队列作为第一流队列,以执行上述实施例的方案,判断当前系统所具有的流队列中是否存在队列长度超出队列缓存阈值的流队列,继而将队列长度超出队列缓存阈值的流队列出队。The virtual port whose port length does not exceed the port cache threshold refers to the sum of the queue lengths of the multiple flow queues corresponding to the virtual port, that is, the port length, which does not exceed the port cache threshold of the virtual port. There may be flow queues whose queue length exceeds the queue cache threshold among the corresponding multiple flow queues. Therefore, if it is determined through the above step 201 that there is no virtual port whose port length exceeds the port cache threshold in the current system, it is necessary to use all flow queues in the current system as the first flow queue to implement the solution of the above embodiment and determine the current system. Whether there is a flow queue whose queue length exceeds the queue cache threshold in the flow queues, and then dequeue the flow queue whose queue length exceeds the queue cache threshold.

本实施例方案,若当前系统不存在端口长度超出端口缓存阈值的虚拟端口,将该当前系统所具有的流队列作为第一流队列,继而进行队列超限的判断,在上述实施例方案的基础上,判断流队列的范围更精确,从而更好地保证缓存的利用率。In the solution of this embodiment, if the current system does not have a virtual port whose port length exceeds the port cache threshold, the flow queue owned by the current system is used as the first flow queue, and then the queue overrun is judged. On the basis of the above-mentioned embodiment solution , to determine the scope of the flow queue more accurately, so as to better ensure the utilization of the cache.

进一步地,本实施例方案中,队列缓存阈值包括至少两个不同等级的缓存阈值。Further, in the solution of this embodiment, the queue cache threshold includes at least two cache thresholds of different levels.

该至少两个不同等级的缓存阈值,其优先级越高,则表示该等级的缓存阈值越大,对应的,优先级越低的缓存阈值则越小。The higher the priority of the at least two caching thresholds of different levels, the larger the caching threshold of the level, and correspondingly, the smaller the caching threshold of the lower priority.

上述方案中步骤101中判断第一流队列中是否存在队列长度超出队列缓存阈值的流队列,具体包括:In the above solution, in step 101, it is judged whether there is a flow queue whose queue length exceeds the queue buffer threshold in the first flow queue, specifically including:

步骤203、将第一流队列中流队列的队列长度与该队列缓存阈值中最高优先级的缓存阈值进行比较,判断该第一流队列中是否存在队列长度超出该最高优先级的缓存阈值的流队列。Step 203: Compare the queue length of the flow queues in the first flow queue with the highest priority cache threshold in the queue cache threshold, and determine whether there is a flow queue in the first flow queue whose queue length exceeds the highest priority cache threshold.

上述方案中步骤100中若第一流队列中存在队列长度超出该队列缓存阈值的流队列,则对该超出该队列缓存阈值的流队列执行出队操作,包括:In step 100 of the above solution, if there is a flow queue whose queue length exceeds the queue cache threshold in the first flow queue, the dequeue operation is performed on the flow queue that exceeds the queue cache threshold, including:

步骤204、若该第一流队列中存在队列长度超出该最高优先级的缓存阈值的流队列,则对超出该最高优先级的缓存阈值的流队列执行出队操作。Step 204: If there is a flow queue whose queue length exceeds the highest priority cache threshold in the first flow queue, perform a dequeue operation on the flow queue that exceeds the highest priority cache threshold.

上述步骤203的判断结果,还存在步骤204之外的另一种情况,包括:For the judgment result of the above step 203, there is another situation other than step 204, including:

步骤205、若该第一流队列中不存在队列长度超出该最高优先级的缓存阈值的流队列,确定该当前系统中端口缓存阈值与端口长度差值最小的虚拟端口,并将该端口缓存阈值与端口长度差值最小的虚拟端口所具有的流队列确定为第二流队列。Step 205: If there is no flow queue whose queue length exceeds the highest priority cache threshold in the first flow queue, determine the virtual port with the smallest difference between the port cache threshold and the port length in the current system, and compare the port cache threshold with the The flow queue of the virtual port with the smallest port length difference is determined as the second flow queue.

若通过步骤201确定当前系统所具有的虚拟端口,其端口长度均未超过端口缓存阈值,且通过上述方案中步骤203判断得到当前系统所具有的流队列,其队列长度均未超过最高优先级的缓存阈值,仅可表示当前时刻,系统的缓存处于安全状态。因此,还需要将该当前系统中端口缓存阈值与端口长度差值最小的虚拟端口所具有的流队列作为第二流队列,也就是后续,端口长度最有可能超出端口缓存阈值的虚拟端口,可称为存在潜在危险的虚拟端口,所对应的流队列。If it is determined through step 201 that the length of the virtual ports owned by the current system does not exceed the port cache threshold, and it is judged through step 203 in the above scheme that the length of the flow queues owned by the current system does not exceed the highest priority. The cache threshold can only indicate that the system's cache is in a safe state at the current moment. Therefore, it is also necessary to use the flow queue of the virtual port with the smallest difference between the port cache threshold and the port length in the current system as the second flow queue, that is, the subsequent virtual port whose port length is most likely to exceed the port cache threshold. It is called a potentially dangerous virtual port and corresponds to a flow queue.

步骤206、按照该队列缓存阈值中各缓存阈值的优先级顺序,依次判断该第二流队列中是否存在队列长度超出该队列缓存阈值中的缓存阈值的流队列。Step 206 : According to the priority order of each cache threshold in the queue cache threshold, sequentially determine whether there is a flow queue in the second flow queue whose queue length exceeds the cache threshold in the queue cache threshold.

若是,则执行步骤207;若否,则继续执行该步骤206。按照队列缓存阈值中缓存阈值的优先级顺序,依次进行判断,若该第二流队列中存在队列长度超出一缓存阈值的流队列,该缓存阈值后面的缓存阈值则无需进行判断。当判断至最后的一个等级的缓存阈值时,若是,继续执行步骤207;若否,则执行步骤208。由于是按照队列缓存阈值中缓存阈值的优先级顺序,依次进行判断,则最后一个等级的缓存阈值则为该队列缓存阈值中优先级最低的缓存阈值。If yes, execute step 207; if not, continue to execute step 206. Judgments are made sequentially according to the priority order of the cache thresholds in the queue cache thresholds. If there is a flow queue whose queue length exceeds a cache threshold in the second flow queue, the cache thresholds behind the cache threshold do not need to be judged. When it is judged that the cache threshold of the last level is reached, if yes, continue to execute step 207 ; if not, execute step 208 . Since the judgment is performed in sequence according to the priority order of the cache thresholds in the queue cache thresholds, the cache threshold of the last level is the cache threshold with the lowest priority among the queue cache thresholds.

步骤207、若该第二流队列中存在队列长度超出一缓存阈值的流队列,则对超出该缓存阈值的流队列执行出队操作。Step 207, if there is a flow queue whose queue length exceeds a cache threshold in the second flow queue, perform a dequeue operation on the flow queue that exceeds the cache threshold.

步骤208、若该第二流队列中不存在队列长度超出该队列缓存阈值中最低优先级的缓存阈值的流队列,则发送第一告警提示信息。该第一告警指示信息包括配置错误提示信息。Step 208: If there is no flow queue in the second flow queue whose queue length exceeds the cache threshold with the lowest priority among the queue cache thresholds, send the first warning prompt information. The first warning indication information includes configuration error prompt information.

如果,该第二流队列中不存在队列长度超出该队列缓存阈值中最低优先级的缓存阈值的流队列,则说明预先配置的队列缓存阈值过大。因而,该配置错误提示消息可以为阈值配置过大提示消息。If there is no flow queue whose queue length exceeds the lowest priority cache threshold among the queue cache thresholds in the second flow queue, it means that the preconfigured queue cache threshold is too large. Therefore, the configuration error prompt message may be a prompt message for an excessively large threshold configuration.

步骤206~步骤208,通过阶梯化的比较判断,确定该第二流队列中,队列长度最有可能超出队列缓存阈值的流队列,执行出队操作,从而可提供一个更完善的缓存管理方案,其不仅可对处于“缓存危险期”的流队列,即队列长度超出队列缓存阈值的流队列执行出队操作,还对处于“潜在缓存危险期”的流队列分级进行判断,使得缓存管理方案更加精细化,更好地保证缓存的利用率。Steps 206 to 208, through hierarchical comparison and judgment, determine the flow queue whose queue length is most likely to exceed the queue cache threshold in the second flow queue, and execute the dequeue operation, so as to provide a more complete cache management solution. It can not only dequeue the flow queues in the "caching danger period", that is, the flow queues whose queue length exceeds the queue cache threshold, but also judge the classification of the flow queues in the "potential cache danger period", making the cache management scheme more efficient. Refined to better ensure the utilization of the cache.

进一步,在上述方案的基础上,在步骤101中判断第一流队列中是否存在队列长度超出队列缓存阈值的流队列之前,还包括:Further, on the basis of the above solution, before judging in step 101 whether there is a flow queue whose queue length exceeds the queue cache threshold in the first flow queue, it also includes:

根据第一流队列的优先级,对该队列缓存阈值进行配置。Configure the queue buffer threshold according to the priority of the first flow queue.

第一流队列的优先级越高,配置的队列缓存阈值越大,对应的,第一流队列的优先级越低,配置的队列缓存阈值越小。The higher the priority of the first flow queue, the greater the configured queue cache threshold. Correspondingly, the lower the priority of the first flow queue, the smaller the configured queue cache threshold.

进一步地,当前系统中所具有的虚拟端口的端口缓存阈值之和小于等于共享缓存的N倍;该当前系统的总缓存包括共享缓存;Further, the sum of the port cache thresholds of the virtual ports in the current system is less than or equal to N times the shared cache; the total cache of the current system includes the shared cache;

该N为最高优先级的缓存阈值与最低优先级的缓存阈值的比值。The N is a ratio of the cache threshold with the highest priority to the cache threshold with the lowest priority.

在共享缓存还未耗尽之前,任何优先级的流队列和/或报文均优先占用该共享缓存的空间,不同的流队列和/或报文采用先到先占的方式,占用一定的缓存空间。Before the shared cache is exhausted, flow queues and/or packets of any priority will occupy the space of the shared cache first, and different flow queues and/or packets will occupy a certain amount of cache space in a first-come-first-served manner. .

当前系统中所具有的虚拟端口的端口缓存阈值之和,指的是,当前系统的缓存阈值。当前系统的缓存阈值配置过小,其缓存难以得到充分利用,因此该缓存阈值至少应大于共享缓存;若配置过大,难以通过该缓存管理方法对流队列进行出队,易出现配置错误提示。The sum of the port cache thresholds of the virtual ports in the current system refers to the cache threshold of the current system. The cache threshold configuration of the current system is too small, and its cache is difficult to be fully utilized. Therefore, the cache threshold should be at least larger than the shared cache; if the configuration is too large, it is difficult to dequeue the flow queue through this cache management method, and configuration error prompts may easily appear.

当前系统的缓存阈值还等于当前系统中所具有的流队列的队列缓存阈值中最高缓存阈值之和。流队列的队列缓存阈值,例如可以包括四个等级的缓存阈值,按照优先级高低依次为fq_thld、fq_thld*1/2、fq_thld*1/4、fq_thld*1/8。The cache threshold of the current system is also equal to the sum of the highest cache thresholds among the queue cache thresholds of the flow queues in the current system. The queue cache threshold of the flow queue may include, for example, four levels of cache thresholds, which are fq_thld, fq_thld*1/2, fq_thld*1/4, and fq_thld*1/8 in order of priority.

最高优先级的缓存阈值与最低优先级的缓存阈值的比值,为8,则当前系统中所具有的虚拟端口的端口缓存阈值之和小于等于共享缓存的8倍。如果,最低优先级的缓存阈值为fq_thld*1/16,则当前系统中所具有的虚拟端口的端口缓存阈值之和小于等于共享缓存的16倍。If the ratio of the cache threshold with the highest priority to the cache threshold with the lowest priority is 8, then the sum of the port cache thresholds of the virtual ports in the current system is less than or equal to 8 times of the shared cache. If the cache threshold of the lowest priority is fq_thld*1/16, the sum of the port cache thresholds of the virtual ports in the current system is less than or equal to 16 times of the shared cache.

该实施例方案,在上述实施例方案的基础上,提供一个更完善的缓存管理方案,其不仅可对处于“缓存危险期”的流队列,即队列长度超出队列缓存阈值的流队列执行出队操作,还对处于“潜在缓存危险期”的流队列分级进行判断,使得缓存管理方案更加精细化,更好地保证缓存的利用率。This embodiment scheme, on the basis of the above-mentioned embodiment scheme, provides a more complete cache management scheme, which can not only dequeue the flow queues in the "cache danger period", that is, the flow queues whose queue length exceeds the queue cache threshold It also judges the classification of flow queues in the "potential cache danger period", making the cache management plan more refined and better ensuring the utilization of the cache.

实施例三Embodiment Three

本实施例还提供一种缓存管理方法。图3为本发明实施例三所提供的缓存管理方法的流程图。在上述实施例中步骤201的判断结果,除上述步骤202之外还存在另一种情况,具体包括:This embodiment also provides a cache management method. FIG. 3 is a flowchart of a cache management method provided by Embodiment 3 of the present invention. In the above embodiment, the judgment result of step 201, in addition to the above step 202, there is another situation, specifically including:

步骤301、若当前系统存在端口长度超出端口缓存阈值的虚拟端口,确定该当前系统中端口长度与端口缓存阈值差值最大的虚拟端口,并将该端口长度与端口缓存阈值差值最大的虚拟端口所具有的流队列确定为该第一流队列。Step 301, if the current system has a virtual port whose port length exceeds the port cache threshold, determine the virtual port with the largest difference between the port length and the port cache threshold in the current system, and calculate the virtual port with the largest difference between the port length and the port cache threshold The owned flow queue is determined as the first flow queue.

具体地,本实施例在上述实施例2方案的基础上,还提供一种当前系统存在端口长度超出端口缓存阈值的虚拟端口情况下的缓存管理方法。该方法,将当前系统中端口长度与端口缓存阈值差值最大的虚拟端口,所具有的流队列作为第一流队列执行队列超限判断的操作。Specifically, on the basis of the solution in the above-mentioned embodiment 2, this embodiment also provides a cache management method in the case that the current system has a virtual port whose port length exceeds the port cache threshold. In this method, the flow queue of the virtual port with the largest difference between the port length and the port cache threshold in the current system is used as the first flow queue to perform the operation of judging the queue overrun.

在上述方案的基础上,上述方案中步骤101中判断第一流队列中是否存在队列长度超出队列缓存阈值的流队列,还包括:On the basis of the above scheme, in step 101 of the above scheme, it is judged whether there is a flow queue whose queue length exceeds the queue buffer threshold in the first flow queue, and further includes:

步骤302、若该第一流队列中不存在队列长度超出该最高优先级的缓存阈值的流队列,按照所述队列缓存阈值中各缓存阈值的优先级顺序,依次判断该第一流队列中是否存在队列长度超出该队列缓存阈值中的缓存阈值的流队列。Step 302: If there is no flow queue whose queue length exceeds the highest priority cache threshold in the first flow queue, determine whether there is a queue in the first flow queue according to the priority order of each cache threshold in the queue cache threshold Flow queues whose length exceeds the cache threshold in Cache Thresholds for this queue.

对应的,上述方案中步骤102中若第一流队列中存在队列长度超出队列缓存阈值的流队列,则对超出该队列缓存阈值的流队列执行出队操作,还包括:Correspondingly, in step 102 of the above solution, if there is a flow queue whose queue length exceeds the queue cache threshold in the first flow queue, the dequeue operation is performed on the flow queue exceeding the queue cache threshold, which also includes:

步骤303、若该第一流队列中存在队列长度超出一缓存阈值的流队列,则对超出该缓存阈值的流队列执行出队操作。Step 303, if there is a flow queue whose queue length exceeds a buffer threshold in the first flow queue, perform a dequeue operation on the flow queue whose queue length exceeds the buffer threshold.

进一步地,该方法,还包括:Further, the method also includes:

步骤304、若该第一流队列中不存在队列长度超出该队列缓存阈值中最低优先级的缓存阈值的流队列,发送第二告警提示信息;该第二告警指示信息包括配置错误提示信息。Step 304: If there is no flow queue in the first flow queue whose queue length exceeds the cache threshold with the lowest priority among the queue cache thresholds, send a second warning indication message; the second warning indication information includes configuration error prompt information.

进一步,在上述方案步骤101中判断第一流队列中是否存在队列长度超出队列缓存阈值的流队列之前,还包括:Further, before judging in step 101 of the above solution whether there is a flow queue whose queue length exceeds the queue cache threshold in the first flow queue, it also includes:

根据该第一流队列的优先级,设置该队列缓存阈值。Set the queue cache threshold according to the priority of the first flow queue.

当前系统中所具有的流队列的端口缓存阈值之和小于等于共享缓存的N倍;该当前系统的总缓存包括共享缓存;The sum of the port cache thresholds of the flow queues in the current system is less than or equal to N times the shared cache; the total cache of the current system includes the shared cache;

N为该当前系统中所具有的流队列的端口缓存阈值之和与该当前系统的实际缓存的比值。N is the ratio of the sum of the port cache thresholds of the flow queues in the current system to the actual cache of the current system.

该实施例方案与上述实施例的方案,分别适用于不用的场景,其不仅可对处于“缓存危险期”的流队列,即队列长度超出队列缓存阈值的流队列执行出队操作,还对处于“潜在缓存危险期”的流队列分级进行判断,使得缓存管理方案更加精细化,更好地保证缓存的利用率。The solution of this embodiment and the solution of the above-mentioned embodiments are respectively applicable to different scenarios. It can not only dequeue the flow queues in the "caching danger period", that is, the flow queues whose queue length exceeds the queue cache threshold, but also dequeue the flow queues in the The "potential cache danger period" is judged by the flow queue classification, which makes the cache management plan more refined and better guarantees the utilization rate of the cache.

实施例四Embodiment Four

本实施例还提供一种缓存管理方法。图4为本发明实施例四所提供的缓存管理方法的流程图。在上述实施例方案中步骤201判断当前系统是否存在端口长度超出端口缓存阈值的虚拟端口之前,该方法还包括:This embodiment also provides a cache management method. FIG. 4 is a flowchart of a cache management method provided by Embodiment 4 of the present invention. Before step 201 in the solution of the above embodiment determines whether there is a virtual port whose port length exceeds the port cache threshold in the current system, the method further includes:

步骤401、判断当前系统的空闲缓存是否小于保护缓存的阈值。Step 401, judging whether the free cache of the current system is smaller than the threshold of the protected cache.

为使得该缓存管理方案运行更稳定,在上述方案的基础上,当前系统总的缓存空间除共享缓存之外还包括保护缓存。保护缓存,用于在进行流队列出队过程中,吸收并处理路径时延的报文。其中,空闲缓存可通过idle_buf来表示,保护缓存阈值,可通过glb_buf来表示。In order to make the cache management solution run more stably, on the basis of the above solution, the total cache space of the current system includes the protection cache in addition to the shared cache. The protection cache is used to absorb and process the packets with path delay during the process of dequeuing the flow queue. Among them, the idle cache can be represented by idle_buf, and the protection cache threshold can be represented by glb_buf.

当前系统的空闲缓存指的是,总的缓存空间减去,当前系统中所有虚拟端口所对应的端口长度之和,也就是当前系统的实际缓存,所剩余的缓存空间。判断当前系统的空闲缓存是否小于保护缓存阈值,实际是判断当前系统的共享缓存是否耗尽。The free cache of the current system refers to the total cache space minus the sum of the port lengths corresponding to all virtual ports in the current system, that is, the remaining cache space of the actual cache of the current system. Judging whether the free cache of the current system is smaller than the protection cache threshold is actually judging whether the shared cache of the current system is exhausted.

步骤402、若该当前系统的空闲缓存小于该保护缓存的阈值,执行判断该当前系统是否存在端口长度超出端口缓存阈值的虚拟端口的操作。Step 402: If the free cache of the current system is smaller than the threshold of the protection cache, perform an operation of judging whether the current system has a virtual port whose port length exceeds the threshold of the port cache.

前系统的空间缓存小于保护缓存阈值,是说当前系统的共享缓存已耗尽,需要执行缓存管理策略,对其中预定的流队列进行出队,以腾出对应的缓存空间,从而保证当前系统总的缓存利用率。The space cache of the previous system is less than the protection cache threshold, which means that the shared cache of the current system has been exhausted, and it is necessary to implement a cache management strategy to dequeue the scheduled flow queues to free up the corresponding cache space, so as to ensure that the current system total cache utilization.

若该当前系统的空闲缓存大于或等于该保护缓存阈值,则说明当前系统的共享缓存还有剩余,因而无需通过缓存管理策略,进行流队列的出队。If the free cache of the current system is greater than or equal to the protection cache threshold, it means that there is still a shared cache in the current system, so there is no need to dequeue the flow queue through the cache management strategy.

进一步,在步骤401判断所述当前系统的空闲缓存是否小于保护缓存阈值之前,还包括:Further, before step 401 is judged whether the free cache of the current system is smaller than the protection cache threshold, it also includes:

根据该当前系统中处理信息的时延,设置保护缓存的阈值。According to the time delay of processing information in the current system, the threshold for protecting the cache is set.

如当前系统处理信息的时延较大,则可能导致流队列执行出队之后,该流队列所对应的队列长度并未及时更新,从而导致当前系统的空闲缓存未及时更新,而如果当前系统的保护缓存阈值设置过小,则会使得该当前系统的出队过于频繁,易造成缓存信息的溢出,从而影响系统的稳定性。因而,如当前系统处理信息的时延较大,可配置较大些的保护缓存阈值,可避免缓存信息的溢出。对应的,如当前系统处理信息的时延较小,其保护缓存阈值可配置的小些。If the delay in processing information in the current system is large, the queue length corresponding to the flow queue may not be updated in time after the flow queue is dequeued, resulting in the idle cache of the current system not being updated in time. If the protection cache threshold is set too small, the current system will leave the queue too frequently, which will easily cause the overflow of cache information, thus affecting the stability of the system. Therefore, if the delay in processing information in the current system is relatively large, a larger protection cache threshold can be configured to avoid overflow of cached information. Correspondingly, if the delay in processing information in the current system is small, the protection cache threshold can be configured to be smaller.

本实施例方案,可避免缓存信息的溢出,从而保证当前系统的稳定性。The scheme of this embodiment can avoid the overflow of cached information, thereby ensuring the stability of the current system.

实施例五Embodiment five

本实施例还提供一种缓存管理方法,该实施例通过具体实例对上述实施例方案进行解释说明,其中队列缓存阈值包括:fq_thld、fq_thld*1/2、fq_thld*1/4、fq_thld*1/8,fq_thld优先级最高,fq_thld*1/8优先级最低。图5为本发明实施例五所提供的缓存管理方法的流程图。如图5所示,该方法包括:This embodiment also provides a buffer management method. This embodiment explains the solutions of the above embodiments through specific examples, wherein the queue buffer thresholds include: fq_thld, fq_thld*1/2, fq_thld*1/4, fq_thld*1/ 8. fq_thld has the highest priority, and fq_thld*1/8 has the lowest priority. FIG. 5 is a flowchart of a cache management method provided by Embodiment 5 of the present invention. As shown in Figure 5, the method includes:

步骤501、判断当前系统的idle_buf<glb_buf。若是,则执行步骤502;若否,则该缓存管理方案结束。Step 501, judge that idle_buf<glb_buf of the current system. If yes, execute step 502; if not, the cache management solution ends.

步骤502、判断当前系统是否存在vi_qlen>vi_thld的虚拟端口。若是,则执行步骤503;若否,则执行步骤504。Step 502, judging whether there is a virtual port with vi_qlen>vi_thld in the current system. If yes, execute step 503; if not, execute step 504.

步骤503、确定当前系统中vi_qlen-vi_thld差值最大的虚拟端口,并将虚拟端口所具有的流队列确定为第一流队列。Step 503: Determine the virtual port with the largest difference between vi_qlen-vi_thld in the current system, and determine the flow queue of the virtual port as the first flow queue.

步骤503之后继续执行步骤505。Step 505 is continued after step 503 .

步骤504、将该当前系统所具有的流队列确定为第一流队列。Step 504: Determine the flow queue of the current system as the first flow queue.

在步骤504之后,继续执行步骤514。After step 504, continue to execute step 514.

步骤505、判断第一流队列中是否存在fq_qlen>fq_thld的流队列。若是,则执行步骤506;若否,则执行步骤507。Step 505. Determine whether there is a flow queue with fq_qlen>fq_thld in the first flow queue. If yes, go to step 506; if not, go to step 507.

步骤506、在该超出队列缓存阈值的流队列中选择一个流队列执行出队操作。Step 506: Select a flow queue from the flow queues exceeding the queue cache threshold to perform a dequeue operation.

步骤507、判断该第一流队列中是否存在fq_qlen>fq_thld*1/2的流队列。若是,则执行步骤508;如否,则执行步骤509。Step 507. Determine whether there is a flow queue with fq_qlen>fq_thld*1/2 in the first flow queue. If yes, go to step 508; if not, go to step 509.

步骤508、在该超出队列缓存阈值1/2的流队列中选择一个流队列执行出队操作。Step 508 : Select a flow queue from the flow queues that exceed 1/2 of the queue cache threshold to perform a dequeue operation.

步骤509、判断该第一流队列中是否存在fq_qlen>fq_thld*1/4的流队列。若是,则执行步骤510;若否,则执行步骤511。Step 509, judging whether there is a flow queue with fq_qlen>fq_thld*1/4 in the first flow queue. If yes, execute step 510; if not, execute step 511.

步骤510、在该超出队列缓存阈值1/4的流队列中选择一个流队列执行出队操作。Step 510: Select a flow queue from the flow queues exceeding 1/4 of the queue cache threshold to perform a dequeue operation.

步骤511、判断该第一流队列中是否存在fq_qlen>fq_thld*1/8的流队列。若是,则执行步骤512;若否,则执行步骤513。Step 511. Determine whether there is a flow queue with fq_qlen>fq_thld*1/8 in the first flow queue. If yes, execute step 512; if not, execute step 513.

步骤512、在该超出队列缓存阈值1/8的流队列中选择一个流队列执行出队操作。Step 512: Select a flow queue from the flow queues exceeding 1/8 of the queue cache threshold to perform a dequeue operation.

步骤513、发送第二告警提示信息,该第二告警指示信息包括配置错误提示信息。Step 513: Send second warning indication information, where the second warning indication information includes configuration error prompt information.

步骤514、判断第一流队列中是否存在fq_qlen>fq_thld的流队列。若是,则执行步骤515;若否,则执行步骤516。Step 514, determine whether there is a flow queue with fq_qlen>fq_thld in the first flow queue. If yes, go to step 515; if not, go to step 516.

该步骤514与步骤505区别在于,其第一流队列所包含的对象不同。The difference between step 514 and step 505 is that the objects contained in the first flow queue are different.

步骤515、在该超出队列缓存阈值的流队列中选择一个流队列执行出队操作。Step 515 , select a flow queue from the flow queues exceeding the queue cache threshold to perform a dequeue operation.

步骤516、确定当前系统中vi_thld-vi_qlen差值最小的虚拟端口,并将虚拟端口所具有的流队列确定为第二流队列。Step 516: Determine the virtual port with the smallest vi_thld-vi_qlen difference in the current system, and determine the flow queue of the virtual port as the second flow queue.

步骤517、判断该第二流队列中是否存在fq_qlen>fq_thld*1/2的流队列。若是,则执行步骤518;若否,则执行步骤519。Step 517. Determine whether there is a flow queue with fq_qlen>fq_thld*1/2 in the second flow queue. If yes, go to step 518; if not, go to step 519.

步骤518、在该超出队列缓存阈值1/2的流队列中选择一个流队列执行出队操作。Step 518: Select a flow queue from the flow queues that exceed 1/2 of the queue cache threshold to perform a dequeue operation.

步骤519、判断该第二流队列中是否存在fq_qlen>fq_thld*1/4的流队列。若是,则执行步骤520;若否,则执行步骤521。Step 519. Determine whether there is a flow queue with fq_qlen>fq_thld*1/4 in the second flow queue. If yes, go to step 520; if not, go to step 521.

步骤520、在该超出队列缓存阈值1/4的流队列中选择一个流队列执行出队操作。Step 520 , select a flow queue from the flow queues exceeding 1/4 of the queue cache threshold to perform a dequeue operation.

步骤521、判断该第二流队列中是否存在fq_qlen>fq_thld*1/8的流队列。若是,则执行步骤522;若否,则执行步骤523。Step 521. Determine whether there is a flow queue with fq_qlen>fq_thld*1/8 in the second flow queue. If yes, execute step 522; if not, execute step 523.

步骤522、在该超出队列缓存阈值1/8的流队列中选择一个流队列执行出队操作。Step 522: Select a flow queue from the flow queues exceeding 1/8 of the queue cache threshold to perform a dequeue operation.

步骤523、发送第一告警提示信息,该第一告警指示信息包括配置错误提示信息。Step 523: Send first warning indication information, where the first warning indication information includes configuration error prompt information.

本实施例方案是在上述实施例方案的基础上,通过具体实例进行解释说明,其具体的实现过程及有益效果与上述实施例类似,在此不再赘述。The solution of this embodiment is based on the solutions of the above embodiments, and is explained through specific examples. Its specific implementation process and beneficial effects are similar to those of the above embodiments, and will not be repeated here.

实施例六Embodiment six

本发明实施例六提供一种缓存管理方法。图6为本发明实施例六所提供的缓存管理方法的流程图。Embodiment 6 of the present invention provides a cache management method. FIG. 6 is a flowchart of a cache management method provided in Embodiment 6 of the present invention.

如图6所示,进一步,在上述实施例方案中步骤102中对超出队列缓存阈值的流队列执行出队操作,具体包括如下步骤:As shown in FIG. 6 , further, in step 102 of the above embodiment solution, the dequeue operation is performed on the flow queue exceeding the queue cache threshold, which specifically includes the following steps:

步骤601、在超出队列缓存阈值的流队列中选择一个流队列。Step 601. Select a flow queue from the flow queues exceeding the queue cache threshold.

具体地,该超出队列缓存阈值的流队列可以为多个流队列,也可以为一个流队列。为尽可能避免流队列的出队对系统所造成的影响,该实施例方案优选的,从超出队列缓存阈值的流队列中选择一个流队列进行出队。Specifically, the flow queue exceeding the queue cache threshold may be multiple flow queues, or may be one flow queue. In order to avoid the impact on the system caused by the dequeue of the flow queue as much as possible, the solution of this embodiment preferably selects a flow queue from the flow queues exceeding the queue cache threshold to dequeue.

步骤602、将选择的流队列对应的信息传递给队列管理器,以使该队列管理器对该选择的流队列对应的信息中一个存储包的信息执行出队操作。Step 602: Send the information corresponding to the selected flow queue to the queue manager, so that the queue manager performs a dequeue operation on the information of one stored packet in the information corresponding to the selected flow queue.

对流队列执行出队操作,指的是对流队列所缓存的数据信息执行出队操作。每个流队列存在多个存储包,流队列通过其所具有的缓存单元缓存信息。该实施例方案优选的,在步骤601中所选择的待出队的流队列所缓存的信息中,选择一个存储包的信息进行出队。对应的,在执行出队操作之后,该选择的流队列的队列长度,则减少一个存储包的信息长度。Executing the dequeue operation on the stream queue refers to performing the dequeue operation on the data information cached in the stream queue. There are multiple storage packets in each flow queue, and the flow queue caches information through its buffer unit. Preferably, in the solution of this embodiment, among the information cached in the flow queue to be dequeued selected in step 601 , select information of a stored packet to be dequeued. Correspondingly, after the dequeue operation is performed, the queue length of the selected flow queue is reduced by the information length of one storage packet.

该实施例方案,在上述实施例方案的基础上,特定的,在超对队列缓存阈值的流队列中选择一个流队列,继而将该流队列对应的信息中一个存储包的信息执行出队操作,从而尽可能的避免出队操作对当前系统处理业务的影响。In this embodiment scheme, on the basis of the above-mentioned embodiment scheme, specifically, a flow queue is selected in the flow queue exceeding the cache threshold of the queue, and then the information corresponding to the flow queue is dequeued for a stored packet information , so as to avoid the impact of dequeue operation on the current system processing business as much as possible.

实施例七Embodiment seven

本发明实施例七提供一种缓存管理方法。图7为本发明实施例七所提供的缓存管理方法的流程图。Embodiment 7 of the present invention provides a cache management method. FIG. 7 is a flowchart of a cache management method provided by Embodiment 7 of the present invention.

如图7所示,进一步地,在上述方案的基础上,该方法还包括:As shown in Figure 7, further, on the basis of the above solution, the method also includes:

步骤701、根据选择的流队列对应的老化指示消息,判断该选择的流队列是否为需要老化的流队列。Step 701. According to the aging indication message corresponding to the selected flow queue, determine whether the selected flow queue is a flow queue that needs to be aged.

步骤702、对该需要老化的流队列执行老化操作。Step 702, perform an aging operation on the flow queue that needs to be aged.

其中,老化指示消息,例如可以是通过flush_ind来表示。通过该flush_ind所携带的信息来标识流队列是否为需老化的流队列。Wherein, the aging indication message may be represented by flush_ind, for example. The information carried by the flush_ind is used to identify whether the flow queue is a flow queue to be aged.

现有技术中根据流队列中的存储包在数据入队时所打印的时间戳,执行队列老化。由于每个流队列具有多个存储包,而对每个存储包都打印时间戳,占用大量的时间戳资源,造成资源的浪费。该实施例方案无需打印繁琐的时间戳,即可实现流队列的老化,减少系统资源的浪费。In the prior art, queue aging is performed according to the timestamp printed by the storage packets in the flow queue when data is enqueued. Since each flow queue has multiple storage packages, printing a time stamp for each storage package occupies a large amount of time stamp resources, resulting in a waste of resources. In the solution of this embodiment, the aging of the flow queue can be realized without printing complicated time stamps, and the waste of system resources can be reduced.

在上述方案步骤602在将选择的流队列对应的信息传递给队列管理器之后,还包括:In step 602 of the above solution, after transferring the information corresponding to the selected flow queue to the queue manager, it also includes:

根据队列管理器,在对该选择的流队列对应的信息中一个存储包的信息执行出队操作,之后产生的出队指示消息,将该选择的流队列对应的出队计数器的值加1。According to the queue manager, the dequeue operation is performed on the information of a stored packet in the information corresponding to the selected flow queue, and then the dequeue indication message generated will add 1 to the value of the dequeue counter corresponding to the selected flow queue.

出队指示消息,例如可以是通过fq_dep_ind表示。出队计数器,例如可通过fq_pot_cnt表示。在该选择的流队列执行出队操作之后,其对应的出队指示消息,fq_dep_ind可以配置为1。如检测到fq_dep_ind=1,则可将其对应的出队计数器,fq_pot_cnt的值加一。The dequeue indication message may be indicated by fq_dep_ind, for example. The dequeue counter, for example, can be represented by fq_pot_cnt. After the selected flow queue executes the dequeue operation, its corresponding dequeue indication message, fq_dep_ind can be configured as 1. If it is detected that fq_dep_ind=1, the value of fq_pot_cnt, its corresponding out-of-queue counter, can be increased by one.

每个流队列都存在各自对应的出队计时器,该出队计数器用于记录其对应的流队列的出队次数,流队列每执行一次出队操作,其出队计数器的值加一。Each flow queue has its own corresponding dequeue timer. The dequeue counter is used to record the number of dequeue times of its corresponding flow queue. Every time a stream queue executes a dequeue operation, the value of its dequeue counter is incremented by one.

进一步,上述步骤701根据选择的流队列对应的老化指示消息,判断该选择的流队列是否为需要老化的流队列,包括:Further, the above step 701 judges whether the selected flow queue is a flow queue that needs to be aged according to the aging indication message corresponding to the selected flow queue, including:

若出队计数器的值大于出队次数阈值,将该选择的流队列对应的老化指示消息配置为1;若该出队计数器的值小于等于所述出队次数阈值,将该选择的流队列对应的老化指示消息配置为0;If the value of the dequeue counter is greater than the dequeue times threshold, configure the aging indication message corresponding to the selected flow queue as 1; if the value of the dequeue counter is less than or equal to the dequeue times threshold, the selected flow queue corresponds The aging indication message is configured as 0;

在预定周期内,若该选择的流队列对应的老化指示消息持续为1,则确定该选择的流队列为需要老化的流队列。Within a predetermined period, if the aging indication message corresponding to the selected flow queue continues to be 1, it is determined that the selected flow queue is a flow queue that needs to be aged.

具体地,该实施例方案,在流队列均具有出队计数器的情况下,至少还具有出队次数阈值。不同的流队列可根据其所对应的虚拟端口的优先级,具有不同的出队次数阈值。流队列的出队次数阈值,例如可以通过fq_pot_thld。Specifically, in the solution of this embodiment, in the case that the flow queues all have dequeue counters, they also have at least a dequeue times threshold. Different flow queues may have different dequeue times thresholds according to the priority of their corresponding virtual ports. The threshold of dequeuing times of the flow queue, for example, can be passed through fq_pot_thld.

当出队计数器的值大于出队次数阈值,即fq_pot_cnt>fq_pot_thld,则表面该流队列的出队太过频繁,则说明该流队列拥塞,其所存储的缓存信息长期得不到自然出队。因此,可将所对应老化指示消息,flush_ind配置为1,继而将该流队列按照队列老化模式执行队列老化操作。在预定周期内,若该选择的流队列对应的老化指示消息,flush_ind持续为1,也就是说,该选择的流队列的持续处于队列长度超限状态,需要反复的队列出队,则表面该选择的流队列属于长期拥塞队列。因此,可将该长期拥塞队列确定为需要老化的流队列,继而执行队列操作,将该流队列当前存储的缓存信息转移至其他队列或是端口。When the value of the dequeue counter is greater than the threshold of dequeue times, that is, fq_pot_cnt>fq_pot_thld, it means that the flow queue is dequeued too frequently, indicating that the flow queue is congested, and the cached information stored in it cannot be dequeued naturally for a long time. Therefore, the corresponding aging indication message, flush_ind, can be configured as 1, and then the queue aging operation is performed on the flow queue according to the queue aging mode. In the predetermined period, if the aging indication message corresponding to the selected flow queue, flush_ind continues to be 1, that is to say, the selected flow queue continues to be in the queue length exceeding state, and the queue needs to be repeatedly dequeued, then the surface The selected flow queue belongs to the long-term congestion queue. Therefore, the long-term congestion queue can be determined as a flow queue that needs to be aged, and then the queue operation is performed to transfer the cache information currently stored in the flow queue to other queues or ports.

进一步地,在确定选择的流队列为需要老化的流队列之后,还包括:Further, after determining that the selected flow queue is a flow queue that needs to be aged, it also includes:

减少该选择的流队列对应的队列缓存阈值的配置。Reduce the configuration of the queue cache threshold corresponding to the selected flow queue.

在预定周期内,若选择的流队列对应的老化指示消息持续为0,则恢复该选择的流队列对应的队列缓存阈值的配置。Within a predetermined period, if the aging indication message corresponding to the selected flow queue continues to be 0, the configuration of the queue cache threshold corresponding to the selected flow queue is restored.

具体地,若该选择的流队列为需要老化的流队列时,为避免后续通过该流队列进行信息的缓存时易造成的队列拥塞,可将预先配置的该流队列对应的队列缓存阈值,减小,从而提高该流队列可能执行出队的可能性,减少队列老化的可能。预先配置的该流队列对应的队列缓存阈值,例如可以通过fq_thld表示。减少该选择的流队列对应的队列缓存阈值的配置,即fq_thld的配置。Specifically, if the selected flow queue is a flow queue that needs to be aged, in order to avoid queue congestion that is likely to be caused when information is cached through the flow queue, the pre-configured queue cache threshold corresponding to the flow queue can be reduced by Small, so as to increase the possibility that the flow queue may be dequeued and reduce the possibility of queue aging. The pre-configured queue cache threshold corresponding to the flow queue can be represented by fq_thld, for example. Reduce the configuration of the queue cache threshold corresponding to the selected flow queue, that is, the configuration of fq_thld.

若该选择的流队列对应的老化指示消息,flush_ind持续为0,也就是说,该流队列并非拥塞队列,无需进行队列老化,且状态稳定,因此恢复该选择的流队列对应的队列缓存阈值的配置。恢复该选择的流队列对应的队列缓存阈值的配置,减少该流队列可能执行出队的可能性,避免出队操作的多次执行导致的资源浪费。If the aging indication message corresponding to the selected flow queue, flush_ind remains 0, that is to say, the flow queue is not a congested queue, does not need to perform queue aging, and the state is stable, so restore the queue cache threshold value corresponding to the selected flow queue configuration. Restore the configuration of the queue cache threshold corresponding to the selected flow queue, reduce the possibility that the flow queue may be dequeued, and avoid resource waste caused by multiple executions of the dequeue operation.

进一步,对于系统中需要老化的流队列除长期拥塞队列之外,还包括仅有出队的流队列及仅有入队的流队列。在预定周期内,如检测到该流队列对应的fq_dep_ind持续为1,则该流队列为仅有出队的流队列,可对该流队列执行队列老化操作,在执行队列老化操作之后,可将fq_dep_ind重置为0。对于空的流队列,也就是说当检测到该流队列的队列长度为0时,也将该流队列对应的fq_dep_ind更新为1。因此在预定周期内,如检测到该流队列对应的fq_dep_ind持续为0,该流队列无出队操作,为仅有入队的流队列,当可对该流队列执行队列老化操作。Furthermore, in addition to the long-term congestion queues, the flow queues that need to be aged in the system also include flow queues that only go out of the queue and flow queues that only enter the queue. During the predetermined period, if it is detected that the fq_dep_ind corresponding to the flow queue is continuously 1, then the flow queue is the flow queue that only dequeues, and the queue aging operation can be performed on the flow queue. After the queue aging operation is performed, the fq_dep_ind is reset to 0. For an empty flow queue, that is, when it is detected that the queue length of the flow queue is 0, the fq_dep_ind corresponding to the flow queue is also updated to 1. Therefore, within a predetermined period, if it is detected that the fq_dep_ind corresponding to the flow queue is continuously 0, the flow queue has no dequeue operation and is a flow queue that only enters the queue, and the queue aging operation can be performed on the flow queue.

本实施例方案,在上述实施例方案可提高系统缓存利用率的基础上,还可节约系统的资源。In the solution of this embodiment, on the basis that the solution in the above embodiments can improve the utilization rate of the system cache, system resources can also be saved.

实施例八Embodiment Eight

本发明实施例八提供一种缓存管理装置。图8为本发明实施例八所提供的缓存管理装置的结构示意图。如图8所示,该缓存管理装置801,包括:Embodiment 8 of the present invention provides a cache management device. FIG. 8 is a schematic structural diagram of a cache management device provided by Embodiment 8 of the present invention. As shown in Figure 8, the cache management device 801 includes:

判断模块802,用于判断第一流队列中是否存在队列长度超出队列缓存阈值的流队列.A judging module 802, configured to judge whether there is a flow queue whose queue length exceeds a queue cache threshold in the first flow queue.

执行模块803,用于若该第一流队列中存在队列长度超出该队列缓存阈值的流队列,对超出该队列缓存阈值的流队列执行出队操作。The execution module 803 is configured to, if there is a flow queue whose queue length exceeds the queue cache threshold in the first flow queue, perform a dequeue operation on the flow queue exceeding the queue cache threshold.

在上述方案的基础上,判断模块802,还用于在判断第一流队列的队列长度是否超出队列缓存阈值之前,判断当前系统是否存在端口长度超出端口缓存阈值的虚拟端口。On the basis of the above solution, the judging module 802 is further configured to judge whether there is a virtual port whose port length exceeds the port caching threshold in the current system before judging whether the queue length of the first flow queue exceeds the queue caching threshold.

缓存管理装置801,还包括:The cache management device 801 also includes:

确定模块,用于若当前系统不存在端口长度超出端口缓存阈值的虚拟端口,将该当前系统所具有的流队列确定为所述第一流队列。The determining module is configured to determine the flow queue of the current system as the first flow queue if there is no virtual port whose port length exceeds the port cache threshold in the current system.

在上述实施例方案中,队列缓存阈值包括至少两个不同优先级的缓存阈值。In the solutions of the foregoing embodiments, the queue cache threshold includes at least two cache thresholds with different priorities.

对应的,判断模块802,用于将该第一流队列中流队列的队列长度与该队列缓存阈值中最高优先级的缓存阈值进行比较,判断第一流队列中是否存在队列长度超出该最高优先级的缓存阈值的流队列。Correspondingly, the judging module 802 is configured to compare the queue length of the flow queue in the first flow queue with the highest priority cache threshold in the queue cache threshold, and judge whether there is a cache whose queue length exceeds the highest priority in the first flow queue Threshold for flow queues.

执行模块803,用于若该第一流队列中存在队列长度超出该最高优先级的缓存阈值的流队列,则对超出该最高优先级的缓存阈值的流队列执行出队操作。The execution module 803 is configured to, if there is a flow queue whose queue length exceeds the highest-priority cache threshold in the first flow queue, perform a dequeue operation on the flow queue that exceeds the highest-priority cache threshold.

进一步地,上述方案中的确定模块,还用于若该第一流队列中不存在队列长度超出该最高优先级的缓存阈值的流队列,确定当前系统中端口缓存阈值与端口长度差值最小的虚拟端口,并将该端口缓存阈值与端口长度差值最小的虚拟端口所具有的流队列确定为第二流队列。Further, the determination module in the above solution is also used to determine the virtual flow queue with the smallest difference between the port buffer threshold and the port length in the current system if there is no flow queue whose queue length exceeds the highest priority buffer threshold in the first flow queue. port, and determine the flow queue of the virtual port with the smallest difference between the port cache threshold and the port length as the second flow queue.

对应的,判断模块802,还用于按照该队列缓存阈值中各缓存阈值的优先级顺序,依次判断该第二流队列中是否存在队列长度超出该队列缓存阈值中的缓存阈值的流队列。Correspondingly, the judging module 802 is further configured to sequentially judge whether there is a flow queue in the second flow queue whose queue length exceeds the cache threshold in the queue cache threshold according to the priority sequence of each cache threshold in the queue cache threshold.

执行模块803,还用于若该第二流队列中存在队列长度超出一缓存阈值的流队列,则对超出该缓存阈值的流队列执行出队操作。The executing module 803 is further configured to, if there is a flow queue whose queue length exceeds a cache threshold in the second flow queue, perform a dequeue operation on the flow queue exceeding the cache threshold.

进一步地,缓存管理装置801,还包括:Further, the cache management device 801 also includes:

第一发送模块,用于若该第二流队列中不存在队列长度超出该队列缓存阈值中最低优先级的缓存阈值的流队列,则发送第一告警提示信息;该第一告警指示信息包括配置错误提示信息。The first sending module is configured to send first warning prompt information if there is no flow queue whose queue length exceeds the lowest priority cache threshold among the queue cache thresholds in the second flow queue; the first warning indication information includes configuration Error message.

其中,确定模块,还用于若该当前系统存在端口长度超出端口缓存阈值的虚拟端口,确定该当前系统中端口长度与端口缓存阈值差值最大的虚拟端口,并将该端口长度与端口缓存阈值差值最大的虚拟端口所具有的流队列确定为该第一流队列。Wherein, the determination module is also used to determine the virtual port with the largest difference between the port length and the port cache threshold in the current system if the current system has a virtual port whose port length exceeds the port cache threshold, and compare the port length with the port cache threshold The flow queue of the virtual port with the largest difference is determined as the first flow queue.

在上述实施例方案的基础上,判断模块802,还用于若该第一流队列中不存在队列长度超出该最高优先级的缓存阈值的流队列,按照该队列缓存阈值中各缓存阈值的优先级顺序,依次判断该第一流队列中是否存在队列长度超出该队列缓存阈值中的缓存阈值的流队列;On the basis of the solutions in the above embodiments, the judging module 802 is further configured to: if there is no flow queue whose queue length exceeds the highest priority cache threshold in the first flow queue, according to the priority of each cache threshold in the queue cache threshold In order, determine whether there is a flow queue in the first flow queue whose queue length exceeds the cache threshold in the queue cache threshold;

执行模块803,还用于若第一流队列中存在队列长度超出一缓存阈值的流队列,则对超出该缓存阈值的流队列执行出队操作。The execution module 803 is further configured to, if there is a flow queue whose queue length exceeds a cache threshold in the first flow queue, perform a dequeue operation on the flow queue that exceeds the cache threshold.

进一步地,在上述实施例方案的基础上,缓存管理装置801,还包括:Further, on the basis of the solutions in the above embodiments, the cache management device 801 further includes:

第二发送模块,用于若该第一流队列中不存在队列长度超出该队列缓存阈值中最低优先级的缓存阈值的流队列,发送第二告警提示信息;该第二告警指示信息包括配置错误提示信息。The second sending module is configured to send a second warning message if there is no flow queue in the first flow queue whose queue length exceeds the cache threshold with the lowest priority among the queue cache thresholds; the second warning message includes a configuration error prompt information.

进一步地,缓存管理装置801,还包括:Further, the cache management device 801 also includes:

配置模块,用于在判断第一流队列中是否存在队列长度超出队列缓存阈值的流队列之前,根据该第一流队列的优先级,设置队列缓存阈值。The configuration module is configured to set the queue cache threshold according to the priority of the first flow queue before judging whether there is a flow queue whose queue length exceeds the queue cache threshold in the first flow queue.

在上述实施例方案中,当前系统中所具有的流队列的端口缓存阈值之和小于等于共享缓存的N倍;该当前系统的总缓存包括共享缓存;In the solution of the above embodiment, the sum of the port cache thresholds of the flow queues in the current system is less than or equal to N times the shared cache; the total cache of the current system includes the shared cache;

其中,N为该当前系统中所具有的流队列的端口缓存阈值之和与该当前系统的实际缓存的比值。Wherein, N is the ratio of the sum of the port cache thresholds of the flow queues in the current system to the actual cache of the current system.

进一步地,判断模块802,还用于判断当前系统是否存在端口长度超出端口缓存阈值的虚拟端口之前,判断该当前系统的空闲缓存是否小于保护缓存的阈值;该当前系统的总缓存,还包括保护缓存;当前系统的空闲缓存小于该保护缓存的阈值时,执行判断该当前系统是否存在端口长度超出端口缓存阈值的虚拟端口的操作。Further, the judging module 802 is also used to judge whether the current system has a virtual port whose port length exceeds the port cache threshold, and judge whether the current system’s free cache is smaller than the protection cache threshold; the current system’s total cache also includes protection Cache: when the free cache of the current system is less than the threshold of the protection cache, perform the operation of judging whether the current system has a virtual port whose port length exceeds the threshold of the port cache.

在上述方案的基础上,进一步地,配置模块,还用于在判断该当前系统的空闲缓存是否小于保护缓存阈值之前,根据该当前系统中处理信息的时延,设置保护缓存的阈值。On the basis of the above solution, further, the configuration module is further configured to set the threshold of the protection cache according to the time delay of processing information in the current system before judging whether the free cache of the current system is smaller than the threshold of the protection cache.

进一步地,执行模块803,具体用于在该超出队列缓存阈值的流队列中选择一个流队列;Further, the executing module 803 is specifically configured to select a flow queue from the flow queues exceeding the queue cache threshold;

发送模块,还用于将该选择的流队列对应的信息传递给队列管理器,以使该队列管理器对该选择的流队列对应的信息中一个存储包的信息执行出队操作。The sending module is further configured to transmit the information corresponding to the selected flow queue to the queue manager, so that the queue manager performs a dequeue operation on the information of one stored packet in the information corresponding to the selected flow queue.

在上述方案的基础上,判断模块802,还用于根据该选择的流队列对应的老化指示消息,判断该选择的流队列是否为需要老化的流队列;On the basis of the above solution, the judging module 802 is further configured to judge whether the selected flow queue is a flow queue that needs to be aged according to the aging indication message corresponding to the selected flow queue;

执行模块803,还用于对该需要老化的流队列执行老化操作。The execution module 803 is further configured to perform an aging operation on the flow queue that needs to be aged.

进一步地,缓存管理装置801,还包括:Further, the cache management device 801 also includes:

计数模块,用于在将该选择的流队列对应的信息传递给队列管理器之后,根据该队列管理器,在对该选择的流队列对应的信息中一个存储包的信息执行出队操作,之后产生的出队指示消息,将该选择的流队列对应的出队计数器的值加1。The counting module is configured to, after passing the information corresponding to the selected flow queue to the queue manager, according to the queue manager, perform a dequeue operation on the information of a storage package in the information corresponding to the selected flow queue, and then The generated dequeue indication message adds 1 to the value of the dequeue counter corresponding to the selected flow queue.

进一步地,配置模块,还用于若该出队计数器的值大于出队次数阈值,将该选择的流队列对应的老化指示消息配置为1;若该出队计数器的值小于等于该出队次数阈值,将该选择的流队列对应的老化指示消息配置为0;确定模块,还用于在预定周期内,若该选择的流队列对应的老化指示消息持续为1,则确定该选择的流队列为需要老化的流队列。Further, the configuration module is also used to configure the aging indication message corresponding to the selected flow queue as 1 if the value of the dequeue counter is greater than the dequeue times threshold; if the value of the dequeue counter is less than or equal to the dequeue times Threshold, the aging indication message corresponding to the selected flow queue is configured as 0; the determination module is also used to determine the selected flow queue if the aging indication message corresponding to the selected flow queue continues to be 1 within a predetermined period For the flow queue that needs to be aged.

在上述实施例方案的基础上,配置模块,还用于在确定该选择的流队列为需要老化的流队列之后,减少该选择的流队列对应的队列缓存阈值的配置;On the basis of the solutions of the above embodiments, the configuration module is further configured to reduce the configuration of the queue cache threshold corresponding to the selected flow queue after determining that the selected flow queue is a flow queue that needs to be aged;

在该预定周期内,若该选择的流队列对应的老化指示消息持续为0,则恢复该选择的流队列对应的队列缓存阈值的配置。Within the predetermined period, if the aging indication message corresponding to the selected flow queue continues to be 0, the configuration of the queue cache threshold corresponding to the selected flow queue is restored.

本实施例所提供的缓存管理装置可执行上述任一实施例所提供的缓存管理方法,其具体的实现过程及解释说明与上述实施例类似,在此不再赘述。The cache management device provided in this embodiment can execute the cache management method provided in any of the above-mentioned embodiments, and its specific implementation process and explanation are similar to those of the above-mentioned embodiments, and will not be repeated here.

本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps for implementing the above method embodiments can be completed by program instructions and related hardware. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps including the above-mentioned method embodiments; and the aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other various media that can store program codes.

最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present invention, rather than limiting them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: It is still possible to modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the technical solutions of the various embodiments of the present invention. scope.

Claims (34)

1. a buffer memory management method, is characterized in that, comprising:
Whether judge in first-class queue exists queue length to exceed the flow queue of queue buffer memory threshold value;
If exist queue length to exceed the flow queue of described queue buffer memory threshold value in described first-class queue, the described flow queue that exceeds described queue buffer memory threshold value carried out out to team's operation.
2. method according to claim 1, is characterized in that, the described queue length that judges first-class queue also comprises before whether exceeding queue buffer memory threshold value:
Judge whether current system exists port length to exceed the virtual port of buffer to ports threshold value;
If described current system does not exist port length to exceed the virtual port of buffer to ports threshold value, the flow queue that described current system is had is defined as described first-class queue.
3. method according to claim 2, is characterized in that, described queue buffer memory threshold value comprises the buffer memory threshold value of at least two different priorities;
Describedly judge in first-class queue whether exist queue length to exceed the flow queue of queue buffer memory threshold value, to comprise:
The buffer memory threshold value of limit priority in the queue length of flow queue in described first-class queue and described queue buffer memory threshold value is compared, judge in first-class queue and whether exist queue length to exceed the flow queue of the buffer memory threshold value of described limit priority;
If exist queue length to exceed the flow queue of described queue buffer memory threshold value in described first-class queue, the described flow queue that exceeds described queue buffer memory threshold value is carried out out to team's operation, comprising:
If exist queue length to exceed the flow queue of the buffer memory threshold value of described limit priority in described first-class queue, the described flow queue that exceeds the buffer memory threshold value of described limit priority carried out out to team's operation.
4. method according to claim 3, is characterized in that, also comprises:
If do not exist queue length to exceed the flow queue of the buffer memory threshold value of described limit priority in described first-class queue, determine the virtual port of described current system middle port buffer memory threshold value and port length difference minimum, and the flow queue that the virtual port of described buffer to ports threshold value and port length difference minimum is had is defined as second queue;
According to the priority orders of each buffer memory threshold value in described queue buffer memory threshold value, judge successively in described second queue and whether exist queue length to exceed the flow queue of the buffer memory threshold value in described queue buffer memory threshold value;
If exist queue length to exceed the flow queue of a buffer memory threshold value in described second queue, carry out out team's operation to exceeding the flow queue of this buffer memory threshold value.
5. method according to claim 4, is characterized in that, also comprises:
If do not exist queue length to exceed the flow queue of the buffer memory threshold value of lowest priority in described queue buffer memory threshold value in described second queue, send the first alarm prompt; Described the first alarm indication information comprises configuration error information.
6. method according to claim 3, is characterized in that,
If described current system exists port length to exceed the virtual port of buffer to ports threshold value, determine the virtual port of described current system middle port length and buffer to ports threshold difference maximum, and the flow queue that the virtual port of described port length and buffer to ports threshold difference maximum is had is defined as described first-class queue.
7. method according to claim 6, is characterized in that, describedly judges in first-class queue whether exist queue length to exceed the flow queue of queue buffer memory threshold value, also to comprise:
If do not exist queue length to exceed the flow queue of the buffer memory threshold value of described limit priority in described first-class queue, according to the priority orders of each buffer memory threshold value in described queue buffer memory threshold value, judge successively in described first-class queue and whether exist queue length to exceed the flow queue of the buffer memory threshold value in described queue buffer memory threshold value;
If exist queue length to exceed the flow queue of described queue buffer memory threshold value in described first-class queue, the described flow queue that exceeds described queue buffer memory threshold value is carried out out to team's operation, also comprise:
If exist queue length to exceed the flow queue of a buffer memory threshold value in described first-class queue, carry out out team's operation to exceeding the flow queue of this buffer memory threshold value.
8. method according to claim 7, is characterized in that, also comprises:
If do not exist queue length to exceed the flow queue of the buffer memory threshold value of lowest priority in described queue buffer memory threshold value in described first-class queue, send the second alarm prompt; Described the second alarm indication information comprises configuration error information.
9. according to the method described in claim 5 or 8, it is characterized in that whether existing in judging first-class queue before queue length exceeds the flow queue of queue buffer memory threshold value described, also comprise:
According to the priority of described first-class queue, described queue buffer memory threshold value is set.
10. method according to claim 2, is characterized in that, the buffer to ports threshold value sum of the flow queue having in described current system is less than or equal to N times of shared buffer memory; Total buffer memory of described current system comprises described shared buffer memory;
Described N is the buffer to ports threshold value sum of flow queue that has in described current system and the ratio of the real cache of described current system.
11. methods according to claim 10, is characterized in that, describedly judge that whether current system exists before port length exceeds the virtual port of buffer to ports threshold value, also comprises:
Judge whether the free buffer of described current system is less than the threshold value of protection buffer memory; Total buffer memory of described current system, also comprises described protection buffer memory;
When the free buffer of described current system is less than the threshold value of described protection buffer memory, carries out and judge whether described current system exists port length to exceed the operation of the virtual port of buffer to ports threshold value.
12. methods according to claim 11, is characterized in that, before whether the described free buffer that judges described current system is less than protection buffer memory threshold value, also comprise:
According to the time delay of process information in described current system, described protection buffer memory is configured.
13. methods according to claim 9, is characterized in that, described the described flow queue that exceeds queue buffer memory threshold value are carried out out to team operation, comprising:
In the described flow queue that exceeds queue buffer memory threshold value, select a flow queue;
The information that the flow queue of described selection is corresponding passes to queue management device, so that described queue management device goes out team's operation to the information and executing of a storage bag in information corresponding to the flow queue of described selection.
14. methods according to claim 13, is characterized in that, also comprise:
The aging Indication message corresponding according to the flow queue of described selection, judges whether the flow queue of described selection is to need aging flow queue;
The aging flow queue of described needs is carried out to aging operation.
15. methods according to claim 13, is characterized in that, described information corresponding to the flow queue of described selection is passed to queue management device after, also comprise:
According to described queue management device, in to information corresponding to the flow queue of described selection, the information and executing of a storage bag goes out team's operation, and what produce afterwards goes out group Indication message, and the value that goes out group counter that the flow queue of described selection is corresponding adds 1.
16. methods according to claim 15, is characterized in that, the described aging Indication message corresponding according to the flow queue of described selection judges whether the flow queue of described selection is to need aging flow queue, comprising:
If described in go out group counter value be greater than out group frequency threshold value, the aging Indication message that the flow queue of described selection is corresponding is configured to 1; If described in go out group counter value go out group frequency threshold value described in being less than or equal to, the aging Indication message that the flow queue of described selection is corresponding is configured to 0;
In predetermined period, if aging Indication message corresponding to the flow queue of described selection is continuously 1, determine that the flow queue of described selection is the flow queue that described needs are aging.
17. methods according to claim 16, is characterized in that, after the flow queue of described definite described selection is the flow queue that described needs are aging, also comprise:
Reduce the configuration of the queue buffer memory threshold value that the flow queue of described selection is corresponding;
In described predetermined period, if aging Indication message corresponding to the flow queue of described selection is continuously 0, recover the configuration of the queue buffer memory threshold value that the flow queue of described selection is corresponding.
18. 1 kinds of cache management devices, is characterized in that, comprising:
Judge module, for judging whether first-class queue exists queue length to exceed the flow queue of queue buffer memory threshold value;
Executive Module, if exist queue length to exceed the flow queue of described queue buffer memory threshold value for described first-class queue, carries out out team's operation to the described flow queue that exceeds described queue buffer memory threshold value.
19. devices according to claim 18, is characterized in that,
Described judge module, also, for before whether exceeding queue buffer memory threshold value in the described queue length that judges first-class queue, judges whether current system exists port length to exceed the virtual port of buffer to ports threshold value;
Described device, also comprises:
Determination module, if do not exist port length to exceed the virtual port of buffer to ports threshold value for described current system, the flow queue that described current system is had is defined as described first-class queue.
20. devices according to claim 19, is characterized in that, described queue buffer memory threshold value comprises the buffer memory threshold value of at least two different priorities;
Described judge module, for the buffer memory threshold value of limit priority in the queue length of described first-class queue flow queue and described queue buffer memory threshold value is compared, judge in first-class queue and whether exist queue length to exceed the flow queue of the buffer memory threshold value of described limit priority;
Described Executive Module, if exist queue length to exceed the flow queue of the buffer memory threshold value of described limit priority for described first-class queue, carries out out team's operation to the described flow queue that exceeds the buffer memory threshold value of described limit priority.
21. devices according to claim 20, is characterized in that,
Described determination module, if also do not exist queue length to exceed the flow queue of the buffer memory threshold value of described limit priority for described first-class queue, determine the virtual port of described current system middle port buffer memory threshold value and port length difference minimum, and the flow queue that the virtual port of described buffer to ports threshold value and port length difference minimum is had is defined as second queue;
Whether described judge module, also, for according to the priority orders of described each buffer memory threshold value of queue buffer memory threshold value, judge successively in described second queue and exist queue length to exceed the flow queue of the buffer memory threshold value in described queue buffer memory threshold value;
Described Executive Module, if also exist queue length to exceed the flow queue of a buffer memory threshold value for described second queue, carries out out team's operation to exceeding the flow queue of this buffer memory threshold value.
22. devices according to claim 21, is characterized in that, described device, also comprises:
The first sending module, if do not exist queue length to exceed the flow queue of the buffer memory threshold value of lowest priority in described queue buffer memory threshold value for described second queue, sends the first alarm prompt; Described the first alarm indication information comprises configuration error information.
23. devices according to claim 20, is characterized in that,
Described determination module, if also exist port length to exceed the virtual port of buffer to ports threshold value for described current system, determine the virtual port of described current system middle port length and buffer to ports threshold difference maximum, and the flow queue that the virtual port of described port length and buffer to ports threshold difference maximum is had is defined as described first-class queue.
24. devices according to claim 23, is characterized in that,
Described judge module, if also do not exist queue length to exceed the flow queue of the buffer memory threshold value of described limit priority for described first-class queue, according to the priority orders of each buffer memory threshold value in described queue buffer memory threshold value, judge successively in described first-class queue and whether exist queue length to exceed the flow queue of the buffer memory threshold value in described queue buffer memory threshold value;
Described Executive Module, if also exist queue length to exceed the flow queue of a buffer memory threshold value for described first-class queue, carries out out team's operation to exceeding the flow queue of this buffer memory threshold value.
25. devices according to claim 24, is characterized in that, described device, also comprises:
The second sending module, if do not exist queue length to exceed the flow queue of the buffer memory threshold value of lowest priority in described queue buffer memory threshold value for described first-class queue, sends the second alarm prompt; Described the second alarm indication information comprises configuration error information.
26. according to the device described in claim 22 or 25, it is characterized in that, described device, also comprises:
Configuration module, for judging that described whether first-class queue exists before queue length exceeds the flow queue of queue buffer memory threshold value, according to the priority of described first-class queue, arranges described queue buffer memory threshold value.
27. devices according to claim 19, is characterized in that, the buffer to ports threshold value sum of the flow queue having in described current system is less than or equal to N times of shared buffer memory; Total buffer memory of described current system comprises described shared buffer memory;
Described N is the buffer to ports threshold value sum of flow queue that has in described current system and the ratio of the real cache of described current system.
28. devices according to claim 27, is characterized in that,
Described judge module, also judges that for described whether current system exists before port length exceeds the virtual port of buffer to ports threshold value, judges whether the free buffer of described current system is less than the threshold value of protection buffer memory; Total buffer memory of described current system, also comprises described protection buffer memory; When the free buffer of described current system is less than the threshold value of described protection buffer memory, carries out and judge whether described current system exists port length to exceed the operation of the virtual port of buffer to ports threshold value.
29. devices according to claim 28, is characterized in that,
Described configuration module, also, for before whether being less than protection buffer memory threshold value in the described free buffer that judges described current system, according to the time delay of process information in described current system, is configured described protection buffer memory.
30. devices according to claim 26, is characterized in that,
Described Executive Module, specifically for selecting a flow queue in the described flow queue that exceeds queue buffer memory threshold value;
Described sending module, also for information corresponding to the flow queue of described selection is passed to queue management device, so that described queue management device goes out team's operation to the information and executing of a storage bag in information corresponding to the flow queue of described selection.
31. devices according to claim 30, is characterized in that,
Described judge module, also for the aging Indication message corresponding according to the flow queue of described selection, judges whether the flow queue of described selection is to need aging flow queue;
Described Executive Module, also for carrying out aging operation to the aging flow queue of described needs.
32. devices according to claim 30, is characterized in that, described device, also comprises:
Counting module, for described information corresponding to the flow queue of described selection is passed to queue management device after, according to described queue management device, in to information corresponding to the flow queue of described selection, the information and executing of a storage bag goes out team's operation, what produce afterwards goes out group Indication message, and the value that goes out group counter that the flow queue of described selection is corresponding adds 1.
33. devices according to claim 32, is characterized in that,
Described configuration module, if also for described in go out group counter value be greater than out group frequency threshold value, the aging Indication message that the flow queue of described selection is corresponding is configured to 1; If described in go out group counter value go out group frequency threshold value described in being less than or equal to, the aging Indication message that the flow queue of described selection is corresponding is configured to 0;
Described determination module, also in predetermined period, if aging Indication message corresponding to the flow queue of described selection is continuously 1, determines that the flow queue of described selection is the flow queue that described needs are aging.
34. devices according to claim 33, is characterized in that,
Described configuration module, also for after the described flow queue of determining described selection is the flow queue that described needs are aging, reduces the configuration of the queue buffer memory threshold value that the flow queue of described selection is corresponding; In described predetermined period, if aging Indication message corresponding to the flow queue of described selection is continuously 0, recover the configuration of the queue buffer memory threshold value that the flow queue of described selection is corresponding.
CN201310637601.9A 2013-12-02 2013-12-02 Cache management method and device Pending CN103685062A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310637601.9A CN103685062A (en) 2013-12-02 2013-12-02 Cache management method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310637601.9A CN103685062A (en) 2013-12-02 2013-12-02 Cache management method and device

Publications (1)

Publication Number Publication Date
CN103685062A true CN103685062A (en) 2014-03-26

Family

ID=50321416

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310637601.9A Pending CN103685062A (en) 2013-12-02 2013-12-02 Cache management method and device

Country Status (1)

Country Link
CN (1) CN103685062A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017107363A1 (en) * 2015-12-22 2017-06-29 深圳市中兴微电子技术有限公司 Cache management method and device, and computer storage medium
WO2017186067A1 (en) * 2016-04-29 2017-11-02 北京奇虎科技有限公司 Method and device for video transmission processing
CN107347039A (en) * 2016-05-05 2017-11-14 深圳市中兴微电子技术有限公司 A kind of management method and device in shared buffer memory space
CN110795221A (en) * 2019-04-19 2020-02-14 成都海光集成电路设计有限公司 Cache management method, cache controller, processor and storage medium
WO2020042167A1 (en) * 2018-08-31 2020-03-05 华为技术有限公司 Method for improving quality of voice call, terminal, and system
CN113835611A (en) * 2020-06-23 2021-12-24 深圳市中兴微电子技术有限公司 Storage scheduling method, device and storage medium
CN116781633A (en) * 2023-08-01 2023-09-19 苏州盛科通信股份有限公司 Queue congestion aging method, device, network equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101257453A (en) * 2008-03-12 2008-09-03 中兴通讯股份有限公司 A network processor-based traffic shaping method and device
CN101534254A (en) * 2009-04-21 2009-09-16 华为技术有限公司 A queue report method, a device and a passive optical network
CN101741751A (en) * 2010-02-09 2010-06-16 华为技术有限公司 Traffic shaping dispatching method, traffic shaping dispatcher and routing device
CN101902758A (en) * 2010-05-25 2010-12-01 中国科学技术大学 Data processing method and device in wireless network based on protocol test
CN103248583A (en) * 2012-02-09 2013-08-14 迈普通信技术股份有限公司 FIFO (first-in first-out) message queue management method and device based on finite depth

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101257453A (en) * 2008-03-12 2008-09-03 中兴通讯股份有限公司 A network processor-based traffic shaping method and device
CN101534254A (en) * 2009-04-21 2009-09-16 华为技术有限公司 A queue report method, a device and a passive optical network
CN101741751A (en) * 2010-02-09 2010-06-16 华为技术有限公司 Traffic shaping dispatching method, traffic shaping dispatcher and routing device
CN101902758A (en) * 2010-05-25 2010-12-01 中国科学技术大学 Data processing method and device in wireless network based on protocol test
CN103248583A (en) * 2012-02-09 2013-08-14 迈普通信技术股份有限公司 FIFO (first-in first-out) message queue management method and device based on finite depth

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017107363A1 (en) * 2015-12-22 2017-06-29 深圳市中兴微电子技术有限公司 Cache management method and device, and computer storage medium
CN106911740A (en) * 2015-12-22 2017-06-30 深圳市中兴微电子技术有限公司 A kind of method and apparatus of cache management
WO2017186067A1 (en) * 2016-04-29 2017-11-02 北京奇虎科技有限公司 Method and device for video transmission processing
CN107347039A (en) * 2016-05-05 2017-11-14 深圳市中兴微电子技术有限公司 A kind of management method and device in shared buffer memory space
CN107347039B (en) * 2016-05-05 2020-02-21 深圳市中兴微电子技术有限公司 A method and device for managing shared cache space
WO2020042167A1 (en) * 2018-08-31 2020-03-05 华为技术有限公司 Method for improving quality of voice call, terminal, and system
CN110795221A (en) * 2019-04-19 2020-02-14 成都海光集成电路设计有限公司 Cache management method, cache controller, processor and storage medium
CN110795221B (en) * 2019-04-19 2022-04-12 成都海光集成电路设计有限公司 Cache management method, cache controller, processor and storage medium
CN113835611A (en) * 2020-06-23 2021-12-24 深圳市中兴微电子技术有限公司 Storage scheduling method, device and storage medium
CN113835611B (en) * 2020-06-23 2025-01-21 深圳市中兴微电子技术有限公司 Storage scheduling method, device and storage medium
CN116781633A (en) * 2023-08-01 2023-09-19 苏州盛科通信股份有限公司 Queue congestion aging method, device, network equipment and storage medium

Similar Documents

Publication Publication Date Title
CA2575869C (en) Hierarchal scheduler with multiple scheduling lanes
CN101605100B (en) Method and apparatus for managing queue storage space
US8230110B2 (en) Work-conserving packet scheduling in network devices
US8248930B2 (en) Method and apparatus for a network queuing engine and congestion management gateway
CN103685062A (en) Cache management method and device
US8831025B2 (en) Parallel processing using multi-core processor
EP2466824A1 (en) Service scheduling method and device
US10419370B2 (en) Hierarchical packet buffer system
US10419965B1 (en) Distributed meters and statistical meters
CN117579543B (en) Data stream segmentation method, device, equipment and computer readable storage medium
CN106330765A (en) Cache distribution method and device
EP4336796A1 (en) Deterministic traffic transmission method and apparatus
CN102957629B (en) Method and device for queue management
CN103701721B (en) Message transmitting method and device
CN117560433A (en) DPU (digital versatile unit) middle report Wen Zhuaifa order preserving method and device, electronic equipment and storage medium
EP3461085B1 (en) Method and device for queue management
CN101534254B (en) A queue report method, a device and a passive optical network
CN102546423B (en) Method and device for queue scheduling and network device
US9166918B1 (en) Methods and apparatus for scheduling transmission of data in a network
CN115086238A (en) TSN network port output scheduling device
WO2019095942A1 (en) Data transmission method and communication device
WO2022174444A1 (en) Data stream transmission method and apparatus, and network device
CN117749726A (en) Method and device for mixed scheduling of output port priority queues of TSN switch
JP2005210606A (en) Communication apparatus, priority control method, and program for performing priority control of packet
CN102308537A (en) Queue management method, device and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20140326

RJ01 Rejection of invention patent application after publication