Data cache loading method and apparatus

By obtaining business information from network devices, identifying and storing target business instructions in the cache area, the problem of reduced cache hit rate is solved, and the execution efficiency of network devices is improved.

CN113934654BActive Publication Date: 2026-04-10NEW H3C SECURITY TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NEW H3C SECURITY TECH CO LTD
Filing Date
2021-09-26
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

When multiple service programs are configured in a network device, the CPU cache hit rate decreases, leading to a drop in execution efficiency.

Method used

By acquiring the service information of network devices, the target service program is identified and the target service instruction is stored in the cache area. The target bit is set to a write-prohibited state to ensure that the instruction is not overwritten, thereby improving the cache hit rate.

Benefits of technology

It improved the operational efficiency of the target business processes and enhanced the overall execution efficiency of network devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113934654B_ABST
    Figure CN113934654B_ABST
Patent Text Reader

Abstract

The application relates to a data cache loading method and system, and particularly relates to the technical field of network communication. The method comprises the following steps: obtaining service information corresponding to a network device; the service information is used for indicating the execution of each service program on the network device; determining target service instructions corresponding to a target service program according to the service information; determining a target cache area matched with the target service instructions in a cache area in the network device; and saving and locking the target service instructions in the target cache area. The above scheme screens out the target service program from each service program, and solidifies the target service instructions corresponding to the target service program in the target cache area, so that the target service instructions can be directly read from the cache area when the target service program is executed multiple times, the running efficiency of the target service program is improved, and the execution efficiency of the network device is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of network communication, and in particular to a data cache loading method and device. BACKGROUND

[0002] Network equipment is a typical electronic equipment, and its storage system is composed of registers, Cache, memory, flash memory and other non-volatile storage media. Cache is used to temporarily store data in memory, which is a partial copy of memory.

[0003] At present, software forwarding network equipment uses CPU software technology to realize data forwarding, and the work of the data plane also needs to be completed by the CPU. When the software forwarding network equipment is configured with only simple services such as IP forwarding, when the CPU needs to control the IP forwarding task, the instructions corresponding to the IP forwarding will be read from the memory (i.e. main memory) and copied to the cache, so that when the instructions are needed to be read again, they can be directly read from the cache, thereby improving the speed of executing the instructions.

[0004] However, in the above scheme, when multiple services are configured in the CPU, the instruction information corresponding to each service needs to be copied to the cache, and the data in the cache will be refreshed, resulting in a decrease in the Cache hit rate of the CPU. SUMMARY

[0005] The present application provides a data cache loading method and device, which improves the execution efficiency of network equipment. The technical scheme is as follows.

[0006] In one aspect, a data cache loading method is provided, which is applied to network equipment, and the method comprises:

[0007] Obtaining service information corresponding to the network equipment; the service information is used to indicate the execution of each service program on the network equipment;

[0008] Determining target service instructions corresponding to a target service program according to the service information;

[0009] Determining a target cache area matched with the target service instructions in a cache area in the network equipment;

[0010] Saving and locking the target service instructions in the target cache area.

[0011] In another aspect, a data cache loading device is provided, which is applied to network equipment, and the device comprises:

[0012] An observation submodule is configured to acquire service information corresponding to the network device, wherein the service information is used to indicate execution of each service program on the network device.

[0013] A decision submodule is configured to determine target service instructions corresponding to a target service program according to the service information.

[0014] An execution submodule is configured to determine a target cache area matching the target service instructions in a cache area in the network device.

[0015] The execution submodule is further configured to save and lock the target service instructions in the target cache area.

[0016] In another aspect, a computer device is provided, which includes a processor and a memory, and the memory stores at least one instruction, which is loaded and executed by the processor to implement the above data cache loading method.

[0017] In another aspect, a computer readable storage medium is provided, which stores at least one instruction or information, which is loaded and executed by a processor to implement the above data cache loading method.

[0018] The technical solution provided in the present application can include the following beneficial effects:

