CN110109865A - A kind of date storage method, device, equipment and readable storage medium storing program for executing - Google Patents
A kind of date storage method, device, equipment and readable storage medium storing program for executing Download PDFInfo
- Publication number
- CN110109865A CN110109865A CN201910376196.7A CN201910376196A CN110109865A CN 110109865 A CN110109865 A CN 110109865A CN 201910376196 A CN201910376196 A CN 201910376196A CN 110109865 A CN110109865 A CN 110109865A
- Authority
- CN
- China
- Prior art keywords
- file
- empty
- empty file
- creation
- chained list
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 67
- 238000013500 data storage Methods 0.000 claims abstract description 60
- 238000004590 computer program Methods 0.000 claims description 9
- 238000012423 maintenance Methods 0.000 claims description 6
- 230000008569 process Effects 0.000 abstract description 24
- 230000004044 response Effects 0.000 abstract description 7
- 238000004891 communication Methods 0.000 abstract description 6
- 230000007246 mechanism Effects 0.000 abstract description 5
- 230000009286 beneficial effect Effects 0.000 abstract description 3
- 230000000977 initiatory effect Effects 0.000 abstract description 2
- 230000006870 function Effects 0.000 description 6
- 238000012545 processing Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000006872 improvement Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 239000000047 product Substances 0.000 description 2
- 241000282376 Panthera tigris Species 0.000 description 1
- 230000007423 decrease Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000004043 responsiveness Effects 0.000 description 1
- 239000013589 supplement Substances 0.000 description 1
- 230000001502 supplementing effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/11—File system administration, e.g. details of archiving or snapshots
- G06F16/113—Details of archiving
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
技术领域technical field
本发明涉及数据处理技术领域,特别涉及一种数据存储方法、装置、设备及一种可读存储介质。The present invention relates to the technical field of data processing, in particular to a data storage method, device, equipment and a readable storage medium.
背景技术Background technique
目前随着交互数据量的增大系统对于数据存储的效率要求较高,尤其针对一些存储数据量大且时效性要求较高的应用场景,比如经常出现固定时间文件创建瞬时高并发的场景,例如视频监控业务场景。视频监控业务对视频流存储要求极高,为了满足不丢帧的需求,存储文件创建及写入最大时延不能超过500ms,同时对平均时延也有要求。At present, with the increase in the amount of interactive data, the system has higher requirements for data storage efficiency, especially for some application scenarios that store a large amount of data and require high timeliness. For example, there are often scenarios where files are created at a fixed time and are instantaneously high in concurrency, such as Video surveillance business scenario. Video surveillance services have extremely high requirements for video stream storage. In order to meet the requirement of no frame loss, the maximum delay for creating and writing stored files cannot exceed 500ms, and there are also requirements for the average delay.
当前的数据存储方法在存储客户端接收到文件创建写请求时,需要控制后台进行新文件创建,创建成功后将数据写入。其中,文件创建过程由于需要后台元数据服务控制多方参与交互,对于某时间文件创建数据写入高并发的场景所需时间占用较长,会导致前端用户业务响应缓慢甚至停滞,影响用户体验。In the current data storage method, when the storage client receives a file creation and writing request, it needs to control the background to create a new file, and write the data after the creation is successful. Among them, since the file creation process requires background metadata services to control multiple parties to participate in the interaction, it takes a long time for a certain time file creation data to be written to high-concurrency scenarios, which will cause front-end users to respond slowly or even stagnate, affecting user experience.
因此,如何优化创建写过程对于数据存储过程的时间占用,是本领域技术人员需要解决的技术问题。Therefore, how to optimize the time occupied by the creation of the writing process for the data storage process is a technical problem to be solved by those skilled in the art.
发明内容Contents of the invention
本发明的目的是提供一种数据存储方法,该方法可以优化创建写过程对于数据存储过程的时间占用,降低瞬时元数据服务压力;本发明的另一目的是提供一种数据存储装置、设备及一种可读存储介质,具有上述有益效果。The purpose of the present invention is to provide a data storage method, which can optimize the time occupied by the creation and writing process for the data storage process, and reduce the pressure on instantaneous metadata services; another purpose of the present invention is to provide a data storage device, equipment and A readable storage medium has the above beneficial effects.
为解决上述技术问题,本发明提供一种数据存储方法,包括:In order to solve the above technical problems, the present invention provides a data storage method, including:
当存储服务挂载时创建空文件;Create an empty file when the storage service mounts;
为各所述空文件创建维护链表,得到空文件链表;Create a maintenance linked list for each of the empty files to obtain an empty file linked list;
当接收到文件创建写入请求时,确定待写入的目标数据流;When a file creation write request is received, determine the target data stream to be written;
依据所述空文件链表确定作为数据接收端的预创建空文件,得到目标文件;Determine the pre-created empty file as the data receiving end according to the empty file linked list, and obtain the target file;
调用所述目标文件接收并存储所述目标数据流。calling the target file to receive and store the target data stream.
可选地,依据所述空文件链表确定作为数据接收端的预创建空文件,包括:Optionally, determining a pre-created empty file as a data receiving end according to the empty file linked list includes:
获取所述空文件链表中的首个空文件;Obtain the first empty file in the empty file linked list;
根据用户指定的用户名对获取的所述首个空文件进行名称替换,将得到的文件作为所述目标文件。Perform name replacement on the obtained first empty file according to the user name specified by the user, and use the obtained file as the target file.
可选地,在依据所述空文件链表确定作为数据接收端的预创建空文件之后,还包括:Optionally, after determining the pre-created empty file as the data receiving end according to the empty file linked list, the method further includes:
输出创建文件成功的提示信息。Output the prompt message that the file is successfully created.
可选地,在依据所述空文件链表确定作为数据接收端的预创建空文件之后,还包括:Optionally, after determining the pre-created empty file as the data receiving end according to the empty file linked list, the method further includes:
创建与目标个数相同的空文件;其中,所述目标个数与所述空文件链表中已占用文件数量对应;Create empty files identical to the target number; wherein, the target number corresponds to the number of occupied files in the empty file linked list;
将新创建的所述目标个数的空文件添加至所述空文件链表中。Add the newly created empty files of the target number to the empty file linked list.
为实现上述目的,本申请还公开了一种数据存储装置,包括:To achieve the above purpose, the present application also discloses a data storage device, comprising:
第一空文件创建单元,用于当存储服务挂载时创建空文件;The first empty file creation unit is used to create an empty file when the storage service is mounted;
链表创建单元,用于为各所述空文件创建维护链表,得到空文件链表;A linked list creation unit, configured to create a maintenance linked list for each of the empty files to obtain an empty file linked list;
数据流确定单元,用于当接收到文件创建写入请求时,确定待写入的目标数据流;A data stream determining unit, configured to determine a target data stream to be written when a file creation and writing request is received;
目标文件确定单元,用于依据所述空文件链表确定作为数据接收端的预创建空文件,得到目标文件;A target file determining unit, configured to determine a pre-created empty file as a data receiving end according to the empty file linked list, and obtain the target file;
目标文件调用单元,用于调用所述目标文件接收并存储所述目标数据流。The target file calling unit is used to call the target file to receive and store the target data stream.
可选地,所述目标文件确定单元包括:Optionally, the target file determination unit includes:
文件获取子单元,用于获取所述空文件链表中的首个空文件;A file acquisition subunit, configured to acquire the first empty file in the empty file linked list;
名称替换子单元,用于根据用户指定的用户名对获取的所述首个空文件进行名称替换,将得到的文件作为所述目标文件。The name replacement subunit is configured to perform name replacement on the acquired first empty file according to the user name specified by the user, and use the obtained file as the target file.
可选地,数据存储装置还包括:提示单元,所述提示单元与所述目标文件确定单元的输出端连接,所述提示单元用于输出创建文件成功的提示信息。Optionally, the data storage device further includes: a prompt unit connected to the output terminal of the target file determining unit, and the prompt unit is configured to output prompt information indicating that the file creation is successful.
可选地,数据存储装置还包括:第二空文件创建单元,所述第二空文件创建单元与所述目标文件确定单元的输出端连接,所述第二空文件创建单元包括:Optionally, the data storage device further includes: a second empty file creation unit, the second empty file creation unit is connected to the output end of the target file determination unit, and the second empty file creation unit includes:
创建子单元,用于创建目标个数的空文件;其中,所述目标个数为与所述空文件链表中已占用文件数量对应;Create a subunit for creating a target number of empty files; wherein, the target number corresponds to the number of occupied files in the empty file linked list;
添加子单元,用于将新创建的所述目标个数的空文件添加至所述空文件链表中。The adding subunit is used to add the newly created empty files of the target number to the empty file linked list.
为实现上述目的,本申请还公开了一种数据存储设备,包括:In order to achieve the above purpose, this application also discloses a data storage device, including:
存储器,用于存储计算机程序;memory for storing computer programs;
处理器,用于执行所述计算机程序时实现上述数据存储方法的步骤。A processor configured to implement the steps of the above data storage method when executing the computer program.
为实现上述目的,本申请还公开了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被所述处理器执行时实现上述数据存储方法的步骤。To achieve the above purpose, the present application also discloses a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by the processor, the steps of the above-mentioned data storage method are realized.
本发明所提供的数据存储方法在存储客户端在发起文件创建数据写入申请之前先按照固定规则创建好一定的文件量,在存储客户端创建写入申请发过来的时候,直接将已创建好的文件返回给用户,大大减少文件创建的时间,整个对文件创建请求的响应过程不需要和元数据服务进行通信,确定待写入数据后直接将待写入的数据流写入预创建的空文件即可,通过文件预创建机制减少了数据存储过程中与元数据服务间的通信,减少了其中的IO路径,提高了文件创建的并发量,缩短了时延,提升了业务响应效率。In the data storage method provided by the present invention, the storage client first creates a certain amount of files according to fixed rules before initiating the application for file creation and data writing, and when the storage client sends the application for creation and writing, the created files are directly The file is returned to the user, which greatly reduces the time of file creation. The entire response process to the file creation request does not need to communicate with the metadata service. After confirming the data to be written, the data stream to be written is directly written into the pre-created space. Files are enough. Through the file pre-creation mechanism, the communication between the data storage process and the metadata service is reduced, the IO path is reduced, the concurrency of file creation is increased, the delay is shortened, and the business response efficiency is improved.
本发明还提供了一种数据存储装置、设备及一种可读存储介质,具有上述有益效果,在此不再赘述。The present invention also provides a data storage device, equipment and a readable storage medium, which have the above-mentioned beneficial effects, and will not be repeated here.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only It is an embodiment of the present invention, and those skilled in the art can also obtain other drawings according to the provided drawings without creative work.
图1为本发明实施例提供的一种数据存储方法的流程图;FIG. 1 is a flow chart of a data storage method provided by an embodiment of the present invention;
图2为本发明实施例提供的一种数据存储装置的结构框图;FIG. 2 is a structural block diagram of a data storage device provided by an embodiment of the present invention;
图3为本发明实施例提供的一种数据存储设备结构示意图。FIG. 3 is a schematic structural diagram of a data storage device provided by an embodiment of the present invention.
具体实施方式Detailed ways
本发明的核心是提供一种数据存储方法,该方法可以优化创建写过程对于数据存储过程的时间占用,降低瞬时元数据服务压力;本发明的另一核心是提供一种数据存储装置、设备及一种可读存储介质。The core of the present invention is to provide a data storage method, which can optimize the time occupation of the creation and writing process for the data storage process, and reduce the pressure on instantaneous metadata services; another core of the present invention is to provide a data storage device, equipment and A readable storage medium.
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
实施例一:Embodiment one:
请参考图1,图1为本实施例提供的数据存储方法的流程图;该方法主要包括以下步骤:Please refer to Fig. 1, Fig. 1 is the flowchart of the data storage method that the present embodiment provides; This method mainly comprises the following steps:
步骤s110:当存储服务挂载时创建空文件。Step s110: Create an empty file when the storage service is mounted.
创建的空文件的个数可以根据实际应用场景进行设定。例如某应用场景下需要在固定时间存储1000个文件的数据流,则可以在该固定时间前创建1000个空文件。创建的空文件的个数可以固定也可以不固定,对于固定文件数量瞬时高并发的场景可以在存储服务挂载的时候首先在固定目录中创建指定个数的空文件,对于不定发性大数量文件创建场景可以不固定文件创建数量,例如可以在任意元数据服务压力小的时间进行空文件的创建,本实施例中对创建的空文件的数量不做限定。空文件的数量可以通过配置文件进行设置。客户端直接通过挂载形式访问存储集群,即可具有此功能。The number of created empty files can be set according to the actual application scenario. For example, in an application scenario where data streams of 1000 files need to be stored at a fixed time, 1000 empty files can be created before the fixed time. The number of created empty files can be fixed or not. For scenarios with a fixed number of files and high concurrency instantaneously, you can first create a specified number of empty files in a fixed directory when the storage service is mounted. For a large number of variable The number of created files may not be fixed in the file creation scenario. For example, empty files may be created at any time when the metadata service pressure is low. In this embodiment, the number of created empty files is not limited. The number of empty files can be set via the configuration file. This function can be provided by the client directly accessing the storage cluster in the form of mounting.
创建空文件需要尽量在数据存储业务高并发出现前完成,本实施例中对具体创建时间不做限定,为保证各个时间段下存储业务的不定时间下的优化处理,可以在数据存储服务挂载的同时启动空文件的创建工作,当然,也可以考虑其它因素在存储服务挂载的其它时间段进行空文件的创建,比如若数据存储服务挂载的同时元数据服务压力较大时,可以在元数据服务压力较小(整体需要调用元数据服务较少)时进行空文件的创建。在此仅以上述两种空文件创建时间为例进行介绍,其它具体应用场景下的创建时间设定在此不做限定,可以根据实际情况尽量早的进行空文件的创建。The creation of empty files needs to be completed before the high concurrency of data storage services occurs. In this embodiment, the specific creation time is not limited. In order to ensure the optimal processing of storage services in various time periods under uncertain times, it can be mounted on the data storage service. Start the creation of empty files at the same time. Of course, you can also consider other factors to create empty files in other time periods when the storage service is mounted. For example, if the metadata service is under high pressure while the data storage service is mounted, you can Empty files are created when the pressure on the metadata service is low (the overall need to call the metadata service is less). Here we only take the creation time of the above two kinds of empty files as examples to introduce. The creation time settings in other specific application scenarios are not limited here, and the empty file can be created as early as possible according to the actual situation.
步骤s120:为各空文件创建维护链表,得到空文件链表。Step s120: Create a maintenance linked list for each empty file to obtain an empty file linked list.
本地客户端维护一个包括所有空文件的链表,空文件链表中主要包括待调用的预创建空文件的相关信息,也可以包括所有预创建空文件调用情况。空文件链表主要用于空文件调用,其他用途下的空文件链表的调用在此不做限定。The local client maintains a linked list including all empty files. The empty file linked list mainly includes information about the pre-created empty files to be called, and may also include all pre-created empty file calls. The empty file linked list is mainly used for calling the empty file, and the calling of the empty file linked list for other purposes is not limited here.
空文件链表的创建可以在空文件创建完成后进行,也可以首先创建空文件链表,再将新创建空文件添加至链表中进行空文件管理,也可以在空文件创建的同时创建空文件链表,在此对创建空文件以及创建空文件维护链表的执行顺序不做限定。创建空文件的卧虎链表的过程可以参见相关技术中的介绍,在此不再赘述。The empty file linked list can be created after the empty file is created, or the empty file linked list can be created first, and then the newly created empty file can be added to the linked list for empty file management, or the empty file linked list can be created at the same time as the empty file is created. Here, there is no limitation on the execution sequence of creating an empty file and creating an empty file maintenance linked list. For the process of creating the crouching tiger linked list of empty files, please refer to the introduction in the relevant technology, and will not repeat them here.
步骤s130:当接收到文件创建写入请求时,确定待写入的目标数据流。Step s130: When a file creation and writing request is received, determine the target data stream to be written.
步骤s140:依据空文件链表确定作为数据接收端的预创建空文件,得到目标文件。Step s140: Determine the pre-created empty file as the data receiving end according to the empty file link list, and obtain the target file.
文件创建写入请求即有新数据需要写入新创建的文件中,确定待写入的目标数据流,并从预创建的空文件中确定当前需要进行数据写入的目标文件。将预创建的空文件作为当前接收数据的目标文件,不仅可以避免新文件创建过程中对元数据服务带来的服务压力,同时也能减少文件创建过程带来的服务时延,在分布式文件系统中,通过预创建机制提高文件创建的性能,预创建之后等候客户端文件创建的申请,无时延的返回已创建好的文件。对于高并发文件创建场景中,当高并发的创建文件请求发给存储时,可以瞬间将已创建好的空文件返回给用户,提高了用户创建文件的性能,可以满足客户端高并发文件创建需求,业务运行更加顺畅稳定。例如在某些视频流场景中,每个摄像头写入的文件大小固定,达到固定大小之后就会创建新的文件,所以上千路的摄像头会同时的创建文件。本实施例提供的预创建机制可以显著提高该场景下的数据存储效率,提升了产品的竞争力。The file creation and writing request means that there is new data to be written into the newly created file, the target data stream to be written is determined, and the current target file for data writing is determined from the pre-created empty files. Using the pre-created empty file as the target file for currently receiving data can not only avoid the service pressure on the metadata service during the new file creation process, but also reduce the service delay caused by the file creation process. In the system, the performance of file creation is improved through the pre-creation mechanism. After pre-creation, it waits for the application of client file creation, and returns the created file without delay. For high-concurrency file creation scenarios, when a high-concurrency file creation request is sent to the storage, the created empty file can be returned to the user in an instant, which improves the performance of the user's file creation and meets the client's high-concurrency file creation needs. , the business operation is smoother and more stable. For example, in some video streaming scenarios, the size of the file written by each camera is fixed, and a new file will be created after reaching the fixed size, so thousands of cameras will create files at the same time. The pre-creation mechanism provided in this embodiment can significantly improve the data storage efficiency in this scenario and improve the competitiveness of the product.
需要说明的是,在接收到文件创建写入请求时,确定待写入的目标数据流以及确定目标文件的执行顺序本实施例中不做限定,可以先确定目标数据流再确定目标文件,也可以先确定目标文件再确定目标数据流,或者也可以同时执行,可以根据实际应用场景进行设定。It should be noted that, when a file creation and writing request is received, the execution sequence of determining the target data stream to be written and determining the target file is not limited in this embodiment. The target data stream can be determined first and then the target file can be determined. The target file can be determined first and then the target data flow can be determined, or can be executed at the same time, and can be set according to the actual application scenario.
根据空文件链表确定目标文件的过程在此不做限定,可以选取任意预创建的空文件作为目标文件。其中,为了减少文件选择过程中的资源以及时间占用,可以获取空文件链表中的首个空文件;根据用户指定的用户名对获取的首个空文件进行名称替换,将得到的文件作为目标文件。当存储客户端发来创建文件的请求时,将链表中的第一个空文件进行rename操作,rename为用户创建的文件名,减少了与元数据服务之间的通信,减少其中的IO路径,缩短时延,提升创建文件的性能。The process of determining the target file according to the empty file link list is not limited here, and any pre-created empty file can be selected as the target file. Among them, in order to reduce the resources and time occupied in the file selection process, the first empty file in the empty file list can be obtained; the name of the first empty file obtained is replaced according to the user name specified by the user, and the obtained file is used as the target file . When the storage client sends a request to create a file, rename the first empty file in the linked list. Rename is the file name created by the user, which reduces the communication with the metadata service and reduces the IO path. Reduce latency and improve file creation performance.
步骤s150:调用目标文件接收并存储目标数据流。Step s150: calling the target file to receive and store the target data stream.
调用目标文件接收并存储目标数据流的过程可以参见相关技术中数据写入方法,在此不做赘述。For the process of invoking the target file to receive and store the target data stream, refer to the data writing method in the related art, which will not be repeated here.
此外,在上述步骤s140从预创建的空文件中确定目标文件后,可以进一步输出创建文件成功的提示信息,可以对用户起到执行步骤的提示的同时也可以从用户端感受到响应速度的提升。当然,也可以不输出提示信息,或者在其它时间节点输出提示信息,本实施例中对此不做限定。In addition, after the target file is determined from the pre-created empty file in the above step s140, a prompt message that the file is successfully created can be further output, which can prompt the user to execute the steps and also feel the improvement of the response speed from the user end . Of course, it is also possible not to output the prompt information, or to output the prompt information at other time points, which is not limited in this embodiment.
基于上述介绍,本发明实施例公开的数据存储方法在存储客户端在发起文件创建数据写入申请之前先按照固定规则创建好一定的文件量,在存储客户端创建写入申请发过来的时候,直接将已创建好的文件返回给用户,大大减少文件创建的时间,整个对文件创建请求的响应过程不需要和元数据服务进行通信,确定待写入数据后直接将待写入的数据流写入预创建的空文件即可,通过文件预创建机制减少了数据存储过程中与元数据服务间的通信,减少了其中的IO路径,提高了文件创建的并发量,缩短了时延,提升了业务响应效率。Based on the above introduction, the data storage method disclosed in the embodiment of the present invention creates a certain amount of files according to fixed rules before the storage client initiates the file creation and data writing application, and when the storage client sends the creation and writing application, Directly return the created file to the user, greatly reducing the time for creating the file. The entire response process to the file creation request does not need to communicate with the metadata service. After confirming the data to be written, directly write the data stream to be written Just enter the pre-created empty file. Through the file pre-creation mechanism, the communication between the data storage process and the metadata service is reduced, the IO path in it is reduced, the concurrency of file creation is increased, the delay is shortened, and the Business responsiveness.
实施例二:Embodiment two:
基于上述实施例,为保证在客户端持续不断接收数据存储请求的同时保证后台持续的响应速度,可以在依据空文件链表确定作为数据接收端的预创建空文件之后,创建与目标个数相同的空文件;其中,目标个数与空文件链表中已占用文件数量对应;并将新创建的目标个数的空文件添加至空文件链表中。即在空文件数量减少后在此创建空文件,保持系统中预创建的空文件数量,避免在持续大量数据来袭的情况下空文件数量不足导致的效率下降的情况。Based on the above-mentioned embodiments, in order to ensure the continuous response speed of the background while the client continuously receives data storage requests, it is possible to create empty files with the same number as the target after determining the pre-created empty files as the data receiving end according to the empty file link list. files; wherein, the target number corresponds to the number of occupied files in the empty file linked list; and the newly created empty files of the target number are added to the empty file linked list. That is, create empty files here after the number of empty files is reduced, maintain the number of pre-created empty files in the system, and avoid the situation of efficiency decline caused by insufficient number of empty files in the case of continuous large amount of data.
其中,进行新文件的创建的过程可以在每次rename之后进行,即调用了一个空文件后立即新创建一个空文件,保证固定目录中空文件的数量不变;也可以在空文件的数量小于一定阈值之后进行大批量空文件的创建,例如,当空文件的数量不足100个时,启动900个空文件的创建工作,为下次高并发的创建请求做准备。从而减少了元数据服务的压力峰值。本实施例中对于进行新文件补充的执行时间段不做限定,可以根据实际使用需要进行设定。当然,在单次存储服务挂载的同时可以仅进行一次新文件的创建过程,即不进行空文件的补充,不做限定。Among them, the process of creating a new file can be carried out after each rename, that is, a new empty file is created immediately after calling an empty file, so as to ensure that the number of empty files in the fixed directory remains unchanged; it can also be used when the number of empty files is less than a certain Create a large number of empty files after the threshold. For example, when the number of empty files is less than 100, start the creation of 900 empty files to prepare for the next high-concurrency creation request. This reduces pressure peaks on the metadata service. In this embodiment, there is no limitation on the execution time period for supplementing new files, which can be set according to actual needs. Of course, only one new file creation process can be performed at the same time of a single storage service mount, that is, no empty file supplement is performed, and there is no limitation.
实施例三:Embodiment three:
请参考图2,图2为本实施例提供的数据存储装置的结构框图;该装置主要包括:第一空文件创建单元210、链表创建单元220、数据流确定单元230、目标文件确定单元240以及目标文件调用单元250。本实施例提供的数据存储装置可与上述数据存储方法相互对照。Please refer to Fig. 2, Fig. 2 is the structural block diagram of the data storage device that this embodiment provides; The object file calls unit 250 . The data storage device provided in this embodiment can be compared with the above data storage method.
其中,第一空文件创建单元210主要用于当存储服务挂载时创建空文件;Wherein, the first empty file creation unit 210 is mainly used to create an empty file when the storage service is mounted;
链表创建单元220主要用于为各空文件创建维护链表,得到空文件链表;Linked list creation unit 220 is mainly used for creating maintenance linked list for each empty file, obtains empty file linked list;
数据流确定单元230主要用于当接收到文件创建写入请求时,确定待写入的目标数据流;The data stream determination unit 230 is mainly used to determine the target data stream to be written when a file creation write request is received;
目标文件确定单元240主要用于依据空文件链表确定作为数据接收端的预创建空文件,得到目标文件;The target file determination unit 240 is mainly used to determine the pre-created empty file as the data receiving end according to the empty file linked list to obtain the target file;
目标文件调用单元250主要用于调用目标文件接收并存储目标数据流。The target file calling unit 250 is mainly used to call the target file to receive and store the target data stream.
本实施例提供的数据存储装置可以优化创建写过程对于数据存储过程的时间占用,降低瞬时元数据服务压力。The data storage device provided in this embodiment can optimize the time occupied by the creation and writing process for the data storage process, and reduce the pressure on the instantaneous metadata service.
可选地,目标文件确定单元具体可以包括:Optionally, the target file determining unit may specifically include:
文件获取子单元,用于获取空文件链表中的首个空文件;The file acquisition subunit is used to acquire the first empty file in the empty file linked list;
名称替换子单元,用于根据用户指定的用户名对获取的首个空文件进行名称替换,将得到的文件作为目标文件。The name replacement subunit is used to replace the name of the first empty file obtained according to the user name specified by the user, and use the obtained file as the target file.
可选地,本实施例提供的数据存储装置可以进一步包括:提示单元,提示单元与目标文件确定单元的输出端连接,提示单元用于输出创建文件成功的提示信息。Optionally, the data storage device provided in this embodiment may further include: a prompt unit connected to the output terminal of the target file determination unit, and the prompt unit is configured to output prompt information indicating that the file is created successfully.
可选地,本实施例提供的数据存储装置可以进一步包括:第二空文件创建单元,第二空文件创建单元与目标文件确定单元的输出端连接,第二空文件创建单元包括:Optionally, the data storage device provided in this embodiment may further include: a second empty file creation unit, the second empty file creation unit is connected to the output end of the target file determination unit, and the second empty file creation unit includes:
创建子单元,用于创建目标个数的空文件;其中,目标个数为与空文件链表中已占用文件数量对应;Create a subunit for creating a target number of empty files; wherein, the target number corresponds to the number of occupied files in the empty file linked list;
添加子单元,用于将新创建的目标个数的空文件添加至空文件链表中。The adding subunit is used for adding the newly created empty files of the target number to the empty file linked list.
实施例四:Embodiment four:
下面对本申请提供的数据存储设备进行介绍,具体对数据存储设备的介绍可参照上述数据存储方法的步骤,该设备主要包括:The following is an introduction to the data storage device provided by this application. The specific introduction to the data storage device can refer to the steps of the above data storage method. The device mainly includes:
存储器,用于存储计算机程序;memory for storing computer programs;
处理器,用于执行计算机程序时实现上述数据存储方法的步骤。The processor is configured to implement the steps of the above data storage method when executing the computer program.
请参考图3,本申请实施例提供的数据存储设备的结构示意图,该数据存储设备可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上处理器(centralprocessing units,CPU)322(例如,一个或一个以上处理器)和存储器332,一个或一个以上存储应用程序342或数据344的存储介质330(例如一个或一个以上海量存储设备)。其中,存储器332和存储介质330可以是短暂存储或持久存储。存储在存储介质330的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对数据处理设备中的一系列指令操作。更进一步地,中央处理器322可以设置为与存储介质330通信,在数据存储设备301上执行存储介质330中的一系列指令操作。Please refer to FIG. 3 , which is a schematic structural diagram of a data storage device provided by an embodiment of the present application. The data storage device may have relatively large differences due to different configurations or performances, and may include one or more than one processor (central processing units, CPU) 322 (eg, one or more processors) and memory 332, one or more storage media 330 (eg, one or more mass storage devices) for storing application programs 342 or data 344. Wherein, the memory 332 and the storage medium 330 may be temporary storage or persistent storage. The program stored in the storage medium 330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the data processing device. Furthermore, the central processing unit 322 may be configured to communicate with the storage medium 330 , and execute a series of instruction operations in the storage medium 330 on the data storage device 301 .
数据存储设备301还可以包括一个或一个以上电源326,一个或一个以上有线或无线网络接口350,一个或一个以上输入输出接口358,和/或,一个或一个以上操作系统341,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。The data storage device 301 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input and output interfaces 358, and/or, one or more operating systems 341, such as Windows Server™, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
上面图1所描述的数据存储方法中的步骤可以由数据存储设备的结构实现。The steps in the data storage method described in FIG. 1 above can be realized by the structure of the data storage device.
实施例五:Embodiment five:
下面对本申请实施例提供的可读存储介质进行介绍,下文描述的可读存储介质与上文描述的数据存储方法可相互对应参照。The readable storage medium provided by the embodiment of the present application is introduced below, and the readable storage medium described below and the data storage method described above may be referred to in correspondence.
本申请公开的一种可读存储介质,其上存储有程序,程序被处理器执行时实现数据存储方法的步骤。A readable storage medium disclosed in the present application stores a program on it, and when the program is executed by a processor, the steps of the data storage method are realized.
该可读存储介质具体可以为U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可存储程序代码的可读存储介质。Specifically, the readable storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, and the like that can store program codes. readable storage media.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的装置,设备,存储介质和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described devices, equipment, storage media and units can refer to the corresponding process in the foregoing method embodiments, and will not be repeated here. .
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,系统,存储介质和方法,可以通过其它的方式实现。例如,以上所描述的设备实施例仅仅是示意性的,例如,单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed device, system, storage medium and method may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods, for example, multiple units or components can be combined or integrated. to another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。A unit described as a separate component may or may not be physically separated, and a component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or may be distributed to multiple network units. Part or all of the units can 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, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个移动终端中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该产品存储在一个存储介质中,包括若干指令用以使得一台移动终端(可以是手机,或者平板电脑等)执行本申请各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。An integrated unit may be stored in a mobile terminal if it is realized in the form of a software function unit and sold or used as an independent product. Based on this understanding, the essence of the technical solution of this application or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including Several instructions are used to make a mobile terminal (which may be a mobile phone, or a tablet computer, etc.) execute all or part of the steps of the methods in various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other various media that can store program codes. .
说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in the description is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same and similar parts of each embodiment can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and for the related information, please refer to the description of the method part.
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、终端或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Professionals can further realize that the units and algorithm steps described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, terminals, or a combination of the two. In order to clearly illustrate the interoperability of hardware and software Alternatively, in the above description, the components and steps of each example have been generally described according to their functions. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the methods or algorithms described in connection with the embodiments disclosed herein may be directly implemented by hardware, software modules executed by a processor, or a combination of both. Software modules can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other Any other known storage medium.
以上对本申请所提供的数据存储方法、装置、设备及可读存储介质进行了详细介绍。本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想。应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以对本申请进行若干改进和修饰,这些改进和修饰也落入本申请权利要求的保护范围内。The data storage method, device, equipment and readable storage medium provided by the present application have been introduced in detail above. In this paper, specific examples are used to illustrate the principles and implementation methods of the present application, and the descriptions of the above embodiments are only used to help understand the methods and core ideas of the present application. It should be pointed out that those skilled in the art can make some improvements and modifications to the application without departing from the principles of the application, and these improvements and modifications also fall within the protection scope of the claims of the application.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910376196.7A CN110109865A (en) | 2019-05-07 | 2019-05-07 | A kind of date storage method, device, equipment and readable storage medium storing program for executing |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910376196.7A CN110109865A (en) | 2019-05-07 | 2019-05-07 | A kind of date storage method, device, equipment and readable storage medium storing program for executing |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110109865A true CN110109865A (en) | 2019-08-09 |
Family
ID=67488487
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910376196.7A Pending CN110109865A (en) | 2019-05-07 | 2019-05-07 | A kind of date storage method, device, equipment and readable storage medium storing program for executing |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110109865A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112367382A (en) * | 2020-10-29 | 2021-02-12 | 苏州浪潮智能科技有限公司 | File uploading method, device, equipment and storage medium |
CN114189880A (en) * | 2020-09-14 | 2022-03-15 | 大唐移动通信设备有限公司 | Method and device for generating placeholder file for base station test |
CN117785816A (en) * | 2024-01-05 | 2024-03-29 | 柏域信息科技(上海)有限公司 | Methods, devices, equipment and storage media for file fragmentation storage |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH01245343A (en) * | 1988-03-28 | 1989-09-29 | Nec Corp | File controller |
CN102272710A (en) * | 2009-01-06 | 2011-12-07 | 汤姆森特许公司 | Method and apparatus for creating files in a file system |
CN103885887A (en) * | 2012-12-21 | 2014-06-25 | 腾讯科技(北京)有限公司 | User data storage method, reading method and system |
CN106570111A (en) * | 2016-11-01 | 2017-04-19 | 浙江宇视科技有限公司 | Data storage method and storage server |
-
2019
- 2019-05-07 CN CN201910376196.7A patent/CN110109865A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH01245343A (en) * | 1988-03-28 | 1989-09-29 | Nec Corp | File controller |
CN102272710A (en) * | 2009-01-06 | 2011-12-07 | 汤姆森特许公司 | Method and apparatus for creating files in a file system |
CN103885887A (en) * | 2012-12-21 | 2014-06-25 | 腾讯科技(北京)有限公司 | User data storage method, reading method and system |
CN106570111A (en) * | 2016-11-01 | 2017-04-19 | 浙江宇视科技有限公司 | Data storage method and storage server |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114189880A (en) * | 2020-09-14 | 2022-03-15 | 大唐移动通信设备有限公司 | Method and device for generating placeholder file for base station test |
CN114189880B (en) * | 2020-09-14 | 2024-03-01 | 大唐移动通信设备有限公司 | Method and device for generating occupation file for base station test |
CN112367382A (en) * | 2020-10-29 | 2021-02-12 | 苏州浪潮智能科技有限公司 | File uploading method, device, equipment and storage medium |
CN117785816A (en) * | 2024-01-05 | 2024-03-29 | 柏域信息科技(上海)有限公司 | Methods, devices, equipment and storage media for file fragmentation storage |
CN117785816B (en) * | 2024-01-05 | 2024-11-05 | 柏域信息科技(上海)有限公司 | Method, device, equipment and storage medium for file segment storage |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108776934A (en) | Distributed data computational methods, device, computer equipment and readable storage medium storing program for executing | |
JP7100154B2 (en) | Processor core scheduling method, equipment, terminals and storage media | |
CN106170968B (en) | A data compression storage method, device, and distributed file system | |
CN111966502B (en) | Method, apparatus, electronic device and readable storage medium for adjusting instance number | |
CN114201421A (en) | A data stream processing method, storage control node and readable storage medium | |
CN110109865A (en) | A kind of date storage method, device, equipment and readable storage medium storing program for executing | |
CN111586140A (en) | Data interaction method and server | |
CN109002364A (en) | Optimization method, electronic device and the readable storage medium storing program for executing of interprocess communication | |
CN114760357A (en) | Request processing method and device, computer equipment and storage medium | |
CN113014608A (en) | Flow distribution control method and device, electronic equipment and storage medium | |
CN114640706B (en) | Data transmission method, electronic device and computer readable storage medium | |
WO2024239867A1 (en) | Data processing method, system and apparatus, device and storage medium | |
CN109951532B (en) | DPDK-based automatic flow model conversion device | |
CN115550354A (en) | Data processing method and device and computer readable storage medium | |
CN115953587A (en) | Image feature extraction method and system for cross-cluster collaboration | |
CN103299298B (en) | Method and system for processing business | |
CN113254476B (en) | Request processing method and device, electronic equipment and storage medium | |
CN116820527B (en) | Program upgrading method, device, computer equipment and storage medium | |
WO2024251107A1 (en) | Container orchestration method, data access method, and electronic device and storage medium | |
WO2024149299A1 (en) | Image processing method and computing device | |
CN114281258B (en) | Service processing method, device, equipment and medium based on data storage | |
CN117221326A (en) | Software load balancing scheduling method, system, electronic equipment and storage medium | |
WO2018201993A1 (en) | Image drawing method, terminal and storage medium | |
CN116244231A (en) | Data transmission method, device and system, electronic equipment and storage medium | |
CN114995748A (en) | Request processing method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190809 |