CN105573667B - A kind of method for reading data and storage server - Google Patents

A kind of method for reading data and storage server Download PDF

Info

Publication number
CN105573667B
CN105573667B CN201510916991.2A CN201510916991A CN105573667B CN 105573667 B CN105573667 B CN 105573667B CN 201510916991 A CN201510916991 A CN 201510916991A CN 105573667 B CN105573667 B CN 105573667B
Authority
CN
China
Prior art keywords
file
read
current
client
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510916991.2A
Other languages
Chinese (zh)
Other versions
CN105573667A (en
Inventor
彭勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201510916991.2A priority Critical patent/CN105573667B/en
Publication of CN105573667A publication Critical patent/CN105573667A/en
Application granted granted Critical
Publication of CN105573667B publication Critical patent/CN105573667B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • G06F3/0611Improving I/O performance in relation to response time
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0656Data buffering arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input 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/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device

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)
  • Information Transfer Between Computers (AREA)

Abstract

This application involves the data pre-head technologies in data reading techniques field more particularly to network store system.In a kind of method for reading data, the file read request that client is sent is received, this document read requests carry the filename of the current file of current request reading;Filename based on the current file determines subdirectory of the client after current time where the last file destination that should be read;According to the subdirectory where the file destination, the file destination in disk is pre-read;The pre-reads data read in advance from the file destination is cached into memory.Pass through scheme provided herein, it is possible to reduce client reads produced access delay in file processes.

Description

