Cache allocation method and device and storage medium

By expanding the level 3 cache in 5G communication network equipment, the packet leakage and processing rule reading delay caused by insufficient level 3 cache capacity are solved, and the throughput capability of network equipment is improved.

CN119071903APending Publication Date: 2024-12-03ALIBABA (CHINA) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310644951.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-01
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

When 5G communication network devices process data packets, insufficient level 3 cache capacity leads to packet leakage and processing rules reading from memory, reducing the throughput capability of network devices.

Method used

By determining whether the target storage space is used as memory before writing to pending data packets, if so, switch to level 3 cache and expanding the level 3 cache to reduce packet leakage and processing rules to read from memory, and improve throughput .

Benefits of technology

It effectively reduces packet leakage and processing rules reading delay, improves the throughput capability of network devices, and improves packet processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119071903A_ABST
    Figure CN119071903A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a cache allocation method and device and a storage medium, and the method comprises the steps that after a network device obtains a to-be-processed data packet, a target storage space for writing the data packet can be determined firstly; and then, taking the target storage space as a third-level cache for writing the data packet, and controlling the to-be-processed data packet to be written into the third-level cache. Meanwhile, the network equipment can also judge whether a process of switching the target storage space from being used as a memory to being used as a three-level cache exists or not. If the switching exists, the capacity of the third-level cache is insufficient, and the data packets stored in other storage spaces of the third-level cache are stored in the memory. Network equipment reads a data packet from a memory and processes the data packet, so that the throughput of the network equipment is reduced. In the scheme, when the switching process occurs, the three-level cache used for writing the data packet can be expanded, so that the throughput of the network equipment is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of storage technology, and in particular to a cache allocation method, device and storage medium. Background Art

[0002] With the continuous development of the fifth generation mobile communication technology (5G), 5G communication networks can be applied to a variety of scenarios to provide users with a variety of services while meeting the requirements of low latency, high throughput, and high concurrency, such as live broadcast services, extended reality (XR) services, autonomous driving services, and control services for intelligent manufacturing equipment on industrial assembly lines.

[0003] In 5G communication networks, various network devices with data packet forwarding functions in the access network or core network often require higher throughput. Based on the above description, how to improve the throughput of network devices has become an urgent problem to be solved. Summary of the invention

[0004] In view of this, an embodiment of the present invention provides a cache allocation method, device and storage medium to improve the throughput of a network device.

[0005] In a first aspect, an embodiment of the present invention provides a cache allocation method, comprising:

[0006] In response to obtaining the data packet to be processed, determining a target storage space in the network device for writing the data packet to be processed;

[0007] Using the target storage space as a third-level cache in the network device for writing data packets, and controlling the data packets to be processed to be written into the third-level cache;

[0008] If the target storage space is used as the memory of the network device before the to-be-processed data packet is written, the capacity of the third-level cache for writing data packets in the network device is expanded.

[0009] In a second aspect, an embodiment of the present invention provides another cache allocation method, including:

[0010] In response to obtaining the data packet to be processed, determining a target storage space in the network device for writing the data packet to be processed;

[0011] Using the target storage space as a third-level cache in the network device for writing data packets, and controlling the data packets to be processed to be written into the third-level cache;

[0012] In response to the writing of the data packet to be processed, if the processing rules of the data packet to be processed are read from the memory of the network device, the third-level cache for storing the processing rules in the network device is expanded, and the third-level cache for storing the processing rules and the third-level cache for writing data packets are deployed separately in the network device.

[0013] In a third aspect, an embodiment of the present invention provides a network device for implementing a user plane function of a core network, comprising: a central processing unit (CPU), a network card, and a memory, wherein a storage space of a preset capacity in the memory is used as a third-level cache for writing data packets;

[0014] The network card is used to obtain data packets to be processed;

[0015] The CPU is used to determine a target storage space in a network device for writing the data packet to be processed in response to the acquisition of the data packet to be processed; use the target storage space as the third-level cache for writing the data packet to control the writing of the data packet to be processed into the third-level cache; if before the data packet to be processed is written, the target storage space is used as the memory of the network device, then the third-level cache in the network device for writing the data packet is expanded.

[0016] In a fourth aspect, an embodiment of the present invention provides a non-temporary machine-readable storage medium having executable code stored thereon. When the executable code is executed by a processor of an electronic device, the processor can at least implement the cache allocation method as described in the first aspect or the second aspect above.

[0017] For the network devices mentioned in the embodiments of the present invention, the storage space provided by them may include two types, namely, cache and memory. Among them, both the cache and the memory can be used to store data packets to be processed. And part of the storage space can be used as a cache or as a memory when different conditions are met.

[0018] Based on this, in the cache allocation method provided by the embodiment of the present invention, the network device can first obtain the data packet to be processed, and then determine the target storage space for writing the data packet to be processed, and use the target storage space as the third-level cache for writing the data packet, and control the data packet to be processed to be written into the third-level cache. At the same time, for the target storage space, the network device can further determine whether the target storage space is used as a memory or a third-level cache before the data packet to be processed is written.

[0019] If the target storage space is used as memory before the data packet to be processed is written, it indicates that the data packet to be processed is not directly written into the third-level cache using the Data Direct I / O (DDIO) technology, but the target storage space needs to be switched from being used as memory to being used as a third-level cache before the data packet is written and processed, which also indicates that the capacity of the third-level cache currently used to write the data packet is insufficient. At this point, in the method provided in the embodiment of the present invention, the network device can expand the capacity of the third-level cache used to write the data packet.

[0020] And considering the capacity of the L3 cache for writing data packets, if the above switching process occurs, it means that other storage spaces used as L3 cache will be switched to memory, that is, data packets stored in other storage spaces will be stored in memory, that is, data packets will leak from L3 cache to memory. At this time, the network device will read and process data packets from memory, which will reduce its throughput. By expanding capacity, the leakage of data packets can be reduced, thereby improving the throughput of network devices. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0022] Figure 1 A schematic diagram of the structure of a communication network provided by an embodiment of the present invention;

[0023] Figure 2 A schematic diagram of the relationship between the third-level cache and the memory provided in an embodiment of the present invention;

[0024] Figure 3 A flow chart of a cache allocation method provided by an embodiment of the present invention;

[0025] Figure 4 A flowchart of another cache allocation method provided by an embodiment of the present invention;

[0026] Figure 5 A flow chart of a capacity expansion method provided by an embodiment of the present invention;

[0027] Figure 6 A flowchart of another capacity expansion method provided by an embodiment of the present invention;

[0028] Figure 7 A flowchart of another cache allocation method provided by an embodiment of the present invention;

[0029] Figure 8 A schematic diagram of the relationship between the three-level cache, memory, ring buffer, and descriptor ring provided in an embodiment of the present invention;

[0030] Fig. 9 A flowchart of another cache allocation method provided by an embodiment of the present invention;

[0031] Fig.10 A schematic diagram of the structure of a network device provided by an embodiment of the present invention;

[0032] Fig.11 A schematic diagram of applying the cache allocation method and network device provided in an embodiment of the present invention to a 5G communication network;

[0033] Fig.12 A schematic diagram of the structure of another network device provided by an embodiment of the present invention;

[0034] Fig.13 A schematic diagram of the structure of another network device provided by an embodiment of the present invention;

[0035] Fig.14 A schematic diagram of the structure of another network device provided by an embodiment of the present invention;