[0019] When multiple service programs other than IP forwarding are configured in the network device, the execution of each service program in the network device can be acquired first, so that the target service instructions in each service program that need to be solidified are determined, and the target cache area is solidified in the cache area according to the target service instructions, so as to save and lock the target service instructions in the target cache area. The above solution screens the target service program from each service program and solidifies the target service instructions corresponding to the target service program in the target cache area, so that the target service instructions can be directly read from the cache area when the target service program is executed multiple times, which improves the running efficiency of the target service program and the execution efficiency of the network device. BRIEF DESCRIPTION OF DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the specific embodiments or prior art of the present application, the drawings needed in the specific embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0021] Figure 1It is a data cache loading system schematic diagram according to an example embodiment.

[0022] Figure 2 It is a method flow chart of a data cache loading method according to an example embodiment.

[0023] Figure 3 It is a method flow chart of a data cache loading method according to an example embodiment.

[0024] Figure 4 It is a network equipment service processing schematic diagram according to an example embodiment.

[0025] Figure 5 It is a memory mapping schematic diagram according to an example embodiment.

[0026] Figure 6 It is a cache area solidification schematic diagram according to an example embodiment.

[0027] Figure 7 It is a flow schematic diagram of a data cache loading method according to an example embodiment.

[0028] Figure 8 It is a structure block diagram of a data cache loading device according to an example embodiment.

[0029] Figure 9 It is a communication equipment schematic diagram according to an example embodiment. DETAILED DESCRIPTION

[0030] The technical solutions of the present application will be described clearly and completely in combination with the drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.

[0031] It should be understood that the "indication" mentioned in the embodiments of the present application can be direct indication, indirect indication, or can be an indication of an associated relationship. For example, A indicates B, which can mean that B can be obtained through A; or it can mean that A indirectly indicates B, for example, A indicates C, and B can be obtained through C; or it can mean that A and B have an associated relationship.

[0032] In the description of the embodiments of the present application, the term "corresponding" can mean that there is a direct or indirect corresponding relationship between the two, or it can mean that there is an associated relationship between the two, or it can mean an indication and being indicated, configuration and being configured, etc.

[0033] In the embodiments of the present application, the "predefinition" can be achieved by pre-storing corresponding codes, tables or other means for indicating relevant information in devices (e.g., including terminal devices and network devices), and the specific implementation manner is not limited in the present application.

[0034] Figure 1 is a schematic diagram of a data cache loading system according to an exemplary embodiment. As Figure 1 shown, the cache loading system is a network device, which includes a CPU (central processing unit) 110 and a main memory 120.

[0035] In the storage area of the network device, the storage area can be divided into registers, L1 cache, L2 cache, L3 cache, main memory, local secondary storage and remote secondary storage in order of reading speed from fast to slow.

[0036] The registers are CPU registers, which are used to save a row of data read from the cache for the current execution or the execution of the CPU.

[0037] For a multi-core CPU, each core of the CPU usually has a corresponding L1 cache and L2 cache, and the L1 cache saves the cache line taken from the L2 cache.

[0038] The multiple cores of the CPU share an L3 cache, and the L2 cache corresponding to each core is used to save the cache line taken from the L3 cache.

[0039] The data reading speed of the L1 cache, L2 cache and L3 cache is about several nanoseconds to tens of nanoseconds, and when the CPU reads the memory (i.e., the main memory), the reading response time is usually greater than tens of nanoseconds.

[0040] As Figure 1 shown, when the central processor 110 needs to execute a certain service instruction in a certain service program, the CPU first addresses in the CPU cache according to the address of the service instruction (e.g., the address indicated by the previous instruction of the service instruction input into the CPU), and when the service instruction exists in the CPU cache, the service instruction stored in the CPU cache is uploaded to the register in the CPU, and the CPU executes the service instruction. If the service instruction does not exist in the CPU cache (i.e., cache miss), the CPU needs to address in the main memory according to the address of the service instruction, and returns the service instruction obtained by addressing to the cache, so that the CPU reads the service instruction from the cache.

