Method for managing cache queue, electronic device and storage medium

By detecting the amount of data and the enqueue rate in the cache queue and flexibly configuring the dequeue weight, the latency and packet loss problems under the SFQ management method are solved, and efficient management of the cache queue is achieved.

CN114237546BActive Publication Date: 2026-03-27CHINANETCENT TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-01
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

The existing Random Fair Queues (SFQ) cause excessive latency and packet loss in cache queue management, especially when the data volume is large and the queue length exceeds the maximum cache data volume, which easily triggers the packet loss mechanism.

Method used

By detecting whether the amount of cached data in the cache queue exceeds the first preset threshold, the dequeue weight can be flexibly configured according to the data volume and enqueue rate to avoid data backlog and excessive latency, and reduce packet loss.

Benefits of technology

It effectively reduces latency and packet loss in the cache queue, ensuring that data is sent with fewer dequeues, thus avoiding data backlog and excessively rapid queue length growth.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114237546B_ABST
    Figure CN114237546B_ABST
Patent Text Reader

Abstract

Embodiments of the present application relate to the technical field of communication, and disclose a cache queue management method, an electronic device and a storage medium. The cache queue management method comprises: obtaining the data amount of cached data in each cache queue in which the cache condition changes; detecting whether the data amount of the cached data exceeds a first preset threshold; in the case where the data amount of the cached data exceeds the first preset threshold, obtaining the enqueue rate of the cached data in the cache queue and determining the dequeue weight corresponding to the cache queue according to the data amount of the cached data and the enqueue rate; and in the case where the data amount of the cached data does not exceed the first preset threshold, determining the dequeue weight corresponding to the cache queue according to the data amount of the cached data. Thus, when traffic shaping is performed based on the cache queue, the time delay and packet loss can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of communication, in particular to a cache queue management method, an electronic device and a storage medium. BACKGROUND

[0002] Traffic shaping is usually to store data streams into cache queues, and then manage and dispatch the cache queues to send data in a certain way. A common management method of the cache queues is Stochastic Fairness Queueing (SFQ), that is, a plurality of cache queues are set, and the queues are dispatched in turn to send a preset amount of data by polling. When one queue finishes sending, the next queue starts sending, and so on.

[0003] However, SQF binds the sending data amount to the queue, and sends data in a preset amount regardless of the data amount of the data stream stored in the queue. When the data amount is large, a large delay is caused because the queue needs to wait for other cache queues to send data multiple times. Even if the delay is too long or the current cache data exceeds the maximum queue length of the cache queue, that is, the maximum cache data amount, a packet loss mechanism is triggered, causing excessive packet loss. SUMMARY

[0004] Embodiments of the present application aim to provide a cache queue management method, an electronic device and a storage medium, so that when traffic shaping is performed based on cache queues, the delay and packet loss can be reduced.

[0005] To achieve the above-mentioned purpose, an embodiment of the present application provides a cache queue management method, comprising the following steps: obtaining the data amount of the cached data in each cache queue whose cache condition changes; detecting whether the data amount of the cached data exceeds a first preset threshold; in the case that the data amount of the cached data exceeds the first preset threshold, obtaining the enqueue rate of the cached data in the cache queue and determining the dequeue weight corresponding to the cache queue according to the data amount of the cached data and the enqueue rate; in the case that the data amount of the cached data does not exceed the first preset threshold, determining the dequeue weight corresponding to the cache queue according to the data amount of the cached data.

[0006] To achieve the above-mentioned purpose, an embodiment of the present application further provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the cache queue management method as described above.

[0007] To achieve the above object, the embodiment of the present application further provides a computer readable storage medium storing a computer program, the computer program is executed by a processor to implement the management method of the cache queue.