[0036] Fig.15 A schematic diagram of the structure of another network device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0037] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution 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 are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0038] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two, but does not exclude the inclusion of at least one.

[0039] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0040] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to identifying", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is identified" may be interpreted as "when determining" or "in response to determining" or "when identifying (stated condition or event)" or "in response to identifying (stated condition or event)", depending on the context.

[0041] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such a product or system. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the product or system including the elements.

[0042] Before describing the following embodiments of the present invention in detail, the related concepts involved in the following embodiments of the present invention may be explained first:

[0043] Memory: Also known as internal memory or main memory, it is used to temporarily store calculation data in the central processing unit (CPU), and is also used to exchange data with external memory such as hard disk.

[0044] Cache: A memory used for high-speed data exchange. The CPU reads it faster than the memory. The cache can be divided into a primary cache, a secondary cache, and a tertiary cache. The CPU reads the three caches at a lower speed. It should be noted that in the following embodiments of the present invention, the tertiary cache can store the data packets to be processed obtained by the network device, and can also store the processing rules of the data packets.

[0045] In addition, in order to ensure the conciseness of the description of subsequent embodiments, the three-level cache used for data packet writing in the network device can be called the first three-level cache, and the three-level cache storing data packet processing rules in the network device can be called the second three-level cache.

[0046] Ring Buffer: A general data structure used by the Network Interface Controller (NIC) in a network device to process data packets, which can be a circular queue with a First Input First Output (FIFO) feature. The NIC can include two types of ring buffers, namely, a receive ring (RX Ring) for receiving data packets and a transmit ring (TX Ring) for transmitting data packet processing results. It should be noted that the following embodiments of the present invention focus on the reception and processing of data packets, that is, the RX Ring is used as the main focus.

[0047] Cache line: The ring buffer stores data in cache line units.

[0048] Descriptors of a ring buffer: pointers can be stored in them. The pointer points to the storage space corresponding to a cache line in the ring buffer. The descriptor can also store a capacity value, which reflects the capacity of the storage space corresponding to a cache line. Corresponding to the ring buffer, the descriptors can also form a circular queue with FIFO characteristics. The pointer stored in any descriptor in the descriptor ring can execute any cache line in the ring buffer.

[0049] Direct Memory Access (DMA): NIC writes the acquired data directly into the memory.

[0050] Data Direct I / O (DDIO): NIC writes the acquired data directly into the cache. And because the CPU reads cache faster than memory, using data direct technology to write data can improve the throughput of network devices.

[0051] Based on the above concepts, before describing the following embodiments of the present invention in detail, the application background of the present invention may also be described first:

[0052] Figure 1 A communication network is provided in an embodiment of the present invention. Figure 1 As shown, the communication network may include a data network (DN for short) providing target services, a core network, a radio access network (RAN for short) and a terminal device on which a target application for providing target services is installed.

[0053] Optionally, the communication network may be a dedicated network deployed in a specific area, such as an industrial park. The dedicated network may be a cloud network or a localized network.

[0054] Optionally, the DN may include a server that provides a target service, and the server may be a single server or a server cluster. A server may provide at least one service.

[0055] Optionally, the target service may be XR, autonomous driving, industrial equipment control, etc. mentioned in the background technology, or at least one of video on demand and live video. The live video in the live video service may be sports events, telemedicine videos, remote teaching videos, etc.

[0056] Optionally, the terminal device corresponding to the XR service may be a mobile terminal device such as a VR device, an AR device, or an MR device. The terminal device corresponding to the live broadcast service may be a mobile terminal device such as a mobile phone, a tablet computer, or a laptop computer. The server providing the above services may store multimedia data such as XR videos and live broadcast videos. The terminal device corresponding to the autonomous driving service may be a vehicle-mounted terminal device. The server providing this service may store various status data of the vehicle collected and reported by the vehicle-mounted terminal device, and may also generate control instructions based on the various status data, which are used to enable the vehicle to achieve autonomous driving.

[0057] Optionally, the core network can be a 5G core network (5G Core Network, 5GC) based on the fifth generation mobile communication technology (5th Generation Mobile Communication Technology, 5G for short), or a 4G core network based on the fourth generation mobile communication technology (4G for short), or a core network that is a mixture of 4G and 5G. Among them, both the 5G core network and the 4G core network can have a common core network structure, which will not be described in detail here.

[0058] Optionally, the RAN may include an access device. The access device may be specifically a base station. When the core network is specifically a 5GC, the base station may be a 5G base station (the next Generation Node B, referred to as gNB).

[0059] And in Figure 1In the communication network shown, both the terminal device and the server can generate data packets to be processed corresponding to the target service, and the data packets to be processed generated by either party can be transmitted to the other party with the help of various network devices in the communication network. Among them, the device that provides the user plane function (UPF) of the core network, the device that provides the control plane function (CPF) of the core network, and the access device in the RAN can all be considered as network devices with data packet processing and forwarding capabilities. And the throughput of the network device, that is, the data packet processing capability of the network device, can directly affect the service quality of the target service.

[0060] In practice, the inventors found that in order to improve the throughput of network devices, the DDIO technology can be used to directly write the data packets to be processed into the third-level cache, so that the CPU of the network device can directly read and process the data packets from the third-level cache more quickly. Among them, part of the storage space in the network device can be pre-set to be used as both memory and third-level cache. Among them, the third-level cache specifically includes a first third-level cache for writing data packets, and a second third-level cache that stores the processing rules of the data packets. Based on the above description, the relationship between the cache and the memory can be combined Figure 2 understand.

[0061] The inventors later discovered that, considering the capacity of the first and third level caches, the following situations may occur when actually using the DDIO technology to write data packets:

[0062] When a new data packet is written into storage space 1 used as the first third-level cache at time T2, in one case, storage space 2 which was used as the first third-level cache at time T1 and into which the old data packet was written before time T2 is switched to be used as memory, that is, the storage location of the old data packet is squeezed into the memory from the first third-level cache by the new data packet, that is, the old data packet leaks from the first third-level cache into the memory. Since the old data packet leaked into the memory is also a data packet that has not been processed by the network device, the network device needs to read the old data packet from the memory into the second third-level cache again, and process the old data packet using the processing procedures of the data packets stored in the second third-level cache or memory. This process of reading old data packets from the memory and then processing them will obviously reduce the throughput of the network device.

[0063] When a new data packet is written into storage space 1 used as the first third-level cache at time T2, in another case, storage space 2 that stored the processing rules for the data packet at time T1 before time T2 and was used as the second third-level cache at time T1 is switched to be used as memory. That is, the new data packet occupies the second third-level cache that should have stored the processing rules, and the storage space for storing the processing rules is also squeezed into the memory by the new data packet from the second third-level cache, that is, the first third-level cache competes with the second third-level cache. For new data packets that have not been processed, the network device also needs to read the processing rules from the memory into the second third-level cache, and use the read processing rules to process the new data packets. This process of reading the processing rules from the memory and then processing them will obviously also reduce the throughput of the network device.

[0064] In addition, the above situation is actually a state where the first and third level caches are dominated by competition. Of course, in reality, there are also situations where the second and third level caches are dominated by competition, which will also lead to a decrease in network device throughput.

[0065] Based on the above-discovered problems of crowding out old and new data packets and cache competition, the inventors propose the cache allocation methods provided in the following embodiments of the present invention. By executing this method, a network device can improve its throughput.

[0066] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.