[0041] And the time of CPU reading data from cache is far less than the time of CPU reading data from main memory. When the CPU does not read the required instruction or data from the cache, it is considered that a cache miss occurs, and the CPU needs to address data from the main memory, which causes the response speed of the device to be seriously reduced.

[0042] Therefore, in the embodiment of the present application, target bits can be added to the instructions or data stored in the cache. When the CPU reads data from the cache, for example, in the group associative mapping mode, the CPU addresses a certain cache group in the cache according to the memory address (i.e., the physical address). If the target bits of a certain row or several rows in the cache group are set to 1, the cache row can be set to a write-inhibited state. Therefore, the cache row will not be written before receiving the instruction to change the target bits, so the data will not be discarded, thereby ensuring that the CPU can directly obtain the instruction when addressing the cache group corresponding to the row and improving the speed of the CPU obtaining the target instruction.

[0043] Optionally, the cache area with target bits can be at least one of L1 cache, L2 cache, and L3 cache.

[0044] Figure 2 A method flowchart of a data cache loading method according to an exemplary embodiment is shown. The method is performed by a network device as shown in Figure 1 As shown in Figure 2 The data cache loading method can include the following steps:

[0045] Step 201: Obtain service information corresponding to the network device.

[0046] The service information is used to indicate the execution of each service program on the network device.

[0047] In the process of the network device performing IP forwarding through the CPU, the CPU can need to execute multiple service programs (such as IP change) to complete a complete IP forwarding process. At this time, the data generated by the execution of each service program can be saved to the memory (such as the main memory or the local storage) corresponding to the network device.

[0048] Therefore, the network device can obtain the service information stored in the memory, such as the execution times of each service program.

[0049] Step 202: Determine a target service instruction corresponding to a target service program according to the service information.

[0050] When the service information is acquired, the execution of each service program is known, and a target service program can be determined in each service program, and a target service instruction in the target service program can be determined.

[0051] Optionally, the target service program can be a service program with a high frequency in the running process of the network device, and when the service information is acquired, the target service program with a high frequency can be determined in each service program, and the target service instruction corresponding to the target service program can be determined, so as to solidify the target service instruction in the cache, and improve the running efficiency of the target service program.

[0052] In a possible implementation, the target service instruction is part or all of the instructions in the target service program.

[0053] Optionally, the target service instruction can be a function or code data in the target service program with a calling frequency higher than a threshold.

[0054] In step 203, a target cache area matching the target service instruction is determined in the cache area of the network device.

[0055] When the target service instruction to be saved is determined, the target cache area matching the target service instruction can be determined in the cache area of the network device, so that the network device can save and lock the target service instruction in the target cache area.

[0056] In step 204, the target service instruction is saved and locked in the target cache area.

[0057] When the CPU calls a service instruction, the cache area can be queried according to the address corresponding to the service instruction, and when the target service instruction is found in the cache area, the area in which the target service instruction is saved is the target cache area matching the target service instruction, and the target service instruction is directly locked in the target cache area.

[0058] When the CPU calls a service instruction, and the target service instruction is not found in the cache area according to the address corresponding to the service instruction, a cache miss occurs, and the CPU needs to query the target service instruction in the main memory according to the address and save the target service instruction in a sub-area of the cache area, and then the sub-area of the cache area is solidified, so that the target service instruction can be saved and locked in the target cache area.

[0059] In summary, when multiple service programs other than IP forwarding are configured in the network device, the execution of each service program in the network device can be acquired first, so as to determine the target service instruction that needs to be fixed in each service program, and according to the target service instruction, the target cache area is fixed to save and lock the target service instruction in the target cache area. The above scheme screens the target service program from each service program, and fixes the corresponding target service instruction of the target service program in the target cache area, so that when the target service program is executed multiple times, the target service instruction can be directly read from the cache area, the running efficiency of the target service program is improved, and the execution efficiency of the network device is improved.