[0008] The management method of the cache queue provided by the embodiment of the present application acquires the data amount of the cached data of the cache queue whose cache condition changes, and then judges whether the influence of the data enqueue rate on the dequeue weight needs to be considered by detecting whether the data amount exceeds the first preset threshold. It can be understood that, in the case that the data amount of the cached data does not exceed the first preset threshold, that is, there is still more storage space in the cache queue to continue storing data, even if the data enqueue rate is large, the cached data in the cache queue is continuously dequeued, and the cache queue basically does not reach the maximum queue length, that is, the problem of packet loss has been well avoided. At this time, the influence of the data amount of the cached data on the dequeue weight is mainly considered, so that the dequeue weight is adapted to the data amount, the cached data in the cache queue can be sent out through fewer dequeue times, the number of times of waiting for the sending of other cache queues is reduced, the delay is ultimately reduced, the dequeue weight of the cache queue is avoided to be too large, the data amount of one dequeue is avoided to be too large, and the problem that other cache queues need to wait for a long time is avoided. In the case that the data amount of the cached data exceeds the first preset threshold, that is, there is not much storage space in the cache queue to continue storing data, the influence of the data enqueue rate on whether the cache queue reaches the maximum queue length is large at this time, and the influence of the data enqueue rate on the stored data in the cache queue needs to be considered at this time, otherwise, the data enqueue rate is too large, the dequeue weight is small, the dequeue rate is too small, the data is accumulated in the cache queue, the problems of packet loss and large delay are caused, and the influence of the data amount and the data enqueue rate on the dequeue weight is comprehensively considered at this time, the problem of data accumulation caused by the small dequeue weight determined by only considering the queue length is avoided, and the problems of packet loss and large delay are avoided. That is, the weight of the polling dequeue can be flexibly configured according to the actual situation of the cached data in the cache queue, so that the dequeue data amount and the cached data are adapted to each other in the polling process of the cache queue, the data dequeue of other cache queues is not delayed, that is, the delay is not lengthened, and the problems of data accumulation, rapid growth of the queue length, large sending delay and serious packet loss caused by too small data flow of the self-dequeue are avoided. BRIEF DESCRIPTION OF DRAWINGS

[0009] One or more embodiments are illustrated by way of example with reference to the drawings, which are not limiting of the embodiments and which are merely meant to explain the embodiments. The drawings in the accompanying drawings are not to scale, and elements with the same reference numerals designate similar elements unless otherwise specified. The drawings in the accompanying drawings are not to scale, and elements with the same reference numerals designate similar elements unless otherwise specified.

[0010] Figure 1 is a flowchart of the management method of the cache queue provided in an embodiment of the present application;

[0011] Figure 2 is a structural schematic diagram of an electronic device provided in another embodiment of the present application. DETAILED DESCRIPTION

[0012] As known from the background, in traffic shaping, the current SFQ mode is used to manage the cache queue, which has the problems of long delay and serious packet loss.

[0013] To solve the above problems, the embodiment of the present application provides a cache queue management method, which comprises: acquiring the data amount of the cached data in each cache queue in which the cache condition changes; detecting whether the data amount of the cached data exceeds a first preset threshold; in the case that the data amount of the cached data exceeds the first preset threshold, acquiring the enqueue rate of the cached data in the cache queue and determining the dequeue weight corresponding to the cache queue according to the data amount of the cached data and the enqueue rate; in the case that the data amount of the cached data does not exceed the first preset threshold, determining the dequeue weight corresponding to the cache queue according to the data amount of the cached data.