A kind of method for reading data and storage server
Technical field
This application involves data reading techniques fields, the data pre-head skill more particularly in network store system Art.
Background technique
In multimedia application field, media resource can be managed by storage server.Storage server exists After the clients such as player or video editor are received for the read requests of some file, it can go to read this article in disk The data of part, and the data read are returned into the client.
However it is limited to the access performance of disk, storage server reads data from disk to prolong in the presence of access When.In this way, storage server is required to visit every time when the clients such as player need to be successively read the data in multiple files Disk is asked, with from the data in the currently requested file of reading client in disk, so as to cause the wind for generating access delay Danger also greatly increases, and influences the result of broadcast of client.
Summary of the invention
This application provides a kind of method for reading data and storage server, in clients such as players to a series of texts During part is read out, access delay is reduced.
On the one hand, this application provides a kind of method for reading data, this method comprises: storage server receives client hair The file read request sent, this document read requests carry the filename of the current file of current request reading, for example, file Read requests can be the read requests of audio-video document;Filename based on the current file determines the client current Subdirectory after moment where the last file destination that should be read;It is right according to the subdirectory where the file destination The file destination stored in disk is pre-read;The target data read in advance from the file destination is cached into memory.
Since storage server is after receiving to the read requests of current file, the client can determine whether out next time The file destination that should be read pre-reads the file destination in disk, and by the data buffer storage pre-read to memory, this Sample then can directly return to the data of the file destination cached in memory when client request reads the file destination To client, without reading the data of file destination from disk again, so as to reduce access delay.
In a kind of possible design, subdirectory where determining the file destination and the file destination it Before, storage server can be with: obtaining the subdirectory where the current file;Correspondingly, can be based on where current file Subdirectory and current file filename, determine that client the last target that should be read after current time is literary Subdirectory where part.A file can be gone out with unique identification by the filename and catalogue of file, so as to more accurate The subdirectory determined the file that client should be read next time where.
In a kind of possible design, the client the last mesh that should be read after current time is being determined Before subdirectory where mark file and the file destination, storage server can also determine the son where the current file The parent directory of catalogue, in this way, if parent directory is configured with the catalogue for pre-reading rule, based on the specific item where the current file The filename of record and current file, and rule is pre-read according to parent directory configuration, determine that the client exists from the parent directory Subdirectory after current time where the last file destination that should be read.Since same parent directory can be generally stored with The biggish file of correlation, in this way, from the same parent directory determine file destination, can be more accurate determine client The file that should be requested next time can reduce the risk of erroneous judgement.
In a kind of possible design, if parent directory is configured with the catalogue for pre-reading rule, and the file of current file It include preset characters in name, then storage server can be based on the text of subdirectory and the current file where current file Part name determines the subdirectory where file destination.By specifying the file with preset characters that can touch in same subdirectory Hair pre-reads the file with identical preset characters, can have which file of flexible setting to need default, which file is not It needs to pre-read.
It, can be according to the corresponding relationship for pre-reading character and number in rule, by current file in a kind of possible design Filename at least one character of specified location be converted to number;It determines and the number converted out is added into 1 obtained mesh Mark number;According to the corresponding relationship of the character and number, target number is converted at least one target character;By current file Filename at least one character of specified location replace at least one described target character, to obtain the file destination Filename;The filename of current file described in subdirectory where the current file is replaced with to the file of the file destination Name, to obtain the subdirectory where the file destination.
In a kind of possible design, according to the subdirectory where the file destination, to the target in disk Before file is pre-read, the pre-reads data that file destination whether is cached in memory can also be judged, and do not deposit in memory It when containing the preset data, then executes according to the subdirectory where file destination, the file destination in disk is pre-read Operation, so as to avoid the repetition to the file destination from pre-reading.
In a kind of possible design, by from the data buffer storage read in advance in file destination into memory after, if When receiving read requests of the client for the file destination, the visitor is read from the target data of memory cache The requested data in family end, and the data read from memory are returned into client, to reduce access delay.
In a kind of possible design, after the file read request for receiving client transmission, storage server is also Can detecte the pre-reads data that the current file whether is stored in memory;If being stored with the current file in memory Pre-reads data then reads the requested target data of file read request from memory, and the target data read is returned To the client, by caching the data in the current file in memory, it can reduce and the access of the current file is prolonged Late.
In a kind of possible design, while target data is returned to client, storage server can also be right Data in disk in current file are pre-read;By from the data buffer storage read in advance in current file into memory, in this way, under When the primary client request reads the data of the current file, the data of the current file can be directly obtained from memory simultaneously Client is returned to, without visiting again disk, to further reduced access delay.
On the other hand, the embodiment of the invention provides a kind of storage server, which, which has, realizes above-mentioned side The function of method storage server behavior in practice.The function can also be executed corresponding by hardware realization by hardware Software realization.The hardware or software include one or more modules corresponding with above-mentioned function.
It include processor, receiver and memory, the processing in the structure of storage server in a possible design Device is configured as that storage server is supported to execute corresponding function in the above method.The receiver is for supporting storage server Communication between client receives client and sends information or instruction involved in the above method.The storage service Device can also include memory, the memory for couple with processor, save the necessary program instruction of storage server with Data.
Detailed description of the invention
Technical solution in ord to more clearly illustrate embodiments of the present application, below will be to required use in embodiment description Attached drawing be briefly described, it should be apparent that, the accompanying drawings in the following description is only embodiments herein, for this field For those of ordinary skill, without creative efforts, it can also be obtained according to the attached drawing of offer other attached Figure.
Fig. 1 is a kind of possible application scenarios schematic diagram of the application;
Fig. 2 is a kind of flow diagram of method for reading data provided by the embodiments of the present application;
Fig. 3 hands over schematic diagram for a kind of specific process that the embodiment of the present application provides a kind of method for reading data;
Fig. 4 shows a kind of structural schematic diagram of storage server of the embodiment of the present application.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of embodiments of the present application, instead of all the embodiments.It is based on Embodiment in the application, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall in the protection scope of this application.
The technical solution of the embodiment of the present application can be applied to the storage server concentrated, and the storage server of concentration can deposit All Files data needed for storing up client access.The storage server can receive the file read request of client transmission, And this document read requests are based on, corresponding data are returned for client.
The technical solution of the embodiment of the present application also can be applied to distributed memory system, and distributed memory system is by several The set of a independent back end composition, each back end can be a storage server.
Client involved in the application can be the client where player either video editor, such as play Mobile phone, laptop where device, video editor etc..
The application scenarios of application embodiment are introduced below.
For ease of description, to the application scenarios introduction of the embodiment of the present application by taking distributed storage system as an example, such as Fig. 1 institute Show, distributed memory system 100 may include: multiple back end 101, can pass through network phase between each back end Even, network can be internet internet, Internet Protocol storage area network (IP SAN, Internet Protocol Storage Area Network) and private network etc..Back end 101 in the distributed memory system 100 can be with It include: processor, hard disk, memory, system bus, I/O device, communication module and power module etc..Wherein, each data Node 101 is exactly a storage server, and the file of access needed for can store client 200 in the back end is such as more Media file.
Certainly, which can also include meta data server (being not drawn into figure), the Metadata Service Metadata is stored in device, such as the attribute information for the data that can store in metadata node, for supporting the position of instruction storage such as It sets, the functions such as historical data, resource lookup, file record.
Client 200 can establish connection by each back end 101 in network and distributed memory system 100, Such as client can establish connection by internet, IP SAN and private network and back end.
By the network connection between client and back end, client can be to the data in distributed memory system Node sends file read request, and after the back end in distributed memory system receives this document read requests, it can base In this document read requests from the data read in corresponding document in disk, and the data read are returned into the client.
In terms of below in conjunction with the application general character recited above, to the embodiment of the present application further detailed description.
The embodiment of the present application provides a kind of method for reading data, and the storage server based on the method for reading data. The storage server receive client send file read request, according to this document read requests request reading ought be above The filename of part, determines client the last file destination that should be read after current time, and to storing in disk The file destination pre-read, and by the data read in advance storage into memory so that client request reads the target When the data of file, data can be read directly from memory and return to the client, avoided and directly read from disk Access delay caused by data.
Below with reference to Fig. 2, the method for reading data of the embodiment of the present application is introduced.
Such as Fig. 2, the embodiment of the present application may include:
201, receive the file read request that client is sent.
This document read requests carry the filename of the current file of current request reading.
It should be noted that in the present embodiment, this document is read for the ease of being distinguished with the subsequent file pre-read It takes and the file read is requested to be known as current file.
Wherein, client can be the clients such as player and video editor.
The file read request that the storage server receives can be the read requests to multimedia file, for example, right The read requests of video or audio file.
202, the filename based on current file determines what client the last time after current time should read Subdirectory where file destination.
Wherein, which is different from the current file.It is understood that in order to which the current file distinguishes, By client, the last file that should be read is known as file destination after requesting the current file in the embodiment of the present application.
Subdirectory where file destination can characterize the read path for reading the file destination.
The step 202 is understood that request the current file played according to client current time, thus it is speculated that goes out client End should request the subdirectory where the file destination played next time.
In one example, storage server can construct the daisy chaining between each file in advance, wrap in daisy chaining Subdirectory corresponding to the multiple files and this multiple file for needing to be successively read is contained, in this way, the text based on current file Part name can determine the corresponding subdirectory of file that should be read next time after current file according to the daisy chaining.Example Such as, the filename of multiple files of successive reading order is followed successively by file 1, file 2 and file 3 in the daisy chaining, wherein sequence Chain is stored with the corresponding subdirectory 1 of file 1, the corresponding subdirectory 2 of file 2 and the corresponding subdirectory 3 of file 3, if client The file destination for holding current request to read is file 1, then can determine the client next time according to the daisy chaining should read The subdirectory taken is the subdirectory 2 where file 2.
Optionally, the subdirectory where determining file destination can be the first filename according to current file, determine client The file destination that should be read next time is held, then obtains the subdirectory where the file destination again.In one example, currently Meet preset rules the filename for the file destination that should be read after file and current file next time between.It is default based on this Rule can determine the filename of file destination, then inquire the filename of file destination according to the filename of current file Corresponding subdirectory.
It needs successively to play out file 1, file 2 and file 3 for example, playing a film, and these three files Filename successively are as follows: little prince 01, little prince 02 and little prince 03, the preset rules met between filename are as follows: client The filename last character of the current file of current request access adds 1 should to request access to after current file next time File destination filename.
203, according to the subdirectory where the file destination, the file destination stored in disk is pre-read.
It pre-reads and refers to before client reads the file destination, in advance from the number read out in disk in the file destination According to.
The file destination in the disk pre-read can be and reads some or all of data of the file destination It takes out.
In a kind of example, it can be preset from the data volume size read in advance in the file destination in disk, it is such as pre- Read the data of preceding designated bit in the file destination.
In another example, the data volume size read in advance from disk can also request to read every time according to client Data volume size and determine.
204, the target data read in advance from the file destination is cached into memory.
For ease of description, the data read in advance from the file destination of disk storage are known as target data.
After being cached to memory from the target data of the file destination read in advance in disk, in this way when client initiation pair In the file destination when read requests, directly user will can be read in the data of the file destination of memory cache and request to read The data taken, and the data read out from memory are returned into client, without visiting again disk.
As it can be seen that can trigger when receiving read requests of the client to a file and determine that the client is reading this article After part next time needed for the file destination that reads, and the data for reading out from disk the file destination are cached, to keep away Exempt from when receiving the read requests to the file destination, then go in disk to read the data of the file destination, caused by prolong Late.
It in the embodiment of the present application, can be according to this document access request after receiving the file access request of client The filename of the current file requested access to, to determine client the last target that should be read after current time File, to be pre-read to the file destination in disk, and by the data buffer storage pre-read to memory, in this way, in client When the file destination is read in request, then the data of the file destination cached in memory directly can be returned into client, and The data that file destination is read from disk are no longer needed to, so as to reduce access delay.
After step 204, the read requests that client is directed to the file destination can also be received, if receiving the reading Request is taken, then can read the requested data of the client from the target data of the memory cache, and will be from memory The data read return to client.
Optionally, before step 202, the embodiment of the present application can also include: the specific item obtained where the current file Record.Wherein, the subdirectory where current file characterizes the read path of the current file.Due to may in storage server It stores that two file contents are different but filename identical file, therefore by the filename of current file and can deserve The read path of preceding document carrys out one file of unique identification, the case where to avoid current file cannot be accurately positioned.For example, it is assumed that The entitled avenger alliance _ 0000.png of the file of current file, then the catalogue where current file folder can revenge for move/ Person alliance/avenger alliance _ 0000.png, and even if the filename of alternative document is also avenger alliance _ 0000.png, still Its read path but can not be identical as the current file.
It is understood that the catalogue for the read path for characterizing current file is known as subdirectory, it is only for it is rear The continuous parent directory occurred distinguishes.
Wherein, client sends the read path that file read request can carry the current file of current request reading Information, so that storage server determines subdirectory corresponding to current file.It should be noted that when the text of client transmission It, then can directly will be according to the reading when part read requests carry the read path information of the current current file to be read Routing information determines the filename of current file, carries filename in this document read requests without client.
Correspondingly, storage server determines that file destination can be with are as follows: based on where the current file subdirectory and should The filename of current file determines son of the client after current time where the last file destination that should be read Catalogue.
Based on the filename of subdirectory and the current file where the current file, where determining the file destination The detailed process of subdirectory is referred to mention in step 202 two kinds of exemplary descriptions.
Optionally, there are a series of files of incidence relation can generally be configured under the same parent directory, therefore, can be with According to the filename of subdirectory and current file where current file, determine client at current time from the parent directory Subdirectory where the last file destination that should be read before.
In one possible implementation, pre- read right can also be configured for parent directory and is configured under parent directory between file Preset rules, can be pre-read with the subdirectory indicated under the parent directory.Wherein, it is according to father's mesh that this, which pre-reads rule, What the incidence relation between filename corresponding to each subdirectory under record determined.Specifically, if parent directory be configured with Pre-read the catalogue of rule, then it can be based on the filename of subdirectory and current file where current file, and according to the father Catalogue configuration pre-reads rule, the subdirectory where the file destination that should be read determining in the parent directory next time.As it can be seen that The subdirectory parent directory having the same where subdirectory and the current file where file destination.
It is understood that this is pre- when the incidence relation difference of filename corresponding to each subdirectory under parent directory Mostly difference may also be had by reading rule, can specifically be set according to actual needs.
Optionally, this pre-read rule can transformation rule for filename between, then according to this pre-read it is regular current to this The filename of file is converted, the filename of the next time corresponding file destination read of available client.
Such as, the corresponding relationship that rule may include character and number is pre-read, then determines file destination according to preset rules Filename may is that the corresponding relationship according to preset character and number, by specified location in the filename of current file At least one character is converted to number;It determines and the number converted out is added into 1 obtained target number;According to the character and number Corresponding relationship, target number is converted at least one target character;It will be specified described in the filename of the current file At least one character at position replaces at least one described target character, to obtain the filename of the file destination.
After the filename for determining file destination, by the file of current file described in the subdirectory where current file Name replaces with the filename of file destination, can obtain the subdirectory where file destination.Due to the subdirectory of file destination It is to be obtained using the filename of current file in the subdirectory where the filename replacement current file of file destination, thus may be used Subdirectory where knowing file destination is identical as the upper level catalogue of subdirectory where the current file, i.e., where file destination Subdirectory and current file where subdirectory parent directory having the same.
For example, it is assumed that the entitled avenger alliance _ 000a.png of the file of current file, and preset rules needs ought be above Inverse the 5th to the 8th in the filename of part is converted, then can extract " 000a " in filename, it is assumed that by it Being converted to number is " 0001 ", and " 0001 " plus 1 are obtained " 0010 ", then " 0010 " is converted to character is " 000b ", in this way The entitled avenger alliance _ 000b.png of the file of available file destination.Correspondingly, assuming the subdirectory where current file For move/ avenger alliance/avenger alliance _ 000a.png, then the subdirectory where file destination can be move/ avenger Alliance/avenger alliance _ 000b.png.
It is, of course, also possible to there are other to determine the mode of the subdirectory where file destination and file destination, regardless of which Kind of mode determines that file destination is suitable for the application, without restriction herein.
Further, in the application above embodiments, it can also be arranged under same parent directory and only have part subdirectory institute Corresponding file can be triggered and be pre-read to alternative document, and file corresponding to another part subdirectory can not then trigger Alternative document is pre-read, the text pre-read to alternative document can be triggered under the same parent directory in order to distinguish Part can be set: there is filename the file of preset characters can trigger and pre-read to alternative document, which can be with For one or more characters.In this way, as long as working as parent directory is the catalogue configured with preset rules, and in the filename of current file It, just can be according to the subdirectory where the filename and current file of the current file, from the parent directory really comprising preset characters Set the goal subdirectory corresponding to file and the file destination.
For example, video file may may require that continuous broadcasting, in the filename that video file can be set in this way " .avi " is that preset characters just can be based on the text of the current file then if including " .avi " in the filename of current file Subdirectory where part name and current file, to determine file destination that the client should play and target text next time The operation of subdirectory where part.
Optionally, before the step 203 of the embodiment of the present application, can also be judged with storage server be in memory The no pre-reads data for being cached with the file destination illustrates if being cached with the pre-reads data of the file destination in memory The data that the file destination has been pre-read from disk are pre-read without repeating;And not stored file destination only in the memory Pre-reads data, just will continue to execute the step 203, to read the data of the file destination in advance from disk.
Before pre-reading to file destination, the pre-reads data for judging whether to be cached with the file destination in memory can be with Avoid pre-reading the repetition of file destination, it is such because are as follows: the data volume in a file is generally all bigger, and client may need The reading that could complete all data in this document is repeatedly read, in this way, if receiving the client every time for current After file sends file read request, all to another file i.e. file destination that should be read after the current file next time It is pre-read, the identical data for reading the file destination in advance from the disk is repeated it will cause storage server, causes weight It pre-reads again.
Optionally, after the step 201 of the embodiment of the present application, storage server can be read according to the file of the client Request obtains the requested target data of this document read requests, and the target data is returned to the client.
In one possible implementation, whether storage server can also detect is stored with the current file in memory Pre-reads data, if being stored with the pre-reads data of the current file in memory, can directly from memory go out read this document The requested target data of read requests, and the target data of reading is directly returned into client;Certainly, if in the memory The pre-reads data of the uncached current file, then storage server needs to read out this document read requests in disk and is requested Target data.
Wherein, storage server caches the pre-reads data of the current file in memory there are two types of possible situations:
A kind of possible situation are as follows: before client request reads the data of the current file, client is to ought be above During data before part in the last file read are read out, storage server is determined one under the client The secondary file that should be read is the current file, and read in advance from the disk and deserve the data of preceding document, and will be read in advance Data buffer storage is into memory.
Alternatively possible situation are as follows: when the data of the current file are read in primary request on the client, storage service Device has estimated out the data that the client should be read out of this current file next time, to the current file stored in disk into Row is pre-read, and by the data read in advance from the current file storage into memory.
Further, while target data is returned to the client, storage server can also be somebody's turn to do in disk Data in current file are pre-read, and by the data buffer storage read in advance from the current file into memory, so as to the visitor Family end issues the read requests of the current file next time after, corresponding data are directly read from memory.It is understood that From the data that the data read in advance in current file are after the requested data of this file read request, and pre-read Data volume out can be set as needed, and e.g., the data volume read in advance can be the data volume that client is requested every time, can also To be greater than client requested data volume every time.
Below in conjunction with more attached drawings, the embodiment of the present invention is described further.
It is after storage server receives the file read request for current file, to current file and mesh such as Fig. 3 It marks under the scene that file is pre-read, a kind of specific implementation that the specific implementation flow schematic diagram of the method for reading data is Process interaction schematic diagram.In this scenario, with the subdirectory where current current file to be read are as follows: move/ avenger It is introduced for alliance/avenger alliance _ 0001.png.
In 301 parts, client sends file read request to storage server, and the carrying of this document read requests is requested Current file subdirectory: move/ avenger alliance/avenger alliance _ 0001.png, and request read number of targets According to, e.g., preceding n-bit data in avenger alliance _ 0001.png.
In 302 parts, store memory from disk subdirectory move/ avenger alliance/avenger alliance _ The forward preceding n-bit data that sort are read out in the corresponding current file of 0001.png, and return to client.
In 303 parts, storage server from disk subdirectory move/ avenger alliance/avenger alliance _ In the corresponding current file of 0001.png, the data of designated bit amount after the preceding n-bit data are read out, and store and arrive memory In.
Wherein, which can be set as needed.
For example, it is n-bit that client requests the data read every time, and the total amount of data of current file is 3n ratio Spy, then client, which needs to send file read request to storage server in three times, can just read the institute in the current file There are data, in that case, after client is sent to the read requests of the current file for the first time, storage server is visitor While family end returns to the data of the n-bit, storage server can be from reading the n-bit data in advance in the current file in disk The data of designated bit later are e.g. located at after the n-bit data from reading in advance in the current file stored in the disk N-bit data.When second of file read request sent to the current file of client, and request to read (n-1)th to 2n When the data of bit, then can with read in memory this (n-1)th to 2n bit data and return to client;Meanwhile it storing Server can read the 2n+1 of the current file to the data of 3n bit from disk, and cache into memory.
In 304 parts, storage server detects subdirectory move/ avenger alliance/avenger alliance _ 0001.png Parent directory move/ avenger alliance be preset with and pre-read rule, and the subdirectory corresponding filename avenger alliance _ The target that client should be read next time is determined then according to the preset rules including preset characters " .png " in 0001.png The entitled avenger alliance _ 0002.png of the file of file, and the subdirectory of file destination is move/ avenger alliance/avenger Alliance _ 0002.png.
Wherein, which can be set as needed.The preset rules can be read in this example for current request The 5-9 character of inverse adds 1 in the filename of the current file taken, then the 5-9 word reciprocal in avenger alliance _ 0001.png Symbol is " 0001 ", then the entitled avenger alliance _ 0002.png of file that will be obtained after the character " 0001 " plus 1.
In 305 parts, storage server according to file destination subdirectory move/ avenger alliance/avenger alliance _ 0002.png reads preceding m bit data from reading out in the disk, and delays in file destination avenger alliance _ 0002.png It deposits into memory.
Wherein, the size of the m also can be set as needed, and m bit generally can be set to be greater than each institute of client The data volume of request;Certainly, the data volume size which can also request every time with client is identical, i.e., m is identical as n.
In 306 part, client is sent to file destination move/ avenger alliance/avenger alliance _ 0002.png File read request, this document read requests are for requesting to be read out the preceding n-bit data in the file destination.
In 307 part, storage server reads file destination move/ avenger alliance/avenger's connection from memory The preceding n-bit data of alliance _ 0002.png, and return to the client.
It should be noted that client can also be initiated to revenge to current file move/ again before 308 parts (n+1)th to 2n bit data in person alliance/avenger alliance _ 0001.png, then what storage server was cached from memory deserves Requested data are read out in preceding document move/ avenger alliance/avenger alliance _ 0001.png data, and are returned to Client, meanwhile, storage server continuation pre-reads the data of the current file from disk, until this in disk is current There is no the data not pre-read in file.
And after client reads all data of current file, which can send to storage server and read The request for taking the file destination, hence into 307 part.
Certainly, while the step 308, storage server can from disk subdirectory move/ avenger alliance/multiple In Chou Zhe alliance _ corresponding file destination of 0002.png, the data of designated bit amount after the preceding n-bit data are read, and are deposited It stores up in memory.Meanwhile storage server can also determine client in the filename and subdirectory move/ of the file destination Avenger alliance/avenger alliance _ 0002.png determines next after file destination avenger alliance _ 0002.png Subdirectory corresponding to the secondary file destination that should be pre-read is move/ avenger alliance/avenger alliance _ 0003.png, and right File in disk under the move/ avenger alliance/avenger alliance _ 0003.png catalogue is pre-read.
The above-mentioned angle mainly interacted between each client and server to scheme provided in an embodiment of the present invention into Introduction is gone.It is understood that client and storage server are in order to realize the above functions, it comprises execute each function Corresponding hardware configuration and/or software module.Those skilled in the art should be readily appreciated that, in conjunction with disclosed herein Each exemplary unit and algorithm steps of embodiment description, the present invention can be with the combination shape of hardware or hardware and computer software Formula is realized.Some functions is executed in a manner of hardware or computer software driving hardware actually, depends on technical solution Specific application and design constraint.Professional technician can realize each specific application using distinct methods Described function, but such implementation should not be considered as beyond the scope of the present invention.
Fig. 4 shows a kind of possible structural schematic diagram of storage server involved in above-described embodiment.
Storage server 400 includes: receiver 401, processor 402 and memory 403.
Wherein, receiver 401 is used to receive the file read request of client transmission, and the file read request carries The filename for the current file that current request is read;
Processor 402 determines the client after current time most for the filename based on the current file Subdirectory where the nearly file destination that should once read, the file destination are different from the current file;According to described in Subdirectory where file destination pre-reads the file destination stored in disk;
Memory 403, the target data read in advance from the file destination for cache processor.
The storage server can also include nonvolatile memory, and the nonvolatile memory is for storing the processor Execute the above program code operated and data.
It is designed it is understood that Fig. 4 illustrate only simplifying for storage server.In practical applications, storage service Device 400 can also include communication bus 404, wherein memory, processor and receiver can be connected by communication bus.
The storage server can also include any number of controller, communication unit etc., and all may be implemented this The storage server of invention is all within the scope of protection of this application
Optionally, the processor is also used to, the specific item where determining the file destination and the file destination Before record, the subdirectory where the current file is obtained;
Then the processor determines the subdirectory where file destination and file destination are as follows: is based on the current file institute Subdirectory and the current file filename, determining that the client is the last after current time should read Subdirectory where the file destination taken.
Optionally, the processor is also used to, in the determination client after current time the last institute Before subdirectory where the file destination and the file destination that should read, the subdirectory where the current file is determined Parent directory;
Then the processor determines the subdirectory where the file destination and the file destination are as follows: if the father Catalogue is the text configured with the catalogue for pre-reading rule, then based on subdirectory and the current file where the current file Part name, and pre-read rule according to parent directory configuration, determined from the parent directory client current time it Subdirectory where the last file destination that should be read afterwards.
Optionally, the processor pre-reads rule according to what the parent directory configured, from the parent directory described in determination Subdirectory of the client after current time where the last file destination that should be read is specifically as follows:
According to the corresponding relationship for pre-reading character and number in rule, by specific bit in the filename of the current file At least one character at the place of setting is converted to number;
It determines and the number converted out is added into 1 obtained target number;
According to the corresponding relationship of the character and number, the target number is converted at least one target character;
At least one character of specified location described in the filename of the current file is replaced with described at least one A target character, to obtain the filename of the file destination;
The filename of current file described in subdirectory where the current file is replaced with into the file destination Filename, to obtain the subdirectory where the file destination.
Optionally, the processor is also used to, when receive the client be directed to the file destination read requests When, the requested data of the client are read from the target data of the memory cache.
The storage server further includes transmitter, and the transmitter is used for will be from the target data of memory cache The data read out return to the client.
Optionally, the processor is also used to, in the subdirectory according to where the file destination, in disk Before the file destination is pre-read, the pre-reads data that the file destination whether is cached in the memory is judged;If The pre-reads data of the not stored file destination in the memory, then execute the specific item according to where the file destination Record, the operation that the file destination in disk is pre-read.
Optionally, the processor is also used to, after the file read request for receiving client transmission, detection Whether the pre-reads data of the current file is stored in memory;If being stored with the pre- reading of the current file in memory According to then reading the requested target data of the file read request from the memory;If in memory it is not stored have it is described The pre-reads data of current file, then from the target data read in disk in the current file;
The storage server further include: transmitter, the target data for reading the processor return to institute State client.
Optionally, the processor is also used to while target data is returned to the client, to the disk Described in data in current file pre-read;
The memory is also used to cache the data that the processor is read in advance from the current file.
Each embodiment in this specification is described in a progressive manner, the highlights of each of the examples are with other The difference of embodiment, the same or similar parts in each embodiment may refer to each other.For device disclosed in embodiment For, since it is corresponded to the methods disclosed in the examples, so being described relatively simple, related place is said referring to method part It is bright.
The foregoing description of the disclosed embodiments makes professional and technical personnel in the field can be realized or use the application. Various modifications to these embodiments will be readily apparent to those skilled in the art, as defined herein General Principle can be realized in other embodiments without departing from the spirit or scope of the application.Therefore, the application It is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase one The widest scope of cause.