[0060] Figure 3 is a method flow chart of a data cache loading method according to an exemplary embodiment. The method is performed by a network device as shown in Figure 1 The data cache loading method can include the following steps, as shown in Figure 3

[0061] Step 301, acquiring service information corresponding to the network device.

[0062] Please refer to Figure 4 , which shows a network device service processing schematic diagram related to an embodiment of the present application.

[0063] Optionally, the service information includes traffic data corresponding to each service program.

[0064] Optionally, the service information can include the number of ports corresponding to each service program.

[0065] In the network device as shown in Figure 4 , port 1, port 2 and port 3 are included, and port 1, port 2 and port 3 are used for forwarding messages. For example, the message received by the network device can be processed according to service program A and service program B in turn, and forwarded through port 1; the message received by the network device can also be processed according to service program C, and forwarded through port 2; the message received by the network device can also be processed according to service program A and service program C in turn, and forwarded through port 3.

[0066] When the service information corresponding to the network device is acquired, the service information can include the number of ports corresponding to each service program. For example, in the network device as shown in Figure 4 , service program A is used for data processing of messages forwarded by port 1, and is also used for data processing of messages forwarded by port 3; service program B is used for data processing of messages forwarded by port 1; and service program C is used for data processing of messages forwarded by port 3. Therefore, in the network device​Figure 4 In the network device shown, the number of ports corresponding to service program A is 2, while the number of ports corresponding to service programs B and C is 1 each.

[0067] When obtaining the service information corresponding to the network device, the service information may also include the amount of traffic data processed by the service program within a specified time.

[0068] For example, since business program A processes data on packets forwarded from both port 1 and port 3 simultaneously, the amount of traffic data processed by business program A within a specified time is the sum of the amounts of traffic data from port 1 and port 3 within the specified time.

[0069] Step 302: Determine the target business instruction corresponding to the target business program based on the business information.

[0070] In one possible implementation, when the business information includes the number of ports corresponding to each business program, the business program with the largest number of ports is identified as the target business program, and the business instruction corresponding to the target business program is identified as the target business instruction.

[0071] like Figure 4 As shown, there may be multiple ports in a network device, and the business program used to process data in each port may be different. Therefore, the number of ports corresponding to each business program may be different. In order to ensure that as many ports as possible can improve data forwarding efficiency, the business program with the largest number of ports can be taken as the target business program, and the business instruction corresponding to the target business program can be determined as the target business instruction.

[0072] When the target business instruction is stored in the cache area, it can be read directly from the cache area each time it is read, without CPU cache miss. This improves the execution speed of the target business program, and the data forwarding speed of multiple ports is also improved.

[0073] In one possible implementation, when the service information includes traffic data of each service program, the traffic data corresponding to each service program of the network device within a specified time period is obtained; the service program with the largest corresponding traffic data within the specified time period is identified as the target service program, and the service instruction corresponding to the target service program is identified as the target service instruction.

[0074] Similarly, Figure 4As shown, there can be different ports in the network device, and each port can use different service programs for data processing, and the data flow size of each port is different. For example, the data flow of port 1 is ten times that of port 2, and obviously the execution frequency of the service program in port 1 is higher.

[0075] Therefore, when monitoring the data flow size of each port of the network device within a specified time, and the execution frequency of each service program in each data forwarding process of each port, the actual call frequency (i.e. actual execution frequency) of each service program involved in the network device within the specified time can be obtained.

[0076] In a possible implementation, when the service information includes the traffic data of each service program, and the call frequency of each function in each service program.

[0077] According to the traffic data corresponding to each service program and the call frequency of each function in each service program, a target service instruction is determined; at this time, the service program containing the target service instruction is the target service program.