[0014] The method for managing the cache queue provided by the embodiment of the present application acquires the data amount of the cached data of the changed cache queue, and then judges whether the influence of the enqueuing rate on the dequeuing weight needs to be considered by detecting whether the data amount exceeds the first preset threshold. It can be understood that, in the case that the data amount of the cached data does not exceed the first preset threshold, that is, there is still more storage space in the cache queue to continue storing data, even if the data enqueuing rate is large, the cached data in the cache queue is continuously dequeued, and the cache queue basically will not reach the maximum queue length, that is, the problem of packet loss has been well avoided. At this time, the influence of the data amount of the cached data on the dequeuing weight is mainly considered, so that the dequeuing weight is adapted to the data amount, the cached data in the cache queue can be sent out through fewer dequeuing times, the number of waiting for the sending of other cache queues is reduced, the delay is ultimately reduced, the dequeuing weight of the cache queue is avoided to be too large, the data amount of one-time dequeuing is avoided to be too large, and the problem that other cache queues need to wait for a long time is avoided. In the case that the data amount of the cached data exceeds the first preset threshold, that is, there is not much storage space in the cache queue to continue storing data, the influence of the data enqueuing rate on whether the cache queue reaches the maximum queue length is large. At this time, the influence of the enqueuing rate on the stored data in the cache queue needs to be considered, otherwise, the enqueuing rate is too large, the dequeuing weight is small, the dequeuing rate is too small, and thus the data will be accumulated in the cache queue, the problems of packet loss and large delay will occur. That is, at this time, the influence of the data amount and the enqueuing rate of the data on the dequeuing weight is comprehensively considered, the problem of data accumulation caused by the small dequeuing weight determined by only considering the queue length is avoided, and the problems of packet loss and large delay are avoided. That is, the weight of the polling dequeuing can be flexibly configured according to the actual situation of the cached data in the cache queue, so that the dequeuing data amount and the cached data are adapted to each other in the polling process of the cache queue, the data dequeuing of other cache queues is not delayed, that is, the delay is not lengthened, and the problems of too little data flow of the self-dequeuing, too fast growth of the queue length, and finally too large sending delay and serious packet loss are avoided.

[0015] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in detail below with reference to the drawings. However, those skilled in the art can understand that, in the embodiments of the present application, many technical details are proposed in order to make the readers better understand the present application. However, the technical solutions claimed by the present application can be implemented even without these technical details and various changes and modifications based on the following embodiments.

[0016] The division of the following embodiments is for the convenience of description, and should not constitute any limitation on the specific implementation modes of the present application. The embodiments can be combined and referenced with each other on the premise of no contradiction.

[0017] The embodiment of the present application provides a cache queue management method, which is applied to a computer, a mobile phone, a server or the like electronic device. Figure 1

[0018] In step 101, the data amount of the cached data in each cache queue whose cache condition changes is acquired.

[0019] In the embodiment, the cache queue is mainly a cache queue for traffic shaping in the computer or the like electronic device, in particular, the cache queue can be a cache queue of a communication out interface of the computer or the like electronic device.

[0020] In the embodiment, the cache condition change of the cache queue can include: the cached data in the cache queue is dequeued, data in the cache queue is enqueued, the cached data in the cache queue is processed by packet discarding according to a certain strategy, etc., of course, the above is only a specific example, the cache condition change of the cache queue can also be other conditions, which will not be described here.

[0021] In particular, the data amount of the cached data can be represented in multiple ways, such as frames, messages, bits, etc.

[0022] In an example, the data amount of the cached data is represented as the number of messages, for example, the cache queue includes queue 1 to queue 10, wherein the data amount of the cached data in queue 1 changes from 100 messages to 78 messages due to the dequeued cached data, the data amount of the cached data in queue 5 changes from 35 messages to 66 messages due to the enqueued new data, in this case, the data amount of the cached data in each cache queue whose cache condition changes is acquired, that is, the data amount of the cached data in queue 1 is acquired as 78 messages, and the data amount of the cached data in queue 5 is acquired as 66 messages.