Claims (13)

1. a kind of method for reading data is applied to storage server characterized by comprising
The file read request that client is sent is received, it is current file that the file read request, which requests the file read, The file read request carries the filename of current file;
Obtain the subdirectory where the current file;
Determine the parent directory of the subdirectory where the current file;
If the parent directory be configured with pre-read rule catalogue, based on where the current file subdirectory and institute The filename of current file is stated, and pre-reads rule according to parent directory configuration, the client is determined from the parent directory Hold the subdirectory after current time where the last file destination that should be read;The file destination is different from described Current file;
According to the subdirectory where the file destination, the file destination stored in disk is pre-read;
The target data read in advance from the file destination is cached into memory.
2. the method according to claim 1, wherein if the parent directory is configured with the mesh for pre-reading rule Record, then the filename based on subdirectory and the current file where the current file, and match according to the parent directory That sets pre-reads rule, and the client the last target that should be read after current time is determined from the parent directory Subdirectory where file, comprising:
It and include predetermined word in the filename of the current file if the parent directory is configured with the catalogue for pre-reading rule Symbol, then the filename based on subdirectory and the current file where the current file, and match according to the parent directory That sets pre-reads rule, and the client the last target that should be read after current time is determined from the parent directory Subdirectory where file.
3. method according to claim 1 or 2, which is characterized in that it is described to pre-read rule according to parent directory configuration, Son where determining the client file destination that the last time should read after current time in the parent directory Catalogue, comprising:
According to the corresponding relationship for pre-reading character and number in rule, by specified location in the filename of the current file At least one character be converted to number;
It determines and the number converted out is added into 1 obtained target number;
According to the corresponding relationship of the character and number, the target number is converted at least one target character;
At least one character of specified location described in the filename of the current file is replaced at least one described mesh Marking-up symbol, to obtain the filename of the file destination;
The filename of current file described in subdirectory where the current file is replaced with to the file of the file destination Name, to obtain the subdirectory where the file destination.
4. method according to claim 1 or 2, which is characterized in that in the specific item according to where the file destination Record, before being pre-read to the file destination in disk, further includes:
Judge the pre-reads data that the file destination whether is cached in the memory;
If the pre-reads data of the not stored file destination in the memory, execute described according to where the file destination Subdirectory, the operation that the file destination in disk is pre-read.
5. method according to claim 1 or 2, which is characterized in that will be read in advance from the file destination described After target data is cached into memory, further includes:
When receiving read requests of the client for the file destination, from the number of targets of the memory cache The requested data of client are read according to middle, and the data read from memory are returned into client.
6. method according to claim 1 or 2, which is characterized in that read in the file for receiving client transmission After request, further includes:
Whether the pre-reads data of the current file is stored in detection memory;
If being stored with the pre-reads data of the current file in memory, the file read request is read from the memory Requested target data, and the target data read is returned into the client;
If the not stored pre-reads data for having the current file in memory, from the institute read in disk in the current file Target data is stated, and the target data read is returned into the client.
7. according to the method described in claim 6, it is characterized in that, the target data is returned to the same of the client When, further includes:
Data in current file described in the disk are pre-read;
By from the data buffer storage read in advance in the current file into the memory.
8. a kind of storage server characterized by comprising
Receiver, for receiving the file read request of client transmission, the file read request requests the file read It is current file, the file read request carries the filename of current file;
Processor is used for:
Obtain the subdirectory where the current file;
Determine the parent directory of the subdirectory where the current file;
If the parent directory be configured with pre-read rule catalogue, based on where the current file subdirectory and institute The filename of current file is stated, and pre-reads rule according to parent directory configuration, the client is determined from the parent directory The subdirectory after current time where the last file destination that should be read is held, the file destination is different from described Current file;
According to the subdirectory where the file destination, the file destination stored in disk is pre-read;
Memory, the target data read in advance from the file destination for caching the processor.
9. storage server according to claim 8, which is characterized in that the processor is configured according to the parent directory Rule is pre-read, the client the last file destination that should be read after current time is determined from the parent directory The subdirectory at place, specifically:
According to the corresponding relationship for pre-reading character and number in rule, by specified location in the filename of the current file At least one character be converted to number;
It determines and the number converted out is added into 1 obtained target number;
According to the corresponding relationship of the character and number, the target number is converted at least one target character;
At least one character of specified location described in the filename of the current file is replaced at least one described mesh Marking-up symbol, to obtain the filename of the file destination;
The filename of current file described in subdirectory where the current file is replaced with to the file of the file destination Name, to obtain the subdirectory where the file destination.
10. storage server according to claim 8 or claim 9, which is characterized in that the processor is also used to, it is described according to Judge in the memory before being pre-read to the file destination in disk according to the subdirectory where the file destination Whether the pre-reads data of the file destination is cached with;If the pre-reads data of the not stored file destination in the memory, The subdirectory according to where the file destination is then executed, the operation pre-read to the file destination in disk.
11. storage server according to claim 8 or claim 9, which is characterized in that the processor is also used to, and is incited somebody to action described After caching from the target data read in advance in the file destination into memory, the mesh is directed to when receiving the client When marking the read requests of file, the requested data of the client are read from the target data of the memory cache;
The storage server further includes transmitter, and the transmitter is for returning the data read from the target data Back to the client.
12. storage server according to claim 8 or claim 9, which is characterized in that the processor is also used to, and is connect described After the file read request for receiving client transmission, the pre-reads data that the current file whether is stored in memory detected; If being stored with the pre-reads data of the current file in memory, the file read request is read from the memory and is asked The target data asked;If the not stored pre-reads data for having the current file in memory, read from disk described current The target data in file;
The storage server further include: transmitter, the target data for reading the processor return to institute State client.
13. storage server according to claim 12, which is characterized in that the processor is also used to by number of targets While according to the client is returned to, the data in current file described in the disk are pre-read;
The memory is also used to cache the data that the processor is read in advance from the current file.
CN201510916991.2A 2015-12-10 2015-12-10 A kind of method for reading data and storage server Active CN105573667B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510916991.2A CN105573667B (en) 2015-12-10 2015-12-10 A kind of method for reading data and storage server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510916991.2A CN105573667B (en) 2015-12-10 2015-12-10 A kind of method for reading data and storage server