[0078] It can be known from Figure 4 As can be known from the above, there can be multiple ports in the network device, and the same service program can be used when the multiple ports perform data forwarding processes. And in different service programs, the same service instruction can be called, for example, function 1 can be called in service program A and service program B. Therefore, when considering fixing a certain service instruction as a target service instruction in the cache, the service instruction with a higher actual call frequency in each application program corresponding to each port of the network device can be fixed as the target service instruction in the cache, so as to improve the overall working efficiency of the network device.

[0079] Optionally, after obtaining the traffic data corresponding to each service program and the call frequency of each function in each service program, the actual call frequency of each service instruction is determined according to the traffic data corresponding to each service program and the call frequency of each function in each service program, and the service instruction with an actual call frequency satisfying a specified condition is determined as the target service instruction.

[0080] For example, when the traffic data of service program A is 100KB, the traffic data of service B is 200KB, the traffic data of service C is 20KB, service program A calls function 1 once and function 2 once, service B calls function 1 twice and function 3 once, and service C calls function 3 once, it can be known that, within a specified time, function 1 actually processes 500KB of traffic, function 2 actually processes 100KB of traffic, and function 3 processes 220KB of traffic.

[0081] If the specified condition (i.e., the actual number of calls) is that the traffic processed within a unit of time is 200KB, function 1 and function 3 can be determined as target service instructions.

[0082] Step 303: Addressing the target service instruction in the cache area in the network device to obtain an addressing result of the target service instruction.

[0083] When it is determined that solidification needs to be performed to lock the target service instruction in the cache area, the target service instruction can be addressed according to the address corresponding to the target service instruction.

[0084] Step 304: Determining a target cache area matching the target service instruction in the cache area according to the addressing result of the target service instruction.

[0085] In a possible implementation, when the target service instruction is addressed in the cache area in the network device, the sub-cache area in which the target service instruction is located is determined as the target cache area.

[0086] When the target service instruction is addressed in the cache area in the network device, it indicates that the target service instruction is saved in the cache area at this time, and the sub-cache area in which the target service instruction is stored in the cache area is the target cache area.

[0087] If the target service instruction is not addressed in the cache area in the network device, the network device needs to address the target service instruction in the main memory at this time.

[0088] In a possible implementation, the cache area and the main memory area in the embodiment of the present application are group-associative mapping.

[0089] Please refer to Figure 5 which shows a memory mapping diagram related to an embodiment of the present application. As shown in Figure 5As shown, the CPU's cache region can include several cache sets, each cache set containing several cache lines (or cache blocks), while main memory can be divided into several main memory blocks. When set-associative mapping is used, a main memory block can be stored in any line within a specified cache set. For example, the relationship between main memory addresses and cache sets can be described by the function q = j mod u, where q is the cache set number, j is the address of the main memory block, and u is the total number of cache sets.

[0090] Therefore, when adopting such Figure 5 When memory mapping is performed as shown, when a business instruction is read from main memory, the group in which the business instruction is stored in the cache region (e.g., group 1) can be determined based on the address information of the business instruction, and then stored in group 1. When the business instruction is determined to be the target business instruction through the above steps, the cache line corresponding to the target business instruction in group 1 can be locked (i.e., the target cache region is locked). At this time, the cache line corresponding to the target business instruction in group 1 can only be read and cannot be written. Therefore, when instructions from other addresses need to be written to group 1 through the function relationship q = j mod u, they can be written randomly or in a specified order to other unlocked lines in group 1.

[0091] In one possible implementation, when the target service instruction is not addressed in the cache area of ​​the network device, the target service instruction is addressed from the main memory module of the network device and saved to the cache area.

[0092] When the target service instruction is not found in the cache area of ​​the network device, it means that the target service instruction is not in the cache area and needs to be addressed in the main memory. The target service instruction is then rewritten into a group in the cache area according to the correspondence between the address and the cache area. The cache line in that group that stores the target service instruction is then set to a write-prohibited state, thereby ensuring that the cache line storing the target service instruction (i.e., the target cache area) is fixed.

