CN111488316B - File cache recovery method and device - Google Patents

File cache recovery method and device Download PDF

Info

Publication number
CN111488316B
CN111488316B CN202010282546.6A CN202010282546A CN111488316B CN 111488316 B CN111488316 B CN 111488316B CN 202010282546 A CN202010282546 A CN 202010282546A CN 111488316 B CN111488316 B CN 111488316B
Authority
CN
China
Prior art keywords
file cache
memory
file
target system
cache
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010282546.6A
Other languages
Chinese (zh)
Other versions
CN111488316A (en
Inventor
魏方征
汪庆权
胡飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou DPTech Technologies Co Ltd
Original Assignee
Hangzhou DPTech Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou DPTech Technologies Co Ltd filed Critical Hangzhou DPTech Technologies Co Ltd
Priority to CN202010282546.6A priority Critical patent/CN111488316B/en
Publication of CN111488316A publication Critical patent/CN111488316A/en
Application granted granted Critical
Publication of CN111488316B publication Critical patent/CN111488316B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure relates to a file cache recycling method, a device, electronic equipment and a computer readable medium. The method comprises the following steps: acquiring an idle memory and a file cache of a target system; generating a file cache recovery command when the idle memory is smaller than a first threshold and the file cache is larger than a second threshold; performing recovery operation on the file cache of the target system based on the file cache recovery command; and when the idle memory is larger than a third threshold value, finishing the file cache recovery operation. The file cache recovery method, the file cache recovery device, the electronic equipment and the computer readable medium can effectively solve the problem that the auditing service fails to probabilistically allocate the memory when the file cache occupies too much memory, and improve the accuracy of network auditing.

Description

File cache recovery method and device
Technical Field
The disclosure relates to the field of computer information processing, and in particular relates to a file cache recycling method, a device, electronic equipment and a computer readable medium.
Background
Network audit refers to the examination of the internet surfing behavior of a user according to a certain security policy. In order to ensure high processing performance of the auditing system when the linux system supports network auditing, a non-dormancy mode is required to be selected to apply for the memory when the memory is applied, namely the memory system does not wait for recovering the file cache memory, and the application failure is directly returned when the idle memory of the system is insufficient.
However, a large number of behavior audit logs are generated in the running process of the network audit system, the logs need to be sent to a log server for storage so as to facilitate log query of historical logs, and files can be frequently read and written in the storage and query processes of log files. When the log server and the auditing system are the same device, the problem of memory consumption of the file cache memory is faced, if the file cache memory occupies too much memory, the memory application failure of the kernel auditing flow may be caused, and the accuracy of the auditing system is finally affected. Therefore, it becomes particularly important how to balance file caching and free memory.
The above information disclosed in the background section is only for enhancement of understanding of the background of the disclosure and therefore it may include information that does not form the prior art that is already known to a person of ordinary skill in the art.
Disclosure of Invention
In view of the above, the disclosure provides a method, an apparatus, an electronic device, and a computer readable medium for recovering a file cache, which can effectively solve the problem of probability of memory allocation failure of an audit service when the file cache occupies too much memory, and improve accuracy of network audit.
Other features and advantages of the present disclosure will be apparent from the following detailed description, or may be learned in part by the practice of the disclosure.
According to an aspect of the present disclosure, a method for recovering a file cache is provided, including: acquiring an idle memory and a file cache of a target system; generating a file cache recovery command when the idle memory is smaller than a first threshold and the file cache is larger than a second threshold; performing recovery operation on the file cache of the target system based on the file cache recovery command; and when the idle memory is larger than a third threshold value, finishing the file cache recovery operation.
In an exemplary embodiment of the present disclosure, before acquiring the idle memory and the file cache of the target system, the method includes: and controlling the target system to carry out network audit service, wherein the target system is a linux system.
In an exemplary embodiment of the present disclosure, acquiring the free memory and the file cache of the target system includes: and acquiring the idle memory and the file cache of the target system through a kernel thread.
In an exemplary embodiment of the present disclosure, obtaining, by a kernel thread, the free memory and the file cache of the target system includes: and periodically calling the kernel thread to acquire the idle memory and the file cache of the target system.
In an exemplary embodiment of the present disclosure, performing a reclamation operation on a file cache of the target system based on the file cache reclamation command includes: and carrying out file cache recovery operation on a plurality of memory management areas of the target system one by one based on the file cache recovery command.
In an exemplary embodiment of the present disclosure, performing a file cache reclamation operation on a plurality of memory management areas of the target system one by one based on the file cache reclamation command includes: calling a kernel cache recycling interface based on the file cache recycling command; acquiring file caches of a plurality of memory management areas of the target system through the kernel cache recovery interface; and recovering the file caches in the memory management areas one by one.
In an exemplary embodiment of the present disclosure, performing a reclamation operation on file caches of the plurality of memory management areas one by one includes: and after the file cache of the current memory management area is recycled, updating the idle memory based on the recycling operation.
In an exemplary embodiment of the present disclosure, further comprising: and when the idle memory is smaller than a third threshold value and the file cache is larger than a second threshold value, continuing to recycle the file caches in the rest memory management area.
In an exemplary embodiment of the present disclosure, further comprising: and when the idle memory is smaller than a first threshold value and the file cache is smaller than a second threshold value, a file cache recycling command is not generated.
According to an aspect of the present disclosure, a file cache reclaiming apparatus is provided, including: the data module is used for acquiring an idle memory and a file cache of the target system; the command module is used for generating a file cache recovery command when the idle memory is smaller than a first threshold value and the file cache is larger than a second threshold value; the recovery module is used for carrying out recovery operation on the file cache of the target system based on the file cache recovery command; and the completion module is used for completing the file cache recovery operation when the idle memory is larger than a third threshold value.
According to an aspect of the present disclosure, there is provided an electronic device including: one or more processors; a storage means for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the methods as described above.
According to an aspect of the present disclosure, a computer-readable medium is presented, on which a computer program is stored, which program, when being executed by a processor, implements a method as described above.
According to the file cache recycling method, the device, the electronic equipment and the computer readable medium, when the idle memory of the target system is smaller than a first threshold value and the file cache is larger than a second threshold value, a file cache recycling command is generated; performing recovery operation on the file cache of the target system based on the file cache recovery command; when the idle memory is larger than a third threshold value, the mode of the file cache recovery operation is completed, the problem that the auditing service fails to probabilistically allocate the memory when the file cache occupies too much memory can be effectively solved, and accuracy of network auditing is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings. The drawings described below are merely examples of the present disclosure and other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art.
FIG. 1 is a system block diagram illustrating a method and apparatus for file cache reclamation according to an exemplary embodiment.
FIG. 2 is a flow chart illustrating a method of file cache reclamation according to an exemplary embodiment.
Fig. 3 is a flow chart illustrating a method of file cache reclamation according to another exemplary embodiment.
Fig. 4 is a block diagram illustrating a file cache reclamation apparatus according to an exemplary embodiment.
Fig. 5 is a block diagram of an electronic device, according to an example embodiment.
Fig. 6 is a block diagram of a computer-readable medium shown according to an example embodiment.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments can be embodied in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar parts, and thus a repetitive description thereof will be omitted.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the disclosed aspects may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the disclosure.
The block diagrams depicted in the figures are merely functional entities and do not necessarily correspond to physically separate entities. That is, the functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The flow diagrams depicted in the figures are exemplary only, and do not necessarily include all of the elements and operations/steps, nor must they be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the order of actual execution may be changed according to actual situations.
It will be understood that, although the terms first, second, third, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one element from another element. Accordingly, a first component discussed below could be termed a second component without departing from the teachings of the concepts of the present disclosure. As used herein, the term "and/or" includes any one of the associated listed items and all combinations of one or more.
Those skilled in the art will appreciate that the drawings are schematic representations of example embodiments and that the modules or flows in the drawings are not necessarily required to practice the present disclosure, and therefore, should not be taken to limit the scope of the present disclosure.
The terms referred to in this disclosure are explained as follows:
network audit: the method refers to checking the surfing behavior of a user according to a certain security policy. For example, when auditing Email, if the Email subject of a certain client is appointed to audit whether the Email subject of the certain client contains an ABC keyword, the device filters the mail content coming from the client, extracts the related information of the message containing the appointed keyword, and sends a notification.
Memory: memory is one of the important components in a computer, and is a bridge for communication between the memory and the CPU. All programs in the computer are run in the memory, so the performance of the memory has a great influence on the computer. Memories (memories) are also called an internal Memory and a main Memory, and function to temporarily store operation data in a CPU and data exchanged with an external Memory such as a hard disk. As long as the computer is in operation, the CPU will call the data to be operated to the memory for operation, and after the operation is completed, the CPU will transmit the result, and the operation of the memory also determines the stable operation of the computer.
The inventor of the present disclosure finds that, because the efficiency of accessing the Memory is far higher than the efficiency of accessing the hard disk, in order to improve the read-write speed of the file, the Linux kernel caches the file in the Memory when accessing the file, and this portion of Memory is called a Cache Memory, and after the operation of accessing the file is finished, the Cache Memory is not automatically released, so that the file data can be directly obtained from the Memory when the same file is accessed next time, and the efficiency of accessing the file is greatly improved. The Cache Memory also automatically recovers a part, but not all, of the Memory when the system Memory is lower than a certain threshold, and stops recovery when the Memory level reaches a high water level, wherein the main recovery method comprises the following steps:
scheme 1: the memory is managed in blocks, and the independent memory space is divided for the auditing service to use independently, for example, the memory is divided into two parts of 10G and 6G for 16G, and 10G is used for the auditing service. 6G is used for the operating system and log query; thus, excessive memory of the query log can be avoided. The use of memory partitioning management in this way may result in underutilization of memory, such as the use of 6G memory allocated for query use without a query log would be wasteful
Scheme 2: and triggering recovery by using a linux self-contained Cache recovery mechanism during kswapd process and memory allocation. Because the recovery mechanism of Linux itself depends on the memory threshold of the memory management system, each zone of the physical memory in Linux has its own independent three thresholds of min, low and high. When the memory allocation is performed, if the allocator (such as the add allocation) finds that the value of the current free memory is lower than "low" but higher than "min", which indicates that the current memory faces a certain pressure, then after the memory allocation is completed, kswapd will be awakened to execute the memory reclamation operation until the free memory reaches a high threshold level, and then reclamation is finished. Under the condition, although the memory allocation can trigger the memory recovery, the problem that the memory is blocked by the memory recovery does not exist, the execution relationship between the memory allocation and the memory recovery is asynchronous, and the problem is seemingly solved, but when a network auditing system actually works, a large amount of memory is often required in a short time, the min/low/high phase difference of the system is smaller, at the moment, the rate of the memory recovery is fast, the rate of the memory recovery is not allocated, and finally, the situation of memory allocation failure still occurs, and the accuracy of auditing service is influenced by the memory failure.
Scheme 3: the script executes echo 3>/proc/sys/vm/drop_caches for cache reclamation by timing the remaining memory of the device. In this way, all Cache memories are directly recovered, but all file caches are lost while recovery is performed, so that the influence on the read-write performance of the files is great.
In view of the defects in the prior art, the disclosure provides a file cache recycling method and device, which are an optimization method for balancing file cache and memory allocation of kernel audit service, and aim to solve the problem of memory allocation failure of audit function when file cache is too large. The present disclosure is described in detail below in connection with specific embodiments.
FIG. 1 is a system block diagram of a method, apparatus, electronic device, and computer readable medium for file cache reclamation, according to an example embodiment.
As shown in fig. 1, the system architecture 10 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. Various communication client applications, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc., may be installed on the terminal devices 101, 102, 103.
The terminal devices 101, 102, 103 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like. The terminal devices 101, 102, 103 are provided with a linux system.
The server 105 may be a server providing various services, such as a background management server providing support for a platform browsed by a user using the terminal devices 101, 102, 103. The background management server can analyze the received data and feed back the processing result to the terminal equipment.
The terminal devices 101, 102, 103 may, for example, acquire free memory and file cache of the own system; the terminal device 101, 102, 103 may generate a file cache reclamation command, for example, when the free memory is smaller than a first threshold and the file cache is larger than a second threshold; the terminal device 101, 102, 103 may perform a reclamation operation on the file cache of the target system, for example, based on the file cache reclamation command; the terminal device 101, 102, 103 may complete the current file cache reclamation operation, for example, when the free memory is greater than a third threshold.
Server 105 may, for example, obtain the free memory and file cache of terminal device 101 (or 102 or 103); the server 105 may generate a file cache reclamation command, for example, when the free memory is less than a first threshold and the file cache is greater than a second threshold; server 105 may perform a reclamation operation on the file cache of the target system, e.g., based on the file cache reclamation command; the server 105 may complete the current file cache reclamation operation, for example, when the free memory is greater than a third threshold.
The server 105 may be an entity server, or may be a plurality of servers, for example, it should be noted that the method for recovering a file cache provided in the embodiments of the present disclosure may be executed by the server 105 or the terminal devices 101, 102, 103, and accordingly, the file cache recovering apparatus may be disposed in the server 105 or the terminal devices 101, 102, 103.
According to the file cache recovery method, through the addition of the memory detection thread, the memory and file cache service conditions are periodically scanned, the idle memory threshold value, the file cache threshold value and the safe memory threshold value are set, and whether the file cache needs to be recovered and how much file cache needs to be recovered are judged according to the size relation among the idle memory, the file cache and the threshold values. When the idle memory is smaller than the idle threshold, indicating that the current system has little residual memory, and expecting to recover file cache for audit service; when recycling, firstly checking the size of the current file cache, if the file cache is smaller than a cache threshold value, indicating that the file cache occupies little memory, most of the memory is possibly occupied by audit service, recycling the cache and not solving the problem of shortage of the memory, and otherwise, if the file cache is larger than the cache threshold value, releasing more memory through recycling the cache; and selecting the principle of recovering as few files as possible when recovering the file cache, and ending the recovery when the free memory is larger than the safety threshold. The method can ensure that the kernel audit service cannot fail when applying for the memory, and can also fully utilize the file caching characteristic of the linux system, thereby ensuring the efficiency of reading and writing the file during log inquiry.
FIG. 2 is a flow chart illustrating a method of file cache reclamation according to an exemplary embodiment. The file cache reclaiming method 20 at least includes steps S202 to S208.
As shown in fig. 2, in S202, the free memory and file cache of the target system are acquired. The target system is a linux system. Before acquiring the idle memory and the file cache of the target system, the method comprises the following steps: and controlling the target system to carry out network audit service.
In one embodiment, acquiring the free memory and file cache of the target system includes: and acquiring the idle memory and the file cache of the target system through a kernel thread. Specific examples are: and periodically calling the kernel thread to acquire the idle memory and the file cache of the target system.
In S204, when the idle memory is smaller than a first threshold and the file cache is larger than a second threshold, a file cache reclamation command is generated. In one embodiment, further comprising: and when the idle memory is smaller than a first threshold value and the file cache is smaller than a second threshold value, a file cache recycling command is not generated.
The first threshold may be considered as a minimum value of the system idle memory, and when the idle memory is smaller than the minimum value, reclamation is expected, and the first threshold may be also referred to as an idle memory threshold.
The second threshold may be considered as a minimum file cache threshold, and when the file cache is smaller than the minimum file cache, no reclamation is performed, and the second threshold may also be referred to as a cache memory threshold.
In S206, a reclamation operation is performed on the file cache of the target system based on the file cache reclamation command. Comprising the following steps: and carrying out file cache recovery operation on a plurality of memory management areas of the target system one by one based on the file cache recovery command.
In one embodiment, the file cache reclaiming operation is performed on the plurality of memory management areas of the target system one by one based on the file cache reclaiming command, including: calling a kernel cache recycling interface based on the file cache recycling command; acquiring file caches of a plurality of memory management areas of the target system through the kernel cache recovery interface; and recovering the file caches in the memory management areas one by one.
In one embodiment, further comprising: and after the file cache of the current memory management area is recycled, updating the idle memory based on the recycling operation.
In S208, when the idle memory is greater than the third threshold, the current file cache reclamation operation is completed. Further comprises: and when the idle memory is smaller than a third threshold value and the file cache is larger than a second threshold value, continuing to recycle the file caches in the rest memory management area.
The third threshold may be considered as a full level of free memory, and the third threshold may be referred to as a safe memory threshold, and when the file cache is reclaimed, the current reclamation operation is ended when the threshold is reached.
According to the file cache recovery method, the idle memory and the file cache of the target system are obtained; generating a file cache recovery command when the idle memory is smaller than a first threshold and the file cache is larger than a second threshold; performing recovery operation on the file cache of the target system based on the file cache recovery command; when the idle memory is larger than a third threshold value, the mode of the file cache recovery operation is completed, the problem that the auditing service fails to probabilistically allocate the memory when the file cache occupies too much memory can be effectively solved, and accuracy of network auditing is improved.
It should be clearly understood that this disclosure describes how to make and use particular examples, but the principles of this disclosure are not limited to any details of these examples. Rather, these principles can be applied to many other embodiments based on the teachings of the present disclosure.
Fig. 3 is a flow chart illustrating a method of file cache reclamation according to another exemplary embodiment. The flow shown in fig. 3 is a complementary description of the flow shown in fig. 2.
As shown in fig. 3, in S302, the memory usage is periodically checked. More specifically, the memory use condition can be periodically checked through the kernel thread, and the idle memory and the file cache of the system can be detected.
In S304, whether the free memory is smaller than a first threshold. Comparing the idle memory with the first threshold, if the idle memory is greater than the first threshold, step S302 is entered, and the periodic checking is continued. If the free content is smaller than the first threshold, the process proceeds to step S306.
In S306, whether the file cache is greater than a second threshold. Comparing the file cache with the second threshold, if the file cache is lower than the second threshold, which means that the file cache occupies less memory and does not need to be recycled, the process proceeds to step S302, and the periodic inspection is continued. If the file cache is greater than the second threshold, indicating that the file cache is more, the reclaiming needs to be performed, and the step S308 is entered.
In S308, the traverse memory manager performs file cache page reclamation in sequence. And (3) performing file cache recovery operation, traversing all memory management areas, and calling a kernel cache recovery interface (for example, a krink_zone interface, and taking an actual interface as a reference for different operating systems) to perform file cache page recovery.
In S310, whether the free memory is greater than a third threshold. When the file cache is recovered, all file cache pages are not required to be recovered, and the idle memory level only needs to reach a threshold value III. So after each recovery of one memory management area, it is checked whether the memory needs to be recovered continuously. If the free memory is smaller than the third threshold, the step S308 is entered to continue the reclamation, and if the free memory is larger than the third threshold, the reclamation is ended.
According to the file cache reclaiming method disclosed by the invention, reclaiming is triggered when the memory is lower than the first threshold value, and is ended when the memory is higher than the third threshold value, so that the third threshold value is larger than the first threshold value, and the frequency of cache reclaiming can be reduced. In addition, when the flow bursts, the auditing service can be ensured to be normally distributed to the memory because the first threshold value has a larger difference value from the memory distribution failure threshold value (the threshold value of the memory management module of the linux system).
According to the file cache recovery method, the use condition of the memory is scanned regularly by the kernel thread, and the file cache is recovered according to the set memory threshold, so that the problem of probability memory allocation failure of audit service when the file cache occupies too much memory can be effectively solved, and the accuracy of network audit can be improved.
Those skilled in the art will appreciate that all or part of the steps implementing the above described embodiments are implemented as a computer program executed by a CPU. The above-described functions defined by the above-described methods provided by the present disclosure are performed when the computer program is executed by a CPU. The program may be stored in a computer readable storage medium, which may be a read-only memory, a magnetic disk or an optical disk, etc.
Furthermore, it should be noted that the above-described figures are merely illustrative of the processes involved in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily appreciated that the processes shown in the above figures do not indicate or limit the temporal order of these processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, for example, among a plurality of modules.
The following are device embodiments of the present disclosure that may be used to perform method embodiments of the present disclosure. For details not disclosed in the embodiments of the apparatus of the present disclosure, please refer to the embodiments of the method of the present disclosure.
Fig. 4 is a block diagram illustrating a file cache reclamation apparatus according to an exemplary embodiment. As shown in fig. 4, the file cache reclaiming apparatus 40 includes: a data module 402, a command module 404, a reclamation module 406, and a completion module 408.
The data module 402 is configured to obtain an idle memory and a file cache of the target system; the target system can be a linux system, and can simultaneously conduct network audit business. The data module 402 is further configured to obtain, by using a kernel thread, the idle memory and the file cache of the target system.
The command module 404 is configured to generate a file cache reclamation command when the idle memory is smaller than a first threshold and the file cache is larger than a second threshold;
the reclamation module 406 is configured to perform reclamation operation on the file cache of the target system based on the file cache reclamation command; for example, the file cache reclaiming operation may be performed on a plurality of memory management areas of the target system one by one based on the file cache reclaiming command. The reclamation module 406 is further configured to invoke a kernel cache reclamation interface based on the file cache reclamation command; acquiring file caches of a plurality of memory management areas of the target system through the kernel cache recovery interface; and recovering the file caches in the memory management areas one by one.
The completion module 408 is configured to complete the current file cache reclamation operation when the free memory is greater than a third threshold.
According to the file cache recovery device, an idle memory and a file cache of a target system are obtained; generating a file cache recovery command when the idle memory is smaller than a first threshold and the file cache is larger than a second threshold; performing recovery operation on the file cache of the target system based on the file cache recovery command; when the idle memory is larger than a third threshold value, the mode of the file cache recovery operation is completed, the problem that the auditing service fails to probabilistically allocate the memory when the file cache occupies too much memory can be effectively solved, and accuracy of network auditing is improved.
Fig. 5 is a block diagram of an electronic device, according to an example embodiment.
An electronic device 500 according to such an embodiment of the present disclosure is described below with reference to fig. 5. The electronic device 500 shown in fig. 5 is merely an example and should not be construed to limit the functionality and scope of use of embodiments of the present disclosure in any way.
As shown in fig. 5, the electronic device 500 is embodied in the form of a general purpose computing device. The components of electronic device 500 may include, but are not limited to: at least one processing unit 510, at least one memory unit 520, a bus 530 connecting the different system components (including the memory unit 520 and the processing unit 510), a display unit 540, etc.
Wherein the storage unit stores program code executable by the processing unit 510 such that the processing unit 510 performs steps according to various exemplary embodiments of the present disclosure described in the above-described electronic prescription flow processing methods section of the present specification. For example, the processing unit 510 may perform the steps as shown in fig. 2, 3.
The memory unit 520 may include readable media in the form of volatile memory units, such as Random Access Memory (RAM) 5201 and/or cache memory unit 5202, and may further include Read Only Memory (ROM) 5203.
The storage unit 520 may also include a program/utility 5204 having a set (at least one) of program modules 5205, such program modules 5205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment.
Bus 530 may be one or more of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 500 may also communicate with one or more external devices 500' (e.g., keyboard, pointing device, bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 500, and/or any device (e.g., router, modem, etc.) that enables the electronic device 500 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 550. Also, electronic device 500 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet, through network adapter 560. The network adapter 560 may communicate with other modules of the electronic device 500 via the bus 530. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with electronic device 500, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, as shown in fig. 6, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, and includes several instructions to cause a computing device (may be a personal computer, a server, or a network device, etc.) to perform the above-described method according to the embodiments of the present disclosure.
The software product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, with readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A readable storage medium may also be any readable medium that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
The computer-readable medium carries one or more programs, which when executed by one of the devices, cause the computer-readable medium to perform the functions of: acquiring an idle memory and a file cache of a target system; generating a file cache recovery command when the idle memory is smaller than a first threshold and the file cache is larger than a second threshold; performing recovery operation on the file cache of the target system based on the file cache recovery command; and when the idle memory is larger than a third threshold value, finishing the file cache recovery operation.
Those skilled in the art will appreciate that the modules may be distributed throughout several devices as described in the embodiments, and that corresponding variations may be implemented in one or more devices that are unique to the embodiments. The modules of the above embodiments may be combined into one module, or may be further split into a plurality of sub-modules.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or in combination with the necessary hardware. Thus, the technical solutions according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, and include several instructions to cause a computing device (may be a personal computer, a server, a mobile terminal, or a network device, etc.) to perform the method according to the embodiments of the present disclosure.
Exemplary embodiments of the present disclosure are specifically illustrated and described above. It is to be understood that this disclosure is not limited to the particular arrangements, instrumentalities and methods of implementation described herein; on the contrary, the disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims (6)

1. The file cache recycling method is characterized by comprising the following steps of:
controlling a target system to carry out network audit service, wherein the target system is a linux system;
periodically calling a kernel thread to acquire an idle memory and a file cache of a target system;
generating a file cache reclamation command when the idle memory is smaller than a first threshold and the file cache is larger than a second threshold, and not generating the file cache reclamation command when the idle memory is smaller than the first threshold and the file cache is smaller than the second threshold;
performing recovery operation on the file cache of the target system based on the file cache recovery command;
and when the idle memory is larger than a third threshold value, finishing the file cache recovery operation.
2. The method of claim 1, wherein reclaiming the file cache of the target system based on the file cache reclamation command comprises:
and carrying out file cache recovery operation on a plurality of memory management areas of the target system one by one based on the file cache recovery command.
3. The method of claim 2, wherein performing the file cache reclamation operation on the plurality of memory management regions of the target system one by one based on the file cache reclamation command comprises:
calling a kernel cache recycling interface based on the file cache recycling command;
acquiring file caches of a plurality of memory management areas of the target system through the kernel cache recovery interface;
and recovering the file caches in the memory management areas one by one.
4. The method of claim 3, wherein reclaiming the file caches of the plurality of memory management areas one by one comprises:
and after the file cache of the current memory management area is recycled, updating the idle memory based on the recycling operation.
5. The method as recited in claim 4, further comprising:
and when the idle memory is smaller than a third threshold value and the file cache is larger than a second threshold value, continuing to recycle the file caches in the rest memory management area.
6. The utility model provides a file cache recovery unit which characterized in that includes:
the data module is used for controlling a target system to carry out network audit service, the target system is a linux system, and kernel threads are periodically called to acquire idle memory and file cache of the target system;
the command module is used for generating a file cache recycling command when the idle memory is smaller than a first threshold value and the file cache is larger than a second threshold value, and not generating the file cache recycling command when the idle memory is smaller than the first threshold value and the file cache is smaller than the second threshold value;
the recovery module is used for carrying out recovery operation on the file cache of the target system based on the file cache recovery command;
and the completion module is used for completing the file cache recovery operation when the idle memory is larger than a third threshold value.
CN202010282546.6A 2020-04-12 2020-04-12 File cache recovery method and device Active CN111488316B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010282546.6A CN111488316B (en) 2020-04-12 2020-04-12 File cache recovery method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010282546.6A CN111488316B (en) 2020-04-12 2020-04-12 File cache recovery method and device

Publications (2)

Publication Number Publication Date
CN111488316A CN111488316A (en) 2020-08-04
CN111488316B true CN111488316B (en) 2023-09-22

Family

ID=71812718

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010282546.6A Active CN111488316B (en) 2020-04-12 2020-04-12 File cache recovery method and device

Country Status (1)

Country Link
CN (1) CN111488316B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112035253B (en) * 2020-08-27 2023-01-20 浪潮商用机器有限公司 Linux system page cache recovery method and related device
CN113986540B (en) * 2021-10-25 2024-05-10 苏州浪潮智能科技有限公司 Method and device for regularly recycling linux cache

Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6038571A (en) * 1996-01-31 2000-03-14 Kabushiki Kaisha Toshiba Resource management method and apparatus for information processing system of multitasking facility
WO2008135078A1 (en) * 2007-05-02 2008-11-13 Telefonaktiebolaget Lm Ericsson (Publ) Secure erasure of digital files
CN101833512A (en) * 2010-04-22 2010-09-15 中兴通讯股份有限公司 Method and device thereof for reclaiming memory
CN103092775A (en) * 2013-01-31 2013-05-08 武汉大学 Spatial data double cache method and mechanism based on key value structure
CN105760228A (en) * 2016-01-29 2016-07-13 珠海汇迪科技有限公司 Method for improving game fluency under low-memory Android device
CN106776375A (en) * 2016-12-27 2017-05-31 东方网力科技股份有限公司 Data cache method and device inside a kind of disk
CN107045530A (en) * 2017-01-20 2017-08-15 华中科技大学 A kind of method that object storage system is embodied as to local file system
CN107220076A (en) * 2016-09-27 2017-09-29 华为技术有限公司 A kind of method for recovering internal storage and device
CN108733507A (en) * 2017-04-17 2018-11-02 伊姆西Ip控股有限责任公司 The method and apparatus of file backup and recovery
CN109271355A (en) * 2018-08-27 2019-01-25 杭州迪普科技股份有限公司 A kind of method and device of cleaning journal file caching
CN109445943A (en) * 2018-10-24 2019-03-08 郑州云海信息技术有限公司 The EMS memory management process of I/O stack, system and relevant apparatus in kernel state system
CN109815425A (en) * 2018-12-14 2019-05-28 平安科技(深圳)有限公司 Caching data processing method, device, computer equipment and storage medium
CN110134652A (en) * 2019-05-10 2019-08-16 Oppo广东移动通信有限公司 Recovery method, device, electronic equipment and the storage medium of cache file
CN110162396A (en) * 2018-02-14 2019-08-23 阿里巴巴集团控股有限公司 Method for recovering internal storage, device, system and storage medium
CN110908923A (en) * 2018-09-14 2020-03-24 阿里巴巴集团控股有限公司 Memory recovery method and device
WO2020062986A1 (en) * 2018-09-26 2020-04-02 Oppo广东移动通信有限公司 Recovery method and device for page cache, storage medium and terminal

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8346740B2 (en) * 2005-07-22 2013-01-01 Hewlett-Packard Development Company, L.P. File cache management system
US9075813B2 (en) * 2011-09-15 2015-07-07 Red Hat, Inc. Saving a snapshot of free space of a file system on persistent storage

Patent Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6038571A (en) * 1996-01-31 2000-03-14 Kabushiki Kaisha Toshiba Resource management method and apparatus for information processing system of multitasking facility
WO2008135078A1 (en) * 2007-05-02 2008-11-13 Telefonaktiebolaget Lm Ericsson (Publ) Secure erasure of digital files
CN101833512A (en) * 2010-04-22 2010-09-15 中兴通讯股份有限公司 Method and device thereof for reclaiming memory
CN103092775A (en) * 2013-01-31 2013-05-08 武汉大学 Spatial data double cache method and mechanism based on key value structure
CN105760228A (en) * 2016-01-29 2016-07-13 珠海汇迪科技有限公司 Method for improving game fluency under low-memory Android device
WO2018059076A1 (en) * 2016-09-27 2018-04-05 华为技术有限公司 Memory recovery method and apparatus
CN107220076A (en) * 2016-09-27 2017-09-29 华为技术有限公司 A kind of method for recovering internal storage and device
CN106776375A (en) * 2016-12-27 2017-05-31 东方网力科技股份有限公司 Data cache method and device inside a kind of disk
CN107045530A (en) * 2017-01-20 2017-08-15 华中科技大学 A kind of method that object storage system is embodied as to local file system
CN108733507A (en) * 2017-04-17 2018-11-02 伊姆西Ip控股有限责任公司 The method and apparatus of file backup and recovery
CN110162396A (en) * 2018-02-14 2019-08-23 阿里巴巴集团控股有限公司 Method for recovering internal storage, device, system and storage medium
CN109271355A (en) * 2018-08-27 2019-01-25 杭州迪普科技股份有限公司 A kind of method and device of cleaning journal file caching
CN110908923A (en) * 2018-09-14 2020-03-24 阿里巴巴集团控股有限公司 Memory recovery method and device
WO2020062986A1 (en) * 2018-09-26 2020-04-02 Oppo广东移动通信有限公司 Recovery method and device for page cache, storage medium and terminal
CN109445943A (en) * 2018-10-24 2019-03-08 郑州云海信息技术有限公司 The EMS memory management process of I/O stack, system and relevant apparatus in kernel state system
CN109815425A (en) * 2018-12-14 2019-05-28 平安科技(深圳)有限公司 Caching data processing method, device, computer equipment and storage medium
CN110134652A (en) * 2019-05-10 2019-08-16 Oppo广东移动通信有限公司 Recovery method, device, electronic equipment and the storage medium of cache file

Also Published As

Publication number Publication date
CN111488316A (en) 2020-08-04

Similar Documents

Publication Publication Date Title
US11151499B2 (en) Discovering linkages between changes and incidents in information technology systems
JP6381801B2 (en) Dynamic scaling of storage volume for storage client file system
CN110865888B (en) Resource loading method and device, server and storage medium
US9003239B2 (en) Monitoring and resolving deadlocks, contention, runaway CPU and other virtual machine production issues
CN109857556B (en) Memory recovery method and device, storage medium and electronic equipment
CN110059477B (en) Attack detection method and device
US9501313B2 (en) Resource management and allocation using history information stored in application's commit signature log
CN107025256B (en) Method and system for reducing reactivation time of cloud-based services
US8918776B2 (en) Self-adapting software system
CN111488316B (en) File cache recovery method and device
CN113254445B (en) Real-time data storage method, device, computer equipment and storage medium
CN109951553B (en) Data processing method, system, electronic device and computer readable storage medium
US20200387381A1 (en) Prefetch filter table
US10796019B2 (en) Detecting personally identifiable information (PII) in telemetry data
CN109062602B (en) Data processing method and device for application program and electronic equipment
CN107657155B (en) Method and device for authenticating user operation authority
CN111858393A (en) Memory page management method, memory page management device, medium and electronic device
CN116521639A (en) Log data processing method, electronic equipment and computer readable medium
US20230236922A1 (en) Failure Prediction Using Informational Logs and Golden Signals
CN111562958A (en) Page data display management method and device
CN113791925B (en) Memory map file storage method and device
CN115484149B (en) Network switching method, network switching device, electronic equipment and storage medium
US20230161664A1 (en) Method of responding to operation, electronic device, and storage medium
CN115390992A (en) Virtual machine creating method, device, equipment and storage medium
CN116302154A (en) File processing method and device, electronic equipment and storage medium thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant