WO2017000657A1 - 一种缓存管理的方法、装置和计算机存储介质 - Google Patents

一种缓存管理的方法、装置和计算机存储介质 Download PDF

Info

Publication number
WO2017000657A1
WO2017000657A1 PCT/CN2016/080975 CN2016080975W WO2017000657A1 WO 2017000657 A1 WO2017000657 A1 WO 2017000657A1 CN 2016080975 W CN2016080975 W CN 2016080975W WO 2017000657 A1 WO2017000657 A1 WO 2017000657A1
Authority
WO
WIPO (PCT)
Prior art keywords
queue
buffer
cache
data packet
priority
Prior art date
Application number
PCT/CN2016/080975
Other languages
English (en)
French (fr)
Inventor
高继伟
Original Assignee
深圳市中兴微电子技术有限公司
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 深圳市中兴微电子技术有限公司 filed Critical 深圳市中兴微电子技术有限公司
Publication of WO2017000657A1 publication Critical patent/WO2017000657A1/zh

Links

Images

Definitions

  • the present invention relates to network communication technologies, and in particular, to a method, an apparatus, and a computer storage medium for cache management.
  • the cache management of data packets is an important link in traffic management.
  • the mainstream cache management scheme can be divided into exclusive mode, shared mode, exclusive sharing and sharing according to the flow queue.
  • the exclusive sharing mode is mainly: first divide the cache into two areas, as shown in the blank area in Figure 1, the exclusive area is evenly distributed according to each queue, and is occupied independently; The shaded area shows the shared area.
  • the shared area is currently managed in a variety of ways, if the stream is large or the shared area is fully configured, the shared area is basically equivalent to the exclusive area, because the cache is occupied.
  • On a first-come-first-served basis when the system is heavily congested, the entire cache is completely occupied. High-priority packets cannot be preempted, and only passive packets can be lost. The allocation and use of the cache cannot be controlled.
  • the embodiment of the present invention is to provide a method, a device, and a computer storage medium for buffer management, which can ensure that packets with high priority are preferentially transmitted during system congestion.
  • the embodiment of the present invention provides a method for buffer management, which divides a cache into a regular area and a buffer.
  • the method includes:
  • the method further includes:
  • the free space of the buffer is greater than a preset second threshold, allocate the buffer cache for the first data packet, and update the first data according to the buffer cache identifier of the first data packet.
  • the cache ID of the packet to which the queue to which the packet belongs is first cached.
  • the method further includes:
  • the method further includes:
  • the queue is immediately dispatched;
  • dequeue scheduling is performed when the corresponding lower priority queue has a cache release.
  • the data packet of the highest priority queue is not released.
  • an embodiment of the present invention provides a cache management apparatus, where a cache includes a normal area and a buffer, and the apparatus includes: a monitoring unit, an obtaining unit, an allocating unit, a comparing unit, and a releasing unit;
  • the monitoring unit is configured to monitor a free space of the regular area, and trigger the acquiring unit when the free space of the regular area falls to a preset first threshold;
  • the monitoring unit is further configured to monitor a free space of the buffer; and when the free space of the buffer is less than a preset second threshold, triggering the comparing unit;
  • the comparing unit is configured to compare a priority of the queue to which the first data packet belongs with a lowest priority of a cache queue in the buffer; and when the priority of the queue to which the first data packet belongs is higher than The release unit is triggered when the lowest priority of the cache queue in the buffer;
  • the releasing unit is configured to release a data packet last cached to the buffer in the lowest priority queue
  • the allocating unit is configured to allocate the first data packet to a cache after the release in the buffer.
  • the device further includes an update unit
  • the monitoring unit is further configured to trigger the allocating unit and the updating unit when a free space of the buffer is greater than a preset second threshold;
  • the allocating unit is further configured to allocate the buffer cache for the first data packet
  • the updating unit is configured to update, according to the buffer cache identifier of the first data packet, an occupied link list and an occupancy count of the queue to which the first data packet belongs, where the first pointer of the occupied linked list is the first data packet belongs to The cache identifier of the data packet that is last cached by the queue to the buffer, and the tail pointer of the occupied link list is a cache identifier of the data packet first cached to the buffer by the queue to which the first data packet belongs.
  • the release unit is configured to:
  • the occupancy count of the lowest priority queue is decremented by one.
  • the device further includes a scheduling and dequeuing unit configured to:
  • the queue is immediately dispatched;
  • dequeue scheduling is performed when the corresponding lower priority queue has a cache release.
  • the data packet of the highest priority queue is not released.
  • the embodiment of the invention provides a method, a device and a computer storage medium for buffer management, which not only improve the cache flexibility, but also improve the cache flexibility by additionally dividing the buffer from the cache to cache and schedule the queue according to the queue priority.
  • the important service data is ensured, that is, the packets with higher priority are not lost, and the packets with higher priority are preferentially transmitted.
  • FIG. 1 is a schematic diagram of cache partitioning in the prior art
  • FIG. 3 is a schematic diagram of a cache division according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of an apparatus for buffer management according to an embodiment of the present disclosure.
  • buffering is performed according to the priority of the queue according to S202 to S203; specifically, for step S203, releasing the last priority in the lowest priority queue to the
  • the buffer data packet can include:
  • step S203 after the first data packet is allocated to the cache in the buffer, the method may further include:
  • the above process describes the process of allocating a buffer for a data packet in a buffer. It can be understood that when the buffer pressure of the buffer is large, the priority of the queue in which the data packet is stored can be cached, thereby avoiding the low priority.
  • the queue occupies the cache space of the queue with the highest priority, ensuring that the packets of the highest priority queue are not lost. Understandably, in the buffer, the packets of the highest priority queue are not released. This ensures that important business data packets will not be lost.
  • the embodiment of the invention provides a buffer management method, which not only increases the cache of the cache according to the priority of the queue, but also increases the flexibility of the cache, and the network load pressure is increased.
  • the important service data is ensured, that is, the packets with higher priority are not lost, and the packets with higher priority are preferentially transmitted.
  • the embodiment of the present invention provides a computer storage medium, where the computer storage medium stores computer executable instructions, and the computer executable instructions are configured to execute the cache management method according to the embodiment of the present invention.
  • S401 Receive a data packet a1, record a queue identifier to which the data packet a1 belongs, and a corresponding priority;
  • the queue to which the data packet a1 belongs is set to A, and the priority is level 1.
  • the priority is at least level 1, and the highest level is level 3.
  • the data packet a1 is the first data packet of the queue A.
  • the buffer cache identifier of the data packet a1 can be 0001, and the first and last pointers of the occupied list of the queue A are all the data packets a1.
  • the cache identifier is 0001, and the occupancy count of queue A is 1.
  • S403 Receive a data packet a2, record a queue identifier to which the data packet a2 belongs, and a corresponding priority;
  • the queue to which the data packet a2 belongs is set to A, and the priority is 1 level;
  • S404 Allocating a cache for the data packet a2, and updating the occupied link list and the occupancy count of the queue to which the data packet a2 belongs according to the buffer cache identifier of the data packet a2;
  • the data packet a2 is the second data packet of the queue A.
  • the buffer cache identifier of the data packet a2 may be 0002, and the first and last pointers of the occupied link list of the queue A are respectively the cache identifier of the data packet a2.
  • 0002 and the cache identifier 0001 of the data packet a1 the occupancy count of the queue A is 2; as can be seen, the order of the first and last pointers of the occupied linked list is opposite to the order of the cache identifiers, so that when the subsequent high priority data packets are allocated It can be released from the last buffer allocated by the queue buffer, thus ensuring that the first cached packet will not be lost.
  • the steps S401 to S404 can be repeated to buffer the data packets of the queue to the buffer.
  • the first and last pointers of the queue list of the queue A in the buffer are 0009:0001; the occupancy count is 9, the queue A The priority is 1.
  • the buffer pressure of the buffer is also large at this time. At this time, when the packet with the high priority queue enters the buffer. Packets for high priority queues Need to seize the packets of the low priority queue, the specific process is as follows:
  • S405 Receive a data packet b1, record a queue identifier to which the data packet a1 belongs, and a corresponding priority.
  • the queue to which the data packet b1 belongs is set to B, and the priority is 2 levels.
  • the priority of queue A is the lowest level, and the priority of queue B is the second level. Therefore, the priority of queue B is higher than the priority of queue A. In this case, packet b1 needs to preempt queue A.
  • the data packet is buffered in the buffer; the specific process can include:
  • step S407 may specifically include:
  • the buffer of the queue A can be preempted by steps S405 to S408. Until the buffer cache occupied by queue A is completely preempted, the occupancy count of queue A is also cleared, indicating that queue A no longer occupies the cache of the buffer.
  • the queue B of the data packet b1 may be updated according to the buffer cache identifier of the data packet b1 as described in step S404. Occupy list and occupancy count.
  • steps S401 to S408 the principle of buffer allocation for buffer is explained in steps S401 to S408, that is, the buffer of the high priority queue is guaranteed, so that the network load pressure is large, and the guarantee is ensured. There is no packet loss in important business data.
  • dequeue scheduling is performed when the corresponding lower priority queue has a cache release. This ensures that important data services are not interrupted.
  • This embodiment provides a detailed process of buffer management.
  • the buffer that is cached and scheduled to be queued according to the priority of the queue is additionally divided from the cache, which not only improves the flexibility of the cache, but also has a large load on the network.
  • the important service data is ensured, that is, the packets with higher priority are not lost, and the packets with higher priority are preferentially transmitted.
  • the cache may include a regular area and a buffer, and the cache management apparatus. 50 may include: a monitoring unit 501, an obtaining unit 502, an allocating unit 503, a comparing unit 504, and a releasing unit 505;
  • the monitoring unit 501 is configured to monitor the free space of the regular area, and trigger the acquiring unit 502 when the free space of the regular area falls to a preset first threshold;
  • the obtaining unit 502 is configured to acquire a priority of the queue to which the received first data packet belongs and the priority corresponding to the queue;
  • the monitoring unit 501 is further configured to monitor the free space of the buffer; and when the free space of the buffer is less than the preset second threshold, the comparing unit 504 is triggered;
  • the comparing unit 504 is configured to compare the priority of the queue to which the first data packet belongs with the lowest priority of the cache queue in the buffer; and when the priority of the queue to which the first data packet belongs is higher than the buffer in the buffer
  • the release unit 505 is triggered when the lowest priority of the queue;
  • the release unit 505 is configured to release the last buffer in the lowest priority queue to the buffer data pack;
  • the apparatus 50 may further include an updating unit 506;
  • the monitoring unit 501 is further configured to trigger the allocating unit 503 and the updating unit 506 when the free space of the buffer is greater than a preset second threshold;
  • the allocating unit 503 is further configured to allocate a buffer buffer for the first data packet
  • the updating unit 506 is configured to update, according to the buffer cache identifier of the first data packet, the occupied link list and the occupancy count of the queue to which the first data packet belongs; wherein, the first pointer of the occupied linked list is the last cache of the queue to which the first data packet belongs to the buffer.
  • the cache identifier of the data packet of the area, and the tail pointer of the occupied list is the cache identifier of the data packet first cached to the buffer by the queue to which the first data packet belongs.
  • the release unit 505 is configured to:
  • the packets of the highest priority queue are not released.
  • the cache management device in the embodiment of the present invention can be implemented in a practical application by a personal computer (PC), a server, or a network device that supports a cache function.
  • the monitoring unit 501, the obtaining unit 502, the allocating unit 503, the comparing unit 504, the releasing unit 505, the updating unit 506, and the scheduling and dequeuing unit 507 in the cache management apparatus may be implemented by a central processing unit (CPU, Central Processing). Unit), Digital Signal Processor (DSP) or Field-Programmable Gate Array (FPGA) implementation.
  • CPU Central Processing
  • DSP Digital Signal Processor
  • FPGA Field-Programmable Gate Array
  • the disclosed apparatus and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner such as: multiple units or components may be combined, or Can be integrated into another system, or some features can be ignored or not executed.
  • the coupling, or direct coupling, or communication connection of the components shown or discussed may be indirect coupling or communication connection through some interfaces, devices or units, and may be electrical, mechanical or other forms. of.
  • the units described above as separate components may or may not be physically separated, and the components displayed as the unit may or may not be physical units, that is, may be located in one place or distributed to multiple network units; Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • the foregoing program may be stored in a computer readable storage medium, and the program is executed when executed.
  • the steps of the foregoing method embodiments are included; and the foregoing storage medium includes: a mobile storage device, a read only memory (ROM, Read-Only) Memory, random access memory (RAM), disk or optical disk, and other media that can store program code.
  • the above-described integrated unit of the present invention may be stored in a computer readable storage medium if it is implemented in the form of a software function module and sold or used as a standalone product.
  • the technical solution of the embodiments of the present invention may be embodied in the form of a software product in essence or in the form of a software product stored in a storage medium, including a plurality of instructions.
  • a computer device (which may be a personal computer, server, or network device, etc.) is caused to perform all or part of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes various media that can store program codes, such as a mobile storage device, a ROM, a RAM, a magnetic disk, or an optical disk.
  • the buffer that is cached and scheduled to be dequeued according to the queue priority is additionally divided from the cache, which not only improves the flexibility of the cache, but also ensures important service data under the condition that the network load pressure is large. That is, packets with higher priority will not be lost, ensuring that packets with higher priority are preferentially transmitted.

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明实施例公开了一种缓存管理的方法、装置和计算机存储介质,该方法可以包括:将缓存划分为常规区域和缓冲区,当常规区域的空闲空间下降至预设的第一门限时,获取接收到的第一数据包的所属队列及所属队列对应的优先级;当缓冲区的空闲空间小于预设的第二门限时,将第一数据包所属队列的优先级与缓冲区中的缓存队列的最低优先级进行比较;当第一数据包所属队列的优先级高于缓冲区中的缓存队列的最低优先级时,释放最低优先级队列中最后缓存至缓冲区的数据包,并将第一数据包分配至缓冲区中释放后的缓存。