[0067] Figure 3 A flowchart of a cache allocation method provided by an embodiment of the present invention. The cache allocation method provided by an embodiment of the present invention can be executed by a network device, more specifically, by a CPU in the network device. Optionally, the network device can be Figure 1 Any device with data packet processing and forwarding capabilities used in the communication system or other scenarios shown. Figure 3 As shown, the method may include the following steps:

[0068] S101, in response to obtaining a data packet to be processed, determining a target storage space in a network device for writing the data packet to be processed.

[0069] The network device may obtain the data packet to be processed. Optionally, the data packet to be processed may be obtained by a NIC in the network device. Optionally, when the network device is Figure 1 devices in the communication network shown, and Figure 1When the communication network shown is specifically a 5G communication network, the network device may specifically be a network device that performs data packet processing and forwarding most frequently, that is, a device having the UPF function in 5GC.

[0070] During the uplink transmission process, the data packets to be processed obtained by the network device with UPF function can come from different control plane function network elements in the 5G base station or 5GC. During the downlink transmission process, the data packets to be processed obtained by the device can come from the server providing the target service or the control plane function network element in the 5GC. Optionally, the above-mentioned uplink and downlink transmission processes can occur when the terminal device accesses the network or when the terminal device uses the target service.

[0071] As Figure 2 The relationship between the memory and the three-level cache shown in the figure is that while a part of the storage space in the network device is preset to be used as both a memory and a first three-level cache, the address of this part of the storage space with multiple usage methods can also be recorded. Then, in response to the acquisition of the data packet to be processed, the network device can further select a target address from these addresses, and determine the storage space corresponding to this target address as the write location of the data packet to be processed, that is, the target storage space for writing the data packet to be processed. Optionally, for the selection of the target address, the network device can select sequentially, or give priority to the address with higher frequency of use.

[0072] S102, using the target storage space as a third-level cache for writing data packets in the network device, and controlling the data packets to be processed to be written into the third-level cache.

[0073] S103, if the target storage space is used as the memory of the network device before the data packet to be processed is written, the third-level cache for writing the data packet in the network device is expanded.

[0074] Next, the network device can further determine whether the target storage space in step S101 is used as a memory or as a first three-level cache before writing the data packet to be processed. If the target storage space is used as a first three-level cache, the network device can directly write the data packet to be processed into the target storage space and further complete the processing of the data packet.

[0075] If the target storage space is used as memory, the network device can first switch the usage of the target storage space from memory to the first-level cache, and then write the data packet to be processed. According to the invention ideas of the above inventors, the switching of usage means that a data packet leakage has occurred, and this data packet leakage indicates that the first-level cache capacity of the current network device is too small. Therefore, when it is determined that the target storage space is used as the memory of the network device before the data packet to be processed is written, the network device can expand the first-level cache, and the throughput of the network device can also be improved by expanding the capacity.

[0076] In addition, according to the invention ideas of the above-mentioned inventors, it can also be known that the specific manifestation of data packet leakage can be: the newly obtained data packet to be processed squeezes the storage location of the old data packet from the first-level cache to the memory, that is, the old data packet leaks from the first-level cache to the memory, or the newly obtained data packet to be processed occupies the second-level cache that should store the processing rules, that is, the storage space of the processing rules is also squeezed from the second-level cache to the memory, that is, the first-level cache competes with the second-level cache.

[0077] In this embodiment, the network device can first obtain the data packet to be processed, and then determine the target storage space for writing the data packet to be processed, and use the target storage space as the first three-level cache to control the data packet to be processed to be written into the first three-level cache. At the same time, for the target storage space, the network device can further determine whether the target storage space is used as a memory or a three-level cache before the data packet to be processed is written. If the target storage space is used as a memory before the data packet to be processed is written, it indicates that the capacity of the three-level cache currently used to write the data packet is insufficient. At this time, the network device can expand the capacity of the first three-level cache used to write the data packet to reduce the leakage of the data packet, thereby improving the throughput of the network device.

[0078] In practice, the complete process of processing the data packets to be processed with the help of DDIO technology can be described as follows: the network device can first write the data packets to be processed directly into the first three-level cache. After that, the target processing rule corresponding to the data packets to be processed can be further determined from the various processing rules stored in the second three-level cache, and the data packets to be processed can be processed according to this target processing rule. Among them, the processing rule can specifically be a packet detection rule (Packet Detection Rule, referred to as PDR) for data packet forwarding. Optionally, the various processing rules required for processing data packets can also be stored in the memory of the network device. It can be seen that the processing process of the data packets to be processed includes a writing stage and a processing stage.

[0079] According to the description in the above embodiment, during the writing phase of the data packet to be processed, the data packet to be processed may squeeze the target processing rules stored in the second and third level caches into the memory, and may also squeeze the data packets obtained before the data packet to be processed in the first and third level caches into the memory. At this time, it indicates that the capacity of the first and third level caches is insufficient, and the network device can use Figure 3 Optionally, in order to ensure that there is no competition between the first third-level cache and the second third-level cache, the two caches can also be deployed in isolation.

[0080] During the processing stage of the data packets to be processed, the data packets occupying the processing rules in the above-mentioned writing stage can cause the capacity of the second and third level caches to be insufficient, resulting in the network device needing to read the target processing rules from the memory into the second and third level caches to further complete the processing of the data packets.

[0081] In this case, Figure 4 A flowchart of another cache allocation method provided by an embodiment of the present invention. The cache allocation method provided by an embodiment of the present invention can be executed by a network device, more specifically, by a CPU in the network device. Figure 4 As shown, the method may include the following steps:

[0082] S201, in response to obtaining a data packet to be processed, determining a target storage space in a network device for writing the data packet to be processed.

[0083] S202, using the target storage space as a third-level cache for writing data packets in the network device, and controlling the data packets to be processed to be written into the third-level cache.

[0084] In addition, the specific implementation process of the above steps S201 to S202 can be found in Figure 3 The detailed description of the relevant steps in the illustrated embodiment will not be repeated here.

[0085] S203, if the target processing rule corresponding to the data packet to be processed is read from the memory of the network device, the third-level cache for storing the processing rules of the data packet in the network device is expanded, and the third-level cache for storing the processing rules and the third-level cache for writing data packets are deployed separately in the network device.

[0086] After the data packet to be processed is written into the first three-level cache, the network device can start processing the data packet. During the processing, if the network device reads the target processing rules corresponding to the data packet to be processed from the memory, it indicates that the capacity of the second three-level cache is insufficient. This lack of capacity causes the network device to read the target processing rules from the memory into the second three-level cache and further complete the processing of the data packet. Since the reading speed of the memory is slower than the three-level cache, the above process of reading the target processing rules from the memory will result in a decrease in the throughput of the network device. In order to improve the throughput of the network device, if the network device reads the target processing rules corresponding to the data packet to be processed from the memory, the second three-level cache is expanded.

[0087] Optionally, in order to ensure that there is no contention between the first third-level cache and the second third-level cache, the two caches may be deployed in isolation.

[0088] In this embodiment, by expanding the capacity of the second and third level caches, the leakage of data packets can be reduced, and the situation where network devices read processing rules from memory can be reduced, thereby increasing the speed at which network devices read processing rules and the speed at which network devices process data packets, that is, increasing the throughput of network devices.

[0089] The relationship between the above two embodiments can also be understood as follows: During the data packet writing phase, the data packet to be processed may crowd the processing rules into the memory or crowd the old data packets previously acquired into the memory. In this case, it indicates that the capacity of the first level 3 cache is insufficient, and this capacity deficiency can also reduce the throughput of the network device. To improve this situation, you can use Figure 3 The first level 3 cache is expanded in the manner shown.