[0093] In one possible implementation, when the sub-cache region corresponding to the target business instruction is determined, the target bit corresponding to the sub-cache region is set to a write-prohibited state; the target bit is used to indicate the read / write state of the sub-cache region.

[0094] In the embodiment of the present application, in order to solidify the cache line and ensure that other service programs cannot write into the cache line, a target bit is set in each cache line in the cache area, which is used to indicate whether the cache line is in a solidified state. For example, when the target bit of the cache line is 1, the target bit can be considered to be set in a write-prohibited state, and the cache line corresponding to the target bit is prohibited from being written into but can be read, so as to ensure that the target service instruction in the cache line is solidified in the cache area.

[0095] In step 305, when the new target service instruction is determined according to the new service information, the target bit of the target cache area is updated to a writable state.

[0096] When the new service information is reacquired, the network device can determine the new target service instruction according to the new service device through steps 301 and 302, re-determine the corresponding target cache area according to the new target service instruction, and update the target bit of the old target cache area to a writable state (for example, 0), so that the previous target cache area can perform a write operation again, so as to change from a solidified state to a normal working state.

[0097] Please refer to Figure 6 , which shows a solidified cache area according to an embodiment of the present application. As Figure 6 shown, through the software device containing the above steps of the embodiment of the present application, part of the solidified area can be separated in the cache area of the network device, so as to save the target service instruction and not be overwritten by other service instructions.

[0098] In the cache area according to the embodiment of the present application, a region is divided, which is used to load the specific code segment instruction data calculated by the scheme shown in the embodiment of the present application. The instructions and data cached in the region will not be replaced by the replacement algorithm after the cache device is full, and will be locked in the region until the software device designed in the patent is updated again, so as to reduce the probability of Cache Miss when the network device processes complex services.

[0099] It should be noted that the solidified area and the normal cache area shown in Figure 6 are only schematic representations. In the actual cache area, the position of the area solidified to save the target service instruction can be unfixed.

[0100] In summary, when multiple service programs other than IP forwarding are configured in the network device, the execution of each service program in the network device can be acquired first, so as to determine the target service instruction in each service program that needs to be solidified, and according to the target service instruction, the target cache area is solidified to save and lock the target service instruction in the target cache area. The above scheme screens the target service program from each service program, and solidifies the corresponding target service instruction in the target cache area, so that when the target service program is executed multiple times, the target service instruction can be directly read from the cache area, the running efficiency of the target service program is improved, and the execution efficiency of the network device is improved.

[0101] Figure 7 is a flowchart of a data cache loading method according to an exemplary embodiment. As shown in Figure 7 , for example, when only the message forwarding (i.e., data forwarding) process of a port in the network device is considered, the cache area in the CPU can be set in the following manner.

[0102] When the network device receives a message and needs to forward the message through port 1, the data needs to be processed by service program A, service program B, service program C, and service program A before forwarding the message.

[0103] At this time, since the CPU executes service program A, service program B, and service program C, the service instructions of service program A, service program B, and service program C need to be loaded into the cache area in sequence, so that the CPU can read the service instructions in the cache area to execute each service program.

[0104] Since the storage capacity of the cache area is small, the instructions of the service program loaded into the cache area later may cover the service instructions of the service program loaded earlier. For example, as shown in Figure 7 , when service program A receives a message, its corresponding service instructions need to be loaded into the cache area, and when service program B and service program C are loaded into the cache area, they may cover the service instructions of service program A, so that when service program A is called by the CPU after the execution of service program C on the message is completed, it needs to be read from the main memory again, which increases the execution time of service program A.

[0105] Therefore, as shown in Figure 7 , the execution frequency of each service program in a certain time period can be acquired first, and as shown in Figure 7The message forwarding steps shown, the service program A is executed twice in a message forwarding process, so the execution frequency of the service program A is obviously higher, when the sub-buffer area where the service instruction corresponding to the service program A is located is set to the write-prohibited state, thereby saving the service instruction corresponding to the service program A.