[0023] In another example, the data amount of the cached data is represented as the number of bytes, for example, the cache queue includes queue 1 to queue 100, wherein the data amount of the cached data in queue 65 changes from 456 bytes to 244 bytes due to the dequeued cached data, the data amount of the cached data in queue 87 changes from 546 bytes to 658 bytes due to the enqueued new data, and 33 bytes of the cached data in queue 100 are discarded due to the triggered packet discarding mechanism because the current cached data exceeds the preset time delay of the data flow, that is, the waiting timeout, in this case, the data amount of the cached data in each cache queue whose cache condition changes is acquired, that is, the data amount of the cached data in queue 65 is acquired as 244 bytes, the data amount of the cached data in queue 87 is acquired as 66 messages, and the data amount of the cached data in queue 100 is acquired as 0 bytes.

[0024] ​It is worth mentioning that when the data amount of the cached data is represented by the number of packets, the data size of different packets can be different due to the indefinite length of the packets, which can not uniquely determine the data size from the number of packets, and the data size of the cached data with the same number of packets can be different, which can further cause the time required for sending the cached data with the same number of packets to be different, i.e., the waiting time before the packet is sent is different with the data size of a packet, which finally causes the delay to be uncontrollable. For example, when the shaping bandwidth of a computer or other electronic device is 100M and the data amount of the cached data in all the cache queues is 1000 packets, the sending time of each packet with a length of 600 bytes is obviously twice the sending time of each packet with a length of 300 bytes. Therefore, the same 100th packet to be sent has a sending delay that is twice the sending delay of each packet with a length of 300 bytes. When the data amount is replaced by the number of bytes, the data size can be accurately determined, which avoids the above problems, thereby accurately controlling the cache queue delay. In particular, when the data amount is the number of bytes, the queue length can also be configured according to the delay parameter.

[0025] It should be noted that the above is only an example of packet number and byte number, and in fact, the packet number can be replaced by the frame number, and the byte number can be replaced by the word number, bit number, etc. which can uniquely represent the data size, which will not be repeated here.

[0026] In order to facilitate those skilled in the art to better understand the above-mentioned scenarios where the cache situation changes, the following will be described by taking data enqueuing as an example.

[0027] Before obtaining the data amount of the cached data in each cache queue where the cache situation changes, the management method of the cache queue further includes: determining the cache queue corresponding to the to-be-cached data; detecting whether the cache queue corresponding to the to-be-cached data can cache the to-be-cached data according to the data amount of the to-be-cached data; discarding the to-be-cached data in the case that the cache queue corresponding to the to-be-cached data cannot cache the to-be-cached data; and in the case that the cache queue corresponding to the to-be-cached data can cache the to-be-cached data, caching the to-be-cached data in the corresponding cache queue and determining that the cache situation of the corresponding cache queue changes.

[0028] It should be noted that it takes a certain time for the to-be-cached data to be enqueued, and in the enqueuing process, it can be determined through polling that it is the turn of the cache queue into which the to-be-cached data enters to send data outward. Therefore, in order to ensure that the obtained dequeuing weight corresponds to the actual situation in real time, further reduce the delay, and alleviate the packet loss problem, the dequeuing weight can be updated once for each enqueued packet or data frame in the cache queue through the execution of steps 101-104 to determine the dequeuing weight of each cache queue in real time, without waiting for all the to-be-cached data to be enqueued before executing steps 101-104. Alternatively, the to-be-cached data can be enqueued in the process, and the cache queue can be monitored, such as detecting whether the cache queue that is one sending sequence before the cache queue into which the to-be-cached data enters in the sending sequence is sending data, predicting the sending waiting time, and detecting whether the waiting time for the cache queue into which the to-be-cached data enters to send data is less than or equal to a preset time length, etc. In the case where the cached data in the cache queue into which the to-be-cached data enters is about to be sent, the dequeuing weight of the cache queue into which the to-be-cached data enters is updated in real time, i.e., the dequeuing weight is updated once for each enqueued packet or data frame through the execution of steps 101-104 to determine the dequeuing weight of each cache queue in real time until the cache queue into which the to-be-cached data enters stops sending data.