Description

一种缓存管理的方法、装置和计算机存储介质 技术领域
本发明涉及网络通信技术,尤其涉及一种缓存管理的方法、装置和计算机存储介质。
背景技术
在数据通信网络中,对数据报文的缓存管理是流量管理中比较重要的环节,目前主流的缓存管理方案中,依据流队列可以分为独享方式、共享方式、独享加共享等方式。其中,独享加共享方式主要为:先将缓存整体划分出两块区域,如图1中的空白区域所示,独享区域按照各个队列平均分配,独立占用;剩下如图1中斜线阴影区域所示的是共享区域,尽管目前对于共享区域的管理方式多种多样,但是,如果流较多或者共享区域满配时,共享区域就基本上等同于独享区域,由于缓存的占用是通过先到先得的方式进行,从而导致在系统严重拥塞时,整个缓存被完全占用,会出现高优先级的报文无法抢占缓存,只能被动丢包,无法控制对缓存的分配和使用。
发明内容
本发明实施例期望提供一种缓存管理的方法、装置和计算机存储介质,能够在系统严重拥塞时,保证优先级高的报文优先进行数据传输。
本发明实施例的技术方案是这样实现的:
第一方面,本发明实施例提供了一种缓存管理的方法,将缓存划分为常规区域和缓冲区,当所述常规区域的空闲空间下降至预设的第一门限时,所述方法包括:
获取接收到的第一数据包的所属队列及所属队列对应的优先级;
当所述缓冲区的空闲空间小于预设的第二门限时,将所述第一数据包所属队列的优先级与所述缓冲区中的缓存队列的最低优先级进行比较;
当所述第一数据包所属队列的优先级高于所述缓冲区中的缓存队列的最低优先级时,释放最低优先级队列中最后缓存至所述缓冲区的数据包,并将所述第一数据包分配至所述缓冲区中释放后的缓存。
作为一种实施方式,所述方法还包括:
当所述缓冲区的空闲空间大于预设的第二门限时,为所述第一数据包分配所述缓冲区缓存,并根据所述第一数据包的缓存区缓存标识更新所述第一数据包所属队列的占用链表及占用计数;其中,所述占用链表的首指针为第一数据包所属队列最后缓存至所述缓冲区的数据包的缓存标识,所述占用链表的尾指针为第一数据包所属队列最先缓存至所述缓冲区的数据包的缓存标识。
作为一种实施方式,所述释放最低优先级队列中最后缓存至所述缓冲区的数据包,具体包括:
将所述最低优先级队列的占用链表的首指针进行出链;
释放所述最低优先级队列中最后缓存之所属缓冲区的数据包的缓存标识;
将所述最低优先级队列的占用计数减一。
作为一种实施方式,将所述第一数据包分配至所述缓冲区中释放后的缓存后,还包括:
根据所述第一数据包的缓冲区缓存标识更新所述第一数据包所属队列的占用链表及占用计数。
作为一种实施方式,当所述缓冲区内的队列调度出队时,所述方法还包括:
对于高优先级队列的数据包,立即进行调度出队;
对于较低优先级队列的数据包,当对应的较低优先级队列有缓存释放时进行出队调度。
作为一种实施方式,所述缓冲区中,最高优先级队列的数据包不被释放。
第二方面,本发明实施例提供了一种缓存管理装置,缓存包括常规区域和缓冲区,所述装置包括:监控单元、获取单元、分配单元、比较单元和释放单元;其中,
所述监控单元,配置为监控所述常规区域的空闲空间,并且当所述常规区域的空闲空间下降至预设的第一门限时,触发所述获取单元;
所述获取单元,配置为获取接收到的第一数据包的所属队列及所属队列对应的优先级;
所述监控单元,还配置为监控所述缓冲区的空闲空间;并当所述缓冲区的空闲空间小于预设的第二门限时,触发所述比较单元;
所述比较单元,配置为将所述第一数据包所属队列的优先级与所述缓冲区中的缓存队列的最低优先级进行比较;并且当所述第一数据包所属队列的优先级高于所述缓冲区中的缓存队列的最低优先级时触发所述释放单元;
所述释放单元,配置为释放最低优先级队列中最后缓存至所述缓冲区的数据包;
所述分配单元,配置为将所述第一数据包分配至所述缓冲区中释放后的缓存。
作为一种实施方式,所述装置还包括更新单元;
所述监控单元,还配置为当所述缓冲区的空闲空间大于预设的第二门限时,触发所述分配单元和所述更新单元;
所述分配单元,还配置为为所述第一数据包分配所述缓冲区缓存;
所述更新单元,配置为根据所述第一数据包的缓冲区缓存标识更新所述第一数据包所属队列的占用链表及占用计数;其中,所述占用链表的首指针为第一数据包所属队列最后缓存至所述缓冲区的数据包的缓存标识,所述占用链表的尾指针为第一数据包所属队列最先缓存至所述缓冲区的数据包的缓存标识。
作为一种实施方式,所述释放单元,配置为:
将所述最低优先级队列的占用链表的首指针进行出链;
释放所述最低优先级队列中最后缓存之所属缓冲区的数据包的缓存标识;
将所述最低优先级队列的占用计数减一。
作为一种实施方式,所述装置还包括调度出队单元,配置为,
对于高优先级队列的数据包,立即进行调度出队;
对于较低优先级队列的数据包,当对应的较低优先级队列有缓存释放时进行出队调度。
作为一种实施方式,所述缓冲区中,最高优先级队列的数据包不被释放。
第三方面,本发明实施例提供了一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令配置为执行本发明实施例所述的缓存管理的方法。
本发明实施例提供了一种缓存管理的方法、装置和计算机存储介质,通过将从缓存中额外划分出能够按照队列优先级进行缓存和调度出队的缓冲区,不仅提高了缓存的弹性,而且在网络负载压力较大的情况下,保证了重要业务数据,即优先级较高的数据包不会出现丢包的现象,保证了优先级高的报文优先进行数据传输。
附图说明
图1为现有技术中的缓存划分示意图;
图2为本发明实施例提供的一种缓存管理的方法流程示意图;
图3为本发明实施例提供的一种缓存划分示意图;
图4为本发明实施例提供的一种缓存管理的详细流程示意图;
图5为本发明实施例提供的一种缓存管理的装置结构示意图;
图6为本发明实施例提供的另一种缓存管理的装置的结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。
实施例一
参见图2,其示出了本发明实施例提供的一种缓存管理的方法,该方法可以应用于如图3所示的划分为常规区域和缓冲区的缓存,缓冲区用虚线表示,可以理解地,在本发明实施例中,常规区域可以按照图1所示,分为共享区域和独享区域,本发明实施例对此不做具体限制;当常规区域的空闲空间下降至预设的第一门限时,该方法可以包括:
S201:获取接收到的第一数据包的所属队列及所属队列对应的优先级;
S202:当缓冲区的空闲空间小于预设的第二门限时,将第一数据包所属队列的优先级与缓冲区中的缓存队列的最低优先级进行比较;
S203:当第一数据包所属队列的优先级高于缓冲区中的缓存队列的最低优先级时,释放最低优先级队列中最后缓存至缓冲区的数据包,并将第一数据包分配至缓冲区中释放后的缓存。
需要说明的是,当常规区域的空闲空间超过预设的第一门限时,说明此时网络负载较轻,分配到独享或者共享区域的数据包可以立即等待调度。此时网络缓存的申请和释放都比较顺畅,总缓存内划分的独享区域加共享 区域足以满足需求。
但是当网络稍有抖动或拥塞时,独享区域和共享区域都已经分配完毕,为了提高缓存的弹性,避免刚性的丢包或者向前级反压,本发明实施例通过启动缓冲区进行缓存的管理和分配,作为网络负载压力较大时的备用分配机制。
可以理解地,网络负载较轻时,对于常规区域的缓存分配和管理与现有技术的缓存管理和分配方法相同,在此不再赘述。当网络负载较大时,也就是当常规区域的空闲空间下降至预设的第一门限时,则需要对缓冲区进行缓存的管理和分配。
示例性地,当数据包进入缓冲区时,可以根据缓冲区的空闲空间与第二门限之间的比较来确定缓冲区的缓存压力。
可选地,当缓冲区的缓存压力较轻的时候,还可以通过步骤S204对数据包进行缓存;S204:当缓冲区的空闲空间大于预设的第二门限时,为第一数据包分配缓冲区缓存,并根据第一数据包的缓冲区缓存标识更新第一数据包所属队列的占用链表及占用计数;
其中,占用链表为一个逆序链表,占用链表的首指针为第一数据包所属队列最后缓存至缓冲区的数据包的缓存标识,占用链表的尾指针为第一数据包所属队列最先缓存至缓冲区的数据包的缓存标识。
可选地,当缓冲区的缓存压力较大时,通过S202至S203根据队列优先级的高低进行缓冲区的缓存;具体地,对于步骤S203来说,释放最低优先级队列中最后缓存至所述缓冲区的数据包,可以包括:
将最低优先级队列的占用链表的首指针进行出链;以及,
释放最低优先级队列中最后缓存至所属缓冲区的数据包的缓存标识;以及,
将最低优先级队列的占用计数减一。
示例性地,步骤S203中,将所述第一数据包分配至所述缓冲区中释放后的缓存后,该方法还可以包括:
根据第一数据包的缓冲区缓存标识更新第一数据包所属队列的占用链表及占用计数。
上述过程描述的是在缓冲区中为数据包分配缓存的过程,可以理解地,当缓冲区的缓存压力较大的时候,可以通过数据包所在队列的优先级进行缓存,从而避免优先级低的队列占用优先极高的队列的缓存空间,保证了优先极高的队列的数据包不会丢失。可以理解地,在缓冲区中,最高优先级队列的数据包不被释放。从而保证了重要业务数据包不会出现丢包的情况。
当对队列进行调度出队时,仍然需要根据队列的优先级来确定调度方式,具体可以为:当缓冲区内的队列调度出队时,对于高优先级队列的数据包,立即进行调度出队;对于较低优先级队列的数据包,当对应的较低优先级队列有缓存释放时进行出队调度。
本发明实施例提供了一种缓存管理的方法,通过将从缓存中额外划分出能够按照队列优先级进行缓存和调度出队的缓冲区,不仅提高了缓存的弹性,而且在网络负载压力较大的情况下,保证了重要业务数据,即优先级较高的数据包不会出现丢包的现象,保证了优先级高的报文优先进行数据传输。
本发明实施例提供了一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令配置为执行本发明实施例所述的缓存管理的方法。
实施例二
参见图4,其示出了本发明实施例提供的一种缓存管理的详细流程,该流程可以包括:当常规区域的空闲空间下降至预设的第一门限时,
S401:接收数据包a1,记录数据包a1所属的队列标识和对应的优先级;
在本实施例中,设定数据包a1所属的队列为A,优先级为1级;本实施例中,优先级最低为1级,最高为3级。
S402:当缓冲区的空闲空间大于预设的第二门限时,为数据包a1分配缓存,并根据数据包a1的缓冲区缓存标识更新数据包a1所属队列的占用链表及占用计数;
需要说明的是,设定数据包a1为队列A的第一个数据包,此时,数据包a1的缓冲区缓存标识可以为0001,则队列A的占用链表的首尾指针均为数据包a1的缓存标识0001,队列A的占用计数为1;
S403:接收数据包a2,记录数据包a2所属的队列标识和对应的优先级;
在本实施例中,设定数据包a2所属的队列为A,优先级为1级;
S404:为数据包a2分配缓存,并根据数据包a2的缓冲区缓存标识更新数据包a2所属队列的占用链表及占用计数;
需要说明的是,数据包a2为队列A的第二个数据包,此时,数据包a2的缓冲区缓存标识可以为0002,则队列A的占用链表的首尾指针分别为数据包a2的缓存标识0002和数据包a1的缓存标识0001,队列A的占用计数为2;从中可以看出,占用链表的首尾指针与缓存标识入链的顺序相反,从而可以使得当后续高优先级数据包进行分配时,能够从队列最后分配缓冲区缓存的数据包开始释放,从而保证了最先缓存的数据包不会出现丢包情况。
可以理解地,不断重复步骤S401至S404能够将队列的数据包缓存至缓冲区,本实施例中,缓冲区内队列A的占用链表的首尾指针为0009:0001;占用计数为9,队列A的优先级为1。随着缓冲区不断地进行分配,当缓冲区的空闲空间小于预设的第二门限时,说明此时缓冲区的缓存压力也较大,此时,当有高优先级队列的数据包进入缓冲区时,高优先级队列的数据包 需要来抢占低优先级队列的数据包,具体过程如下所示:
S405:接收数据包b1,记录数据包a1所属的队列标识和对应的优先级;
在本实施例中,设定数据包b1所属的队列为B,优先级为2级。
S406:将数据包b1所属的队列B的优先级与队列A的优先级进行比较;
由于队列A的优先级为1级,为最低级;而队列B的优先级为2级;因此,队列B的优先级高于队列A的优先级,此时,数据包b1需要抢占队列A的数据包在缓冲区的缓存;具体过程可以包括:
S407:释放队列A的缓存标识为0009的数据包a9;
S408:将数据包b1分配至缓冲区中释放后的缓存;
需要说明的是,步骤S407具体可以包括:
将队列A的占用指针的首指针0009进行出链;以及,
释放数据包a9的缓存标识0009;以及,
将队列A的占用计数减一。
可以理解地,以此类推后续高优先级队列的数据包进入缓冲区时,可以通过步骤S405至S408抢占队列A的缓存。直到队列A所占用的缓冲区缓存全被抢占完毕,队列A的占用计数也清零,说明队列A不再占用缓冲区的缓存。
需要说明的是,在缓冲区中,最高优先级队列的数据包不被释放,也就是最高优先级队列的所占用的缓存不会被抢占。
还需要说明的是,通过步骤S408将数据包b1分配至缓冲区中释放后的缓存以后,还可以如步骤S404所述的,根据数据包b1的缓冲区缓存标识更新数据包b1所属队列B的占用链表及占用计数。
综上,通过步骤S401至S408阐述了缓冲区进行缓存分配的原则,也就是保证高优先级队列的缓存,从而在网络负载压力较大的情况下,保证 了重要业务数据不会出现丢包的现象。
此外,对于缓冲区的队列调度出队原则,具体可以为:
对于高优先级队列的数据包,立即进行调度出队;
对于较低优先级队列的数据包,当对应的较低优先级队列有缓存释放时进行出队调度。从而保证了重要的数据业务不会中断。
本实施例提供了一种缓存管理的详细流程,通过将从缓存中额外划分出能够按照队列优先级进行缓存和调度出队的缓冲区,不仅提高了缓存的弹性,而且在网络负载压力较大的情况下,保证了重要业务数据,即优先级较高的数据包不会出现丢包的现象,保证了优先级高的报文优先进行数据传输。
实施例三
基于前述实施例相同的技术构思,参见图5,其示出了本发明实施例提供的一种缓存管理装置50,本实施例所述的缓存可以包括常规区域和缓冲区,所述缓存管理装置50可以包括:监控单元501、获取单元502、分配单元503、比较单元504和释放单元505;其中,
所述监控单元501,配置为监控常规区域的空闲空间,并且当常规区域的空闲空间下降至预设的第一门限时,触发所述获取单元502;
所述获取单元502,配置为获取接收到的第一数据包的所属队列及所属队列对应的优先级;
所述监控单元501,还配置为监控缓冲区的空闲空间;并当缓冲区的空闲空间小于预设的第二门限时,触发所述比较单元504;
所述比较单元504,配置为将第一数据包所属队列的优先级与缓冲区中的缓存队列的最低优先级进行比较;并且当第一数据包所属队列的优先级高于缓冲区中的缓存队列的最低优先级时触发所述释放单元505;
所述释放单元505,配置为释放最低优先级队列中最后缓存至缓冲区的 数据包;
所述分配单元503,配置为将第一数据包分配至缓冲区中释放后的缓存。
示例性地,参见图6,装置50还可以包括更新单元506;
所述监控单元501,还配置为当缓冲区的空闲空间大于预设的第二门限时,触发所述分配单元503和所述更新单元506;
所述分配单元503,还配置为为第一数据包分配缓冲区缓存;
所述更新单元506,配置为根据第一数据包的缓冲区缓存标识更新第一数据包所属队列的占用链表及占用计数;其中,占用链表的首指针为第一数据包所属队列最后缓存至缓冲区的数据包的缓存标识,占用链表的尾指针为第一数据包所属队列最先缓存至缓冲区的数据包的缓存标识。
示例性地,所述释放单元505,配置为:
将最低优先级队列的占用链表的首指针进行出链;
释放最低优先级队列中最后缓存之所属缓冲区的数据包的缓存标识;
将最低优先级队列的占用计数减一。
示例性地,参见图6,装置50还可以包括调度出队单元507,配置为对于高优先级队列的数据包,立即进行调度出队;
对于较低优先级队列的数据包,当对应的较低优先级队列有缓存释放时进行出队调度。
示例性地,缓冲区中,最高优先级队列的数据包不被释放。
本实施例提供了一种缓存管理的装置50,通过将从缓存中额外划分出能够按照队列优先级进行缓存和调度出队的缓冲区,不仅提高了缓存的弹性,而且在网络负载压力较大的情况下,保证了重要业务数据,即优先级较高的数据包不会出现丢包的现象,保证了优先级高的报文优先进行数据传输。
本发明实施例缓存管理装置,在实际应用中可通过支持缓存功能的个人计算机(PC)、服务器或者网络设备实现。所述缓存管理装置中的监控单元501、获取单元502、分配单元503、比较单元504、释放单元505、更新单元506和调度出队单元507,在实际应用中可由中央处理器(CPU,Central Processing Unit)、数字信号处理器(DSP,Digital Signal Processor)或可编程门阵列(FPGA,Field-Programmable Gate Array)实现。
在本申请所提供的几个实施例中,应该理解到,所揭露的设备和方法,可以通过其它的方式实现。以上所描述的设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个单元或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或单元的间接耦合或通信连接,可以是电性的、机械的或其它形式的。
上述作为分离部件说明的单元可以是、或也可以不是物理上分开的,作为单元显示的部件可以是、或也可以不是物理单元,即可以位于一个地方,也可以分布到多个网络单元上;可以根据实际的需要选择其中的部分或全部单元来实现本实施例方案的目的。
另外,在本发明各实施例中的各功能单元可以全部集成在一个处理单元中,也可以是各单元分别单独作为一个单元,也可以两个或两个以上单元集成在一个单元中;上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、只读存储器(ROM,Read-Only  Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
或者,本发明上述集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本发明各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。
工业实用性
本发明实施例通过将从缓存中额外划分出能够按照队列优先级进行缓存和调度出队的缓冲区,不仅提高了缓存的弹性,而且在网络负载压力较大的情况下,保证了重要业务数据,即优先级较高的数据包不会出现丢包的现象,保证了优先级高的报文优先进行数据传输。

Claims (12)

  1. 一种缓存管理的方法,将缓存划分为常规区域和缓冲区,当所述常规区域的空闲空间下降至预设的第一门限时,所述方法包括:
    获取接收到的第一数据包的所属队列及所属队列对应的优先级;
    当所述缓冲区的空闲空间小于预设的第二门限时,将所述第一数据包所属队列的优先级与所述缓冲区中的缓存队列的最低优先级进行比较;
    当所述第一数据包所属队列的优先级高于所述缓冲区中的缓存队列的最低优先级时,释放最低优先级队列中最后缓存至所述缓冲区的数据包,并将所述第一数据包分配至所述缓冲区中释放后的缓存。
  2. 根据权利要求1所述的方法,其中,所述方法还包括:
    当所述缓冲区的空闲空间大于预设的第二门限时,为所述第一数据包分配所述缓冲区缓存,并根据所述第一数据包的缓存区缓存标识更新所述第一数据包所属队列的占用链表及占用计数;其中,所述占用链表的首指针为第一数据包所属队列最后缓存至所述缓冲区的数据包的缓存标识,所述占用链表的尾指针为第一数据包所属队列最先缓存至所述缓冲区的数据包的缓存标识。
  3. 根据权利要求1所述的方法,其中,所述释放最低优先级队列中最后缓存至所述缓冲区的数据包,具体包括:
    将所述最低优先级队列的占用链表的首指针进行出链;
    释放所述最低优先级队列中最后缓存之所属缓冲区的数据包的缓存标识;
    将所述最低优先级队列的占用计数减一。
  4. 根据权利要求1所述的方法,其中,将所述第一数据包分配至所述缓冲区中释放后的缓存后,还包括:
    根据所述第一数据包的缓冲区缓存标识更新所述第一数据包所属队列 的占用链表及占用计数。
  5. 根据权利要求1所述的方法,其中,当所述缓冲区内的队列调度出队时,所述方法还包括:
    对于高优先级队列的数据包,立即进行调度出队;
    对于较低优先级队列的数据包,当对应的较低优先级队列有缓存释放时进行出队调度。
  6. 根据权利要求1所述的方法,其中,所述缓冲区中,最高优先级队列的数据包不被释放。
  7. 一种缓存管理装置,缓存包括常规区域和缓冲区,所述装置包括:监控单元、获取单元、分配单元、比较单元和释放单元;其中,
    所述监控单元,配置为监控所述常规区域的空闲空间,并且当所述常规区域的空闲空间下降至预设的第一门限时,触发所述获取单元;
    所述获取单元,配置为获取接收到的第一数据包的所属队列及所属队列对应的优先级;
    所述监控单元,还配置为监控所述缓冲区的空闲空间;并当所述缓冲区的空闲空间小于预设的第二门限时,触发所述比较单元;
    所述比较单元,配置为将所述第一数据包所属队列的优先级与所述缓冲区中的缓存队列的最低优先级进行比较;并且当所述第一数据包所属队列的优先级高于所述缓冲区中的缓存队列的最低优先级时触发所述释放单元;
    所述释放单元,配置为释放最低优先级队列中最后缓存至所述缓冲区的数据包;
    所述分配单元,配置为将所述第一数据包分配至所述缓冲区中释放后的缓存。
  8. 根据权利要求7所述的装置,其中,所述装置还包括更新单元;
    所述监控单元,还配置为当所述缓冲区的空闲空间大于预设的第二门限时,触发所述分配单元和所述更新单元;
    所述分配单元,还配置为为所述第一数据包分配所述缓冲区缓存;
    所述更新单元,配置为根据所述第一数据包的缓冲区缓存标识更新所述第一数据包所属队列的占用链表及占用计数;其中,所述占用链表的首指针为第一数据包所属队列最后缓存至所述缓冲区的数据包的缓存标识,所述占用链表的尾指针为第一数据包所属队列最先缓存至所述缓冲区的数据包的缓存标识。
  9. 根据权利要求7所述的装置,其中,所述释放单元,配置为:
    将所述最低优先级队列的占用链表的首指针进行出链;
    释放所述最低优先级队列中最后缓存之所属缓冲区的数据包的缓存标识;
    将所述最低优先级队列的的占用计数减一。
  10. 根据权利要求7所述的装置,其中,所述装置还包括调度出队单元,配置为对于高优先级队列的数据包,立即进行调度出队;
    对于较低优先级队列的数据包,当对应的较低优先级队列有缓存释放时进行出队调度。
  11. 根据权利要求7所述的装置,其中,所述缓冲区中,最高优先级队列的数据包不被释放。
  12. 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令配置为执行权利要求1至6任一项所述的缓存管理的方法。
PCT/CN2016/080975 2015-06-30 2016-05-04 一种缓存管理的方法、装置和计算机存储介质 WO2017000657A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510374433.8 2015-06-30
CN201510374433.8A CN106330760A (zh) 2015-06-30 2015-06-30 一种缓存管理的方法和装置

Publications (1)

Publication Number Publication Date
WO2017000657A1 true WO2017000657A1 (zh) 2017-01-05

Family

ID=57607740

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/080975 WO2017000657A1 (zh) 2015-06-30 2016-05-04 一种缓存管理的方法、装置和计算机存储介质

Country Status (2)

Country Link
CN (1) CN106330760A (zh)
WO (1) WO2017000657A1 (zh)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108347389A (zh) * 2017-01-22 2018-07-31 中兴通讯股份有限公司 一种在数据转发网络中实现流量均衡的方法及装置
CN110557432A (zh) * 2019-07-26 2019-12-10 苏州浪潮智能科技有限公司 一种缓存池均衡优化方法、系统、终端及存储介质
CN111177032A (zh) * 2019-12-29 2020-05-19 浪潮电子信息产业股份有限公司 缓存空间申请方法、系统、装置及计算机可读存储介质
CN111355673A (zh) * 2018-12-24 2020-06-30 深圳市中兴微电子技术有限公司 一种数据处理方法、装置、设备及存储介质
CN111984889A (zh) * 2020-02-21 2020-11-24 广东三维家信息科技有限公司 缓存方法及系统
CN112597075A (zh) * 2020-12-28 2021-04-02 海光信息技术股份有限公司 用于路由器的缓存分配方法、片上网络及电子设备
CN113872881A (zh) * 2020-06-30 2021-12-31 华为技术有限公司 队列信息的处理方法及装置

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019061270A1 (zh) * 2017-09-29 2019-04-04 深圳市大疆创新科技有限公司 数据缓存装置及控制方法、数据处理芯片、数据处理系统
CN113454957B (zh) * 2019-02-22 2023-04-25 华为技术有限公司 一种存储器的管理方法及装置
CN112650574A (zh) * 2020-12-31 2021-04-13 广州技象科技有限公司 基于优先级的任务调度方法、装置、系统和存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1770125A (zh) * 2004-11-04 2006-05-10 华为技术有限公司 一种分配内存的方法
CN1881937A (zh) * 2005-05-02 2006-12-20 美国博通公司 将存储空间动态分配给多个队列的方法及设备
US20090161684A1 (en) * 2007-12-21 2009-06-25 Juniper Networks, Inc. System and Method for Dynamically Allocating Buffers Based on Priority Levels
CN102447610A (zh) * 2010-10-14 2012-05-09 中兴通讯股份有限公司 实现报文缓存资源共享的方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1770125A (zh) * 2004-11-04 2006-05-10 华为技术有限公司 一种分配内存的方法
CN1881937A (zh) * 2005-05-02 2006-12-20 美国博通公司 将存储空间动态分配给多个队列的方法及设备
US20090161684A1 (en) * 2007-12-21 2009-06-25 Juniper Networks, Inc. System and Method for Dynamically Allocating Buffers Based on Priority Levels
CN102447610A (zh) * 2010-10-14 2012-05-09 中兴通讯股份有限公司 实现报文缓存资源共享的方法和装置

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108347389A (zh) * 2017-01-22 2018-07-31 中兴通讯股份有限公司 一种在数据转发网络中实现流量均衡的方法及装置
CN111355673A (zh) * 2018-12-24 2020-06-30 深圳市中兴微电子技术有限公司 一种数据处理方法、装置、设备及存储介质
CN110557432A (zh) * 2019-07-26 2019-12-10 苏州浪潮智能科技有限公司 一种缓存池均衡优化方法、系统、终端及存储介质
CN111177032A (zh) * 2019-12-29 2020-05-19 浪潮电子信息产业股份有限公司 缓存空间申请方法、系统、装置及计算机可读存储介质
CN111984889A (zh) * 2020-02-21 2020-11-24 广东三维家信息科技有限公司 缓存方法及系统
CN113872881A (zh) * 2020-06-30 2021-12-31 华为技术有限公司 队列信息的处理方法及装置
CN112597075A (zh) * 2020-12-28 2021-04-02 海光信息技术股份有限公司 用于路由器的缓存分配方法、片上网络及电子设备
CN112597075B (zh) * 2020-12-28 2023-02-17 成都海光集成电路设计有限公司 用于路由器的缓存分配方法、片上网络及电子设备

Also Published As

Publication number Publication date
CN106330760A (zh) 2017-01-11

Similar Documents

Publication Publication Date Title
WO2017000657A1 (zh) 一种缓存管理的方法、装置和计算机存储介质
US10530846B2 (en) Scheduling packets to destination virtual machines based on identified deep flow
US20230039191A1 (en) Throttling queue for a request scheduling and processing system
WO2016011894A1 (zh) 报文处理方法和装置
WO2017000673A1 (zh) 一种共享缓存分配方法、装置及计算机存储介质
CN111512602B (zh) 一种发送报文的方法、设备和系统
US9152482B2 (en) Multi-core processor system
CN102594691B (zh) 一种处理报文的方法及装置
WO2017016505A1 (zh) 一种数据入队与出队方法及队列管理单元
US7948976B2 (en) Efficient management of queueing resources for switches
US20130074091A1 (en) Techniques for ensuring resources achieve performance metrics in a multi-tenant storage controller
US20140075036A1 (en) Queue Scheduling Method and Apparatus
US8428076B2 (en) System and method for priority scheduling of plurality of message types with serialization constraints and dynamic class switching
CN105812285A (zh) 一种端口拥塞管理方法及装置
US10999209B2 (en) Technologies for scalable network packet processing with lock-free rings
CN102298539A (zh) 一种用于分布式并行处理的共享资源调度方法及系统
US9336006B2 (en) High-performance parallel traffic management for multi-core platforms
CN111897637B (zh) 作业调度方法、装置、主机及存储介质
CN102521057A (zh) 资源调度方法和装置
CN113312160A (zh) 用于任务分配系统中的行为配对的技术
US8879578B2 (en) Reducing store and forward delay in distributed systems
US8018958B1 (en) System and method for fair shared de-queue and drop arbitration in a buffer
US7933283B1 (en) Shared memory management
US9990240B2 (en) Event handling in a cloud data center
US9628398B1 (en) Queuing methods and apparatus in a network device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16817021

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16817021

Country of ref document: EP

Kind code of ref document: A1