[0090] The crowding generated during the packet writing phase will further cause the network device to read the processing rules from the memory during the packet processing phase. At this time, it indicates that the second and third level cache capacity is insufficient, which can also reduce the throughput of the network device. To improve this situation, you can use Figure 4 The second and third level caches are expanded in the manner shown.

[0091] Optionally, the network device can detect in real time whether the first third-level cache and the second third-level cache are lacking in the manner described in the above embodiment, so as to respectively perform Figure 3 or Figure 4 The illustrated embodiment is used to expand the capacity of the first and second level 3 caches. Considering that the total capacity of the first and second level 3 caches is fixed, expanding the capacity of one level 3 cache is equivalent to shrinking the capacity of the other level 3 cache.

[0092] In each of the above embodiments, before the network device executes the capacity expansion step, it is also necessary to execute the following determination step: determine whether the target storage space is used as the memory of the network device before the data packet to be processed is written, and determine whether the target processing rule corresponding to the data packet to be processed is read from the memory of the network device. The execution of the above determination step and capacity expansion step requires the use of the computing resources of the network device, especially the CPU resources. In order to reduce the waste of computing resources and ensure the utilization rate of computing resources, the network device can optionally also first count the data packet acquisition amount of the network device, and determine whether to execute the determination step and capacity expansion step based on the statistical results.

[0093] Specifically, in the data packet writing phase, the network device can determine its own data packet acquisition amount within the target time period to which the acquisition time of the data packet to be processed belongs in response to the acquisition of the data packet to be processed, that is, the total amount of data packets that the network device has acquired within the target time period before the network device acquires the data packet to be processed. Optionally, the length of the target time period can be preset. The network device can obtain the data packet acquisition amount within the target time period through a bus based on the high-speed serial computer expansion bus standard (Peripheral Component Interconnect Express, referred to as PCIE).

[0094] If the amount of data packets acquired is not less than the preset threshold, it indicates that the data flow in the communication system is at a high level during the target period, and the high flow leads to a high possibility of data packet crowding, that is, a high possibility of capacity shortage. Therefore, during the data packet writing phase, the network device can determine whether to expand the first and third-level cache by executing the step of "determining whether the target storage space is used as the memory of the network device before the data packet to be processed is written". If the amount of data packets acquired is less than the preset threshold, the network device does not execute the above determination step or the expansion step.

[0095] In addition, during the data packet processing phase, the network device can also perform statistics on the amount of data packets obtained. If the amount of data packets obtained is not less than a preset threshold, the step of "determining whether the target processing rule corresponding to the data packet to be processed is read from the memory of the network device" can be performed to determine whether to expand the second and third level caches. If the amount of data packets obtained is less than the preset threshold, the network device does not perform the above determination step or the expansion step.

[0096] In this embodiment, since the amount of data packets acquired can reflect the possibility of capacity shortage, the network device can use the amount of data packets acquired as a basis for whether to expand capacity, thereby expanding the first-level cache or the second-level cache at the appropriate time to improve the waste of computing resources of the network device caused by frequent capacity expansion.

[0097] Figure 3 In the illustrated embodiment, when the network device determines that the target storage space before the data packet to be processed is written is used as the memory of the network device, the first third-level cache can be expanded. Optionally, in order to further improve the utilization rate of the computing resources of the network device, Figure 5 The flowchart of another cache expansion method provided by the embodiment of the present invention. The cache allocation method provided by the embodiment of the present invention can be executed by a network device, more specifically, by a CPU in the network device. The method is also an optional specific implementation of step S103. Figure 5 As shown, the method may include the following steps:

[0098] S1031, if the target storage space is used as the memory of the network device before the data packet to be processed is written, then determine the first ratio corresponding to the target time period, the first ratio includes the ratio of the number of historical storage spaces used as memory before the data packet to be processed is written to the number of historical data packets obtained in the target time period, and the historical data packets written to the historical storage space are obtained before the data packet to be processed.

[0099] In the writing phase of the pending data packet, if the network device determines that the target storage space is used as memory before the pending data packet is written, the network device can further determine the first ratio corresponding to the target time period to which the acquisition time of the pending data packet belongs. The first ratio includes the ratio of the amount of historical storage space used as memory to write historical data packets to the total amount of historical data packets. The historical data packets are all data packets acquired before the pending data packet in the target time period.

[0100] It is easy to understand that not all historical storage spaces for writing historical data packets are used as memory. Therefore, the first ratio indicates the ratio of data packet leakage during the data packet writing process during the target period. The higher the first ratio, the more times historical data packets leak into the memory, the more deficient the first and third level caches are, and the lower the throughput of the network device.

[0101] S1032: Determine whether to expand the capacity of the third-level cache used for writing data packets in the network device according to the first ratio.

[0102] Regarding determining whether to expand the first-level cache based on the first ratio, optionally, if the first ratios corresponding to multiple consecutive time periods including the target time period do not gradually increase, indicating that the traffic in the communication network is in a stable state, the capacity of the first-level cache in the network device is kept unchanged, that is, it is not expanded.

[0103] If the first ratios corresponding to multiple consecutive time periods including the target time period gradually increase, it indicates that the traffic in the communication network is gradually increasing. The increase in traffic may lead to a higher possibility of data packet crowding, that is, the possibility of capacity shortage increases. In this case, the network device expands the first three-level cache.

[0104] In this embodiment, when it is determined that the target storage space is used as the memory of the network device before the data packet to be processed is written, it indicates that a data packet leakage has occurred. However, considering the sporadic nature of data packet leakage, the network device can further determine a first ratio indicating the frequency of data packet leakage during the data packet writing phase, and expand the capacity of the first three-level cache according to the first ratio. Since the first ratio can more accurately reflect the possibility of insufficient capacity of the first three-level cache, the first ratio can enable the network device to expand capacity at a more appropriate time, so as to improve the waste of network device computing resources caused by frequent capacity expansion and improve the utilization rate of network device computing resources.

[0105] Optionally, after expanding the capacity of the first third-level cache according to the first ratio, the network device may also continue to count the amount of data packets acquired in other time periods after the target time period, and determine whether to continue expanding the capacity of the first third-level cache according to the amount of data packets acquired. For example, if the amount of data packets acquired by the network device in other time periods after the target time period is less than a preset threshold, indicating that the traffic of the communication network in other time periods is in a stable state, at this time, the possibility of capacity shortage is reduced, and the network device may stop expanding the capacity of the first third-level cache.

[0106] In this embodiment, the network device may also stop capacity expansion in a timely manner according to the amount of data packets acquired, so as to improve the utilization rate of computing resources of the network device.

[0107] Figure 4 In the illustrated embodiment, when the network device determines the target processing rule corresponding to the data packet to be processed read from the memory, the second and third level caches can also be expanded. Optionally, in order to further improve the utilization rate of the computing resources of the network device, Figure 6 Flow chart of another cache expansion method provided by an embodiment of the present invention. This method is also an optional specific implementation of step S203. Figure 6 As shown, the method may include the following steps:

[0108] S2031, if the target processing rules are read from the memory of the network device, the second ratio corresponding to the target time period is determined, and the second ratio includes the ratio of the number of historical processing rules read from the memory of the network device to the total number of historical processing data packets obtained within the target time period. The historical data packets processed by the historical processing rules are obtained before the data packets to be processed.