[0106] At this time, the service program A with higher execution frequency can directly read the corresponding service instruction in the cache area during execution, which significantly improves the overall execution efficiency of the message forwarding process.

[0107] Figure 8 The structure block diagram of the data cache loading device is shown according to an exemplary embodiment. The system is applied to the network device as shown Figure 1 The device includes:

[0108] The observation submodule 801 is configured to acquire service information corresponding to the network device; the service information is used to indicate execution of each service program on the network device.

[0109] The decision submodule 802 is configured to determine target service instructions corresponding to a target service program according to the service information.

[0110] The execution submodule 803 is configured to determine a target cache area matching the target service instructions in a cache area in the network device.

[0111] The execution submodule 803 is further configured to save and lock the target service instructions in the target cache area.

[0112] In a possible implementation manner, the execution submodule is specifically configured to:

[0113] address the target service instructions in the cache area in the network device to obtain an addressing result of the target service instructions.

[0114] According to the addressing result of the target service instructions, the target cache area matching the target service instructions is determined in the cache area.

[0115] In a possible implementation manner, the target cache area determination unit is specifically configured to:

[0116] When the target service instructions are addressed in the cache area in the network device, a sub-cache area where the target service instructions are located is determined as the target cache area.

[0117] Or,

[0118] When the target service instruction is not addressed in the cache area of the network device, a target cache area matching the target service instruction is determined in the cache area of the network device based on a mapping relationship between a physical address of the target service instruction and the cache area.

[0119] In a possible implementation, the execution submodule is further configured to:

[0120] The target bit corresponding to the sub-cache area is set as a write-prohibited state; and the target bit is used to indicate a read-write state of the sub-cache area.

[0121] In a possible implementation, the service information includes a port number corresponding to each of the service programs;

[0122] The decision submodule is configured to determine a service program with a maximum port number as the target service program, and determine a service instruction corresponding to the target service program as the target service instruction.

[0123] In a possible implementation, the service information includes traffic data of each of the service programs;

[0124] The observation submodule is further configured to acquire corresponding traffic data of each of the service programs of the network device within a specified time.

[0125] The decision submodule is further configured to determine a service program with maximum corresponding traffic data within the specified time as the target service program, and determine a service instruction corresponding to the target service program as the target service instruction.

[0126] In a possible implementation, the decision submodule is further configured to:

[0127] When a new target service program is determined according to new service information, the bit of the target cache area is updated to a writable state.

[0128] In summary, when multiple service programs except IP forwarding are configured in the network device, the execution of each service program in the network device can be acquired first, so that a target service instruction that needs to be fixed in each service program is determined, and a target cache area is fixed in the cache area according to the target service instruction, so as to save and lock the target service instruction in the target cache area. The above scheme screens a target service program from each service program, and fixes a target service instruction corresponding to the target service program in a target cache area, so that the target service instruction can be directly read from the cache area when the target service program is executed multiple times, the running efficiency of the target service program is improved, and the execution efficiency of the network device is improved.

[0129] Referring to Figure 9 Fig. 1 is a schematic diagram of a communication device according to an example embodiment of the present application, which comprises a memory and a processor, the memory is configured to store a computer program, and the computer program is configured to be executed by the processor to implement the method described above.

[0130] The processor can be a Central Processing Unit (CPU). The processor can also be other general-purpose processors, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination thereof.

[0131] The memory is a non-transitory computer readable storage medium, which can be configured to store a non-transitory software program, a non-transitory computer executable program and a module, such as the program instructions / module corresponding to the method in the embodiments of the present application. The processor executes various functions and data processing of the processor by running the non-transitory software program, instructions and modules stored in the memory, i.e. implements the method in the method embodiments described above.