Publications (2)

Publication Number Publication Date
CN105573667A CN105573667A (en) 2016-05-11
CN105573667B true CN105573667B (en) 2019-07-23

Family

ID=55883861

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510916991.2A Active CN105573667B (en) 2015-12-10 2015-12-10 A kind of method for reading data and storage server

Country Status (1)

Country Link
CN (1) CN105573667B (en)

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106777047A (en) * 2016-12-09 2017-05-31 郑州云海信息技术有限公司 A kind of metadata read method and its device for distributed system
CN107506154A (en) * 2017-09-26 2017-12-22 郑州云海信息技术有限公司 A kind of read method of metadata, device and computer-readable recording medium
CN107590278A (en) * 2017-09-28 2018-01-16 郑州云海信息技术有限公司 A kind of pre-reading method of files and relevant apparatus based on CEPH
CN107704596B (en) * 2017-10-13 2021-06-29 郑州云海信息技术有限公司 Method, device and equipment for reading file
CN108959519A (en) * 2018-06-28 2018-12-07 郑州云海信息技术有限公司 A kind of method, apparatus and computer readable storage medium reading data
CN110737388A (en) * 2018-07-18 2020-01-31 中兴通讯股份有限公司 Data pre-reading method, client, server and file system
CN109766318B (en) * 2018-12-17 2021-03-02 新华三大数据技术有限公司 File reading method and device
CN109783015B (en) * 2018-12-24 2022-05-10 新华三技术有限公司 File transmission method, device, server and storage medium
CN109783453B (en) * 2019-01-14 2021-08-17 哈皮尼思(北京)文化科技有限公司 File browsing method and device
CN109947720A (en) * 2019-04-12 2019-06-28 苏州浪潮智能科技有限公司 A kind of pre-reading method of files, device, equipment and readable storage medium storing program for executing
CN110502498A (en) * 2019-08-16 2019-11-26 济南浪潮数据技术有限公司 A kind of distributed file system pre-reading method of files and system
CN110795030A (en) * 2019-10-11 2020-02-14 新华三大数据技术有限公司 Small file reading method and device
CN110807010A (en) * 2019-10-29 2020-02-18 北京猎豹移动科技有限公司 File reading method and device, electronic equipment and storage medium
CN112799589B (en) * 2021-01-14 2023-07-14 新华三大数据技术有限公司 Data reading method and device
CN114237518B (en) * 2022-02-22 2022-05-24 苏州浪潮智能科技有限公司 Data reading method, system, device and terminal

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103608785A (en) * 2013-06-21 2014-02-26 华为技术有限公司 Method for reading file, storage device and reading system
CN104333803A (en) * 2014-10-29 2015-02-04 华为技术有限公司 Method, equipment and system for preventing frame loss in process of video editing

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7421432B1 (en) * 1999-12-15 2008-09-02 Google Inc. Hypertext browser assistant
CN101315595A (en) * 2008-06-30 2008-12-03 华为技术有限公司 Data reading method and device
CN103593147B (en) * 2013-11-07 2016-08-17 华为技术有限公司 A kind of method and device of digital independent

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103608785A (en) * 2013-06-21 2014-02-26 华为技术有限公司 Method for reading file, storage device and reading system
CN104333803A (en) * 2014-10-29 2015-02-04 华为技术有限公司 Method, equipment and system for preventing frame loss in process of video editing