[0029] In one example, determining the cache queue to which the data to be cached corresponds can be implemented in the following manner: determining flow identification information of the data to be cached, wherein the flow identification information can be information such as a five-tuple or a three-tuple of a data flow to which the data to be cached belongs, for example, the flow identification information can be a source Internet Protocol (IP) address, a destination IP address, a source port number, a destination port number, and a protocol number carried in a message such as a Transmission Control Protocol (TCP) message, a User Datagram Protocol (UDP) message, an Internet Control Message Protocol (ICMP) message, and the like that has a port number and a protocol number; and determining the cache queue to which the data to be cached uniquely corresponds according to the flow identification information, the total number of cache queues, and a hash algorithm. In the case where the flow identification information is a five-tuple, the hash algorithm can be exclusive-OR operation on the five data in the five-tuple, and then, after obtaining the hash value, modulo operation is performed on the hash value based on the total number of cache queues, so as to obtain the queue number of the cache queue into which the data to be cached is enqueued. For example, if the total number of cache queues is 1000 and the hash value is 5, the determined cache queue is the cache queue with a queue number of 5; if the hash value is 1027, the determined cache queue is the cache queue with a queue number of 27. Of course, in the case where the flow identification information is a source IP address and a destination IP address, the hash algorithm can also be summing the source IP address and the destination IP address, and then performing modulo operation on the summed value based on the total number of cache queues to obtain the hash value, which is the queue number of the cache queue into which the data to be cached is enqueued. Details are not described herein.

[0030] It should be noted that, by the above-described manner of determining the queue number, the data to be cached with the same flow identification information, i.e., the data in the same data flow, is stored in the same cache queue, and different cache queues store data from different data flows.

[0031] It also needs to be explained that, in the above example, the actual creation of the cache queue is based on the determination that the data to be cached is determined to enter which cache queue, and the actual creation of part of the cache queue can be completed. When the determined queue number does not belong to the queue number of the currently created cache queue, a new cache queue is created and the queue number is set to the queue number determined by the hash algorithm. In particular, the above step: determining the cache queue uniquely corresponding to the data to be cached according to the flow identification information, the total number of cache queues and the hash algorithm, can be replaced by: determining the cache queue uniquely corresponding to the data to be cached according to the flow identification information, the preset number threshold of the cache queue and the hash algorithm. That is, at this time, the total number of cache queues is predetermined, which can prevent the creation of too many queues when the number of flows in the system is too large, consume system memory resources, and affect system operation.

[0032] In another example, according to the data amount of the data to be cached, whether the cache queue corresponding to the data to be cached can cache the data to be cached can be implemented by the following way: detecting whether the data amount of the data to be cached exceeds the corresponding second preset threshold of the cache queue corresponding to the data to be cached; in the case that the data amount of the data to be cached exceeds the corresponding second preset threshold, determining that the cache queue corresponding to the data to be cached cannot cache the data to be cached; in the case that the data amount of the data to be cached does not exceed the corresponding second preset threshold, detecting whether the sum of the data amount of the data to be cached and the data amount of the cached data of all cache queues exceeds a third preset threshold; in the case that the third preset threshold is exceeded, determining that the cache queue corresponding to the data to be cached cannot cache the data to be cached; in the case that the third preset threshold is not exceeded, determining that the cache queue corresponding to the data to be cached can cache the data to be cached.

[0033] It is worth mentioning that the above comparison of the second preset threshold and the third preset threshold actually adds the judgment of the cacheable data amount of all cache queues on the basis of determining whether the data to be cached is enqueued by whether the remaining storage space of the cache queue can store the data to be cached, avoiding too much total cache data, thereby preventing the problem of occupying too much system resource for storing or processing data by the computer and other electronic devices, affecting the working efficiency of the system.

[0034] Step 102, detecting whether the data amount of the cached data exceeds the first preset threshold, if yes, executing step 103, if no, executing step 104.