[0109] In the processing stage of the data packet to be processed, if the network device determines that the target processing rules required for processing the data packet to be processed are read from the memory, the network device can further determine the second ratio corresponding to the target time period to which the acquisition time of the data packet to be processed belongs. The second ratio includes the ratio of the number of historical processing rules required for processing the historical data packets read from the memory to the total number of historical data packets. The historical data packets are data packets acquired before the data packet to be processed within the target time period.

[0110] It is easy to understand that not all processing rules are stored in the memory. Therefore, the second ratio indicates the proportion of packet leakage in the processing stage of the packet during the target period. The higher the second ratio, the more times the packets with processing rules stored are leaked to the memory, indicating that the second and third level caches are more deficient, and the throughput of the network device is lower.

[0111] S2032: Determine whether to expand the capacity of a third-level cache for storing processing rules in the network device according to the second ratio.

[0112] Regarding determining whether to expand the second and third level caches based on the second ratio, optionally, if the second ratios corresponding to multiple consecutive time periods including the target time period do not gradually increase, indicating that the traffic in the communication network is in a stable state, the capacity of the second and third level caches in the network device is kept unchanged, that is, the capacity is not expanded.

[0113] If the second ratios corresponding to multiple consecutive time periods including the target time period gradually increase, it indicates that the traffic in the communication network is gradually increasing. The increase in traffic may lead to a higher possibility of data packet crowding, that is, the possibility of capacity shortage increases. In this case, the network device will expand the second and third level caches.

[0114] In this embodiment, when the target processing rule corresponding to the data packet to be processed is read from the memory, it indicates that a data packet leakage has occurred. However, considering the sporadic nature of data packet leakage, the network device can further determine a second ratio indicating how much data packet leakage occurred during the data packet processing phase, and expand the second and third level caches according to the second ratio. Since the second ratio can more accurately reflect the possibility of insufficient capacity of the second and third level caches, the second ratio can enable the network device to expand capacity at a more appropriate time, thereby improving the waste of network device computing resources caused by frequent capacity expansion and improving the utilization rate of network device computing resources.

[0115] and Figure 5Similarly, in the illustrated embodiment, optionally, after the second and third level caches are expanded according to the second ratio, the network device may also continue to count the amount of data packets acquired in other time periods after the target time period, and determine whether to continue to expand the capacity according to the amount of data packets acquired. For example, if the amount of data packets acquired by the network device in other time periods after the target time period is less than a preset threshold, indicating that the traffic of the communication network in other time periods is in a stable state, at this time, the possibility of capacity shortage is reduced, and the network device may stop expanding the second and third level caches.

[0116] In this embodiment, the network device may also stop capacity expansion in a timely manner according to the amount of data packets acquired, so as to improve the utilization rate of computing resources of the network device.

[0117] Above Figure 3 to Figure 6 The process of the embodiment shown can also be combined with Figure 7 understand.

[0118] In practice, the first ratio and the second ratio can be collected in real time, and the network device can also comprehensively consider the two ratios to determine whether to expand the third-level cache to ensure the rationality of the expansion.

[0119] Optionally, if the first ratio increases gradually and the second ratio does not increase gradually, the network device may expand the first level 3 cache. If the second ratio increases gradually and the first ratio does not increase gradually, the network device may expand the second level 3 cache.

[0120] As mentioned in the above embodiments, part of the storage space in the network device is pre-set to be used as both a memory and a first-level three-level cache. Optionally, the above storage space with multiple usage modes can also be logically expressed as a ring buffer. Among them, the ring buffer stores data in units of cache lines, that is, a cache line corresponds to a storage space pointed to by an address. The ring buffer can be a circular queue with FIFO characteristics. Optionally, the address of the storage space corresponding to each cache line in the ring buffer is a pointer, which can also be used as a descriptor of the storage space. Corresponding to the ring buffer, the descriptors of different cache lines in the ring buffer can also constitute a descriptor ring. The descriptor ring can also be considered as a circular queue with FIFO characteristics. Optionally, the descriptor of each cache line can also include the size of the storage space corresponding to this cache line.

[0121] Based on the above descriptor ring, the complete processing process of the network device for the data packet to be processed can be described as follows: the network device can read the pointer at the top of the queue from the descriptor ring in a first-in-first-out order, and the storage space pointed to by this pointer is the target storage space. After that, the data packet to be processed can be directly written into the target storage space used as the first three-level cache. The network device can further determine the target processing rule corresponding to the data packet to be processed from the various processing rules stored in the second three-level cache, and process the data packet to be processed according to this target processing rule.

[0122] It can be seen that for multiple data packets to be processed acquired by the network device, they can be written in sequence according to the order of the descriptors containing the pointers in the descriptor ring. Optionally, the number of cache lines in the ring buffer can also be greater than the number of descriptors in the descriptor ring. Then, according to the address of the storage space corresponding to each cache line in the ring buffer, the descriptors in the descriptor ring can also be updated regularly. By updating the descriptors, different cache lines in the ring buffer can be written into data packets.

[0123] Optionally, the relationship between the ring buffer, the descriptor ring, the first level 3 cache, the second level 3 cache and the memory can also be combined with Figure 8 In the figure, any descriptor in the descriptor ring contains a pointer pointing to a cache line in the ring buffer. The figure also shows the physical and logical manifestations of the first three-level cache.

[0124] Based on the above-mentioned ring buffer and descriptor ring, the inventors have found that if the time interval between two consecutive data packets being written into a storage space used as the first third-level cache is greater than a preset threshold, the storage space will be switched to be used as memory, that is, the storage space can be changed from hot to cold. And when the storage space becomes cold, the network device needs to read the data packets from the memory and process them, which leads to a decrease in the throughput of the network device.

[0125] And the higher the frequency of storage space cooling, the greater the impact on the throughput of the network device. Optionally, the factors affecting the cooling frequency may include the descriptor ring length. The specific impact can be understood as follows: the longer the descriptor ring, the longer the time interval between two consecutive data packets being written to the storage space pointed to by the pointer contained in the same descriptor, the greater the possibility of the storage space cooling, and the greater the impact on the throughput of the network device. That is, the longer the descriptor ring, the higher the frequency of storage space cooling, and the lower the throughput of the network device.

[0126] At the same time, the longer the descriptor ring length is, the more data packets can be directly written into the first and third level caches, so that the network device can process these data packets in a timely manner, and the number of data packets that the network device discards that cannot be processed in time is less, that is, the packet loss rate is lower. And after the data packets to be processed are directly written into the first and third level caches, the probability of data packet leakage due to the crowding of new and old data packets or cache competition will be lower, and the throughput of the network device will be higher.

[0127] According to the above analysis, the longer the descriptor ring length is, the lower the packet loss rate is, the lower the probability of packet leakage is, but the frequency of storage space cooling is greater. Therefore, in practice, the packet loss rate, leakage probability and cooling frequency should be considered comprehensively to set a suitable descriptor ring length. Since the leakage of data packets has a greater impact on the throughput of network devices, the probability of data packet leakage can be given priority when determining the descriptor ring length.

[0128] Optionally, the leakage probability of the data packet can be predicted using the following formula: E(Y)=N-M+M(1-1 / M) N .