Also Published As

Publication number Publication date
CN105573667A (en) 2016-05-11

Similar Documents

Publication Publication Date Title
CN105573667B (en) A kind of method for reading data and storage server
KR101028639B1 (en) Managed object replication and delivery
KR102047495B1 (en) Method and apparatus for playing multimedia content of server via streaming at client using cache
CN101409706B (en) Method, system and relevant equipment for distributing data of edge network
US7716306B2 (en) Data caching based on data contents
US9158460B2 (en) Selecting data nodes using multiple storage policies in cloud storage system
US8745262B2 (en) Adaptive network content delivery system
US20160048476A1 (en) Data managing system, data managing method, and computer-readable, non-transitory medium storing a data managing program
US8176061B2 (en) Tracking digital assets on a distributed network
US20170149860A1 (en) Partial prefetching of indexed content
KR101964927B1 (en) Method and apparatus for caching proxy
CN103945259B (en) A kind of Online Video player method and device
RU2005124131A (en) INFORMATION PROCESSING DEVICE, CONTENT MANAGEMENT METHOD, CONTENT INFORMATION MANAGEMENT METHOD AND COMPUTER PROGRAM
CN106681990B (en) Data cached forecasting method under a kind of mobile cloud storage environment
AU2017265064B2 (en) Access to data on a remote device
CN108540510B (en) Cloud host creation method and device and cloud service system
KR20060123508A (en) Methods and apparatuses for synchronizing and identifying content
DK2834746T3 (en) PIPELINE TREATMENT FOR PARALLEL NETWORK CONNECTIONS FOR TRANSMISSION OF A DIGITAL CONTENT POWER
WO2006105469A1 (en) Method and apparatus for cooperative file distribution in the presence of firewalls
CN109582246A (en) Data access method, device, system and readable storage medium storing program for executing based on mine machine
US8549274B2 (en) Distributive cache accessing device and method for accelerating to boot remote diskless computers
CN102238174A (en) Information processing apparatus, information processing method, program, information providing apparatus, and information processing system
JP2018511131A (en) Hierarchical cost-based caching for online media
CN110855786A (en) Processing method and device for network data request and computer storage medium
WO2022105631A1 (en) Method and apparatus for requesting configuration page, and electronic device

Legal Events

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