[0035] In this embodiment, the data amount of the cached data and the first preset threshold have the same representation, for example, when the data amount of the cached data is represented by the number of messages, the first preset threshold is a message number threshold, and when the data amount of the cached data is represented by the number of bytes, the first preset threshold is a byte number threshold.

[0036] It should be noted that the first preset threshold can be a fixed value set according to experience, or a dynamic value related to the change of the system resource, running state and the like of the computer, server or the like, or a dynamic value related to the change of the enqueue and dequeue of the buffered data, which will not be described herein.

[0037] It should be further noted that the first preset threshold of each buffer queue can be the same or different, which is mainly determined according to the actual situation. For example, when the enqueue rate of the buffered data is high, the first preset threshold corresponding to the buffered data can be set to a small value, so that the dequeue weight corresponding to the buffer queue where the buffered data is located is determined according to the enqueue rate and the data amount of the buffered data as much as possible, to avoid the problem that the high enqueue rate causes the data to be accumulated in the buffer queue and easily leads to packet loss. Similarly, when the enqueue rate of the buffered data is low, the first preset threshold corresponding to the buffered data can be set to a large value.

[0038] In step 103, the enqueue rate of the buffered data in the buffer queue is obtained, and the dequeue weight of the corresponding buffer queue is determined according to the data amount and the enqueue rate of the buffered data.

[0039] In this embodiment, the dequeue weight is positively correlated with the enqueue rate, and the dequeue weight is positively correlated with the data amount of the buffered data.

[0040] In one example, the data amount and the enqueue rate of the buffered data are positively proportional to the dequeue weight, such as K = K1*s1 + K2*v1 + c1, where s1 is the data amount of the buffered data, v1 is the enqueue rate of the buffered data, K1, K2 and c1 are preset values; or the dequeue weight K = K3*s2 + K4*v2 + K5*s2*v2 + K6*s2*v2 + K7*s2*v2 + K8*s2*v2 + K9*s2*v2 + K10*s2*v2 + c2 + c3 + c4 + c5, where s2 is the data amount of the buffered data, v2 is the enqueue rate of the buffered data, K3, K4, K5, K6, K7, K8, K9, K10, c2, c3, c4 and c5 are preset values.

[0041] where s2 is the data amount of the buffered data, v2 is the enqueue rate of the buffered data, K3, K4, K5, K6, K7, K8, K9, K10, c2, c3, c4 and c5 are preset values.

[0042] Of course, the above is only a specific example, and in other examples, the specific relationship between the dequeue weight and the data amount and the enqueue rate of the buffered data can also be a nonlinear positive correlation, which will not be described herein.