[0132] The memory can include a program storage area and a data storage area. The program storage area can store an operating system and at least one application required by a function. The data storage area can store data created by the processor and the like. In addition, the memory can include a high-speed random access memory, and can also include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some embodiments, the memory can optionally include a memory remotely arranged with respect to the processor, and these remote memories can be connected to the processor through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0133] In an exemplary embodiment, a computer readable storage medium storing at least one computer program is also provided, the at least one computer program is loaded and executed by a processor to implement all or part of the steps in the above method. For example, the computer readable storage medium can be a Read-Only Memory (ROM), a Random Access Memory (RAM), a Compact Disc Read-Only Memory (CD-ROM), a magnetic tape, a floppy disk and an optical data storage device, etc.

[0134] Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. It is intended that the specification and examples be considered as exemplary only, with the true scope and spirit of the application being indicated by the following claims.

[0135] It is to be understood that the application is not limited to the precise details of design and construction that have been described and exemplified above and that various modifications and changes can be made by those skilled in the art without departing from the scope of the application. The scope of the application is limited only by the claims that follow.

Claims

1. A method of data cache loading, characterized by, The method is used for a network device, and the method comprises: obtaining service information corresponding to the network device; the service information is used for indicating execution of each service program on the network device; the service information comprises port numbers corresponding to the each service program respectively or traffic data of the each service program; determining a target service instruction corresponding to a target service program according to the service information; the target service instruction is a service instruction whose actual calling times satisfy a specified condition; determining a target cache area matching the target service instruction in a cache area in the network device; saving and locking the target service instruction in the target cache area; the determining of the target cache area matching the target service instruction in the cache area in the network device comprises: when the target service instruction is addressed in the cache area in the network device, determining a sub-cache area where the target service instruction is located as the target cache area.

2. The method of claim 1, wherein, the determining of the target cache area matching the target service instruction in the cache area in the network device further comprises: when the target service instruction is not addressed in the cache area in the network device, determining a target cache area matching the target service instruction in the cache area in the network device based on a mapping relationship between a physical address of the target service instruction and the cache area.

3. The method of claim 2, wherein, the saving and locking of the target service instruction in the target cache area comprises: setting a target bit corresponding to the sub-cache area as a write-prohibited state; the target bit is used for indicating a read-write state of the sub-cache area.

4. The method according to any one of claims 1 to 3, characterized in that, the determining of the target service instruction corresponding to the target service program according to the service information comprises: determining a service program with the largest corresponding port number as the target service program, and determining a service instruction corresponding to the target service program as the target service instruction.

5. The method according to any one of claims 1 to 3, characterized in that, the obtaining of the service information corresponding to the network device comprises: obtaining corresponding traffic data of each service program of the network device within a specified time; the determining of the target service instruction corresponding to the target service program according to the service information comprises: determining a service program with the largest corresponding traffic data within the specified time as the target service program, and determining a service instruction corresponding to the target service program as the target service instruction.

6. The method of claim 3, wherein, the method further comprises: when a new target service program is determined according to new service information, updating a bit of the target cache area as a writable state.

7. A data cache loading apparatus, characterized by, The device is applied to a network device, and the device comprises: an observation submodule, configured to obtain service information corresponding to the network device; the service information is used for indicating execution of each service program on the network device; the service information comprises port numbers corresponding to the each service program respectively or traffic data of the each service program; a decision submodule, configured to determine a target service instruction corresponding to a target service program according to the service information; the target service instruction is a service instruction whose actual calling times satisfy a specified condition; The execution submodule is configured to determine a target cache region in which the target service instruction matches in a cache region in the network device; The execution submodule is further configured to save and lock the target service instruction in the target cache region; The execution submodule is further configured to determine a target cache region in which the target service instruction matches in a cache region in the network device; When the target service instruction is addressed in the cache region in the network device, a sub-cache region in which the target service instruction is located is determined as the target cache region.

8. A computer device, comprising: The computer device includes a processor and a memory, and the memory stores at least one instruction, which is loaded and executed by the processor to implement the data cache loading method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction or information, which is loaded and executed by the processor to implement the data cache loading method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Cache access control method and Cache access control device

    CN102567220A