[0129] Wherein, E(Y) is the probability of data packet leakage after the candidate data packet is written into the first three-level cache, and the candidate data packet can be any data packet obtained by the network device at a historical time. N is a first quantity, N=preset descriptor ring length*data length of the candidate data packet. M is a second quantity, and the second quantity is the total number of cache lines in the ring buffer. The preset descriptor ring length can be any one of the candidate descriptor ring lengths. The length of the descriptor ring is the length of the circular queue, that is, the number of descriptors. The total number of cache lines in the ring buffer can be greater than the number of descriptors.

[0130] Then, it can be determined whether to use the preset descriptor ring length according to the leakage probability. For example, if the leakage probability is greater than a preset threshold, the preset descriptor ring length is not used, and the next one of the candidate descriptor ring lengths is selected to calculate the leakage probability.

[0131] In this embodiment, the network device can use the leakage probability of the data packet as an important basis for determining the length of the descriptor ring, so as to preset a suitable descriptor ring length. This suitable length can reduce the frequency of storage space cooling and ultimately ensure the throughput of the network device.

[0132] In actual use, for the first level 3 cache which is logically a ring buffer, the cache lines contained therein include the following types: data packets that have been written, data packets that are being written, and data packets that have not been written. That is, RX = mbuf decs +mbuf queue +mbuf empty .

[0133] Among them, RX represents the ring buffer, mbuf queue Indicates the cache line in the ring buffer where the data packet has been written, mbuf decs Indicates the cache line in the ring buffer where the data packet is being written, mbuf empty Represents cache lines in the ring buffer that have no packets written to them.

[0134] Optionally, the factors affecting the frequency of cooling down may also include the length of the ring buffer. The specific influence can be understood as follows: the longer the ring buffer is, the longer the time interval between two consecutive data packets being written into the storage space corresponding to the same buffer row is, the greater the possibility of the storage space cooling down, and the greater the impact on the throughput of the network device. That is, the longer the ring buffer is, the higher the frequency of the storage space cooling down is, and the lower the throughput of the network device is.

[0135] Based on the above analysis, the network device can first determine the original length of a ring buffer, and then determine the time interval corresponding to the same storage space based on the original length. The time interval reflects the interval length between consecutive data packets being written to the same storage space, and the same storage space corresponds to any cache line in the first three-level cache. If the time interval is greater than the preset interval, indicating that the storage space has become cold, it is determined that the storage space corresponds to the target cache line. Next, the second number of target cache lines in the first three-level cache is counted, and based on the second number, it is determined whether to adjust the original length, that is, whether to adjust the capacity of the first three-level cache, that is, whether to adjust the number of cache lines. Specifically, if the second number is greater than the preset upper limit, the length of the ring buffer is increased. If the second number is less than the preset lower limit, the length of the ring buffer is shortened, specifically by reducing mbuf. empty If the second number is between the preset upper limit and the preset lower limit, the length of the ring buffer is not adjusted.

[0136] In this embodiment, the network device determines the adjustment method of the ring buffer by counting the number of storage spaces that have become cold, so as to obtain a suitable length of the ring buffer. This suitable length can reduce the frequency of storage space becoming cold and ultimately ensure the throughput of the network device.

[0137] It should be noted that, compared with the presetting of the descriptor ring length, the length of the ring buffer can be pre-set in the above manner. After pre-setting, the length of the ring buffer can be dynamically adjusted according to the data flow of the communication network during the process of processing the data packet by the network device.

[0138] Specifically, the network device can determine the amount of data packet acquisition in response to the continuous acquisition of data packets. If the amount of data packet acquisition is greater than a preset threshold, it indicates that the data traffic in the current communication system is at a high level, and the high traffic leads to a high possibility of data packet crowding, that is, a high possibility of capacity shortage, then the network device can dynamically adjust the length of the ring buffer in the above manner, that is, adjust the capacity of the first three-level cache.

[0139] Fig. 9 A flowchart of another cache allocation method provided by an embodiment of the present invention. Fig. 9 As shown, the method may include the following steps:

[0140] S301, in response to obtaining a data packet to be processed, determining a target storage space in a network device for writing the data packet to be processed.

[0141] S302, using the target storage space as a third-level cache for writing data packets in the network device, and controlling the data packets to be processed to be written into the third-level cache.

[0142] S303, in response to the writing of the data packet to be processed, if the processing rules of the data packet to be processed are read from the memory of the network device, the third-level cache for storing the processing rules in the network device is expanded, and the third-level cache for storing the processing rules and the third-level cache for writing data packets are deployed separately in the network device.

[0143] In addition, the contents not described in detail in this embodiment and the technical effects that can be achieved can be found in Figure 4 The relevant description in the illustrated embodiment will not be repeated here.

[0144] In the above embodiments, each process of allocating cache to a network device is described from the perspective of a process. The network devices that implement the above embodiments can also be described in detail from the perspective of device structure. It can be understood by those skilled in the art that these network devices can be configured using commercially available hardware components through the steps taught in this solution.

[0145] Fig.10 A schematic diagram of the structure of a network device provided by an embodiment of the present invention. Fig.10 As shown, the device may include a CPU, a network card and a memory, and a storage space with a preset capacity in the memory is used as a third-level cache for writing data packets.

[0146] The network card is used to obtain the data packet to be processed. The CPU can determine the target storage space in the network device for writing the data packet to be processed in response to the acquisition of the data packet to be processed. The target storage space is used as the first third-level cache, and the data packet to be processed is controlled to be written into the first third-level cache. If the target storage space is used as the memory of the network device before the data packet to be processed is written, the first third-level cache in the network device is expanded.

[0147] Optionally, the specific expansion process of the CPU for the first level 3 cache can be referred to above Figure 5 Related description in the illustrated embodiment.

[0148] Optionally, the CPU can also expand the second and third level caches. The specific process can be found in the above Figure 6 Related description in the illustrated embodiment.

[0149] Optionally, the first level 3 cache may be logically represented as a ring buffer, and the CPU may also write the to-be-processed data packet into the first level 3 cache by means of a descriptor ring corresponding to the ring buffer. The pre-setting and dynamic adjustment of the length of the ring buffer and the descriptor ring may also be performed by the CPU, and the specific process may also refer to the above-mentioned related description.

[0150] In addition, the contents not described in detail in this embodiment and the technical effects that can be achieved can be found in Figure 4 The relevant description in the illustrated embodiment will not be repeated here.

[0151] The following describes the specific implementation process of the cache allocation method provided in the above embodiments by taking the 5G communication network as a specific application scenario. Fig.11 understand.

[0152] 5G communication networks can be deployed as dedicated networks in industrial parks to provide autonomous driving services, live broadcast services, VR services, control services for industrial equipment on assembly lines, etc. to terminal devices connected to this dedicated network. When the terminal device accesses the dedicated network, the pending data packets generated by the terminal device, base station, and CPF in the core network can be transmitted with the help of the UPF network element in the core network. When the terminal device uses these services, the pending data packets generated by the terminal device and the servers corresponding to different services can also be transmitted with the help of the UPF network element.

[0153] In order to ensure the throughput of the UPF network element for the data packets to be processed, it can dynamically adjust the three-level cache.

[0154] Specifically, in response to the acquisition of the data packets to be processed, the UPF network element can determine its own data packet acquisition amount. If the data packet acquisition amount is greater than a preset threshold, the UPF network element further determines whether to expand the first three-level cache. And after the expansion, the data packet acquisition amount of the network device can also be counted in real time, and whether to continue to expand or stop the expansion is determined based on the acquisition amount.

