WO2020113941A1 - Data access method, apparatus and system based on mining computer, and readable storage medium - Google Patents
Data access method, apparatus and system based on mining computer, and readable storage medium Download PDFInfo
- Publication number
- WO2020113941A1 WO2020113941A1 PCT/CN2019/092004 CN2019092004W WO2020113941A1 WO 2020113941 A1 WO2020113941 A1 WO 2020113941A1 CN 2019092004 W CN2019092004 W CN 2019092004W WO 2020113941 A1 WO2020113941 A1 WO 2020113941A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data
- solid state
- linked list
- data access
- state disk
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/061—Improving I/O performance
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0655—Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
- G06F3/0658—Controller construction arrangements
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
- G06F3/068—Hybrid storage device
Definitions
- the invention relates to the field of cache acceleration, in particular to a data access method, device, system and computer-readable storage medium based on a mining machine.
- Miners are small computer equipment deployed in the homes of individual users. They are connected to the Internet through a home gateway to provide computing, storage, and bandwidth resources for cloud services.
- the cache acceleration scheme based on the small mining machine is to use the mechanical disk (HDD) or solid state disk (SSD) mounted on the mining machine as the cache, and download the file to the mining machine's disk for caching in advance.
- HDD mechanical disk
- SSD solid state disk
- the current cache acceleration solution has many problems, such as: high-performance solid-state disks are not fully utilized, resulting in waste of resources; insufficient IO output of mechanical disks, and cannot reach the expected output IO; the situation that mechanical disks are too concentrated in hot spots, There will be IO output bottlenecks, heat generation, and disk service life decline; furthermore, the requested data is in the mechanical disk. Because the mechanical disk IO performance is not high, the user response time increases, which affects the user experience. If all solid-state disks are used, the cost of user expenditure will increase.
- the main purpose of the present invention is to provide a data access method, device, system and computer-readable storage medium based on a mining machine, aiming to solve the technical problem of how to improve the cache acceleration performance of the mining machine.
- a data access method based on a mining machine includes:
- the solid state disk stores data in the mechanical disk that the number of times of access exceeds the first predetermined threshold
- the target data stored in the solid state disk is sent to the business system; if not, the target data stored in the mechanical disk is sent to the business system.
- the method before receiving the data access request sent by the service system, the method further includes:
- the method before adding the pointer corresponding to the first data to the cache linked list of the solid state disk, the method further includes:
- the pointer whose number of hits within the predetermined time duration is less than the third predetermined threshold is used as the pointer to be moved; if it does not exist, the pointer to be moved is determined from the cache linked list through the LRU strategy;
- the method before moving the pointer to be moved to the history cache linked list, the method further includes:
- the determining whether target data corresponding to the data access request is stored in the solid state disk includes:
- the method further includes:
- the present invention further provides a data access device based on a mining machine, the device includes a memory and a processor, and the memory stores a data access program that can run on the processor, the data When the access program is executed by the processor, any data access method described above is implemented.
- the device is a node constituting a CDN network or a blockchain network.
- the present invention further provides a data access system based on a mining machine, the system includes:
- the request receiving unit is used to receive the data access request sent by the business system
- the judging unit is used to judge whether the target data corresponding to the data access request is stored in the solid-state disk; the solid-state disk stores the data of the number of times the access in the mechanical disk exceeds the first predetermined threshold;
- a first data sending unit configured to send the target data stored in the solid state disk to the business system when the target data corresponding to the data access request is stored in the solid state disk;
- the second data sending unit is configured to send the target data stored in the mechanical disk to the business system when the target data corresponding to the data access request is not stored in the solid state disk.
- the present invention further provides a computer-readable storage medium having a data access program stored on the computer-readable storage medium, which can be executed by one or more processors to implement any of the above Data access method.
- a data access method based on a mining machine includes: receiving a data access request sent by a business system; and determining whether a solid state disk corresponding to the data access request is stored Target data; wherein, the solid-state disk stores data that the number of accesses in the mechanical disk exceeds a first predetermined threshold; if so, the target data stored in the solid-state disk is sent to the business system; if not, then Sending target data stored in the mechanical disk to the business system;
- the solid-state disk since the solid-state disk has high IO performance, it only stores data with high access frequency, so that when receiving the data access request sent by the business system, the target data is preferentially obtained from the solid-state disk. If the target data does not exist in the solid state disk, it is obtained from the mechanical disk. That is to say, this scheme combines the solid state disk and the mechanical disk to realize the data access method of the miner, uses the solid state disk with high IO performance to store data with high access frequency, and stores the mechanical disk with large capacity to store all The written data improves the cache acceleration performance of the miner through the combination of the two advantages.
- the invention also discloses a data access device, system and computer readable storage medium based on the mining machine, which can also achieve the above technical effects.
- FIG. 1 is a schematic flowchart of an embodiment of the present invention
- FIG. 3 is a schematic flowchart of another embodiment of the present invention.
- FIG. 4 is a schematic flowchart of a method for managing a cache linked list disclosed in an embodiment of the present invention
- FIG. 5 is a schematic schematic diagram of updating an LRU linked list disclosed in an embodiment of the present invention.
- FIG. 6 is a schematic structural diagram of a data access system based on a mining machine disclosed in an embodiment of the present invention.
- FIG. 7 is a schematic structural diagram of a data access device based on a mining machine disclosed in an embodiment of the present invention.
- first, second, etc. in the present invention are for descriptive purposes only, and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated .
- the features defined with “first” and “second” may include at least one of the features either explicitly or implicitly.
- the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of those skilled in the art to realize. When the combination of technical solutions contradicts or cannot be realized, it should be considered that the combination of such technical solutions does not exist , Nor within the protection scope claimed by the present invention.
- the embodiment of the invention discloses a data access method based on a mining machine.
- FIG. 1 is a schematic flowchart of an embodiment of the present invention.
- the method includes:
- the miner applying the data access method described in this embodiment must have at least one mechanical disk (HDD) and one solid state disk (SSD).
- the mechanical disk serves as a storage layer to store all written data.
- the solid state disk As a cache layer to provide high-performance IO output medium. Therefore, in terms of overall logic, the data method is mainly divided into a business layer, a cache layer, and a storage layer. Referring to FIG. 2, it is a logic flow chart of the overall solution of an embodiment of the present invention. As can be seen from FIG.
- the business layer Provided to users with different needs, each user has their own different business needs, that is to say, users realize the storage and reading of data through different business systems;
- the cache layer is mainly responsible for reading data in the business layer according to Information such as the frequency of user data reads maintains the data in the solid-state disk to provide high-performance cache functions;
- the storage layer is responsible for writing the data safely and accurately to the mechanical disk
- the mechanical disk has a larger capacity than the solid state disk, the solid state disk capacity is relatively small.
- the data access method provided in this embodiment is described based on the perspective of the cache layer.
- the data access request in this embodiment can be specifically understood as a data acquisition request. If the request sent by the user through the business system is a data write request, the request is directly sent to the storage layer, and the data is directly stored to the mechanical disk through the storage layer. The mechanical disk realizes the storage of data.
- S102 Determine whether the target data corresponding to the data access request is stored in the solid state disk; wherein, the solid state disk stores data in the mechanical disk that the number of times of access exceeds the first predetermined threshold; if yes, perform S103; if not , Execute S104;
- the data in the mechanical disk that is accessed more than the first predetermined threshold is not only stored in the mechanical disk, but also stored in the solid state disk, so that when users access the data, they can first search from the solid state disk, if found, then The data in the solid state disk is directly returned. If it cannot be found, it is searched from the mechanical disk and the search result is returned. If the data is not found in the solid state disk and the mechanical disk, the prompt message that the search fails is returned.
- cache index information is stored in the solid state disk, and data is retrieved from the solid state disk through the cache index information.
- the cache information includes cache index information and corresponding data; therefore, the cache information will be gradually established according to the user's request during the cold start of the program.
- the cache information can be periodically flushed to the mechanical disk for persistent operation when necessary. The cache information is reloaded when the program starts.
- the index information structure is defined as follows:
- the solid-state disk is in a state where there is no cache data or there is less cache data If you still get the data from the solid state drive first, it will cause a problem that the access hit rate of the solid state drive is low.
- the mechanical disk and the solid state disk are mixed.
- the mechanical disk has a large capacity and is responsible for storing data.
- the solid state disk has high IO performance and is responsible for data caching, thereby improving the mining performance.
- the overall IO performance of the computer; in actual use, the hotspot data is about 20%, so that the solid state disk can completely cover the storage of hotspot data; and for the business layer, the business layer does not perceive whether the data comes from the storage layer or the cache
- the high IO performance of the solid state disk is maximized, which can solve the difficult problems of mechanical disk heating in high hot spots, shortened disk life, and low IO output. It can also provide users with better Playing and downloading experience.
- the embodiment of the present invention discloses another data access method based on a mining machine.
- FIG. 3 is a schematic flowchart of another embodiment of the present invention.
- the method includes:
- S202 Determine whether the target data is stored in the solid-state disk by using a cache linked list; wherein, the solid-state disk stores data that the number of accesses in the mechanical disk exceeds the first predetermined threshold; if yes, execute S204; if no, then Perform S203;
- the cache index information may include cache linked list cacheing and historical cache linked list cache_history, and each linked list includes a pointer key corresponding to the data, and the pointer is used to point to the data stored in the solid state disk.
- the data in the mechanical disk that has been accessed more than the first predetermined threshold will be added to the cache list first. If the number of pointers in the cache list reaches the upper limit, you need to match the cache list according to the predetermined list movement rule. The pointer of is moved to the history cache linked list. If the number of pointers in the history cache linked list also reaches the upper limit, the corresponding pointer and corresponding data need to be deleted from the history cache list according to the predetermined list deletion rule.
- the corresponding target data can be quickly found according to the pointers in the linked list, and the pointers eliminated in the cache linked list are not directly deleted, but instead The pointer is added to the historical cache linked list, so that when searching for the target data, if the data is not found from the cache linked list with a high hit rate, it will continue to find from the historical cache linked list, thereby improving the data hit rate and realizing the mining machine's hit rate. Cache acceleration performance.
- this embodiment discloses a method for managing a cache linked list.
- the cache linked list management method described in this embodiment may not limit the execution order between the steps of the data access method described in any of the above embodiments, but in order to improve the data access hit rate, this implementation In the example, it may be set to be executed before the step of receiving the data access request sent by the service system.
- the detailed process of the data access method reference may be made to any of the above embodiments, which is not specifically described in this embodiment.
- FIG. 4 is a schematic flowchart of a method for managing a cache linked list disclosed in an embodiment of the present invention.
- the method includes:
- S302 Detect whether the number of pointers in the cache linked list exceeds a second predetermined threshold
- S307 Determine the pointer to be deleted from the history cache linked list through the LRU strategy, and delete the pointer to be deleted and the data corresponding to the pointer to be deleted;
- the two linked list chains, the cache list cacheing and the history cache list cache_history are both empty.
- the data can be read from the mechanical disk of the storage layer, and the number of hits exceeds At the first predetermined threshold, the data is copied to the solid state disk, and the pointer corresponding to the data is added to the cache linked list cacheing.
- the cache linked list has an upper limit of the number of pointers, and the upper limit is the second predetermined threshold. If a new pointer is added to the cache linked list, it is detected that the number of pointers in the cache linked list reaches the second predetermined threshold, At this time, a part of the linked list needs to be moved from the cache linked list according to the linked list moving rule.
- the linked list moving rule may include the following two types: a pointer to be hit less than a third predetermined threshold within a predetermined duration is used as a pointer to be moved, and moved to the historical cache linked list; if The number of pointer hits in the linked list is not less than the third predetermined threshold, at this time, the pointer to be moved can be determined from the cache linked list through the LRU strategy. As the number of requests continues to increase, the number of pointers in the history cache linked list will also reach the upper limit.
- the corresponding pointers need to be deleted according to the linked list deletion rule, which is an LRU strategy That is to say, the pointer to be deleted is determined from the history cache linked list according to the LRU strategy, and the pointer to be deleted and the data corresponding to the pointer to be deleted are both deleted.
- the linked list deletion rule which is an LRU strategy That is to say, the pointer to be deleted is determined from the history cache linked list according to the LRU strategy, and the pointer to be deleted and the data corresponding to the pointer to be deleted are both deleted.
- FIG. 5 it is a schematic schematic diagram of the LRU linked list update disclosed by an embodiment of the present invention.
- the new pointer data needs to be inserted into the head position of the linked list.
- the pointer data is moved to The head position of the linked list; if the entire chain reaches the upper limit of data and new pointer data is added, the data at the tail of the linked list needs to be eliminated directly; for the cached linked list, the eliminated pointer data is moved to the historical cache linked list, for the historical cache linked list , The deleted pointer data will be deleted directly.
- the method further includes: moving a pointer corresponding to the target data in the historical cache linked list to the cache linked list .
- the history cache linked list cache_history stores data that has been hit or eliminated, but if the data located in the historical cache linked list happens to be hit in a certain request, then the hit pointer key needs to be re-added to the cache linked list In the cacheing chain, similarly, the cache linked list cacheing needs to eliminate a key to the historical cache linked list cache_history according to the above linked list movement rules.
- this solution uses the above-mentioned cache linked list management method to keep the cache linked list cacheing chain and historical cache linked list cache_history in a balanced state of writing and elimination, while keeping the hot data of the mechanical disk gradually copied to the solid state disk for Cache acceleration will also delete the data eliminated by cache_history from the cache of the solid state disk. In this way, the probability of the business system hitting the data in the solid state disk can be increased, and the cache acceleration performance of the miner can be improved.
- this embodiment also discloses a data access system based on a mining machine.
- FIG. 6 it is a schematic structural diagram of a data access system based on a mining machine disclosed in an embodiment of the present invention.
- the system includes:
- the request receiving unit 100 is used to receive the data access request sent by the business system
- the judging unit 200 is used to judge whether the target data corresponding to the data access request is stored in the solid state disk; the solid state disk stores the data that the number of times of access in the mechanical disk exceeds the first predetermined threshold;
- the first data sending unit 300 is configured to send the target data stored in the solid state disk to the service system when the target data corresponding to the data access request is stored in the solid state disk;
- the second data sending unit 400 is configured to send the target data stored in the mechanical disk to the business system when the target data corresponding to the data access request is not stored in the solid state disk.
- this plan also includes:
- a first detection unit configured to detect whether there is data in the mechanical disk that the number of times of access exceeds a first predetermined threshold
- a data copying unit used to copy the data whose access times exceed the first predetermined threshold to the solid state disk when there is data in the mechanical disk whose access times exceed the first predetermined threshold;
- the pointer adding unit is used to add the pointer corresponding to the first data to the cache linked list of the solid state disk.
- this plan also includes:
- a second detection unit configured to detect whether the number of pointers in the cache linked list exceeds the second predetermined threshold; if not, trigger the pointer addition unit; if yes, trigger the hit count determination unit;
- the hit count judging unit is used to judge whether there is a pointer in the cache linked list that has a hit count less than a third predetermined threshold within a predetermined duration; if it exists, it triggers the first pointer-to-be-moved determination unit; if it does not exist, it triggers the second wait Move the pointer to determine the unit;
- a first pointer-to-be-moved determination unit configured to use a pointer whose number of hits within a predetermined time period is less than a third predetermined threshold as a pointer to be moved;
- a second pointer-to-be-moved determination unit configured to determine a pointer to be moved from the cache linked list through an LRU strategy
- the first pointer moving unit is used to move the pointer to be moved to the history cache linked list.
- this plan also includes:
- a pointer number judging unit used to judge whether the number of pointers in the history cache linked list exceeds the fourth predetermined threshold; if not, trigger the pointer moving unit; if yes, trigger the pointer determination unit to be deleted;
- a pointer-to-be-deleted determination unit configured to determine a pointer to be deleted from the historical cache linked list through an LRU strategy
- the pointer deleting unit is used to delete the pointer to be deleted and the data corresponding to the pointer to be deleted.
- the judgment unit includes:
- the first judgment subunit is used to judge whether the target data is stored in the solid state disk by using a cache linked list; if it is, trigger the first data sending unit; if not, trigger the second judgment subunit;
- the second judgment subunit is used to judge whether the target data is stored in the solid state disk by using a history cache linked list; if it is, the first data sending unit is triggered; if not, the second data sending unit is triggered.
- this plan also includes:
- a second pointer moving unit configured to move a pointer corresponding to the target data in the historical cache linked list to the cache linked list when using the historical cache linked list to determine that the solid-state disk stores the target data .
- an embodiment of the present invention further provides a computer-readable storage medium, and a data access program is stored on the computer-readable storage medium, and the data access program may be executed by one or more processors to implement any of the above The data access method described in the method embodiment.
- this embodiment also discloses a data access device 1 based on a mining machine.
- FIG. 7 is a schematic structural diagram of a data access device based on a mining machine disclosed in an embodiment of the present invention.
- the device includes a memory 11 and a processor 12, and the memory 11 stores data access that can run on the processor.
- Program 01. When the data access program 01 is executed by the processor, the data access method implemented by any of the foregoing method embodiments is implemented.
- the data access device 1 may be a PC (Personal Computer) or a smart phone, tablet computer, palmtop computer, portable computer, smart router, mining machine, and network storage device terminal device.
- PC Personal Computer
- smart phone tablet computer, palmtop computer, portable computer, smart router, mining machine, and network storage device terminal device.
- the device 1 may be a node constituting a CDN network or a blockchain network.
- the data access device 1 may include a memory 11, a processor 12, and a bus 13.
- the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, and the like.
- the memory 11 may be an internal storage unit of the data access device 1 in some embodiments, such as a hard disk of the data access device 1.
- the memory 11 may also be an external storage device of the data access device 1, such as a plug-in hard disk equipped on the data access device 1, a smart memory card (Smart Media, Card, SMC), and a secure digital (Secure Digital, SD) card, flash card (Flash Card), etc.
- the memory 11 may also include both the internal storage unit of the data access device 1 and the external storage device.
- the memory 11 can be used not only to store application software and various types of data installed in the data access device 1, such as codes of the data access program 01, but also to temporarily store data that has been or will be output.
- the processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip for running the program code or processing stored in the memory 11 Data, for example, data access program 01 is executed.
- CPU central processing unit
- controller microcontroller
- microprocessor or other data processing chip for running the program code or processing stored in the memory 11 Data, for example, data access program 01 is executed.
- the bus 13 may be a peripheral component interconnection (peripheral component interconnection, PCI for short) bus or an extended industry standard architecture (extended industry standard architecture, EISA) bus, or the like.
- PCI peripheral component interconnection
- EISA extended industry standard architecture
- the bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only a thick line is used in FIG. 7, but it does not mean that there is only one bus or one type of bus.
- the data access device may further include a network interface 14, and the network interface 14 may optionally include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used in the device 1 to communicate with other electronic devices. Establish a communication connection between devices.
- a network interface 14 may optionally include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used in the device 1 to communicate with other electronic devices. Establish a communication connection between devices.
- the device 1 may further include a user interface.
- the user interface may include a display and an input unit such as a keyboard.
- the optional user interface may also include a standard wired interface and a wireless interface.
- the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light emitting diode) touch device, or the like.
- the display may also be appropriately referred to as a display screen or a display unit, for displaying information processed in the data access device 1 and for displaying a visual user interface.
- FIG. 7 only shows the data access device 1 having the components 11-14 and the data access program 01.
- the structure shown in FIG. 7 does not constitute a limitation on the data access device 1, and may include There are fewer or more components than shown, or some components are combined, or different components are arranged.
- an embodiment of the present invention further provides a computer program product, including computer instructions, which, when run on a computer, enable the computer to execute the data access method described in any of the above method embodiments.
- the computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, all or part of the processes or functions according to the embodiments of the present invention are generated.
- the computer may be a general-purpose computer, a dedicated computer, a computer network, or other programmable devices.
- the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be from a website site, computer, server or data center Transmission to another website, computer, server or data center via wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.).
- wired such as coaxial cable, optical fiber, digital subscriber line (DSL)
- wireless such as infrared, wireless, microwave, etc.
- the computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server, a data center, or the like that includes one or more available medium integrations.
- the available media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), etc.
- the disclosed system, device, and method may be implemented in other ways.
- the device embodiments described above are only schematic.
- the division of the units is only a division of logical functions.
- there may be other divisions for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented.
- the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
- the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
- each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
- the above integrated unit may be implemented in the form of hardware or software functional unit.
- the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium.
- the technical solution of the present application essentially or part of the contribution to the existing technology or all or part of the technical solution can be embodied in the form of a software product, the computer software product is stored in a storage medium , Including several instructions to enable a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application.
- the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program code .
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
A data access method, apparatus and system based on a mining computer, and a readable storage medium. The method comprises: receiving a data access request sent by a service system; determining whether a solid state drive stores target data corresponding to the data access request, wherein the solid state drive stores data with the number of times of access exceeding a first predetermined threshold value in a hard disk drive; if the solid state drive stores target data corresponding to the data access request, sending the target data stored in the solid state drive to the service system; and if the solid state drive does not store target data corresponding to the data access request, sending the target data stored in the hard disk drive to the service system. Therefore, the solid state drive and the hard disk drive in the present solution are combined to realize a data access mode of the mining computer. The solid state drive with high IO performance is used for storing data with high access frequency, and the hard disk drive with high capacity is used for storing all written data. By combining the advantages of the solid state drive and the hard disk drive, the cache acceleration performance of the mining computer is improved.
Description
本申请要求于2018年12月06日提交中国专利局、申请号为201811488094.6、发明名称为“基于矿机的数据访问方法、装置、系统及可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requires the priority of the Chinese patent application filed on December 06, 2018 in the Chinese Patent Office with the application number 201811488094.6 and the invention titled "Data Access Method, Device, System and Readable Storage Media Based on Mining Machines". The entire contents are incorporated by reference in this application.
本发明涉及缓存加速领域,尤其涉及一种基于矿机的数据访问方法、装置、系统及计算机可读存储介质。The invention relates to the field of cache acceleration, in particular to a data access method, device, system and computer-readable storage medium based on a mining machine.
矿机是部署在个人用户家庭内的小型计算机设备,通过家庭网关连接到互联网,为云服务提供计算、存储和带宽资源。现在基于小矿机的缓存加速方案是使用矿机上挂载的机械盘(HDD)或者固态盘(SSD)作为缓存,预先将文件下载到矿机的磁盘中进行缓存,等用户请求资源时,根据用户请求找到数据存放目录,读取文件响应给用户。Miners are small computer equipment deployed in the homes of individual users. They are connected to the Internet through a home gateway to provide computing, storage, and bandwidth resources for cloud services. The cache acceleration scheme based on the small mining machine is to use the mechanical disk (HDD) or solid state disk (SSD) mounted on the mining machine as the cache, and download the file to the mining machine's disk for caching in advance. When the user requests resources, according to The user requests to find the data storage directory, reads the file and responds to the user.
目前的缓存加速方案存在诸多问题,例如:高性能的固态盘得不到充分利用,造成资源的浪费;机械盘IO输出不足,达不到预期的输出IO;机械盘在热点过于集中的情况,会有IO输出瓶颈,发热,磁盘使用寿命下降的情况;进而,请求数据在机械盘,由于机械盘IO性能不高,导致用户响应时间增大,影响用户体验。而如果全部使用固态盘,增加用户支出成本。The current cache acceleration solution has many problems, such as: high-performance solid-state disks are not fully utilized, resulting in waste of resources; insufficient IO output of mechanical disks, and cannot reach the expected output IO; the situation that mechanical disks are too concentrated in hot spots, There will be IO output bottlenecks, heat generation, and disk service life decline; furthermore, the requested data is in the mechanical disk. Because the mechanical disk IO performance is not high, the user response time increases, which affects the user experience. If all solid-state disks are used, the cost of user expenditure will increase.
因此,如何提高矿机的缓存加速性能是本领域技术人员需要解决的问题。Therefore, how to improve the cache acceleration performance of the miner is a problem that those skilled in the art need to solve.
发明内容Summary of the invention
本发明的主要目的在于提供一种基于矿机的数据访问方法、装置、系统及计算机可读存储介质,旨在解决如何提高矿机的缓存加速性能的技术问题。The main purpose of the present invention is to provide a data access method, device, system and computer-readable storage medium based on a mining machine, aiming to solve the technical problem of how to improve the cache acceleration performance of the mining machine.
为实现上述目的,本发明提供的一种基于矿机的数据访问方法,所述方法包括:In order to achieve the above object, a data access method based on a mining machine provided by the present invention includes:
接收业务系统发送的数据访问请求;Receive data access requests sent by business systems;
判断固态盘中是否存储有与所述数据访问请求对应的目标数据;其中,所述固态盘中存储了机械盘中访问次数超过第一预定阈值的数据;Determine whether the target data corresponding to the data access request is stored in the solid state disk; wherein, the solid state disk stores data in the mechanical disk that the number of times of access exceeds the first predetermined threshold;
若是,则将所述固态盘中存储的目标数据发送至所述业务系统;若否,则将所述机械盘中存储的目标数据发送至所述业务系统。If yes, the target data stored in the solid state disk is sent to the business system; if not, the target data stored in the mechanical disk is sent to the business system.
优选地,所述接收业务系统发送的数据访问请求之前,还包括:Preferably, before receiving the data access request sent by the service system, the method further includes:
检测机械盘中是否存在访问次数超过第一预定阈值的数据;Detect whether there is data in the mechanical disk that the number of access times exceeds the first predetermined threshold;
若存在,则将访问次数超过第一预定阈值的数据拷贝至所述固态盘,并将所述第一数据对应的指针加入所述固态盘的缓存链表。If it exists, copy the data whose access times exceed the first predetermined threshold to the solid state disk, and add the pointer corresponding to the first data to the cache linked list of the solid state disk.
优选地,所述将所述第一数据对应的指针加入所述固态盘的缓存链表之前,还包括:Preferably, before adding the pointer corresponding to the first data to the cache linked list of the solid state disk, the method further includes:
检测所述缓存链表中的指针数量是否超过第二预定阈值;Detecting whether the number of pointers in the cache linked list exceeds a second predetermined threshold;
若否,则继续执行所述将所述第一数据对应的指针加入所述固态盘的缓存链表的步骤;若是,则判断所述缓存链表中是否存在预定时长内命中次数小于第三预定阈值的指针;If not, continue to perform the step of adding the pointer corresponding to the first data to the cache linked list of the solid state disk; if yes, determine whether there are hits in the cache linked list that are less than a third predetermined threshold within a predetermined duration pointer;
若存在,则将预定时长内命中次数小于第三预定阈值的指针作为待移动指针;若不存在,则通过LRU策略从所述缓存链表中确定待移动指针;If it exists, the pointer whose number of hits within the predetermined time duration is less than the third predetermined threshold is used as the pointer to be moved; if it does not exist, the pointer to be moved is determined from the cache linked list through the LRU strategy;
将待移动指针移动至历史缓存链表。Move the pointer to be moved to the history cache linked list.
优选地,所述将待移动指针移动至历史缓存链表之前,还包括:Preferably, before moving the pointer to be moved to the history cache linked list, the method further includes:
判断所述历史缓存链表中的指针数量是否超过第四预定阈值;Determine whether the number of pointers in the history cache linked list exceeds a fourth predetermined threshold;
若否,则继续执行所述将待移动指针移动至历史缓存链表的步骤;若是,则通过LRU策略从所述历史缓存链表中确定待删除指针;If not, continue to perform the step of moving the pointer to be moved to the history cache linked list; if yes, determine the pointer to be deleted from the history cache linked list through the LRU strategy;
将所述待删除指针以及与所述待删除指针对应的数据均删除。Delete the pointer to be deleted and the data corresponding to the pointer to be deleted.
优选地,所述判断固态盘中是否存储有与所述数据访问请求对应的目标数据,包括:Preferably, the determining whether target data corresponding to the data access request is stored in the solid state disk includes:
利用缓存链表判断所述固态盘中是否存储所述目标数据;Use a cache linked list to determine whether the target data is stored in the solid state disk;
若是,则继续执行所述将所述固态盘中存储的目标数据发送至所述业 务系统的步骤;若否,则利用历史缓存链表判断所述固态盘中是否存储所述目标数据;If yes, continue to perform the step of sending the target data stored in the solid state disk to the business system; if not, use a history cache linked list to determine whether the target data is stored in the solid state disk;
若是,则继续执行所述将所述固态盘中存储的目标数据发送至所述业务系统的步骤;若否,则继续执行所述将所述机械盘中存储的目标数据发送至所述业务系统的步骤。If yes, continue to perform the step of sending the target data stored in the solid-state disk to the business system; if not, continue to execute the sending of the target data stored in the mechanical disk to the business system A step of.
优选地,若利用所述历史缓存链表判定所述固态盘存储所述目标数据,则所述方法还包括:Preferably, if the historical cache linked list is used to determine that the solid-state disk stores the target data, the method further includes:
将所述历史缓存链表中的与所述目标数据对应的指针,移动至所述缓存链表。Move the pointer corresponding to the target data in the historical cache linked list to the cache linked list.
为实现上述目的,本发明进一步提供一种基于矿机的数据访问装置,所述装置包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的数据访问程序,所述数据访问程序被所述处理器执行时实现上述任意数据访问方法。To achieve the above object, the present invention further provides a data access device based on a mining machine, the device includes a memory and a processor, and the memory stores a data access program that can run on the processor, the data When the access program is executed by the processor, any data access method described above is implemented.
优选地,所述装置为组成CDN网络或者区块链网络的节点。Preferably, the device is a node constituting a CDN network or a blockchain network.
为实现上述目的,本发明进一步提供一种基于矿机的数据访问系统,所述系统包括:To achieve the above object, the present invention further provides a data access system based on a mining machine, the system includes:
请求接收单元,用于接收业务系统发送的数据访问请求;The request receiving unit is used to receive the data access request sent by the business system;
判断单元,用于判断固态盘中是否存储有与所述数据访问请求对应的目标数据;所述固态盘中存储了机械盘中访问次数超过第一预定阈值的数据;The judging unit is used to judge whether the target data corresponding to the data access request is stored in the solid-state disk; the solid-state disk stores the data of the number of times the access in the mechanical disk exceeds the first predetermined threshold;
第一数据发送单元,用于在固态盘中存储有与所述数据访问请求对应的目标数据时,将所述固态盘中存储的目标数据发送至所述业务系统;A first data sending unit, configured to send the target data stored in the solid state disk to the business system when the target data corresponding to the data access request is stored in the solid state disk;
第二数据发送单元,用于在固态盘中没有存储与所述数据访问请求对应的目标数据时,将所述机械盘中存储的目标数据发送至所述业务系统。The second data sending unit is configured to send the target data stored in the mechanical disk to the business system when the target data corresponding to the data access request is not stored in the solid state disk.
为实现上述目的,本发明进一步提供一种计算机可读存储介质,所述计算机可读存储介质上存储有数据访问程序,所述数据访问程序可被一个或者多个处理器执行,以实现上述任意数据访问方法。In order to achieve the above object, the present invention further provides a computer-readable storage medium having a data access program stored on the computer-readable storage medium, which can be executed by one or more processors to implement any of the above Data access method.
通过以上方案可知,本发明实施例提供的一种基于矿机的数据访问方法,所述方法包括:接收业务系统发送的数据访问请求;判断固态盘中是 否存储有与所述数据访问请求对应的目标数据;其中,所述固态盘中存储了机械盘中访问次数超过第一预定阈值的数据;若是,则将所述固态盘中存储的目标数据发送至所述业务系统;若否,则将所述机械盘中存储的目标数据发送至所述业务系统;It can be known from the above solution that a data access method based on a mining machine provided by an embodiment of the present invention includes: receiving a data access request sent by a business system; and determining whether a solid state disk corresponding to the data access request is stored Target data; wherein, the solid-state disk stores data that the number of accesses in the mechanical disk exceeds a first predetermined threshold; if so, the target data stored in the solid-state disk is sent to the business system; if not, then Sending target data stored in the mechanical disk to the business system;
可见,在本方案中,由于固态盘的IO性能较高,因此仅仅将其存储访问频率较高的数据,这样在接收到业务系统发送的数据访问请求时,优先从固态盘中获取目标数据,如果固态盘中没有该目标数据,则从机械盘中获取。也就是说,本方案的这种将固态盘与机械盘相结合来实现矿机的数据访问方式,将IO性能高的固态盘用来存储访问频率高的数据,将容量大的机械盘存储所有写入的数据,通过两者优点的结合,提高了矿机的缓存加速性能。It can be seen that in this solution, since the solid-state disk has high IO performance, it only stores data with high access frequency, so that when receiving the data access request sent by the business system, the target data is preferentially obtained from the solid-state disk. If the target data does not exist in the solid state disk, it is obtained from the mechanical disk. That is to say, this scheme combines the solid state disk and the mechanical disk to realize the data access method of the miner, uses the solid state disk with high IO performance to store data with high access frequency, and stores the mechanical disk with large capacity to store all The written data improves the cache acceleration performance of the miner through the combination of the two advantages.
本发明还公开了一种基于矿机的数据访问装置、系统及计算机可读存储介质,同样能实现上述技术效果。The invention also discloses a data access device, system and computer readable storage medium based on the mining machine, which can also achieve the above technical effects.
图1为本发明一实施例的流程示意图;FIG. 1 is a schematic flowchart of an embodiment of the present invention;
图2为本发明一实施例的整体方案逻辑流程图;2 is a logic flow chart of an overall solution according to an embodiment of the invention;
图3为本发明另一实施例的流程示意图;3 is a schematic flowchart of another embodiment of the present invention;
图4为本发明一实施例揭露的缓存链表的管理方法流程示意图;4 is a schematic flowchart of a method for managing a cache linked list disclosed in an embodiment of the present invention;
图5为本发明一实施例揭露的LRU链表更新示意原理图;5 is a schematic schematic diagram of updating an LRU linked list disclosed in an embodiment of the present invention;
图6为本发明一实施例揭露的基于矿机的数据访问系统结构示意图;6 is a schematic structural diagram of a data access system based on a mining machine disclosed in an embodiment of the present invention;
图7为本发明一实施例揭露的基于矿机的数据访问装置结构示意图。7 is a schematic structural diagram of a data access device based on a mining machine disclosed in an embodiment of the present invention.
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本发明,并不用于限定本发明。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施 例,都属于本发明保护的范围。In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by a person of ordinary skill in the art without making creative efforts fall within the protection scope of the present invention.
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", "third", "fourth", etc. (if any) in the description and claims of this application and the above drawings are used to distinguish similar objects without using To describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances so that the embodiments described herein can be implemented in an order other than what is illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, processes, methods, systems, products or devices that contain a series of steps or units need not be limited to those clearly listed Those steps or units, but may include other steps or units not explicitly listed or inherent to these processes, methods, products, or equipment.
需要说明的是,在本发明中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本发明要求的保护范围之内。It should be noted that the descriptions related to "first", "second", etc. in the present invention are for descriptive purposes only, and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated . Thus, the features defined with "first" and "second" may include at least one of the features either explicitly or implicitly. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of those skilled in the art to realize. When the combination of technical solutions contradicts or cannot be realized, it should be considered that the combination of such technical solutions does not exist , Nor within the protection scope claimed by the present invention.
本发明实施例公开一种基于矿机的数据访问方法。The embodiment of the invention discloses a data access method based on a mining machine.
参照图1,图1为本发明一实施例的流程示意图,在本实施例中,该方法包括:Referring to FIG. 1, FIG. 1 is a schematic flowchart of an embodiment of the present invention. In this embodiment, the method includes:
S101、接收业务系统发送的数据访问请求;S101. Receive a data access request sent by a business system;
具体的,应用本实施例所述的数据访问方法的矿机,必须至少有一块机械盘(HDD)和一块固态盘(SSD),机械盘作为存储层用来存储所有写入的数据,固态盘作为缓存层来提供高性能的IO输出介质。因此,从整体逻辑上来说,该数据方法主要分为业务层、缓存层和存储层,参见图2,为本发明一实施例的整体方案逻辑流程图;从图2可以看出,业务层主要提供给不同需求的用户,每个用户提供有自己不同的业务需求,该就是说,用户通过不同的业务系统实现数据的存储和读取;缓存层,主要负责在业务层读取数据时,根据用户的数据读取的频次等信息维护固态盘中的数据,从而提供高性能的缓存功能;在业务层将数据写入到存储层时,存储层负 责将数据安全、准确到写入到机械盘中存储,完成数据存储功能,机械盘有着比固态盘更大的容量,固态盘容量相对较少。Specifically, the miner applying the data access method described in this embodiment must have at least one mechanical disk (HDD) and one solid state disk (SSD). The mechanical disk serves as a storage layer to store all written data. The solid state disk As a cache layer to provide high-performance IO output medium. Therefore, in terms of overall logic, the data method is mainly divided into a business layer, a cache layer, and a storage layer. Referring to FIG. 2, it is a logic flow chart of the overall solution of an embodiment of the present invention. As can be seen from FIG. 2, the business layer Provided to users with different needs, each user has their own different business needs, that is to say, users realize the storage and reading of data through different business systems; the cache layer is mainly responsible for reading data in the business layer according to Information such as the frequency of user data reads maintains the data in the solid-state disk to provide high-performance cache functions; when the business layer writes data to the storage layer, the storage layer is responsible for writing the data safely and accurately to the mechanical disk Medium storage, to complete the data storage function, the mechanical disk has a larger capacity than the solid state disk, the solid state disk capacity is relatively small.
需要说明的是,本实施例提供的数据访问方法为基于缓存层的角度进行描述的。本实施例中的数据访问请求具体可以理解为数据获取请求,如果用户通过业务系统发送的请求为数据写入请求,则直接将请求发送至存储层,通过存储层直接将数据存储至机械盘,由机械盘实现对数据的存储。It should be noted that the data access method provided in this embodiment is described based on the perspective of the cache layer. The data access request in this embodiment can be specifically understood as a data acquisition request. If the request sent by the user through the business system is a data write request, the request is directly sent to the storage layer, and the data is directly stored to the mechanical disk through the storage layer. The mechanical disk realizes the storage of data.
S102、判断固态盘中是否存储有与所述数据访问请求对应的目标数据;其中,所述固态盘中存储了机械盘中访问次数超过第一预定阈值的数据;若是,则执行S103;若否,则执行S104;S102: Determine whether the target data corresponding to the data access request is stored in the solid state disk; wherein, the solid state disk stores data in the mechanical disk that the number of times of access exceeds the first predetermined threshold; if yes, perform S103; if not , Execute S104;
S103、将所述固态盘中存储的目标数据发送至所述业务系统;S103: Send the target data stored in the solid state disk to the business system;
S104、将所述机械盘中存储的目标数据发送至所述业务系统。S104. Send the target data stored in the mechanical disk to the business system.
由于本方案所有的数据均写入机械盘,但是机械盘的IO性能不高,可能会出现用户响应时间大的问题,因此在本方案中,将机械盘中访问次数超过第一预定阈值的数据同时存储在固态盘,也就是说,对于访问频率较高的数据不仅存储在机械盘中,还存储在固态盘中,这样用户访问数据时,可以首先从固态盘中查找,如果查找到,则直接返回固态盘中的数据,如果查找不到,则从机械盘中查找,并返回查找结果,如果在固态盘和机械盘中均未查找到数据,则返回查找失败的提示信息。All data in this solution is written to the mechanical disk, but the IO performance of the mechanical disk is not high, and there may be a problem of large user response time. Therefore, in this solution, the data in the mechanical disk that is accessed more than the first predetermined threshold At the same time, it is stored in the solid state disk, that is to say, the data with higher access frequency is not only stored in the mechanical disk, but also stored in the solid state disk, so that when users access the data, they can first search from the solid state disk, if found, then The data in the solid state disk is directly returned. If it cannot be found, it is searched from the mechanical disk and the search result is returned. If the data is not found in the solid state disk and the mechanical disk, the prompt message that the search fails is returned.
需要说明的是,为了从固态盘中查找数据,固态盘中会存储缓存索引信息,通过该缓存索引信息从固态盘中检索数据。在初始情况下,固态盘中是不存在缓存信息的,该缓存信息包括缓存索引信息和对应的数据;因此,缓存信息在程序冷启动过程中会根据用户的请求行为逐渐建立,为了保证缓存信息的安全性,可在有必要的情况下将这些缓存信息定期Flush到机械盘中进行持久化操作,程序启动时重新加载这些缓存信息,索引信息结构定义如下:It should be noted that, in order to find data from the solid state disk, cache index information is stored in the solid state disk, and data is retrieved from the solid state disk through the cache index information. In the initial situation, there is no cache information in the solid state disk. The cache information includes cache index information and corresponding data; therefore, the cache information will be gradually established according to the user's request during the cold start of the program. In order to ensure the cache information For security, the cache information can be periodically flushed to the mechanical disk for persistent operation when necessary. The cache information is reloaded when the program starts. The index information structure is defined as follows:
需要说明的是,由于固态盘中存储的数据是机械盘中访问次数超过第一预定阈值的数据,因此,在初始过程中,固态盘是处于不存在缓存数据或者存在较少的缓存数据的状态,如果还是首先从固态盘中获取数据,则会出固态盘访问命中率较低的问题,为了避免上述问题,可在执行S102之前,先确定固态盘中的数据是否超过预定阈值,如果是,则先从固态盘中读取数据,否则,直接从机械盘中读取数据,直到固态盘中缓存的数据超过预定阈值后,在优先从固态盘中获取数据。It should be noted that, because the data stored in the solid-state disk is the data in the mechanical disk that the number of accesses exceeds the first predetermined threshold, in the initial process, the solid-state disk is in a state where there is no cache data or there is less cache data If you still get the data from the solid state drive first, it will cause a problem that the access hit rate of the solid state drive is low. In order to avoid the above problem, before performing S102, first determine whether the data in the solid state drive exceeds a predetermined threshold. If it is, The data is first read from the solid state disk, otherwise, the data is directly read from the mechanical disk until the data cached in the solid state disk exceeds a predetermined threshold, and the data is preferentially obtained from the solid state disk.
综上可以看出,本实施例中的矿机在进行缓存加速时,将机械盘和固态盘混用,机械盘大容量,负责存储数据,固态盘IO性能高,负责进行数据缓存,从而提高矿机的整体IO性能;在实际的使用过程,热点数据大概在20%左右,这样固态盘可以完全覆盖热点数据的存储;而对于业务层来说,业务层并不感知数据来源于存储层还是缓存层,通过这种方式,将固态盘的高IO性能发挥到极致,可以解决机械盘在高热点情况下的发热、磁盘寿命缩短、IO输出不高等棘手的难题,同时还可以给用户提供更好的播放、下载体验。In summary, when the mining machine in this embodiment accelerates the cache, the mechanical disk and the solid state disk are mixed. The mechanical disk has a large capacity and is responsible for storing data. The solid state disk has high IO performance and is responsible for data caching, thereby improving the mining performance. The overall IO performance of the computer; in actual use, the hotspot data is about 20%, so that the solid state disk can completely cover the storage of hotspot data; and for the business layer, the business layer does not perceive whether the data comes from the storage layer or the cache In this way, the high IO performance of the solid state disk is maximized, which can solve the difficult problems of mechanical disk heating in high hot spots, shortened disk life, and low IO output. It can also provide users with better Playing and downloading experience.
进一步,本发明实施例公开了另一种基于矿机的数据访问方法。Further, the embodiment of the present invention discloses another data access method based on a mining machine.
参照图3,图3为本发明另一实施例的流程示意图,在本实施例中, 该方法包括:Referring to FIG. 3, FIG. 3 is a schematic flowchart of another embodiment of the present invention. In this embodiment, the method includes:
S201、接收业务系统发送的数据访问请求;S201. Receive a data access request sent by a business system;
S202、利用缓存链表判断所述固态盘中是否存储所述目标数据;其中,所述固态盘中存储了机械盘中访问次数超过第一预定阈值的数据;若是,则执行S204;若否,则执行S203;S202: Determine whether the target data is stored in the solid-state disk by using a cache linked list; wherein, the solid-state disk stores data that the number of accesses in the mechanical disk exceeds the first predetermined threshold; if yes, execute S204; if no, then Perform S203;
S203、利用历史缓存链表判断所述固态盘中是否存储所述目标数据;S203. Determine whether the target data is stored in the solid state disk by using a history cache linked list;
若是,则执行S204;若否,则执行S205;If yes, execute S204; if no, execute S205;
S204、将所述固态盘中存储的目标数据发送至所述业务系统;S204: Send the target data stored in the solid state disk to the business system;
S205、将所述机械盘中存储的目标数据发送至所述业务系统。S205. Send the target data stored in the mechanical disk to the business system.
具体的,在本实施例中,缓存索引信息可以包括缓存链表cacheing和历史缓存链表cache_history,在每个链表中均包括与数据对应的指针key,该指针用来指向固态盘中存储的数据。正常情况下,机械盘中访问次数超过第一预定阈值的数据会首先加入到缓存列表中,如果缓存列表中的指针数量达到上限,这时就需要根据预定的链表移动规则,将缓存链表中对应的指针移动至历史缓存链表,如果历史缓存链表中的指针数量也达到了上限,这时需要根据预定的链表删除规则,从历史缓存列表中删除对应的指针以及对应的数据。Specifically, in this embodiment, the cache index information may include cache linked list cacheing and historical cache linked list cache_history, and each linked list includes a pointer key corresponding to the data, and the pointer is used to point to the data stored in the solid state disk. Under normal circumstances, the data in the mechanical disk that has been accessed more than the first predetermined threshold will be added to the cache list first. If the number of pointers in the cache list reaches the upper limit, you need to match the cache list according to the predetermined list movement rule. The pointer of is moved to the history cache linked list. If the number of pointers in the history cache linked list also reaches the upper limit, the corresponding pointer and corresponding data need to be deleted from the history cache list according to the predetermined list deletion rule.
因此在本方案中,接收到业务系统发送的数据访问请求后,首先需要从缓存链表中查找与该请求对应的目标数据是否存储在固态盘;如果存储在固态盘,则将固态盘中的目标数据发送至业务系统;如果缓存链表中未查找到目标数据,则继续从历史缓存链表中查找目标数据,如果查找到,则将固态盘中的目标数据发送至业务系统;如果没有查找到,则只能从机械盘中查找该目标数据,如果在机械盘中也没有查找到,说明在矿机中未存储该数据,则向业务系统反馈查找失败的提示信息。Therefore, in this solution, after receiving the data access request sent by the business system, you first need to find from the cache linked list whether the target data corresponding to the request is stored in the solid state disk; if it is stored in the solid state disk, the target in the solid state disk The data is sent to the business system; if the target data is not found in the cache linked list, continue to search for the target data from the historical cache linked list, if found, the target data in the solid state disk is sent to the business system; if not found, then The target data can only be searched from the mechanical disk. If the target data is not found in the mechanical disk, it means that the data is not stored in the mining machine, and then a prompt message that the search fails is fed back to the business system.
综上可以看出,在本方案中,通过缓存链表和历史缓存链表,可以根据链表中的指针快速的查找对应的目标数据,并且对于缓存链表中淘汰的指针,并不直接删除,而是将指针加入历史缓存链表,这样在查找目标数据时,如果从命中率高的缓存链表中未查找到该数据,则继续从历史缓存链表中超找,从而提高了数据的命中率,实现了矿机的缓存加速性能。It can be seen from the above that in this solution, through the cache linked list and the historical cache linked list, the corresponding target data can be quickly found according to the pointers in the linked list, and the pointers eliminated in the cache linked list are not directly deleted, but instead The pointer is added to the historical cache linked list, so that when searching for the target data, if the data is not found from the cache linked list with a high hit rate, it will continue to find from the historical cache linked list, thereby improving the data hit rate and realizing the mining machine's hit rate. Cache acceleration performance.
进一步,在上述任意方法实施例的基础上,本实施例公开了一种缓存链表的管理方法。Further, based on any of the above method embodiments, this embodiment discloses a method for managing a cache linked list.
需要说明的是,本实施例所述的缓存链表管理方法,可以不限定与上述任意实施例中所述的数据访问方法的步骤之间的执行顺序,但是为了提高数据访问命中率,在本实施例中可以设定在执行接收业务系统发送的数据访问请求的步骤之前执行,数据访问方法的详细过程可参照上述任意实施例,在本实施例中便不具体赘述。It should be noted that the cache linked list management method described in this embodiment may not limit the execution order between the steps of the data access method described in any of the above embodiments, but in order to improve the data access hit rate, this implementation In the example, it may be set to be executed before the step of receiving the data access request sent by the service system. For the detailed process of the data access method, reference may be made to any of the above embodiments, which is not specifically described in this embodiment.
参照图4,图4为本发明一实施例揭露的缓存链表的管理方法流程示意图,在本实施例中,该方法包括:Referring to FIG. 4, FIG. 4 is a schematic flowchart of a method for managing a cache linked list disclosed in an embodiment of the present invention. In this embodiment, the method includes:
S301、检测机械盘中是否存在访问次数超过第一预定阈值的数据;S301. Detect whether there is data in the mechanical disk that the number of access times exceeds the first predetermined threshold;
若是,则执行S302;若否,则继续执行S301;If yes, execute S302; if no, continue to execute S301;
S302、检测所述缓存链表中的指针数量是否超过第二预定阈值;S302: Detect whether the number of pointers in the cache linked list exceeds a second predetermined threshold;
若否,则执行S309;若是,则执行S303;If not, execute S309; if yes, execute S303;
S303、判断所述缓存链表中是否存在预定时长内命中次数小于第三预定阈值的指针;若是,则执行S304;若否,则执行S305;S303. Determine whether there is a pointer in the cache linked list that has a hit count less than a third predetermined threshold within a predetermined duration; if yes, execute S304; if not, execute S305;
S304、将预定时长内命中次数小于第三预定阈值的指针作为待移动指针,并执行S306;S304. Use a pointer whose number of hits within a predetermined duration is less than a third predetermined threshold as a pointer to be moved, and execute S306;
S305、通过LRU(最近很少使用,least recently used)策略从所述缓存链表中确定待移动指针,并执行S306;S305. Determine the pointer to be moved from the cache linked list through the LRU (recently used recently) strategy, and execute S306;
S306、判断所述历史缓存链表中的指针数量是否超过第四预定阈值;S306. Determine whether the number of pointers in the history cache linked list exceeds a fourth predetermined threshold;
若是,则执行S307;若否,则执行S308;If yes, execute S307; if no, execute S308;
S307、通过LRU策略从所述历史缓存链表中确定待删除指针,将所述待删除指针以及与所述待删除指针对应的数据均删除;S307: Determine the pointer to be deleted from the history cache linked list through the LRU strategy, and delete the pointer to be deleted and the data corresponding to the pointer to be deleted;
S308、将待移动指针移动至历史缓存链表,并执行S309;S308. Move the pointer to be moved to the history cache linked list, and execute S309;
S309、将访问次数超过第一预定阈值的数据拷贝至所述固态盘,并将所述第一数据对应的指针加入所述固态盘的缓存链表。S309. Copy the data whose access times exceed the first predetermined threshold to the solid state disk, and add the pointer corresponding to the first data to the cache linked list of the solid state disk.
具体的,在程序启动时,缓存列表cacheing和历史缓存列表cache_history这两个链表链都为空,用户的请求到来时,如果能从存储层 的机械盘中读取到数据,且命中的次数超过第一预定阈值,则将这个数据拷贝至固态盘中,并将与该数据对应的指针加入到缓存链表cacheing中。Specifically, when the program starts, the two linked list chains, the cache list cacheing and the history cache list cache_history, are both empty. When the user's request comes, if the data can be read from the mechanical disk of the storage layer, and the number of hits exceeds At the first predetermined threshold, the data is copied to the solid state disk, and the pointer corresponding to the data is added to the cache linked list cacheing.
需要说明的是,缓存链表具有指针数量的上限值,该上限值即为第二预定阈值,如果将新指针加入到缓存链表之前,检测到缓存链表中的指针数量达到第二预定阈值,这时需要根据链表移动规则从缓存链表中移动部分链表,该链表移动规则可以包括以下两种:将预定时长内命中次数小于第三预定阈值的指针作为待移动指针,并移动至历史缓存链表;如果链表中的指针的命中次数均不小于第三预定阈值,这时可以通过LRU策略从缓存链表中确定待移动指针。随着请求次数的不断增大,历史缓存链表中的指针数量也会达到上限值,这时再添加新的指针数据时,需要根据链表删除规则删除对应的指针,该链表删除规则为LRU策略,也就是说根据LRU策略从历史缓存链表中确定待删除指针,并将待删除指针以及与待删除指针对应的数据均删除。It should be noted that the cache linked list has an upper limit of the number of pointers, and the upper limit is the second predetermined threshold. If a new pointer is added to the cache linked list, it is detected that the number of pointers in the cache linked list reaches the second predetermined threshold, At this time, a part of the linked list needs to be moved from the cache linked list according to the linked list moving rule. The linked list moving rule may include the following two types: a pointer to be hit less than a third predetermined threshold within a predetermined duration is used as a pointer to be moved, and moved to the historical cache linked list; if The number of pointer hits in the linked list is not less than the third predetermined threshold, at this time, the pointer to be moved can be determined from the cache linked list through the LRU strategy. As the number of requests continues to increase, the number of pointers in the history cache linked list will also reach the upper limit. When new pointer data is added at this time, the corresponding pointers need to be deleted according to the linked list deletion rule, which is an LRU strategy That is to say, the pointer to be deleted is determined from the history cache linked list according to the LRU strategy, and the pointer to be deleted and the data corresponding to the pointer to be deleted are both deleted.
参见图5,为本发明一实施例揭露的LRU链表更新示意原理图;通过该图可以看出,新指针数据需要插入到链表的头部位置,当指针key命中的时候,将指针数据移动到链表的头部位置;如果整个链达到数据上限,且添加新的指针数据时,需要将链表尾部的数据直接淘汰;对于缓存链表,将淘汰的指针数据移动至历史缓存链表中,对于历史缓存链表,则直接将淘汰的指针数据删除。Referring to FIG. 5, it is a schematic schematic diagram of the LRU linked list update disclosed by an embodiment of the present invention. As can be seen from the figure, the new pointer data needs to be inserted into the head position of the linked list. When the pointer key hits, the pointer data is moved to The head position of the linked list; if the entire chain reaches the upper limit of data and new pointer data is added, the data at the tail of the linked list needs to be eliminated directly; for the cached linked list, the eliminated pointer data is moved to the historical cache linked list, for the historical cache linked list , The deleted pointer data will be deleted directly.
其中,若利用所述历史缓存链表判定所述固态盘存储所述目标数据,则所述方法还包括:将所述历史缓存链表中的与所述目标数据对应的指针,移动至所述缓存链表。Wherein, if the historical cache linked list is used to determine that the solid-state disk stores the target data, the method further includes: moving a pointer corresponding to the target data in the historical cache linked list to the cache linked list .
也就是说,由于历史缓存链表cache_history存放的是曾经命中过或者被淘汰的数据,但是如果位于历史缓存链表中的数据在某一次请求正好命中,那么需要将命中的这个指针key重新加入到缓存链表cacheing链中,同样的,缓存链表cacheing则需要根据上述链表移动规则淘汰一个key到历史缓存链表cache_history中。That is to say, because the history cache linked list cache_history stores data that has been hit or eliminated, but if the data located in the historical cache linked list happens to be hit in a certain request, then the hit pointer key needs to be re-added to the cache linked list In the cacheing chain, similarly, the cache linked list cacheing needs to eliminate a key to the historical cache linked list cache_history according to the above linked list movement rules.
综上可以看出,本方案利用上述缓存链表的管理方法可以保持缓存链表cacheing链和历史缓存链表cache_history处于写入和淘汰的均衡的状 态,同时保持机械盘的热点数据逐步拷贝到固态盘中进行缓存加速,同时也会将cache_history淘汰的数据从固态盘的缓存中删除,通过这种方式,可以提高业务系统在固态盘中命中数据的概率,提高矿机的缓存加速性能。To sum up, it can be seen that this solution uses the above-mentioned cache linked list management method to keep the cache linked list cacheing chain and historical cache linked list cache_history in a balanced state of writing and elimination, while keeping the hot data of the mechanical disk gradually copied to the solid state disk for Cache acceleration will also delete the data eliminated by cache_history from the cache of the solid state disk. In this way, the probability of the business system hitting the data in the solid state disk can be increased, and the cache acceleration performance of the miner can be improved.
进一步的,本实施例还公开了一种基于矿机的数据访问系统。Further, this embodiment also discloses a data access system based on a mining machine.
参见图6,为本发明一实施例揭露的基于矿机的数据访问系统结构示意图,该系统包括:Referring to FIG. 6, it is a schematic structural diagram of a data access system based on a mining machine disclosed in an embodiment of the present invention. The system includes:
请求接收单元100,用于接收业务系统发送的数据访问请求;The request receiving unit 100 is used to receive the data access request sent by the business system;
判断单元200,用于判断固态盘中是否存储有与所述数据访问请求对应的目标数据;所述固态盘中存储了机械盘中访问次数超过第一预定阈值的数据;The judging unit 200 is used to judge whether the target data corresponding to the data access request is stored in the solid state disk; the solid state disk stores the data that the number of times of access in the mechanical disk exceeds the first predetermined threshold;
第一数据发送单元300,用于在固态盘中存储有与所述数据访问请求对应的目标数据时,将所述固态盘中存储的目标数据发送至所述业务系统;The first data sending unit 300 is configured to send the target data stored in the solid state disk to the service system when the target data corresponding to the data access request is stored in the solid state disk;
第二数据发送单元400,用于在固态盘中没有存储与所述数据访问请求对应的目标数据时,将所述机械盘中存储的目标数据发送至所述业务系统。The second data sending unit 400 is configured to send the target data stored in the mechanical disk to the business system when the target data corresponding to the data access request is not stored in the solid state disk.
其中,本方案还包括:Among them, this plan also includes:
第一检测单元,用于检测机械盘中是否存在访问次数超过第一预定阈值的数据;A first detection unit, configured to detect whether there is data in the mechanical disk that the number of times of access exceeds a first predetermined threshold;
数据拷贝单元,用于在机械盘中存在访问次数超过第一预定阈值的数据时,将访问次数超过第一预定阈值的数据拷贝至所述固态盘;A data copying unit, used to copy the data whose access times exceed the first predetermined threshold to the solid state disk when there is data in the mechanical disk whose access times exceed the first predetermined threshold;
指针加入单元,用于将第一数据对应的指针加入所述固态盘的缓存链表。The pointer adding unit is used to add the pointer corresponding to the first data to the cache linked list of the solid state disk.
其中,本方案还包括:Among them, this plan also includes:
第二检测单元,用于检测缓存链表中的指针数量是否超过第二预定阈值;若否,则触发所述指针加入单元;若是,则触发命中次数判断单元;A second detection unit, configured to detect whether the number of pointers in the cache linked list exceeds the second predetermined threshold; if not, trigger the pointer addition unit; if yes, trigger the hit count determination unit;
命中次数判断单元,用于判断所述缓存链表中是否存在预定时长内命中次数小于第三预定阈值的指针;若存在,则触发第一待移动指针确定单元;若不存在,则触发第二待移动指针确定单元;The hit count judging unit is used to judge whether there is a pointer in the cache linked list that has a hit count less than a third predetermined threshold within a predetermined duration; if it exists, it triggers the first pointer-to-be-moved determination unit; if it does not exist, it triggers the second wait Move the pointer to determine the unit;
第一待移动指针确定单元,用于将预定时长内命中次数小于第三预定阈值的指针作为待移动指针;A first pointer-to-be-moved determination unit, configured to use a pointer whose number of hits within a predetermined time period is less than a third predetermined threshold as a pointer to be moved;
第二待移动指针确定单元,用于通过LRU策略从所述缓存链表中确定待移动指针;A second pointer-to-be-moved determination unit, configured to determine a pointer to be moved from the cache linked list through an LRU strategy;
第一指针移动单元,用于将待移动指针移动至历史缓存链表。The first pointer moving unit is used to move the pointer to be moved to the history cache linked list.
其中,本方案还包括:Among them, this plan also includes:
指针数量判断单元,用于判断所述历史缓存链表中的指针数量是否超过第四预定阈值;若否,则触发所述指针移动单元;若是,则触发待删除指针确定单元;A pointer number judging unit, used to judge whether the number of pointers in the history cache linked list exceeds the fourth predetermined threshold; if not, trigger the pointer moving unit; if yes, trigger the pointer determination unit to be deleted;
待删除指针确定单元,用于通过LRU策略从所述历史缓存链表中确定待删除指针;A pointer-to-be-deleted determination unit, configured to determine a pointer to be deleted from the historical cache linked list through an LRU strategy;
指针删除单元,用于将所述待删除指针以及与所述待删除指针对应的数据均删除。The pointer deleting unit is used to delete the pointer to be deleted and the data corresponding to the pointer to be deleted.
其中,判断单元包括:Among them, the judgment unit includes:
第一判断子单元,用于利用缓存链表判断所述固态盘中是否存储所述目标数据;若是,则触发第一数据发送单元;若否,则触发第二判断子单元;The first judgment subunit is used to judge whether the target data is stored in the solid state disk by using a cache linked list; if it is, trigger the first data sending unit; if not, trigger the second judgment subunit;
第二判断子单元,用于利用历史缓存链表判断所述固态盘中是否存储所述目标数据;若是,则触发第一数据发送单元;若否,则触发第二数据发送单元。The second judgment subunit is used to judge whether the target data is stored in the solid state disk by using a history cache linked list; if it is, the first data sending unit is triggered; if not, the second data sending unit is triggered.
其中,本方案还包括:Among them, this plan also includes:
第二指针移动单元,用于在利用所述历史缓存链表判定所述固态盘存储所述目标数据时,将所述历史缓存链表中的与所述目标数据对应的指针,移动至所述缓存链表。A second pointer moving unit, configured to move a pointer corresponding to the target data in the historical cache linked list to the cache linked list when using the historical cache linked list to determine that the solid-state disk stores the target data .
进一步的,本发明实施例还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有数据访问程序,所述数据访问程序可被一个或者多个处理器执行,以实现上述任意方法实施例中所述的数据访问方法。Further, an embodiment of the present invention further provides a computer-readable storage medium, and a data access program is stored on the computer-readable storage medium, and the data access program may be executed by one or more processors to implement any of the above The data access method described in the method embodiment.
进一步的,本实施例还公开了一种基于矿机的数据访问装置1。Further, this embodiment also discloses a data access device 1 based on a mining machine.
参照图7为本发明一实施例揭露的基于矿机的数据访问装置结构示意图,所述装置包括存储器11和处理器12,所述存储器11上存储有可在所述处理器上运行的数据访问程序01,所述数据访问程序01被所述处理器执行时实现上述任意方法实施例所实现的数据访问方法。7 is a schematic structural diagram of a data access device based on a mining machine disclosed in an embodiment of the present invention. The device includes a memory 11 and a processor 12, and the memory 11 stores data access that can run on the processor. Program 01. When the data access program 01 is executed by the processor, the data access method implemented by any of the foregoing method embodiments is implemented.
在本实施例中,数据访问装置1可以是PC(Personal Computer,个人电脑),也可以是智能手机、平板电脑、掌上电脑、便携计算机、智能路由器、矿机、网络存储设备终端设备。In this embodiment, the data access device 1 may be a PC (Personal Computer) or a smart phone, tablet computer, palmtop computer, portable computer, smart router, mining machine, and network storage device terminal device.
该装置1可以是组成CDN网络或者区块链网络的节点。The device 1 may be a node constituting a CDN network or a blockchain network.
该数据访问装置1可以包括存储器11、处理器12和总线13。The data access device 1 may include a memory 11, a processor 12, and a bus 13.
其中,存储器11至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、磁性存储器、磁盘、光盘等。存储器11在一些实施例中可以是数据访问装置1的内部存储单元,例如该数据访问装置1的硬盘。存储器11在另一些实施例中也可以是数据访问装置1的外部存储设备,例如数据访问装置1上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器11还可以既包括数据访问装置1的内部存储单元也包括外部存储设备。存储器11不仅可以用于存储安装于数据访问装置1的应用软件及各类数据,例如数据访问程序01的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。Wherein, the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, and the like. The memory 11 may be an internal storage unit of the data access device 1 in some embodiments, such as a hard disk of the data access device 1. In other embodiments, the memory 11 may also be an external storage device of the data access device 1, such as a plug-in hard disk equipped on the data access device 1, a smart memory card (Smart Media, Card, SMC), and a secure digital (Secure Digital, SD) card, flash card (Flash Card), etc. Further, the memory 11 may also include both the internal storage unit of the data access device 1 and the external storage device. The memory 11 can be used not only to store application software and various types of data installed in the data access device 1, such as codes of the data access program 01, but also to temporarily store data that has been or will be output.
处理器12在一些实施例中可以是一中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器或其他数据处理芯片,用于运行存储器11中存储的程序代码或处理数据,例如执行数据访问程序01等。In some embodiments, the processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip for running the program code or processing stored in the memory 11 Data, for example, data access program 01 is executed.
该总线13可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。为便于表示,图7中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 13 may be a peripheral component interconnection (peripheral component interconnection, PCI for short) bus or an extended industry standard architecture (extended industry standard architecture, EISA) bus, or the like. The bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only a thick line is used in FIG. 7, but it does not mean that there is only one bus or one type of bus.
进一步地,数据访问装置还可以包括网络接口14,网络接口14可选 的可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该装置1与其他电子设备之间建立通信连接。Further, the data access device may further include a network interface 14, and the network interface 14 may optionally include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used in the device 1 to communicate with other electronic devices. Establish a communication connection between devices.
可选地,该装置1还可以包括用户接口,用户接口可以包括显示器(Display)、输入单元比如键盘(Keyboard),可选的用户接口还可以包括标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在数据访问装置1中处理的信息以及用于显示可视化的用户界面。Optionally, the device 1 may further include a user interface. The user interface may include a display and an input unit such as a keyboard. The optional user interface may also include a standard wired interface and a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light emitting diode) touch device, or the like. Among them, the display may also be appropriately referred to as a display screen or a display unit, for displaying information processed in the data access device 1 and for displaying a visual user interface.
图7仅示出了具有组件11-14以及数据访问程序01的数据访问装置1,本领域技术人员可以理解的是,图7示出的结构并不构成对数据访问装置1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。7 only shows the data access device 1 having the components 11-14 and the data access program 01. Those skilled in the art can understand that the structure shown in FIG. 7 does not constitute a limitation on the data access device 1, and may include There are fewer or more components than shown, or some components are combined, or different components are arranged.
进一步的,本发明实施例还提供一种计算机程序产品,包括计算机指令,当其在计算机上运行时,使得计算机可以执行上述任意方法实施例中所述的数据访问方法。Further, an embodiment of the present invention further provides a computer program product, including computer instructions, which, when run on a computer, enable the computer to execute the data access method described in any of the above method embodiments.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product.
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本发明实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用 介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk(SSD))等The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on the computer, all or part of the processes or functions according to the embodiments of the present invention are generated. The computer may be a general-purpose computer, a dedicated computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be from a website site, computer, server or data center Transmission to another website, computer, server or data center via wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server, a data center, or the like that includes one or more available medium integrations. The available media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, DVD), or semiconductor media (eg, Solid State Disk (SSD)), etc.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and conciseness of the description, the specific working process of the system, device and unit described above can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, device, and method may be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a division of logical functions. In actual implementation, there may be other divisions, for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application essentially or part of the contribution to the existing technology or all or part of the technical solution can be embodied in the form of a software product, the computer software product is stored in a storage medium , Including several instructions to enable a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program code .
需要说明的是,上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。并且本文中的术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。It should be noted that the sequence numbers of the above embodiments of the present invention are only for description, and do not represent the advantages and disadvantages of the embodiments. And the terms "include", "include", or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, device, article, or method that includes a series of elements includes not only those elements, but also unclear The other elements listed may also include elements inherent to this process, device, article, or method. Without more restrictions, the element defined by the sentence "include one..." does not exclude that there are other identical elements in the process, device, article or method that includes the element.
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。The above are only preferred embodiments of the present invention and do not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by the description and drawings of the present invention, or directly or indirectly used in other related technical fields The same reason is included in the patent protection scope of the present invention.
Claims (10)
- 一种基于矿机的数据访问方法,其特征在于,所述方法包括:A data access method based on a mining machine, characterized in that the method includes:接收业务系统发送的数据访问请求;Receive data access requests sent by business systems;判断固态盘中是否存储有与所述数据访问请求对应的目标数据;其中,所述固态盘中存储了机械盘中访问次数超过第一预定阈值的数据;Determine whether the target data corresponding to the data access request is stored in the solid state disk; wherein, the solid state disk stores data in the mechanical disk that the number of times of access exceeds the first predetermined threshold;若是,则将所述固态盘中存储的目标数据发送至所述业务系统;若否,则将所述机械盘中存储的目标数据发送至所述业务系统。If yes, the target data stored in the solid state disk is sent to the business system; if not, the target data stored in the mechanical disk is sent to the business system.
- 根据权利要求1所述的数据访问方法,其特征在于,所述接收业务系统发送的数据访问请求之前,还包括:The data access method according to claim 1, wherein before receiving the data access request sent by the service system, the method further comprises:检测机械盘中是否存在访问次数超过第一预定阈值的数据;Detect whether there is data in the mechanical disk that the number of access times exceeds the first predetermined threshold;若存在,则将访问次数超过第一预定阈值的数据拷贝至所述固态盘,并将所述第一数据对应的指针加入所述固态盘的缓存链表。If it exists, copy the data whose access times exceed the first predetermined threshold to the solid state disk, and add the pointer corresponding to the first data to the cache linked list of the solid state disk.
- 根据权利要求2所述的数据访问方法,其特征在于,所述将所述第一数据对应的指针加入所述固态盘的缓存链表之前,还包括:The data access method according to claim 2, wherein before adding the pointer corresponding to the first data to the cache linked list of the solid state disk, further comprising:检测所述缓存链表中的指针数量是否超过第二预定阈值;Detecting whether the number of pointers in the cache linked list exceeds a second predetermined threshold;若否,则继续执行所述将所述第一数据对应的指针加入所述固态盘的缓存链表的步骤;若是,则判断所述缓存链表中是否存在预定时长内命中次数小于第三预定阈值的指针;If not, continue to perform the step of adding the pointer corresponding to the first data to the cache linked list of the solid state disk; if yes, determine whether there are hits in the cache linked list that are less than a third predetermined threshold within a predetermined duration pointer;若存在,则将预定时长内命中次数小于第三预定阈值的指针作为待移动指针;若不存在,则通过LRU策略从所述缓存链表中确定待移动指针;If it exists, the pointer whose number of hits within the predetermined time duration is less than the third predetermined threshold is used as the pointer to be moved; if it does not exist, the pointer to be moved is determined from the cache linked list through the LRU strategy;将待移动指针移动至历史缓存链表。Move the pointer to be moved to the history cache linked list.
- 根据权利要求3所述的数据访问方法,其特征在于,所述将待移动指针移动至历史缓存链表之前,还包括:The data access method according to claim 3, wherein before moving the pointer to be moved to the history cache linked list, the method further comprises:判断所述历史缓存链表中的指针数量是否超过第四预定阈值;Determine whether the number of pointers in the history cache linked list exceeds a fourth predetermined threshold;若否,则继续执行所述将待移动指针移动至历史缓存链表的步骤;若是,则通过LRU策略从所述历史缓存链表中确定待删除指针;If not, continue to perform the step of moving the pointer to be moved to the history cache linked list; if yes, determine the pointer to be deleted from the history cache linked list through the LRU strategy;将所述待删除指针以及与所述待删除指针对应的数据均删除。Delete the pointer to be deleted and the data corresponding to the pointer to be deleted.
- 根据权利要求1至4中任意一项所述的数据访问方法,其特征在于,所述判断固态盘中是否存储有与所述数据访问请求对应的目标数据,包括:The data access method according to any one of claims 1 to 4, wherein the determining whether target data corresponding to the data access request is stored in the solid state disk includes:利用缓存链表判断所述固态盘中是否存储所述目标数据;Use a cache linked list to determine whether the target data is stored in the solid state disk;若是,则继续执行所述将所述固态盘中存储的目标数据发送至所述业务系统的步骤;若否,则利用历史缓存链表判断所述固态盘中是否存储所述目标数据;If yes, continue to perform the step of sending the target data stored in the solid state disk to the business system; if not, use a history cache linked list to determine whether the target data is stored in the solid state disk;若是,则继续执行所述将所述固态盘中存储的目标数据发送至所述业务系统的步骤;若否,则继续执行所述将所述机械盘中存储的目标数据发送至所述业务系统的步骤。If yes, continue to perform the step of sending the target data stored in the solid-state disk to the business system; if not, continue to execute the sending of the target data stored in the mechanical disk to the business system A step of.
- 根据权利要求5所述的数据访问方法,其特征在于,若利用所述历史缓存链表判定所述固态盘存储所述目标数据,则所述方法还包括:The data access method according to claim 5, wherein if the history cache linked list is used to determine that the solid-state disk stores the target data, the method further comprises:将所述历史缓存链表中的与所述目标数据对应的指针,移动至所述缓存链表。Move the pointer corresponding to the target data in the historical cache linked list to the cache linked list.
- 一种基于矿机的数据访问装置,其特征在于,所述装置包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的数据访问程序,A data access device based on a mining machine, characterized in that the device includes a memory and a processor, and the memory stores a data access program that can run on the processor,所述数据访问程序被所述处理器执行时实现如权利要求1-6任一项所述的方法。When the data access program is executed by the processor, the method according to any one of claims 1-6 is implemented.
- 根据权利要求7所述的装置,其特征在于,所述装置为组成CDN网络或者区块链网络的节点。The device according to claim 7, wherein the device is a node constituting a CDN network or a blockchain network.
- 一种基于矿机的数据访问系统,其特征在于,所述系统包括:A data access system based on a mining machine, characterized in that the system includes:请求接收单元,用于接收业务系统发送的数据访问请求;The request receiving unit is used to receive the data access request sent by the business system;判断单元,用于判断固态盘中是否存储有与所述数据访问请求对应的目标数据;所述固态盘中存储了机械盘中访问次数超过第一预定阈值的数据;The judging unit is used to judge whether the target data corresponding to the data access request is stored in the solid-state disk; the solid-state disk stores the data of the number of times the access in the mechanical disk exceeds the first predetermined threshold;第一数据发送单元,用于在固态盘中存储有与所述数据访问请求对应的目标数据时,将所述固态盘中存储的目标数据发送至所述业务系统;A first data sending unit, configured to send the target data stored in the solid state disk to the business system when the target data corresponding to the data access request is stored in the solid state disk;第二数据发送单元,用于在固态盘中没有存储与所述数据访问请求对应的目标数据时,将所述机械盘中存储的目标数据发送至所述业务系统。The second data sending unit is configured to send the target data stored in the mechanical disk to the business system when the target data corresponding to the data access request is not stored in the solid state disk.
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有数据访问程序,所述数据访问程序可被一个或者多个处理器执行,以实现如权利要求1至6中任一项所述的数据访问方法。A computer-readable storage medium, characterized in that a data access program is stored on the computer-readable storage medium, and the data access program can be executed by one or more processors to implement claims 1 to 6 The data access method as described in any one.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811488094.6A CN109582246A (en) | 2018-12-06 | 2018-12-06 | Data access method, device, system and readable storage medium storing program for executing based on mine machine |
CN201811488094.6 | 2018-12-06 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020113941A1 true WO2020113941A1 (en) | 2020-06-11 |
Family
ID=65926482
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/092004 WO2020113941A1 (en) | 2018-12-06 | 2019-06-20 | Data access method, apparatus and system based on mining computer, and readable storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN109582246A (en) |
WO (1) | WO2020113941A1 (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109582246A (en) * | 2018-12-06 | 2019-04-05 | 深圳市网心科技有限公司 | Data access method, device, system and readable storage medium storing program for executing based on mine machine |
CN110392094B (en) * | 2019-06-03 | 2021-03-19 | 网宿科技股份有限公司 | Method for acquiring service data and converged CDN system |
CN111309482B (en) * | 2020-02-20 | 2023-08-15 | 浙江亿邦通信科技有限公司 | Hash algorithm-based block chain task allocation system, device and storable medium |
CN113220233A (en) * | 2021-05-14 | 2021-08-06 | 北京百度网讯科技有限公司 | Data reading method, device and system |
CN113590045B (en) * | 2021-08-03 | 2023-05-16 | 中国联合网络通信集团有限公司 | Data hierarchical storage method, device and storage medium |
CN114143234A (en) * | 2021-11-30 | 2022-03-04 | 湖南快乐阳光互动娱乐传媒有限公司 | Data processing method and system |
CN116560585B (en) * | 2023-07-05 | 2024-04-09 | 支付宝(杭州)信息技术有限公司 | Data hierarchical storage method and system |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105573669A (en) * | 2015-12-11 | 2016-05-11 | 上海爱数信息技术股份有限公司 | IO read speeding cache method and system of storage system |
CN109582246A (en) * | 2018-12-06 | 2019-04-05 | 深圳市网心科技有限公司 | Data access method, device, system and readable storage medium storing program for executing based on mine machine |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102662459A (en) * | 2012-04-22 | 2012-09-12 | 复旦大学 | Method for reducing energy consumption of server by using mixed storage of solid-state drive and mechanical hard disk |
CN102768645B (en) * | 2012-06-14 | 2016-01-20 | 国家超级计算深圳中心(深圳云计算中心) | The solid state hard disc forecasting method of hybrid cache and solid-state hard disk SSD |
-
2018
- 2018-12-06 CN CN201811488094.6A patent/CN109582246A/en active Pending
-
2019
- 2019-06-20 WO PCT/CN2019/092004 patent/WO2020113941A1/en active Application Filing
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105573669A (en) * | 2015-12-11 | 2016-05-11 | 上海爱数信息技术股份有限公司 | IO read speeding cache method and system of storage system |
CN109582246A (en) * | 2018-12-06 | 2019-04-05 | 深圳市网心科技有限公司 | Data access method, device, system and readable storage medium storing program for executing based on mine machine |
Also Published As
Publication number | Publication date |
---|---|
CN109582246A (en) | 2019-04-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020113941A1 (en) | Data access method, apparatus and system based on mining computer, and readable storage medium | |
US10191856B2 (en) | Method of managing web browser cache size using logical relationships and clustering | |
KR102097300B1 (en) | File handling within a cloud-based file system | |
CN110401724B (en) | File management method, file transfer protocol server and storage medium | |
CN107197359B (en) | Video file caching method and device | |
WO2016016734A1 (en) | Managing web browser cache for offline browsing | |
CN110989937B (en) | Data storage method, device and equipment and computer readable storage medium | |
US11392545B1 (en) | Tracking access pattern of inodes and pre-fetching inodes | |
US20120296871A1 (en) | File managing apparatus for processing an online storage service | |
CN110352410B (en) | Tracking access patterns of index nodes and pre-fetching index nodes | |
US9189477B2 (en) | Managing direct attached cache and remote shared cache | |
US11256419B2 (en) | Optimal object placement device and method | |
US8549274B2 (en) | Distributive cache accessing device and method for accelerating to boot remote diskless computers | |
CN111930305A (en) | Data storage method and device, storage medium and electronic device | |
KR100812332B1 (en) | Apparatus and Method for managing Contents | |
US20220129419A1 (en) | Method and apparatus for providing metadata sharing service | |
US9922093B2 (en) | Managing presentation of online content | |
CN110489279A (en) | A kind of duplicate of the document maintaining method and relevant apparatus | |
CN110427394B (en) | Data operation method and device | |
CN113485642A (en) | Data caching method and device | |
WO2018075009A1 (en) | Response caching | |
US10235293B2 (en) | Tracking access pattern of inodes and pre-fetching inodes | |
WO2023070462A1 (en) | File deduplication method and apparatus, and device | |
US20130339469A1 (en) | Self-replenishing caches | |
CN109413191A (en) | Data transmission method, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19891728 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 17.09.2021) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19891728 Country of ref document: EP Kind code of ref document: A1 |