[0043] In the embodiment, before obtaining the enqueuing rate of the cached data in the cache queue, the cache queue management method further comprises: periodically obtaining the accumulated data amount of the actual data to be cached in each cache queue according to a preset period, wherein the preset period can be set according to actual needs, for example, when the enqueuing rate of the data to be cached is high, the period can be set to a relatively short time, for example, 100 milliseconds, and when the enqueuing rate of the data to be cached is low, the period can be set to a relatively long time, for example, 200 milliseconds. Thus, the enqueuing rate of the cached data in the cache queue can be obtained by the following method: according to the preset period and the historically obtained accumulated data amount, the enqueuing rate of the corresponding cache queue is determined, for example, the accumulated data amount recorded for the third time is M1 byte amount, the accumulated data amount recorded for the fourth time is M2 byte amount, and the period is T, then the enqueuing rate v = (M1-M2) / T; the accumulated data amount recorded for the seventh time to the twelfth time is M3 byte amount-M8 byte amount, and the period is T', then the enqueuing rate v' = [(M8-M5) / 3T' + (M7-M4) / 3T' + (M6-M3) / 3T'] / 3 = (M8+M7+M6-M5-M4-M3) / 9T'.

[0044] It can be understood that when the computer and other electronic devices statistically accumulate data amount, the actual corresponding statistical time can have a deviation, therefore, in order to further improve the accuracy of the obtained enqueuing rate, the current time can be recorded in real time when the accumulated data amount is recorded, and thus the enqueuing rate is calculated according to the recorded time and the accumulated data amount, which will not be described here.

[0045] It can also be understood that by performing steps 101-104, the update of the dequeuing weight of each cache queue whose cache condition has changed is realized, and the dequeuing weight of each cache queue whose cache condition has not changed remains unchanged, that is, the dequeuing weight of all cache queues is determined, thus, the data can be sent out according to the current dequeuing weight of each cache queue, and traffic shaping is realized, that is, after the dequeuing weight of the corresponding cache queue is determined, the cache queue management method further comprises: determining the dequeuing data amount of each cache queue according to the dequeuing weight of the corresponding cache queue; sending the cached data out of each cache queue at the corresponding dequeuing bandwidth, that is, a cache queue is selected in a certain order to send data out, each cache queue sends the corresponding dequeuing data amount, and after one cache queue finishes sending, the next cache queue starts sending, thus, the data is sent in a loop. Preferably, the sending order can also be determined according to the weight, and the cache queue with a larger weight is sent preferentially, thus, the cache queue with a large cache pressure can be emptied preferentially, thereby reducing the influence on the enqueuing side and reducing the packet loss probability.

[0046] Furthermore, after sending the cached data outward from each cache queue with the corresponding dequeue bandwidth, the cache queue management method also includes: when the cached data in at least one cache queue has been sent, determining that the cache status of the corresponding cache queue has changed, thereby triggering the execution of steps 101-104 to update the dequeue weight of the cache queue from which the cached data was sent. Specifically, similar to the aforementioned data enqueue process, determining that the cache status of the corresponding cache queue has changed could also involve updating the dequeue weight every time a message or data frame is sent out, etc., which will not be elaborated upon here.

[0047] Step 104: Determine the dequeue weight of the corresponding cache queue based on the amount of cached data.

[0048] In this embodiment, the dequeue weight is positively correlated with the amount of cached data, which is roughly the same as the description of step 103, so it will not be repeated here.

[0049] The steps of the various methods described above are only for clarity. In practice, they can be combined into one step or some steps can be split into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent. Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but without changing the core design of the algorithm and process, are also within the scope of protection of this patent.

[0050] Another aspect of the present invention provides an electronic device, such as... Figure 2 As shown, it includes: at least one processor 201; and a memory 202 communicatively connected to at least one processor 201; wherein the memory 202 stores instructions executable by at least one processor 201, which are executed by at least one processor 201 to enable at least one processor 201 to perform the cache queue management method described in any of the above method embodiments.

[0051] The memory 202 and processor 201 are connected via a bus, which may include any number of interconnecting buses and bridges, connecting various circuits of one or more processors 201 and memory 202 together. The bus may also connect various other circuits, such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and therefore will not be described further herein. A bus interface provides an interface between the bus and the transceiver. The transceiver may be a single element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices over a transmission medium. Data processed by processor 201 is transmitted over a wireless medium via an antenna, which further receives data and transmits it to processor 201.

[0052] The processor 201 is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. The memory 202 can be used to store data used by the processor 201 in performing operations.

[0053] In another aspect, the present application also provides a computer readable storage medium storing a computer program. The computer program is executed by a processor to implement the method of managing a cache queue described in any of the above method embodiments.

[0054] That is, those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by programs instructing relevant hardware, the programs are stored in a storage medium, and the storage medium includes a plurality of instructions for causing an apparatus (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the method described in each of the embodiments of the present application. The aforementioned storage medium includes a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0055] Those skilled in the art can understand that the above-mentioned embodiments are specific embodiments for implementing the present application, and in actual applications, various changes can be made in form and details without departing from the spirit and scope of the present application.

Claims

1. A method for managing a cache queue, characterized in that, include: Retrieve the amount of cached data in each cache queue where the cache status has changed; Detect whether the amount of cached data exceeds a first preset threshold; When the amount of cached data exceeds the first preset threshold, the enqueue rate of the cached data in each cache queue where the cache status has changed is obtained, and the dequeue weight of each cache queue corresponding to the change in cache status is determined based on the amount of cached data and the enqueue rate. If the amount of cached data does not exceed the first preset threshold, the dequeue weight of each cache queue corresponding to the change in the cache status is determined based on the amount of cached data. Among them, the dequeue weights determined in the previous step remain unchanged for each cache queue whose cache status has not changed. The method further includes: The amount of data to be dequeued for each cache queue is determined based on the dequeue weight corresponding to each cache queue. The cached data is sent out from each cache queue with the corresponding dequeue bandwidth. The cache queue is selected in a certain order to send data out, and each cache queue sends its corresponding amount of dequeue data.

2. The method for managing a cache queue according to claim 1, characterized in that, The amount of cached data is in bytes.

3. The method for managing a cache queue according to claim 1, characterized in that, The dequeue weight is positively correlated with the enqueue rate, and the dequeue weight is positively correlated with the amount of cached data.

4. The method for managing a cache queue according to claim 1, characterized in that, Before obtaining the amount of cached data in each cache queue where the cache status has changed, the method further includes: Determine the cache queue corresponding to the data to be cached; Based on the amount of data to be cached, detect whether the cache queue corresponding to the data to be cached can cache the data to be cached. If the cache queue corresponding to the data to be cached cannot cache the data to be cached, the data to be cached shall be discarded. If the cache queue corresponding to the data to be cached is able to cache the data to be cached, then the data to be cached is cached in the corresponding cache queue and it is determined that the caching status of the corresponding cache queue has changed.

5. The method for managing a cache queue according to claim 4, characterized in that, The step of determining the cache queue corresponding to the data to be cached includes: Determine the stream identifier information of the data to be cached; Based on the stream identifier information, the total number of cache queues, and the hash algorithm, a unique cache queue is determined for the data to be cached.

6. The method for managing a cache queue according to claim 4, characterized in that, The step of detecting whether the cache queue corresponding to the data to be cached can cache the data to be cached based on the amount of data to be cached includes: Detect whether the amount of data to be cached exceeds the second preset threshold of the cache queue corresponding to the data to be cached; If the amount of data to be cached exceeds the corresponding second preset threshold, it is determined that the cache queue corresponding to the data to be cached cannot cache the data to be cached. If the amount of data to be cached does not exceed the corresponding second preset threshold, it is detected whether the sum of the amount of data to be cached and the amount of data already cached in all current cache queues exceeds a third preset threshold. If the third preset threshold is exceeded, it is determined that the cache queue corresponding to the data to be cached cannot cache the data to be cached; If the third preset threshold is not exceeded, it is determined that the cache queue corresponding to the data to be cached is capable of caching the data to be cached.

7. The method for managing a cache queue according to claim 1, characterized in that, Before obtaining the enqueue rate of cached data in each cache queue where the cache status has changed, the method further includes: According to a preset period, the cumulative amount of actual data to be cached in each cache queue where the cache status changes is periodically obtained; The step of obtaining the enqueue rate of cached data in each cache queue where the cache status has changed includes: Based on the preset period and the accumulated data volume obtained historically, the enqueue rate of each cache queue whose cache status has changed is determined.

8. The method for managing a cache queue according to claim 1, characterized in that, After sending the cached data outward from each cache queue with the corresponding dequeue bandwidth, the method further includes: If the cached data in at least one cache queue is sent, it is determined that the cache status of the corresponding cache queue has changed.

9. An electronic device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the cache queue management method as described in any one of claims 1 to 8.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the method for managing the cache queue as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Method for transmitting data streams and device

    CN107483349A

  • Packet transmission method and device, network node, and storage medium

    WO2021180073A1