[0155] In response to the writing of the data packets to be processed, the UPF network element can determine its own data packet acquisition amount. If the data packet acquisition amount is greater than the preset threshold, the UPF network element further determines whether to expand the second and third-level caches. And after the expansion, the data packet acquisition amount of the network device can also be counted in real time, and whether to continue to expand or stop the expansion based on the acquisition amount. Optionally, the first third-level cache can also be logically expressed as a ring buffer, and the writing of the data packets to be processed can be realized according to the descriptor ring corresponding to the ring buffer.

[0156] The dynamic adjustment process of the L3 cache and the setting and adjustment process of the ring buffer length and the descriptor ring length can also be found in the description of the above-mentioned related embodiments and will not be described in detail here.

[0157] Fig.12 A schematic diagram of the structure of another network device provided in an embodiment of the present invention, such as Fig.12 As shown, the device includes:

[0158] The storage space determination module 11 is used to determine a target storage space in the network device for writing the data packet to be processed in response to the acquisition of the data packet to be processed.

[0159] The control module 12 is used to use the target storage space as a third-level cache for writing data packets in the network device, and control the data packets to be processed to be written into the third-level cache.

[0160] The expansion module 13 is used to expand the third-level cache used for data packet writing in the network device if the target storage space is used as the memory of the network device before the data packet to be processed is written.

[0161] The network device is used to implement the user plane function of the core network, and the core network is deployed in a dedicated network.

[0162] Optionally, the device also includes: a quantity acquisition module 14, which is used to determine the amount of data packets acquired by the network device within the target time period to which the acquisition time of the data packet to be processed belongs in response to the acquisition of the data packet to be processed; if the amount of data packets acquired by the network device within the target time period is not less than a preset threshold, it is determined whether the target storage space is used as the memory of the network device before the data packet to be processed is written.

[0163] Optionally, the expansion module 13 is used to determine a first ratio corresponding to the target time period, the first ratio including the ratio of the amount of historical storage space used as memory to the total amount of historical data packets acquired during the target time period, the historical data packets written to the historical storage space being obtained before the data packets to be processed; based on the first ratio, determine whether to expand the third-level cache used for data packet writing in the network device.

[0164] Optionally, the expansion module 13 is used to expand the capacity of the third-level cache used for data packet writing in the network device if the first ratio corresponding to each of the multiple consecutive time periods including the target time period gradually increases; if the first ratio corresponding to each of the multiple consecutive time periods including the target time period does not gradually increase, then maintain the capacity of the third-level cache used for data packet writing in the network device.

[0165] Optionally, the expansion module 13 is also used to determine whether the target processing rules corresponding to the data packets to be processed are read from the memory of the network device if the amount of data packets acquired by the network device within the target time period is not less than the preset threshold value; if the target processing rules are read from the memory of the network device, the third-level cache used for processing rules in the network device is expanded, and the third-level cache for storing processing rules and the third-level cache for writing data packets are deployed separately in the network device.

[0166] Optionally, the expansion module 13 is used to determine a second ratio corresponding to the target time period, the second ratio including the ratio of the number of historical processing rules read from the memory of the network device to the total number of historical processing data packets obtained within the target time period, and the historical data packets processed using the historical processing rules are obtained before the data packets to be processed; based on the second ratio, determine whether to expand the third-level cache for storing processing rules in the network device.

[0167] Optionally, the expansion module 13 is used to expand the capacity of the third-level cache for storing processing rules in the network device if the second ratio corresponding to each of the multiple consecutive time periods including the target time period gradually increases; if the second ratio corresponding to each of the multiple consecutive time periods including the target time period does not gradually increase, then maintain the capacity of the third-level cache for storing processing rules in the network device.

[0168] Optionally, the device also includes: an expansion termination module 15, which is used to stop expanding the third-level cache for storing processing rules in the network device if the amount of data packets acquired by the network device in other time periods after the target time period is less than the preset threshold; or, if the amount of data packets acquired by the network device in other time periods after the target time period is less than the preset threshold, stop expanding the third-level cache for data packet writing in the network device.

[0169] Optionally, the storage space determination module 11 is used to read a target pointer pointing to the target storage space from a circular queue in a first-in-first-out order, and the pointer stored in the circular queue points to a storage space that can be used as a third-level cache for writing data packets.

[0170] Optionally, the device also includes: a queue length determination module 16, used to obtain a preset length and a total number of cache lines in a third-level cache for writing data packets; determine a first quantity based on the preset length and the data length of the alternative data packet; and determine whether to set the length of the circular queue to the preset length based on the first number and the total number of cache lines.

[0171] Optionally, the device also includes: a cache capacity determination module 17, used to determine the time interval corresponding to the same storage space in the network device, the time interval reflects the interval length between consecutive data packets being written to the same storage space, and the same storage space corresponds to any cache line in the three-level cache used to write data packets; if the time interval is greater than a preset interval, it is determined that the same storage space corresponds to the target cache line; determine the second number of the target cache lines in the three-level cache used to write data packets; and adjust the capacity of the three-level cache in the network device for writing data packets according to the second number.

[0172] Fig.12 The device shown can perform Figures 1 to 8 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figures 1 to 8 The implementation process and technical effects of this technical solution refer to Figures 1 to 8 The description in the illustrated embodiment will not be repeated here.

[0173] In a possible design, the cache allocation method provided in the above embodiments may be applied to another network device, such as Fig.13 As shown, the network device may include: a first processor 21 and a second memory 22. The second memory 22 is used to store the information that supports the network device to execute the above Figures 1 to 8The program of the cache allocation method provided in the illustrated embodiment, the first processor 21 is configured to execute the program stored in the first memory 22 .

[0174] The program includes one or more computer instructions, wherein when the one or more computer instructions are executed by the first processor 21, the following steps can be implemented:

[0175] In response to obtaining the data packet to be processed, determining a target storage space in the network device for writing the data packet to be processed;

[0176] Using the target storage space as a third-level cache in the network device for writing data packets, and controlling the data packets to be processed to be written into the third-level cache;

[0177] If the target storage space is used as the memory of the network device before the to-be-processed data packet is written, the capacity of the third-level cache for writing data packets in the network device is expanded.

[0178] Optionally, the first processor 21 is further configured to execute the aforementioned Figures 1 to 8 All or part of the steps in the illustrated embodiments.

[0179] The structure of the network device may further include a first communication interface 23 for the network device to communicate with other devices or communication systems.

[0180] In addition, an embodiment of the present invention provides a computer storage medium for storing computer software instructions used by the above electronic device, which includes instructions for executing the above Figures 1 to 8 The procedures involved in the cache allocation method shown.

[0181] Fig.14 A schematic diagram of the structure of another network device provided by an embodiment of the present invention, such as Fig.14 As shown, the device includes:

[0182] The determination module 31 is used to determine, in response to the acquisition of the data packet to be processed, a target storage space in the network device for writing the data packet to be processed.

[0183] The control writing module 32 is used to use the target storage space as a third-level cache for writing data packets in the network device, and control the data packets to be processed to be written into the third-level cache.

[0184] The capacity expansion adjustment module 33 is used to respond to the writing of the data packet to be processed. If the processing rules of the data packet to be processed are read from the memory of the network device, the third-level cache for storing the processing rules in the network device is expanded. The third-level cache for storing the processing rules and the third-level cache for writing data packets are deployed separately in the network device.

[0185] Fig.14 The device shown can perform Fig. 9 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Fig. 9 The implementation process and technical effects of this technical solution refer to Fig. 9 The description in the illustrated embodiment will not be repeated here.

