CN111190861B - Hot spot file management method, server and computer readable storage medium - Google Patents

Hot spot file management method, server and computer readable storage medium Download PDF

Info

Publication number
CN111190861B
CN111190861B CN201911373476.9A CN201911373476A CN111190861B CN 111190861 B CN111190861 B CN 111190861B CN 201911373476 A CN201911373476 A CN 201911373476A CN 111190861 B CN111190861 B CN 111190861B
Authority
CN
China
Prior art keywords
file
node
index information
target file
red
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
CN201911373476.9A
Other languages
Chinese (zh)
Other versions
CN111190861A (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.)
China Mobile Communications Group Co Ltd
China Mobile Hangzhou Information Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Hangzhou Information Technology 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 China Mobile Communications Group Co Ltd, China Mobile Hangzhou Information Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201911373476.9A priority Critical patent/CN111190861B/en
Publication of CN111190861A publication Critical patent/CN111190861A/en
Application granted granted Critical
Publication of CN111190861B publication Critical patent/CN111190861B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/13File access structures, e.g. distributed indices
    • G06F16/134Distributed indices
    • 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/14Details of searching files based on file metadata
    • G06F16/148File search processing
    • 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/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations
    • 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
    • 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/18File system types
    • G06F16/182Distributed file systems
    • G06F16/1824Distributed file systems implemented using Network-attached Storage [NAS] architecture
    • G06F16/183Provision of network file services by network file servers, e.g. by using NFS, CIFS
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

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)
  • Library & Information Science (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a hot spot file management method, which comprises the following steps: when receiving service request information of a target file, acquiring first index information and second index information of the target file; judging whether a first node exists in the nodes of the red-black tree according to the first index information; if not, inserting the first node into the red black tree; if yes, judging whether a second node exists in the nodes of the double linked list; if yes, the second node is moved to the head of the doubly linked list; if not, judging whether the target file is a hot spot file or not; if yes, inserting the second node into the head of the doubly linked list; and if not, deleting the first node and the first index information corresponding to the target file in the red-black tree. In the invention, the red and black trees are utilized to record the index information of the hot files, and the double linked lists are utilized to manage the storage and elimination of the hot files, thereby realizing real-time management and fully utilizing the disk space.

Description

Hot spot file management method, server and computer readable storage medium
Technical Field
The embodiment of the invention relates to the technical field of Internet, in particular to a hot spot file management method, a server and a computer readable storage medium.
Background
With the development of society, internet users rapidly grow to drive the vigorous development of internet economy, and mobile internet, electronic commerce, network video, brand network advertisement, network recruitment, network game and the like are rapidly developed and accumulated in a very short time, so that the internet users become an indispensable part of life of people. There is increasing concern about the updating of internet technology, and how to better, faster and more convenient share internet resources is a common focus of people. In order to make the internet content delivery faster and more stable, a content delivery network (Content Delivery Network, CDN) has evolved.
In the current CDN, since the capacity of a memory and a Solid State Disk (SSD) disc (also called a Solid State Disk) is limited, the memory and the Solid State Disk are generally only used to store a hotspot file, so how to manage the hotspot file becomes an important problem.
Because the existing scheme generally utilizes the third-party database to manage the hot spot files, when the client requests are acquired, the communication needs to be carried out to the third-party database, and the method has the defects that the hot spot files cannot be acquired in real time and are inconvenient to manage, and the disk space of the server is not fully utilized.
Disclosure of Invention
The invention aims to provide a hot spot file management method which can avoid using a third party database, and fully utilize a high-performance disk or a memory space to efficiently manage the storage and elimination of hot spot files in real time.
In order to solve the above technical problems, an embodiment of the present invention provides a hotspot file management method, which is applied to a server, and the method includes: when receiving service request information of a target file, acquiring first index information and second index information of the target file; searching in a pre-constructed red-black tree according to the first index information, and judging whether a first node representing the target file exists in the nodes of the red-black tree or not; inserting the first node into the red-black tree when the first node does not exist in the red-black tree, and storing the first index information in the first node; when the first node exists in the red-black tree, judging whether a second node representing the target file exists in the nodes of the pre-constructed doubly-linked list or not; when the second node exists in the nodes of the double-chain table, the second node is moved to the head of the double-chain table; when the second node does not exist in the nodes of the doubly linked list, judging whether the target file is a hot spot file or not; when the target file is a hot spot file, inserting the second node into the head of the doubly linked list, and storing the second index information in the second node; and deleting the first node and the first index information corresponding to the target file in the red-black tree when the target file is not a hot spot file.
The embodiment of the invention also provides a server, which comprises: at least one processor; and a memory communicatively coupled to the at least one processor; the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the steps of the hotspot file management method described above.
The embodiment of the invention also provides a computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the hot spot file management method.
Compared with the prior art, the embodiment of the invention directly uses the server memory without selecting a third party database to manage the hot spot files, records the index information of the hot spot files by constructing the red black tree and the double linked list and utilizes the red black tree, realizes quick search, manages the storage and elimination of the hot spot files by utilizing the linked list structure of the double linked list, realizes the real-time management of the hot spot files and fully utilizes the high-performance disk space. In addition, compared with the prior art, the embodiment of the invention can also utilize the structural attribute of the double linked list to insert or move the hot spot file to the head of the double linked list so as to ensure that file nodes in front of the linked list are all hottest.
Preferably, the first index information includes at least a uniform resource locator requesting the target file.
Preferably, the second index information includes at least a storage path of the target file in the server disk.
Preferably, before the receiving the service request information of the target file, the method further includes: and constructing the red black tree according to the first index information, and constructing the double-chain table according to the second index information.
Preferably, when the target file is a hotspot file, before inserting the second node into the header of the double-stranded table, the method further includes: applying for a memory address for the second node in the double-chain table, and simultaneously storing the memory address into the first index information of the target file in the red-black tree.
Preferably, the determining whether the target file is a hotspot file includes: setting a time period; recording the request times of the client to the target file in the time period; and when the request times are greater than a first threshold value, determining that the target file is a hot file.
Preferably, the method further comprises: judging whether the storage space of the server disk reaches a second threshold value or not; when the storage space of the disk reaches a second threshold value, deleting a preset number of nodes positioned at the tail of the double-chain table and second index information corresponding to the preset number of nodes from a tail scanning file list of the double-chain table; and searching and deleting the corresponding files of the preset number of nodes in the disk according to the corresponding second index information.
Preferably, the method further comprises: searching and deleting first index information and corresponding nodes corresponding to the preset number of nodes in the red and black tree according to the memory addresses of the preset number of nodes. The embodiment of the invention can also utilize the structural attribute of the double linked list, when the disk space is insufficient, the available space of the disk can be replaced by scanning a certain number of file nodes from the tail part of the double linked list and deleting the cold point file of the disk according to the scanned file nodes.
Drawings
One or more embodiments are illustrated by way of example and not limitation in the figures of the accompanying drawings.
FIG. 1 is a flow chart of a method for managing hot files according to a first embodiment of the present invention;
FIG. 2 is a flow chart of a method for hotspot file management according to a second embodiment of the present invention;
fig. 3 is a schematic structural view of a hot spot file management apparatus according to a third embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the following detailed description of the embodiments of the present invention will be given with reference to the accompanying drawings. However, those of ordinary skill in the art will understand that in various embodiments of the present invention, numerous technical details have been set forth in order to provide a better understanding of the present application. However, the technical solutions claimed in the present application can be implemented without these technical details and with various changes and modifications based on the following embodiments.
The first embodiment of the invention relates to a hot spot file management method, which is characterized in that a server memory is directly used, a tree structure of a red black tree is utilized to record hot spot file index information by constructing the red black tree and a double linked list, and the linked list structure of the double linked list is utilized to manage the storage and elimination of hot spot files, so that the real-time management of the hot spot files is realized, and the high-performance disk space is fully utilized. The implementation details of the hotspot file management method of the present embodiment are specifically described below, and the following description is merely provided for convenience of understanding, and is not necessary to implement the present embodiment.
Fig. 1 is a schematic flow chart of a hotspot file management method in the present embodiment, and the method is applied to a server.
In this embodiment, the execution sequence of the steps in the flowchart shown in fig. 1 may be changed, and some steps may be omitted according to different requirements.
Step S101: and when receiving the service request information of the target file, acquiring the first index information and the second index information of the target file.
In this embodiment, the first index information is a uniform resource locator (Uniform Resource Locator, URL) of the access file. Of course, the first index information may also include other file information, such as a memory address in step S107, which is not limited in this embodiment.
The URL is a representation method for specifying information locations on a web service program of the internet, and on the WWW, each information resource has a uniform and unique address on the internet, which is called URL, which is a uniform resource locator of the WWW, and which is called a network address. In this embodiment, the URL may be used to know the web page information of each file, and the number of URL accesses may be counted to further know the historical access frequency of the client to each file. Therefore, the historical access frequency of the client to the file can be used for judging whether the file is a hot spot file or a cold spot file. The cold spot file is a file with insufficient heat at the current time, but the cold spot file is not absolute, and may be a hot spot file at other specific time, and a specific method for determining a hot spot file will be described in detail in step S105.
The second index information is a storage path of the file in the server disk. The storage location of the file can be found through the storage path, and thus the storage location of the file can be quickly found through the second index information.
The client sends a request to the server to acquire the target file. When the server receives the request, the URL of the target file and the storage path of the target file in the server disk are obtained, and the request times (URL access times) of the target file are counted at the same time, so that the subsequent server can judge whether the target file is a hot spot file or not. In this embodiment, the disk may be a memory or an SSD disk, etc. for storing files or other data.
Step S102: searching in a pre-constructed red-black tree according to the first index information, and judging whether a first node representing the target file exists in the nodes of the red-black tree or not. Step S103 is performed when the first node does not exist in the red-black tree, and step S104 is performed when the first node exists in the red-black tree.
In this embodiment, before receiving the service request information of the target file, the server constructs a red-black tree in advance according to the first index information. Specifically, the server builds a red-black tree from the URL.
The red-black tree is a self-balancing binary search tree, a data structure used in computer science, and is typically used for realizing an associated array. Each file in the red-black tree represents a node of the red-black tree. First index information is maintained at each node. In this embodiment, the URL may be used as index information of each node, and the corresponding node may be quickly searched through the URL. Because of the balanced nature of the red black tree itself, the search time is extremely fast, and it can be found, inserted and deleted in O (log n) time, where n is the number of elements in the tree.
When receiving the service request of the target file, the URL of the target file is only required to be acquired, and the URL can be used for indexing in the red-black tree to confirm whether the URL of the target file exists in the red-black tree, so that whether the node corresponding to the target file exists in the red-black tree is confirmed.
Step S103: the first node is inserted into the red-black tree and the first index information is saved in the first node.
In this embodiment, when no node corresponding to the target file is found in the red-black tree, that is, no record about the target file is found in the red-black tree, a new node is inserted in the red-black tree, and URL information of the target file is stored in the node, so that the newly created node represents the target file.
Step S104: and judging whether a second node representing the target file exists in the nodes of the pre-constructed double linked list. Step S105 is executed when the second node does not exist in the nodes of the doubly linked list, whereas step S108 is executed when the second node exists in the nodes of the doubly linked list.
The double linked list is also called a double linked list, is one of linked lists, is another data structure different from a red-black tree, and has two pointers in each data node to direct successor and direct predecessor respectively. Therefore, starting from any node in the doubly linked list, its predecessor and successor nodes can be accessed very conveniently. Like the red-black tree, each file in the doubly linked list represents a node in the doubly linked list.
It should be noted that, since the file exists in the form of nodes in both the red-black tree and the double-chain table, the target file may exist in a corresponding node in both the red-black tree and the double-chain table, and therefore, the first node and the second node in this embodiment are only convenient for description, and are not limited to the nodes.
In this embodiment, before the service request information of the target file is received, the server further builds a doubly linked list in advance according to the second index information. The second index information may be a file storage path (hereinafter abbreviated as a storage path) of each file in the server disk, that is, a storage path of each file in the server disk is stored at each node. The server builds a doubly linked list (double linked list) from the path of the file stored in disk.
In this embodiment, whether a second node representing the target file exists in the nodes of the doubly linked list is determined by the following method:
in a preferred embodiment, searching is performed in the doubly linked list according to the second index information, and it is determined whether there is a second node representing the target file in the nodes of the doubly linked list.
In this embodiment, the second index information is a storage path, and when the server receives the service request information of the target file, the server indexes in the doubly linked list according to the acquired storage path of the target file, and when the doubly linked list has the storage path of the target file, the node representing the target file in the doubly linked list can be quickly found. When the storage path of the target file does not exist in the doubly linked list, it may be determined that a node representing the target file does not exist in the doubly linked list, that is, a file record of the target file does not exist in the doubly linked list.
In another preferred embodiment, whether the second node representing the target file exists in the nodes of the doubly linked list may also be determined by whether the first index information in the red-black tree further includes a memory address (see step S106 in detail), and only if the node corresponding to the target file applies for the memory address in the doubly linked list, the corresponding memory address is stored in the first index information in the red-black tree. Therefore, whether the second node representing the target file exists in the nodes of the doubly linked list can be rapidly judged by whether the memory address exists in the red-black tree.
Step S105: whether the target file is a hot file is determined, and when the target file is a hot file, step S106 is executed, otherwise, step S107 is executed.
The explanation of a hot file in the CDN domain is that a file that is frequently accessed, such as a web portal, is called a hot file when a news event occurs in a hot spot, and the public accesses the news event more frequently; for another example, a hot-broadcasted television show, the number of people watching the video file through downloading is relatively large, and the video file can be called a hot file. In this embodiment, whether the target file is a hot file is determined by:
setting a time period, recording the request times of the client for the target file in the time period, and determining that the target file is a hot spot file when the request times are greater than a first threshold value.
In this embodiment, the time period and the first threshold are set by a developer according to actual needs, and the present invention is not limited thereto. The number of requests of the client to the file object file can be determined by the number of URL accesses. For example, the server counts the URL access times of the target file, and when the count exceeds twice within 5 minutes, the target file is determined to be a hot file. I.e. a file is a hot file if the client accesses the file more than 2 times within 5 minutes.
Step S106: and inserting the second node into the head of the doubly-linked list, and storing the second index information in the second node.
When the target file is judged to be a hot file, the server applies for a memory address for the second node in the double-chain table, and simultaneously stores the memory address into the first index information of the target file in the red-black tree. Thus, the corresponding relation between the red black tree and the double-chain table is established through the memory address. At the same time, the server inserts the second node into the head of the doubly linked list, where the second index information (e.g., storage path) is stored.
Step S107: and deleting the first node and the first index information corresponding to the target file in the red black tree.
When the target file is determined not to be a hot spot file, the server deletes the first node corresponding to the target file and corresponding first index information in the red-black tree. That is, when it is determined that the target file is not a hotspot file, the server deletes the file record of the target file in the red-black tree.
Step S108: the second node is moved to the head of the doubly linked list.
When the second node exists in the nodes of the double-chain table, the target file is indicated to be inserted into the double-chain table as a hot file, so that when a new access request exists, the second node representing the target file is directly moved to the head of the double-chain table, and the heat of the target file is ensured.
If the server searches that the file node of the target file is already in the double-chain table, the stored double-chain table memory address of the file node is taken out of the red-black tree, the file node is directly taken out of the double-chain table and inserted into the head of the double-chain table, so that the request is hottest in the double-chain table when each access is performed, and the file which is not accessed for a long time can be slowly moved to the tail of the double-chain table.
In another preferred embodiment, it is not necessary to search for the second node representing the target file through the doubly linked list, and whether the second node representing the target file exists in the nodes of the doubly linked list can be directly judged through whether the first index information in the red black tree further contains a memory address.
Only if the node corresponding to the target file applies for the memory address in the double-chain table, the corresponding memory address is stored in the first index information in the red-black tree. Therefore, whether the second node representing the target file exists in the nodes of the doubly linked list can be rapidly judged by whether the memory address exists in the red-black tree.
That is, in this embodiment, if there is a node corresponding to the target file in the red-black tree, it may also be directly found whether there is a memory address of the target file in the node of the double-chain table from the index information of the red-black tree, and if the index information of the red-black table includes the memory address, it may be ensured that the target file is the hottest at present by directly moving the node of the target file in the double-chain table to the head of the double-chain table. There is no time delay since the linked list node can be fetched directly from the memory address without having to scan the doubly linked list from scratch.
According to the embodiment, the red black tree and the double-chain table are respectively built according to the storage paths of the first index information URL and the second index information file in the server disk, different index information is respectively stored in the red black tree and the double-chain table by one file, the red black tree and the double-chain table are associated with the index information of the red black tree through the memory address of the double-chain table, so that when the request information of the target file is received, whether the target file is a hot file can be judged by indexing the red black tree according to the URL of the target file, the storage path of the target file in the double-chain table can be quickly positioned according to the memory address stored in the red black tree, the hot file can be moved to the head of the double-chain table by utilizing the chain table structure of the double-chain table, real-time management of the hot file is realized, and in addition, the storage position of the target file in the disk can be quickly searched according to the storage path of the target file in the double-chain table.
Compared with the prior art, the embodiment of the invention directly uses the server memory, records the index information of the hot spot file by constructing the red black tree and the double linked list and utilizes the tree structure of the red black tree, and manages the storage of the hot spot file by utilizing the linked list structure of the double linked list, so that a third party database is not needed, no additional information communication transmission is needed, the real-time management of the hot spot file is realized, and the high-performance disk space is fully utilized.
The second embodiment of the invention relates to a hot spot file management method. The method is applied to the server. The second embodiment is a further improvement of the first embodiment of the present invention, and the main improvement is that: and when the disk space of the server is insufficient, scanning a certain number of file nodes from the tail part of the doubly linked list by utilizing the structural attribute of the doubly linked list, deleting cold point files in the disk according to the scanned file nodes, and replacing the available space of the disk.
As shown in fig. 2, the hotspot file management method in this embodiment specifically includes:
step S201: and when receiving the service request information of the target file, acquiring the first index information and the second index information of the target file.
Step S202: searching in a pre-constructed red-black tree according to the first index information, and judging whether a first node representing the target file exists in the nodes of the red-black tree or not. Step S203 is performed when the first node does not exist in the red-black tree, and step S204 is performed when the first node exists in the red-black tree.
Step S203: the first node is inserted into the red-black tree and the first index information is saved in the first node.
Step S204: and judging whether a second node representing the target file exists in the nodes of the pre-constructed double linked list. Step S205 is executed when the second node does not exist in the nodes of the doubly linked list, whereas step S208 is executed when the second node exists in the nodes of the doubly linked list.
Step S205: whether the target file is a hotspot file is determined, and when the target file is a hotspot file, step S206 is executed, otherwise, step S207 is executed.
Step S206: and inserting the second node into the head of the doubly-linked list, and storing the second index information in the second node.
Step S207: and deleting the first node and the first index information corresponding to the target file in the red black tree.
Step S208: the second node is moved to the head of the doubly linked list.
In this embodiment, the hot file is inserted into or moved to the head of the doubly linked list by using the structural attribute of the doubly linked list, so as to ensure that the file nodes in front of the linked list are all hottest.
In this embodiment, steps S209 and S210 are further included, and steps S201 to S208 are substantially the same as steps S101 to S108 in the first embodiment, respectively, and are not repeated here.
Step S209: and judging whether the storage space of the server disk reaches a second threshold, and executing step S210 when the storage space of the disk reaches the second threshold.
Step S210: and scanning a file list from the tail part of the double-chain table, deleting a preset number of second nodes positioned at the tail part of the double-chain table and corresponding second index information, and deleting corresponding files in the disk according to the corresponding second index information.
Further, step S210 further includes: the server also searches and deletes first index information and corresponding nodes corresponding to the preset number of nodes in the red and black tree according to the memory addresses of the preset number of nodes. The second threshold and the preset number are set by a developer according to needs, for example, when only 200M of server disk space remains available, deleting the data located at the tail 500 mbytes of the double-chain table to release the memory.
In this embodiment, after receiving a file request message sent by a client, the record in the red-black tree is searched first, and the search time is extremely fast due to the balance characteristic of the red-black tree itself, so that whether the file node record exists can be found in the O (log) time. And if the file node is found to be in the double-chain table, the stored double-chain table memory address of the file node is taken out from the red-black tree, the file node is directly taken out from the double-chain table and is inserted into the head part of the double-chain table, so that the request is the hottest in the double-chain table when each access is performed, and the file which is not accessed for a long time can be slowly moved to the tail part of the double-chain table. If the file node record is not found in the red black tree, the file index information is recorded in the red black tree, and in a certain time period, after the request meets the threshold value of the hot file, the file node information is inserted into the head of the doubly linked list, so that the current requested file can be guaranteed to be the hottest in all files in real time.
In this embodiment, because the doubly linked list is adopted, when the high-performance disk storage space such as the memory or the SSD is insufficient, the doubly linked list is reversely scanned from the tail, and a certain number of files are deleted to replace the disk space.
Compared with the prior art, the embodiment of the invention directly uses the server memory, records the index information of the hot spot file by constructing the red black tree and the double linked list and manages the storage and elimination of the hot spot file by utilizing the tree structure of the red black tree and the linked list structure of the double linked list, does not need to use a third party database, does not have additional information communication transmission, realizes the real-time management of the hot spot file and fully utilizes the high-performance disk space.
The above steps of the methods are divided, for clarity of description, and the execution sequence of the steps is not limited, and the steps can be combined into one step or split into a plurality of steps when implemented, so long as the steps comprise the same logic relationship, and the steps are all within the protection scope of the present patent; it is within the scope of this patent to add insignificant modifications to the algorithm or flow or introduce insignificant designs, but not to alter the core design of its algorithm and flow.
A third embodiment of the present invention relates to a hotspot file management apparatus, as shown in fig. 3, comprising at least one processor 301; and a memory 302 communicatively coupled to the at least one processor 301; the memory 302 stores instructions executable by the at least one processor 301, the instructions being executable by the at least one processor 301 to enable the at least one processor 301 to perform the steps of the hot spot file management method described above.
Where the processor 301 and the memory 302 are connected by a bus, the bus may comprise any number of interconnected buses and bridges, the buses connecting the various circuits of the one or more processors 301 and the memory 302 together. The bus may also connect various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art, and therefore, will not be described any further herein. The bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or may be a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor 301 is transmitted over a wireless medium via an antenna, which further receives the data and transmits the data to the processor 301.
The processor 301 is responsible for managing the bus and general processing and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And memory 302 may be used to store data used by processor 301 in performing operations.
The embodiment of the invention also provides a computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the hot spot file management method.
That is, it will be understood by those skilled in the art that all or part of the steps in implementing the methods of the embodiments described above may be implemented by a program stored in a storage medium, where the program includes several instructions for causing a device (which may be a single-chip microcomputer, a chip or the like) or a processor (processor) to perform all or part of the steps in the methods of the embodiments described herein. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It will be understood by those of ordinary skill in the art that the foregoing embodiments are specific examples of carrying out the invention and that various changes in form and details may be made therein without departing from the spirit and scope of the invention.

Claims (10)

1. A hotspot file management method applied to a server, comprising the following steps:
when receiving service request information of a target file, acquiring first index information and second index information of the target file;
searching in a pre-constructed red-black tree according to the first index information, and judging whether a first node representing the target file exists in the nodes of the red-black tree or not;
inserting the first node into the red-black tree when the first node does not exist in the red-black tree, and storing the first index information in the first node;
when the first node exists in the red-black tree, judging whether a second node representing the target file exists in the nodes of the pre-constructed doubly-linked list or not;
when the second node exists in the nodes of the double-chain table, the second node is moved to the head of the double-chain table;
when the second node does not exist in the nodes of the doubly linked list, judging whether the target file is a hot spot file or not;
when the target file is a hot spot file, inserting the second node into the head of the doubly linked list, and storing the second index information in the second node;
and deleting the first node and the first index information corresponding to the target file in the red-black tree when the target file is not a hot spot file.
2. The hotspot file management method of claim 1, wherein the first index information comprises at least a uniform resource locator requesting the target file.
3. The hotspot file management method according to claim 1, wherein the second index information at least includes a storage path of the target file in a server disk.
4. The hotspot file management method according to claim 1, further comprising, before the receiving the service request information of the target file: and constructing the red black tree according to the first index information, and constructing the double-chain table according to the second index information.
5. The method according to claim 1, wherein when the target file is a hotspot file, the inserting the second node into the header of the double-stranded table further comprises:
applying for a memory address for the second node in the double-chain table, and simultaneously storing the memory address into the first index information of the target file in the red-black tree.
6. The hotspot file management method according to claim 1, wherein the determining whether the target file is a hotspot file comprises:
setting a time period;
recording the request times of the client to the target file in the time period;
and when the request times are greater than a first threshold value, determining that the target file is a hot file.
7. A method of managing a hotspot file according to claim 3, further comprising:
judging whether the storage space of the server disk reaches a second threshold value or not;
when the storage space of the disk reaches a second threshold value, deleting a preset number of nodes positioned at the tail of the double-chain table and second index information corresponding to the preset number of nodes from a tail scanning file list of the double-chain table;
and searching and deleting the corresponding files of the preset number of nodes in the server disk according to the corresponding second index information.
8. The method for managing hot spot files according to claim 7, further comprising:
searching and deleting first index information and corresponding nodes corresponding to the preset number of nodes in the red and black tree according to the memory addresses of the preset number of nodes.
9. A server, comprising:
at least one processor; the method comprises the steps of,
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the steps of the hotspot file management method according to any of claims 1 to 8.
10. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the steps of the hotspot file management method according to any of claims 1 to 8.
CN201911373476.9A 2019-12-27 2019-12-27 Hot spot file management method, server and computer readable storage medium Active CN111190861B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911373476.9A CN111190861B (en) 2019-12-27 2019-12-27 Hot spot file management method, server and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911373476.9A CN111190861B (en) 2019-12-27 2019-12-27 Hot spot file management method, server and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN111190861A CN111190861A (en) 2020-05-22
CN111190861B true CN111190861B (en) 2023-06-30

Family

ID=70707690

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911373476.9A Active CN111190861B (en) 2019-12-27 2019-12-27 Hot spot file management method, server and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN111190861B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112000482B (en) * 2020-08-25 2024-03-05 北京金山云网络技术有限公司 Memory management method and device, electronic equipment and storage medium
CN112416946A (en) * 2020-12-09 2021-02-26 深圳市优必选科技股份有限公司 Method, apparatus, device and medium for managing playing content

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6493706B1 (en) * 1999-10-26 2002-12-10 Cisco Technology, Inc. Arrangement for enhancing weighted element searches in dynamically balanced trees
CN103440280A (en) * 2013-08-13 2013-12-11 江苏华大天益电力科技有限公司 Retrieval method and device applied to massive spatial data retrieval
CN103559215A (en) * 2013-10-14 2014-02-05 西安交通大学 Content name storage structure oriented design method in content network
CN104243425A (en) * 2013-06-19 2014-12-24 深圳市腾讯计算机系统有限公司 Content management method, device and system in content delivery network
US9069792B1 (en) * 2008-08-22 2015-06-30 Conifer Systems LLC Method and system for persistently cached, copy-on-write view of revision control trees
CN104933169A (en) * 2015-06-29 2015-09-23 南开大学 File system defragmentation method based on hotspot file priority
CN105447059A (en) * 2014-09-29 2016-03-30 华为技术有限公司 Data processing method and device
WO2016202199A1 (en) * 2015-06-18 2016-12-22 阿里巴巴集团控股有限公司 Distributed file system and file meta-information management method thereof
CN107729535A (en) * 2017-11-17 2018-02-23 中国科学技术大学 The collocation method of Bloom filter in a kind of key value database
CN109254962A (en) * 2017-07-06 2019-01-22 中国移动通信集团浙江有限公司 A kind of optimiged index method and device based on T- tree
CN110162525A (en) * 2019-04-17 2019-08-23 平安科技(深圳)有限公司 Read/write conflict solution, device and storage medium based on B+ tree
CN110321325A (en) * 2019-06-21 2019-10-11 腾讯科技(深圳)有限公司 File inode lookup method, terminal, server, system and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7069272B2 (en) * 2002-10-09 2006-06-27 Blackrock Financial Management, Inc. System and method for implementing dynamic set operations on data stored in a sorted array
WO2013001535A2 (en) * 2011-06-27 2013-01-03 Jethrodata Ltd. System, method and data structure for fast loading, storing and access to huge data sets in real time
US9116812B2 (en) * 2012-01-27 2015-08-25 Intelligent Intellectual Property Holdings 2 Llc Systems and methods for a de-duplication cache

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6493706B1 (en) * 1999-10-26 2002-12-10 Cisco Technology, Inc. Arrangement for enhancing weighted element searches in dynamically balanced trees
US9069792B1 (en) * 2008-08-22 2015-06-30 Conifer Systems LLC Method and system for persistently cached, copy-on-write view of revision control trees
CN104243425A (en) * 2013-06-19 2014-12-24 深圳市腾讯计算机系统有限公司 Content management method, device and system in content delivery network
CN103440280A (en) * 2013-08-13 2013-12-11 江苏华大天益电力科技有限公司 Retrieval method and device applied to massive spatial data retrieval
CN103559215A (en) * 2013-10-14 2014-02-05 西安交通大学 Content name storage structure oriented design method in content network
CN105447059A (en) * 2014-09-29 2016-03-30 华为技术有限公司 Data processing method and device
WO2016202199A1 (en) * 2015-06-18 2016-12-22 阿里巴巴集团控股有限公司 Distributed file system and file meta-information management method thereof
CN104933169A (en) * 2015-06-29 2015-09-23 南开大学 File system defragmentation method based on hotspot file priority
CN109254962A (en) * 2017-07-06 2019-01-22 中国移动通信集团浙江有限公司 A kind of optimiged index method and device based on T- tree
CN107729535A (en) * 2017-11-17 2018-02-23 中国科学技术大学 The collocation method of Bloom filter in a kind of key value database
CN110162525A (en) * 2019-04-17 2019-08-23 平安科技(深圳)有限公司 Read/write conflict solution, device and storage medium based on B+ tree
CN110321325A (en) * 2019-06-21 2019-10-11 腾讯科技(深圳)有限公司 File inode lookup method, terminal, server, system and storage medium

Also Published As

Publication number Publication date
CN111190861A (en) 2020-05-22

Similar Documents

Publication Publication Date Title
US6751627B2 (en) Method and apparatus to facilitate accessing data in network management protocol tables
CN111258978B (en) Data storage method
CN108614837B (en) File storage and retrieval method and device
CN109766318B (en) File reading method and device
CN104516974A (en) Management method and device for file system directory entry
CN108228799B (en) Object index information storage method and device
US11775480B2 (en) Method and system for deleting obsolete files from a file system
CN111190861B (en) Hot spot file management method, server and computer readable storage medium
CN112035766A (en) Webpage access method and device, storage medium and electronic equipment
CN111597259B (en) Data storage system, method, device, electronic equipment and storage medium
JP2011034323A (en) Information terminal device, method and program for retrieving information
CN108154024B (en) Data retrieval method and device and electronic equipment
US20110060788A1 (en) System and method for automatically providing metadata elements on a web page or web site
WO2021037072A1 (en) Buffer information updating method and apparatus, device, and medium
KR101524733B1 (en) A mobile terminal for connecting to website through ip network and a method for reducing connection time to the website
CN116842292A (en) Dynamic page caching method, electronic device, vehicle and storage medium
CN107977381B (en) Data configuration method, index management method, related device and computing equipment
KR102093166B1 (en) A method for reducing connection time to website and an apparatus for the method
KR102169930B1 (en) Semantic Information Management Method for a M2M/IoT platform
US11057470B2 (en) Communication device and communication method for processing meta data
CN105357105B (en) A kind of device and method promoting session speed
CN103685367A (en) Offline download system and offline download method
CN113411364A (en) Resource acquisition method and device and server
JP2009116496A (en) Directory server device, directory server program, directory service system, and directory service management method
JP5071990B2 (en) Database apparatus, database system, cache maintenance method and program 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