[0186] In a possible design, the cache allocation method provided in the above embodiments may be applied to another network device, such as Fig.15 As shown, the network device may include: a second processor 41 and a second memory 42. The second memory 42 is used to store the information that supports the network device to execute the above Fig. 9 The program of the flow table processing method provided in the illustrated embodiment, the second processor 41 is configured to execute the program stored in the second memory 42 .

[0187] The program includes one or more computer instructions, wherein when the one or more computer instructions are executed by the second processor 41, the following steps can be implemented:

[0188] In response to obtaining the data packet to be processed, determining a target storage space in the network device for writing the data packet to be processed;

[0189] Using the target storage space as a third-level cache in the network device for writing data packets, and controlling the data packets to be processed to be written into the third-level cache;

[0190] In response to the writing of the data packet to be processed, if the processing rules of the data packet to be processed are read from the memory of the network device, the third-level cache for storing the processing rules in the network device is expanded, and the third-level cache for storing the processing rules and the third-level cache for writing data packets are deployed separately in the network device.

[0191] Optionally, the second processor 41 is further configured to execute the aforementioned Fig. 9 All or part of the steps in the illustrated embodiments.

[0192] The structure of the network device may further include a second communication interface 43 for the network device to communicate with other devices or communication systems.

[0193] In addition, an embodiment of the present invention provides a computer storage medium for storing computer software instructions used by the above electronic device, which includes instructions for executing the above Fig. 9 The procedures involved in the cache allocation method shown.

[0194] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A cache allocation method, characterized in that: include: In response to obtaining the data packet to be processed, determining a target storage space in the network device for writing the data packet to be processed; Using the target storage space as a third-level cache in the network device for writing data packets, and controlling the data packets to be processed to be written into the third-level cache; If the target storage space is used as the memory of the network device before the to-be-processed data packet is written, the capacity of the third-level cache for writing data packets in the network device is expanded.

2. The method according to claim 1, characterized in that The method further comprises: In response to the acquisition of the data packet to be processed, determining the amount of data packets acquired by the network device within the target time period to which the acquisition time of the data packet to be processed belongs; If the amount of data packets acquired by the network device during the target time period is not less than a preset threshold, it is determined whether the target storage space is used as the memory of the network device before the to-be-processed data packets are written.

3. The method according to claim 2, characterized in that The step of expanding the capacity of the third-level cache for writing data packets in the network device includes: Determining a first ratio corresponding to the target period, the first ratio comprising a ratio of the amount of historical storage space used as memory to the total amount of historical data packets acquired within the target period, the historical data packets written into the historical storage space being acquired before the data packets to be processed; According to the first ratio, it is determined whether to expand the capacity of the third-level cache used for data packet writing in the network device.

4. The method according to claim 3, characterized in that The determining, according to the first ratio, whether to expand the capacity of the third-level cache for writing data packets in the network device includes: If the first ratios corresponding to the consecutive multiple time periods including the target time period gradually increase, the capacity of the third-level cache for writing data packets in the network device is expanded; If the first ratios corresponding to the plurality of consecutive time periods including the target time period do not gradually increase, the capacity of the third-level cache for writing data packets in the network device is maintained.

5. The method according to claim 2, characterized in that: After obtaining the amount of data packets obtained by the network device within the target time period, the method further includes: If the amount of data packets acquired by the network device within the target time period is not less than the preset threshold, determining whether a target processing rule corresponding to the data packet to be processed is read from the memory of the network device; If the target processing rule is read from the memory of the network device, the third-level cache used for processing the rule in the network device is expanded, and the third-level cache storing the processing rule and the third-level cache used for writing data packets are deployed separately in the network device.

6. The method according to claim 5, characterized in that The expanding the capacity of the third-level cache for storing processing rules in the network device includes: Determining a second ratio corresponding to the target time period, the second ratio comprising a ratio of the number of historical processing rules read from the memory of the network device to the total number of historical processing data packets acquired within the target time period, the historical data packets processed using the historical processing rules being obtained before the data packets to be processed; According to the second ratio, it is determined whether to expand the capacity of the third-level cache for storing processing rules in the network device.

7. The method according to claim 6, characterized in that The determining, according to the second ratio, whether to expand the capacity of the third-level cache for storing the processing rules in the network device includes: If the second ratios corresponding to the consecutive multiple time periods including the target time period gradually increase, the capacity of the third-level cache for storing the processing rules in the network device is expanded; If the second ratios corresponding to the plurality of consecutive time periods including the target time period do not gradually increase, the capacity of the third-level cache for storing processing rules in the network device is maintained.

8. The method according to claim 4 or 7, characterized in that: The method further comprises: If the amount of data packets acquired by the network device in other time periods after the target time period is less than the preset threshold, stop expanding the capacity of the third-level cache for storing processing rules in the network device; or, If the amount of data packets acquired by the network device in other time periods after the target time period is less than the preset threshold, the expansion of the third-level cache used for data packet writing in the network device is stopped.

9. The method according to claim 1, characterized in that: The determining of a target storage space for writing the to-be-processed data packet comprises: The target pointer pointing to the target storage space is read from the circular queue in a first-in-first-out order, and the pointer stored in the circular queue points to the storage space that can be used as a third-level cache for writing data packets.

10. The method according to claim 9, characterized in that The method further comprises: Obtaining a preset length and a total amount of cache lines included in a level 3 cache for writing data packets; Determine a first quantity according to the preset length and the data length of the candidate data packet; It is determined whether to set the length of the circular queue to the preset length according to the first number and the total amount of the cache lines.

11. The method according to claim 9, characterized in that The method further comprises: Determine a time interval corresponding to a same storage space in the network device, the time interval reflecting the interval between consecutive data packets being written to the same storage space, the same storage space corresponding to any cache line in a third-level cache for writing data packets; If the time interval is greater than a preset interval, determining that the same storage space corresponds to a target cache line; determining a second number of the target cache lines in the L3 cache for writing the data packet; The capacity of the third-level cache in the network device for writing data packets is adjusted according to the second number.

12. The method according to any one of claims 1 to 11, characterized in that The network device is used to implement the user plane function of a core network, and the core network is deployed in a dedicated network.

13. A cache allocation method, characterized in that: include: In response to obtaining the data packet to be processed, determining a target storage space in the network device for writing the data packet to be processed; Using the target storage space as a third-level cache in the network device for writing data packets, and controlling the data packets to be processed to be written into the third-level cache; In response to the writing of the data packet to be processed, if the processing rules of the data packet to be processed are read from the memory of the network device, the third-level cache for storing the processing rules in the network device is expanded, and the third-level cache for storing the processing rules and the third-level cache for writing data packets are deployed separately in the network device.

14. A network device, characterized in that: Used to implement the user plane function of the core network, including: a central processing unit CPU, a network card and a memory, wherein a storage space of a preset capacity in the memory is used as a third-level cache for writing data packets; The network card is used to obtain data packets to be processed; The CPU is used to determine a target storage space in a network device for writing the data packet to be processed in response to the acquisition of the data packet to be processed; use the target storage space as the third-level cache for writing the data packet to control the writing of the data packet to be processed into the third-level cache; if the target storage space is used as the memory of the network device before the data packet to be processed is written, the third-level cache in the network device for writing the data packet is expanded.

15. A non-transitory machine-readable storage medium, characterized in that: The non-transitory machine-readable storage medium stores executable code, and when the executable code is executed by a processor of an electronic device, the processor is caused to execute the cache allocation method according to any one of claims 1 to 13.