WO2016155238A1 - File reading method in distributed storage system, and server end - Google Patents

File reading method in distributed storage system, and server end Download PDF

Info

Publication number
WO2016155238A1
WO2016155238A1 PCT/CN2015/088998 CN2015088998W WO2016155238A1 WO 2016155238 A1 WO2016155238 A1 WO 2016155238A1 CN 2015088998 W CN2015088998 W CN 2015088998W WO 2016155238 A1 WO2016155238 A1 WO 2016155238A1
Authority
WO
WIPO (PCT)
Prior art keywords
file data
read request
read
thread
server
Prior art date
Application number
PCT/CN2015/088998
Other languages
French (fr)
Chinese (zh)
Inventor
韩盛中
李中军
江俊杰
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2016155238A1 publication Critical patent/WO2016155238A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications

Definitions

  • This document relates to, but is not limited to, the field of communications, and specifically relates to a file reading method and a server in a distributed storage system.
  • the distributed file system is a multi-thread synchronous processing user concurrent read request. As shown in FIG. 1, the client sends a read request to the read thread, and the read thread throws the read request into the corresponding disk queue, each disk.
  • the corresponding processing thread takes the request out of the queue, and returns to the read thread as it is after reading, at which point the read thread can return the read file to the user. In this way, each read thread must wait until the returned file is returned before processing the next read request, thus reducing the processing efficiency of the read request and further reducing the efficiency of obtaining the file.
  • the embodiment of the invention provides a file reading method and a server in a distributed storage system, and solves the related art that the read thread must wait for the file to be read back before releasing the next read request, thereby causing the processing of the read request. Inefficient technical problems.
  • the embodiment of the invention provides a file reading method in a distributed storage system, including:
  • the server obtains a read request from the client through the read thread
  • the server obtains corresponding file data from the corresponding disk according to the read request
  • the server sends the acquired file data to the client through a pre-established return thread.
  • the server obtains the corresponding file data from the corresponding disk according to the read request, including:
  • the server reads the corresponding file data from the corresponding plurality of disks according to the read request, and stores the read file data in the data buffer area;
  • the server sends the obtained file data to the client through a pre-established return thread, including:
  • the server determines whether the file data exists in the data buffer. If the file data exists, the file data is immediately sent to the client through a pre-established return thread.
  • the return thread includes a plurality of sub-return threads, and each sub-return thread corresponds to one data buffer area; determining whether the data cache area has file data includes: the server returns a thread through a sub-return Querying, according to a preset rule, whether there is file data in the corresponding data cache area; and sending the file data to the client by using a pre-established return thread includes: sending the queried file data through a corresponding sub-return thread Give the client.
  • the method further includes: after the server obtains the read request from the client by the read thread, the server reads the corresponding file data from the corresponding disk according to the read request.
  • the server stores the read request in the kernel asynchronous processing queue; the server obtains the corresponding file data from the corresponding disk according to the read request, and the server includes the kernel from the kernel according to a preset processing rule.
  • the asynchronous processing queue fetches the read request, and obtains corresponding file data from the corresponding disk according to the fetched read request.
  • the preset processing rule includes:
  • All read requests in the core asynchronous processing queue are fetched according to a preset period, and multiple read requests with sector positions within a preset range value are combined, and multiple reads with sector positions within a preset range value are acquired Request corresponding file data;
  • the embodiment of the invention further provides a server, including a read request acquisition module, a file data acquisition module and a return thread module:
  • the read request acquisition module is configured to acquire a read request from a client through a read thread
  • the file data obtaining module is configured to obtain corresponding file data from the corresponding disk according to the read request
  • the return thread module is configured to send the acquired file data to the client through a pre-established return thread.
  • the file data obtaining module includes a file data obtaining submodule and a data cache submodule:
  • the data acquisition submodule is configured to respectively read corresponding file data from the corresponding plurality of disks according to the read request; the data cache submodule is configured to store the file data read by the data acquisition submodule into the data buffer. ;
  • the returning thread module is further configured to determine whether the file data exists in the data buffer. If the file data exists, the file data is immediately sent to the client through a pre-established return thread.
  • the return thread includes a plurality of sub-return threads, and each sub-return thread corresponds to one data buffer area; the data acquisition sub-module is further configured to: query by a sub-return thread according to a preset query rule. Whether the file data exists in the corresponding data buffer; the return thread module is further configured to: send the queried file data to the client through the corresponding sub-return thread.
  • the method further includes a kernel asynchronous processing queue, where the kernel asynchronous processing queue is configured to save the read request after the read request obtaining module acquires a read request from a client by using a read thread.
  • the file data acquisition module further includes a receiving submodule: the receiving submodule is configured to fetch a read request from the kernel asynchronous processing queue according to a preset processing rule, and the data obtaining submodule is further configured to The corresponding file data is obtained from the corresponding disk according to the read request.
  • the preset processing rule includes:
  • All read requests in the core asynchronous processing queue are fetched according to a preset period, and multiple read requests with sector positions within a preset range value are combined, and multiple reads with sector positions within a preset range value are acquired Request corresponding file data;
  • the read request is obtained from the kernel asynchronous processing queue in the order in which the kernel asynchronous processing queue is stored, and the corresponding file data is acquired according to the read request.
  • the present invention also provides a computer storage medium having stored therein computer executable instructions for performing the above method.
  • the embodiment of the invention provides a file reading method and a server in a distributed storage system.
  • the server obtains a read request from a client through a read thread.
  • the server obtains a corresponding request from the corresponding disk according to the read request.
  • the file data ; finally, the server sends the obtained file data to the client through a pre-established return thread.
  • the read thread since the file is sent to the client through the pre-established return thread, instead of returning the file data through the read thread, the read thread does not have to wait for the returned file data to be released before processing.
  • a read request can be released as soon as possible to process the next read request, improving the processing efficiency of the read request, further improving the efficiency of obtaining file data, saving processing time, and enhancing user experience.
  • FIG. 1 is a schematic flow chart of a file reading method in a related art distributed storage system
  • FIG. 2 is a schematic flowchart of a file reading method in a distributed storage system according to Embodiment 1 of the present invention
  • FIG. 3 is a schematic structural diagram 1 of a server provided according to Embodiment 2 of the present invention.
  • FIG. 4 is a second schematic diagram of a server structure according to Embodiment 2 of the present invention.
  • FIG. 5 is a schematic structural diagram 3 of a server provided according to Embodiment 2 of the present invention.
  • FIG. 6 is a schematic flowchart of a file reading method in a distributed storage system according to Embodiment 3 of the present invention.
  • FIG. 7 is a schematic structural diagram of a server in a file reading method in a distributed storage system according to Embodiment 3 of the present invention.
  • FIG. 8 is a schematic structural diagram of an asynchronous input/output module in a file reading method in a distributed storage system according to Embodiment 3 of the present invention.
  • Embodiment 1 is a diagrammatic representation of Embodiment 1:
  • Embodiment 1 of the present invention is a schematic flowchart of a file reading method in a distributed storage system according to Embodiment 1 of the present invention, which includes the following steps:
  • Step S101 The server obtains a read request of the file data from the client by using the read thread.
  • the server obtains a read request of the file data from the client, including: a read request parameter, and the read request parameter includes: a file handle, an offset, and a length.
  • the client goes to the metadata server to obtain the copy location corresponding to the read request (the server location and the disk location on the server), and sends the read request to the corresponding server.
  • the file data here may be a complete file data corresponding to a read request, or may be part of the file data corresponding to the read request.
  • the user wants to read the A file data, which is a video file, and the A file data is distributed and stored in Disk 1, Disk 2, and Disk 3 in a video server.
  • the server obtains a read request for the A file data from the client through the read thread from the video server.
  • Step S102 The server obtains corresponding file data from the corresponding disk according to the read request.
  • the corresponding file data herein refers to a partial file in which the file corresponding to the read request is distributed and stored in the disk.
  • the server after receiving the read request of the A file data, the server receives the disk 1, the disk 2, and the disk 3 from the server storing the A file data.
  • the partial file data of the corresponding A file data is respectively obtained.
  • Step S103 The server sends the acquired file data to the client through a pre-established return thread.
  • the return thread should be understood as a thread that can be used to return the acquired file data, unlike the read thread.
  • the file data is sent to the client through the return thread. Instead of using the related technology, after reading, return to the client by the original read-only thread. This will quickly release the read request and process the next read request.
  • the read data of different disks may be different, avoiding the slow processing of a disk may affect the processing of multiple worker threads.
  • the worker thread here refers to all used to process the read.
  • the requesting thread including the thread involved in processing the read request, such as the read thread and the return thread, may cause each disk to be asynchronously processed for a certain read request.
  • the specific implementation may be, in the above step S102, according to the read request.
  • the corresponding file data obtained in the corresponding disk may be: reading the corresponding file data from the corresponding multiple disks according to the read request, and storing the read file data in the data buffer area; optionally, the file Once the data is read, it is placed in the data buffer.
  • Sending the acquired file data to the client through the pre-established return thread in the foregoing step S103 includes: determining whether the file data exists in the data buffer area, and if the file data exists, immediately sending the file data to the client through the pre-established return thread. . In this way, for the first processed disk and the corresponding read request, the next read request can be processed to obtain the file data corresponding to the next read request, and the processing efficiency of the read file and the concurrent throughput utilization of the disk are improved.
  • the obtained file data blocking thread affects the data processing of the subsequent disk and the throughput of the disk.
  • the return thread may be configured to include multiple sub-return threads, and each sub-return thread corresponds to one data buffer area; whether the file data exists in the judgment data buffer area may be used by the server to query the corresponding data buffer area according to a preset rule by the sub-return thread.
  • the preset rule query here is a polling query rule.
  • the throughput of the disk is maximized.
  • the method includes the steps of: after the server obtains the read request from the client by the read thread, and before reading the corresponding file data from the corresponding disk according to the read request, the step of: storing the read request into the kernel asynchronous processing queue; the above step S102 That is, the server obtains the corresponding file data from the corresponding disk according to the read request, and the server may take the read request from the kernel asynchronous processing queue according to the preset processing rule, and obtain the corresponding request from the corresponding disk according to the read request.
  • File data is, after the server obtains the read request from the client by the read thread, and before reading the corresponding file data from the corresponding disk according to the read request, the step of: storing the read request into the kernel asynchronous processing queue; the above step S102 That is, the server obtains the corresponding file data from the corresponding disk according to the read request, and the server may take the read request from the kernel asynchronous processing queue according to the preset processing rule, and obtain
  • the preset processing rule includes: extracting all read requests in the core asynchronous processing queue according to the preset period, and combining the read requests in which the sector positions are within a certain preset range value, and acquiring the sector position at a certain pre-preparation
  • the file data corresponding to each of the plurality of read requests in the range value is set; or the read request in the queue is asynchronously processed from the kernel according to the order in which the kernel asynchronously processes the queue, and the file data corresponding to the read request is obtained.
  • other rules can be set to increase the maximum throughput of the disk.
  • the present invention also provides a computer storage medium having stored therein computer executable instructions for performing the above method.
  • Embodiment 2 is a diagrammatic representation of Embodiment 1:
  • the server provided in this embodiment includes a read request obtaining module 201, a file data obtaining module 202, and a returning thread module 203.
  • the read request obtaining module is configured to obtain a read request from the client through the read thread.
  • the file data obtaining module is configured to obtain corresponding file data from the corresponding disk according to the read request;
  • the return thread module is configured to send the acquired file data to the client through a pre-established return thread.
  • the server is further provided by the embodiment.
  • the file data obtaining module 202 includes a file data obtaining submodule 2022 and a data buffer submodule 2021: the data obtaining submodule 2022 is configured to be based on the read request. The corresponding file data is respectively read from the corresponding plurality of disks, and the data cache sub-module 2021 is configured to store the file data read by the data acquisition sub-module into the data buffer; the return thread module 203 is further configured to determine the data cache. Whether the file data exists in the area, if there is file data, the file data is immediately sent to the client through a pre-established return thread.
  • the return thread includes multiple sub-return threads, and each sub-return thread corresponds to one data buffer area; the data acquisition sub-module 2021 is further configured to: pass the sub-return thread according to a preset query rule. Query whether there is file data in its corresponding data buffer; the return thread module 203 is further configured to: send the queried file data to the client through the corresponding sub-return thread.
  • a server provided by the embodiment, as shown in FIG. 5, further includes a kernel asynchronous processing queue module 204.
  • the kernel asynchronous processing queue module 204 is configured to store the read request acquired by the read request obtaining module 201.
  • the kernel asynchronous processing queue; the file data obtaining module further includes a receiving sub-module 2023: the receiving sub-module 2023 is configured to fetch the read request from the kernel asynchronous processing queue according to a preset processing rule, and the file data obtaining sub-module 2022 is further configured to be based on the fetched read request. Obtain the corresponding file data from the corresponding disk.
  • the preset processing rule includes: extracting all read requests in the core asynchronous processing queue according to the preset period, and combining the read requests in which the sector positions are within a certain preset range value, and acquiring the sector position at a certain pre-preparation
  • the file data corresponding to each of the plurality of read requests in the range value is set; or the read request is obtained from the kernel asynchronous processing queue according to the order of storing the asynchronous processing queue of the kernel, and the corresponding file data is obtained according to the read request.
  • the read request merging process within the preset range value here refers to merging read requests with relatively close sectors to reduce unnecessary seek time.
  • Embodiment 3 is a diagrammatic representation of Embodiment 3
  • FIG. 6 is a schematic flowchart of a file reading method in a distributed storage system according to Embodiment 3 of the present invention, which includes the following steps:
  • Step S301 The user (the user here is a process for the file system, that is, the process of calling the file system interface) calls the read data interface of the file system;
  • Step S302 The client program obtains the corresponding copy location (server, disk) according to the read request parameter (file handle, offset, length, etc.) for submission, and sends the read request to the corresponding server.
  • the read request parameter file handle, offset, length, etc.
  • Step S303 The server sends the read request to the kernel asynchronous processing queue of the corresponding disk according to the disk information obtained by the client at the metadata server.
  • Step S304 The asynchronous input/output AIO module of the kernel continuously scans the read request in the kernel asynchronous processing queue, and combines the read requests of the sectors close to each other within a certain time range, thereby minimizing the seek channel. time consuming. After the disk read request returns, the number of these responses will be Placed in the response queue as requested
  • Step S305 The polling thread continuously queries the corresponding disk AIO module. If there is no data in the waiting area of the AIO module, the polling is continued until the data is available, and the process proceeds to S306.
  • Step S306 After the polling thread acquires the data, the data is returned to the client resident program. Continue to poll the AIO module. The job of polling the thread here is to constantly scan the waiting area of the AIO module, and the data is sent to the client resident program.
  • Step S307 After the client resident program obtains the data, return to the user.
  • FIG. 7 briefly shows the composition of the server. It is worth noting that the structure here is only one type of server, and of course, it can be a server of other different structures.
  • the asynchronous input/output (AIO) module is one of the file data acquisition modules in the above second embodiment, and the polling thread is one of the return threads. It can be seen clearly that each read thread, as long as the read request is placed in the kernel asynchronous processing queue, can be released immediately to process the next request, and will not hang over there. At this time, an asynchronous input and output (AIO) module will take out the requests placed in the asynchronous processing queue and process them (detailed in Figure 8), sorting and aggregation to maximize the disk throughput.
  • AIO asynchronous input and output
  • the AIO module is mainly divided into three parts: AIO receiver, AIO processor and AIO waiting area.
  • the AIO receiver is set to periodically take out read requests from the AIO queue. For example, it can be taken once, and these requests are sent.
  • the AIO processor is set to tidy up these requests, combine read requests with closer sector locations, reduce unnecessary seek times, and send processed request data to the AIO wait area;
  • AIO waits The zone is set to wait for the polling thread to get the request data.
  • the AIO receiver is one of the receiving submodules
  • the AIO processor is one of the data acquiring submodules
  • the AIO waiting area is one of the buffer submodules.
  • the present invention also provides a computer storage medium having stored therein computer executable instructions for performing the above method.
  • the read thread does not have to wait for the returned file data to be released before processing the next read request, and can be released as soon as possible to process the next read request, thereby improving the processing efficiency of the read request and further improving the efficiency of acquiring the file data. , saving processing time and enhancing user experience.

Abstract

A file reading method in a distributed storage system, and a server end. Firstly, the server end acquires a read request from a client via a read thread; then, the server end acquires corresponding file data from a corresponding disk according to the read request; and finally, the server end sends the acquired file data via a pre-established return thread to the client. Compared with the related art, because it is to send a file to the client via the pre-established return thread, instead of returning the file data via the read thread, in this way, the read thread can be released to process the next read request as early as possible without needing to be released to process the next read request until the read file data is returned, so that the processing efficiency of the read request is improved, the efficiency of acquiring the file data is further improved, the processing time is saved, and the user experience is enhanced.

Description

一种分布式存储系统中的文件读取方法及服务端File reading method and server in distributed storage system 技术领域Technical field
本文涉及但不限于通信领域,具体涉及一种分布式存储系统中的文件读取方法及服务端。This document relates to, but is not limited to, the field of communications, and specifically relates to a file reading method and a server in a distributed storage system.
背景技术Background technique
分布式文件系统的应用范围越来越广,而当今的音视频媒体文件、图片文件也越来越大,用户下载时对速度的要求也越来越高。而磁盘作为慢设备,越来越成为读取文件的瓶颈。虽说现如今固态硬盘(Solid State Drives,SSD)技术发展很快,但是无论是容量还是价格方面的因素,SSD仍然不能替代传统的机械盘。因此怎样高效的利用磁盘的读性能,最大程度的满足用户下载速度,成为分布式文件系统一个急需解决的问题。相关技术中分布式文件系统是多线程同步处理用户并发的读请求,如图1所示,客户端将读请求发给读线程,读线程将读请求扔到对应磁盘的队列中,每个磁盘对应的处理线程将请求从队列中取出,读完后按原路返回给读线程,此时读线程才能给用户返回读的文件。这样,每个读线程必须要等到返回读的文件后,才能释放出来处理下一条读请求,这样降低读请求的处理效率,进一步降低获取文件的效率。Distributed file systems are becoming more widely used, and today's audio and video media files and image files are getting larger and larger, and users are increasingly demanding speed when downloading. Disks, as slow devices, are increasingly becoming bottlenecks for reading files. Although solid state drive (SSD) technology is developing rapidly today, SSD is still not a substitute for traditional mechanical disks, both in terms of capacity and price. Therefore, how to effectively utilize the read performance of the disk to satisfy the user download speed to the greatest extent becomes an urgent problem to be solved in the distributed file system. In the related art, the distributed file system is a multi-thread synchronous processing user concurrent read request. As shown in FIG. 1, the client sends a read request to the read thread, and the read thread throws the read request into the corresponding disk queue, each disk. The corresponding processing thread takes the request out of the queue, and returns to the read thread as it is after reading, at which point the read thread can return the read file to the user. In this way, each read thread must wait until the returned file is returned before processing the next read request, thus reducing the processing efficiency of the read request and further reducing the efficiency of obtaining the file.
发明内容Summary of the invention
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the topics detailed in this document. This Summary is not intended to limit the scope of the claims.
本发明实施例提供一种分布式存储系统中的文件读取方法及服务端,解决相关技术中在读线程必须要等到返回读的文件后,才能释放出来处理下一条读请求,导致读请求的处理效率低的技术问题。The embodiment of the invention provides a file reading method and a server in a distributed storage system, and solves the related art that the read thread must wait for the file to be read back before releasing the next read request, thereby causing the processing of the read request. Inefficient technical problems.
本发明实施例提供一种分布式存储系统中的文件读取方法,包括: The embodiment of the invention provides a file reading method in a distributed storage system, including:
服务端通过读线程从客户端获取读请求;The server obtains a read request from the client through the read thread;
所述服务端根据所述读请求从对应的磁盘中获取到相应的文件数据;The server obtains corresponding file data from the corresponding disk according to the read request;
所述服务端将获取的文件数据通过预先建立的返回线程发送给所述客户端。The server sends the acquired file data to the client through a pre-established return thread.
在本发明的一种实施例中,服务端根据所述读请求从对应的磁盘中获取到相应的文件数据包括:In an embodiment of the present invention, the server obtains the corresponding file data from the corresponding disk according to the read request, including:
服务端根据所述读请求从对应的多个磁盘中分别读取对应的文件数据,将读取后的文件数据存入数据缓存区中;The server reads the corresponding file data from the corresponding plurality of disks according to the read request, and stores the read file data in the data buffer area;
服务端将获取的文件数据通过预先建立的返回线程发送给所述客户端包括:The server sends the obtained file data to the client through a pre-established return thread, including:
服务端判断所述数据缓存区是否存在文件数据,如果存在文件数据,立即将所述文件数据通过预先建立的返回线程发送给所述客户端。The server determines whether the file data exists in the data buffer. If the file data exists, the file data is immediately sent to the client through a pre-established return thread.
在本发明的一种实施例中,所述返回线程包括多个子返回线程,每个子返回线程对应一个数据缓存区;判断所述数据缓存区是否存在文件数据包括:所述服务端通过子返回线程根据预设规则查询其对应的数据缓存区是否存在文件数据;所述将所述文件数据通过预先建立的返回线程发送给所述客户端包括:将查询到的文件数据通过对应的子返回线程发送给所述客户端。In an embodiment of the present invention, the return thread includes a plurality of sub-return threads, and each sub-return thread corresponds to one data buffer area; determining whether the data cache area has file data includes: the server returns a thread through a sub-return Querying, according to a preset rule, whether there is file data in the corresponding data cache area; and sending the file data to the client by using a pre-established return thread includes: sending the queried file data through a corresponding sub-return thread Give the client.
在本发明的一种实施例中,所述方法还包括:在服务端通过读线程从客户端获取读请求后,服务端根据所述读请求从对应的磁盘中读取到相应的文件数据之前,服务端将所述读请求存入内核异步处理队列;所述服务端根据所述读请求从对应的磁盘中获取到相应的文件数据包括:所述服务端按照预设处理规则从所述内核异步处理队列取出读请求,根据取出的读请求从对应的磁盘中获取到相应的文件数据。In an embodiment of the present invention, the method further includes: after the server obtains the read request from the client by the read thread, the server reads the corresponding file data from the corresponding disk according to the read request. The server stores the read request in the kernel asynchronous processing queue; the server obtains the corresponding file data from the corresponding disk according to the read request, and the server includes the kernel from the kernel according to a preset processing rule. The asynchronous processing queue fetches the read request, and obtains corresponding file data from the corresponding disk according to the fetched read request.
在本发明的一种实施例中,所述预设处理规则包括:In an embodiment of the present invention, the preset processing rule includes:
按照预设周期取出所述内核异步处理队列中的所有读请求,将扇区位置在预设范围值内的多个读请求合并处理,同时获取扇区位置在预设范围值内的多个读请求各自对应的文件数据;All read requests in the core asynchronous processing queue are fetched according to a preset period, and multiple read requests with sector positions within a preset range value are combined, and multiple reads with sector positions within a preset range value are acquired Request corresponding file data;
Or
按照存入内核异步处理队列的先后的顺序从所述内核异步处理队列中的获取读请求,根据所述读请求获取对应的文件数据。Obtaining a read request from the kernel asynchronous processing queue in the order in which the kernel asynchronous processing queue is stored, and acquiring corresponding file data according to the read request.
本发明实施例还提供一种服务端,包括读请求获取模块、文件数据获取模块和返回线程模块:The embodiment of the invention further provides a server, including a read request acquisition module, a file data acquisition module and a return thread module:
所述读请求获取模块设置为通过读线程从客户端获取读请求;The read request acquisition module is configured to acquire a read request from a client through a read thread;
所述文件数据获取模块设置为根据所述读请求从对应的磁盘中获取到相应的文件数据;The file data obtaining module is configured to obtain corresponding file data from the corresponding disk according to the read request;
所述返回线程模块设置为将获取的文件数据通过预先建立的返回线程发送给所述客户端。The return thread module is configured to send the acquired file data to the client through a pre-established return thread.
在本发明的一种实施例中,所述文件数据获取模块包括文件数据获取子模块和数据缓存子模块:In an embodiment of the present invention, the file data obtaining module includes a file data obtaining submodule and a data cache submodule:
所述数据获取子模块设置为根据所述读请求从对应的多个磁盘中分别读取对应的文件数据;数据缓存子模块设置为将数据获取子模块读取的文件数据存入数据缓存区中;The data acquisition submodule is configured to respectively read corresponding file data from the corresponding plurality of disks according to the read request; the data cache submodule is configured to store the file data read by the data acquisition submodule into the data buffer. ;
所述返回线程模块还设置为判断所述数据缓存区是否存在文件数据,如果存在文件数据,立即将所述文件数据通过预先建立的返回线程发送给所述客户端。The returning thread module is further configured to determine whether the file data exists in the data buffer. If the file data exists, the file data is immediately sent to the client through a pre-established return thread.
在本发明的一种实施例中,所述返回线程包括多个子返回线程,每个子返回线程对应一个数据缓存区;所述数据获取子模块还设置为:通过子返回线程根据预设查询规则查询其对应的数据缓存区是否存在文件数据;所述返回线程模块还设置为:将查询到的文件数据通过对应的子返回线程发送给所述客户端。In an embodiment of the present invention, the return thread includes a plurality of sub-return threads, and each sub-return thread corresponds to one data buffer area; the data acquisition sub-module is further configured to: query by a sub-return thread according to a preset query rule. Whether the file data exists in the corresponding data buffer; the return thread module is further configured to: send the queried file data to the client through the corresponding sub-return thread.
在本发明的一种实施例中,还包括内核异步处理队列;所述内核异步处理队列设置为在所述读请求获取模块通过读线程从客户端获取读请求后,,将所述读请求存入内核异步处理队列;所述文件数据获取模块还包括接收子模块:所述接收子模块设置为按照预设处理规则从所述内核异步处理队列取出读请求,所述数据获取子模块还设置为根据取出的读请求从对应的磁盘中获取到相应的文件数据。 In an embodiment of the present invention, the method further includes a kernel asynchronous processing queue, where the kernel asynchronous processing queue is configured to save the read request after the read request obtaining module acquires a read request from a client by using a read thread. The file data acquisition module further includes a receiving submodule: the receiving submodule is configured to fetch a read request from the kernel asynchronous processing queue according to a preset processing rule, and the data obtaining submodule is further configured to The corresponding file data is obtained from the corresponding disk according to the read request.
在本发明的一种实施例中,所述预设处理规则包括:In an embodiment of the present invention, the preset processing rule includes:
按照预设周期取出所述内核异步处理队列中的所有读请求,将扇区位置在预设范围值内的多个读请求合并处理,同时获取扇区位置在预设范围值内的多个读请求各自对应的文件数据;All read requests in the core asynchronous processing queue are fetched according to a preset period, and multiple read requests with sector positions within a preset range value are combined, and multiple reads with sector positions within a preset range value are acquired Request corresponding file data;
or
按照存入内核异步处理队列的先后的顺序从所述内核异步处理队列中获取读请求,根据所述读请求获取对应的文件数据。The read request is obtained from the kernel asynchronous processing queue in the order in which the kernel asynchronous processing queue is stored, and the corresponding file data is acquired according to the read request.
本发明实施还提供了一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行上述的方法。The present invention also provides a computer storage medium having stored therein computer executable instructions for performing the above method.
本发明实施例的有益效果是:The beneficial effects of the embodiments of the present invention are:
本发明实施例提供一种分布式存储系统中的文件读取方法以及服务端,首先,服务端通过读线程从客户端获取读请求;然后,服务端根据读请求从对应的磁盘中获取到相应的文件数据;最后,服务端将获取的文件数据通过预先建立的返回线程发送给客户端。与相关技术相比,由于是通过预先建立的返回线程将文件发给客户端,而不是通过读线程来返回文件数据,这样,读线程就不必等到返回读的文件数据后,才能释放出来处理下一条读请求,能够尽早释放出来处理下一条读请求,提高了的读请求的处理效率,进一步提高获取文件数据的效率,节约处理时间,增强用户体验度。The embodiment of the invention provides a file reading method and a server in a distributed storage system. First, the server obtains a read request from a client through a read thread. Then, the server obtains a corresponding request from the corresponding disk according to the read request. The file data; finally, the server sends the obtained file data to the client through a pre-established return thread. Compared with the related art, since the file is sent to the client through the pre-established return thread, instead of returning the file data through the read thread, the read thread does not have to wait for the returned file data to be released before processing. A read request can be released as soon as possible to process the next read request, improving the processing efficiency of the read request, further improving the efficiency of obtaining file data, saving processing time, and enhancing user experience.
在阅读并理解了附图和详细描述后,可以明白其他方面。Other aspects will be apparent upon reading and understanding the drawings and detailed description.
附图概述BRIEF abstract
图1为相关技术的分布式存储系统中的文件读取方法流程示意图;1 is a schematic flow chart of a file reading method in a related art distributed storage system;
图2为本发明实施例一提供的分布式存储系统中的文件读取方法流程示意图;2 is a schematic flowchart of a file reading method in a distributed storage system according to Embodiment 1 of the present invention;
图3为本发明实施例二提供的服务端结构示意图一; 3 is a schematic structural diagram 1 of a server provided according to Embodiment 2 of the present invention;
图4为本发明实施例二提供的服务端结构示意图二;4 is a second schematic diagram of a server structure according to Embodiment 2 of the present invention;
图5为本发明实施例二提供的服务端结构示意图三;FIG. 5 is a schematic structural diagram 3 of a server provided according to Embodiment 2 of the present invention; FIG.
图6为本发明实施例三提供的分布式存储系统中的文件读取方法流程示意图;6 is a schematic flowchart of a file reading method in a distributed storage system according to Embodiment 3 of the present invention;
图7为本发明实施例三提供的分布式存储系统中的文件读取方法中的一种服务端结构示意图;FIG. 7 is a schematic structural diagram of a server in a file reading method in a distributed storage system according to Embodiment 3 of the present invention; FIG.
图8为本发明实施例三提供的分布式存储系统中的文件读取方法中的异步输入输出模块结构示意图。FIG. 8 is a schematic structural diagram of an asynchronous input/output module in a file reading method in a distributed storage system according to Embodiment 3 of the present invention.
本发明的较佳实施方式Preferred embodiment of the invention
下面通过具体实施方式结合附图对本申请作进一步详细说明。The present application will be further described in detail below with reference to the accompanying drawings.
实施例一:Embodiment 1:
图2为本发明实施例一提供的分布式存储系统中的文件读取方法流程示意图,包括以下步骤:2 is a schematic flowchart of a file reading method in a distributed storage system according to Embodiment 1 of the present invention, which includes the following steps:
步骤S101:服务端通过读线程从客户端获取文件数据的读请求;Step S101: The server obtains a read request of the file data from the client by using the read thread.
在该步骤中,服务器从客户端获取文件数据的读请求,包括:读请求参数,读请求参数包括:文件句柄、偏移和长度。In this step, the server obtains a read request of the file data from the client, including: a read request parameter, and the read request parameter includes: a file handle, an offset, and a length.
客户端去元数据服务器获取读请求对应的副本位置(服务器位置、以及服务器上的磁盘位置),将读请求发到对应的服务端。The client goes to the metadata server to obtain the copy location corresponding to the read request (the server location and the disk location on the server), and sends the read request to the corresponding server.
这里的文件数据可以是一个读请求对应的完整的文件数据,也可以是读请求对应的部分文件数据。例如,用户要读取A文件数据,该文件为视频文件,A文件数据分布存储在某个视频服务器中的磁盘1、磁盘2和磁盘3中。服务端就从该视频服务器通过读线程从客户端获取A文件数据的读请求。The file data here may be a complete file data corresponding to a read request, or may be part of the file data corresponding to the read request. For example, the user wants to read the A file data, which is a video file, and the A file data is distributed and stored in Disk 1, Disk 2, and Disk 3 in a video server. The server then obtains a read request for the A file data from the client through the read thread from the video server.
步骤S102:服务端根据读请求从对应的磁盘中获取到相应的文件数据;Step S102: The server obtains corresponding file data from the corresponding disk according to the read request.
在该步骤中,这里相应的文件数据是指与读请求对应的文件分布存储在该磁盘中的部分文件。结合步骤S101中例子说明,服务端在收到A文件数据的读请求后,就从存储A文件数据的服务器中的磁盘1、磁盘2和磁盘3 中分别获取对应的A文件数据的部分文件数据。In this step, the corresponding file data herein refers to a partial file in which the file corresponding to the read request is distributed and stored in the disk. Referring to the example in step S101, after receiving the read request of the A file data, the server receives the disk 1, the disk 2, and the disk 3 from the server storing the A file data. The partial file data of the corresponding A file data is respectively obtained.
步骤S103:服务端将获取的文件数据通过预先建立的返回线程发送给客户端。Step S103: The server sends the acquired file data to the client through a pre-established return thread.
在该步骤中,返回线程应该理解为与读线程不同,可以用来返回获取的文件数据的线程。结合步骤S102中例子说明,在从磁盘1、磁盘2和磁盘3中分别获取对应的A文件的部分文件数据后,将这些文件数据通过返回线程发送给客户端。而不是采用相关技术中,通过读完后按原路即读线程返回给客户端。这样可以快速的将读请求释放出来,对下一个读请求进行处理。In this step, the return thread should be understood as a thread that can be used to return the acquired file data, unlike the read thread. Referring to the example in step S102, after the partial file data of the corresponding A file is respectively obtained from the disk 1, the disk 2, and the disk 3, the file data is sent to the client through the return thread. Instead of using the related technology, after reading, return to the client by the original read-only thread. This will quickly release the read request and process the next read request.
可选的,由于不同磁盘的读取数据可能不相同,避免由于某个磁盘的盘处理慢会影响到多个工作线程的处理,值得注意的是,这里的工作线程是指所有用来处理读请求的线程,包括读线程和返回线程等在处理读请求中涉及到的线程,可以使每个磁盘针对某个读请求进行异步处理,具体的实现可以为,在上述步骤S102中根据读请求从对应的磁盘中获取到相应的文件数据可以为:根据读请求从对应的多个磁盘中分别读取对应的文件数据,将读取后的文件数据存入数据缓存区中;可选的,文件数据读取后,立即放入数据缓存区中。在上述步骤S103中将获取的文件数据通过预先建立的返回线程发送给客户端包括:判断数据缓存区是否存在文件数据,如果存在文件数据,立即将文件数据通过预先建立的返回线程发送给客户端。这样,对于先处理完的磁盘和对应的读请求,就可以进行下一个读请求的处理,去获得下一个读请求对应的文件数据,提高的读文件的处理效率和磁盘的并发吞吐利用率。Optionally, since the read data of different disks may be different, avoiding the slow processing of a disk may affect the processing of multiple worker threads. It is worth noting that the worker thread here refers to all used to process the read. The requesting thread, including the thread involved in processing the read request, such as the read thread and the return thread, may cause each disk to be asynchronously processed for a certain read request. The specific implementation may be, in the above step S102, according to the read request. The corresponding file data obtained in the corresponding disk may be: reading the corresponding file data from the corresponding multiple disks according to the read request, and storing the read file data in the data buffer area; optionally, the file Once the data is read, it is placed in the data buffer. Sending the acquired file data to the client through the pre-established return thread in the foregoing step S103 includes: determining whether the file data exists in the data buffer area, and if the file data exists, immediately sending the file data to the client through the pre-established return thread. . In this way, for the first processed disk and the corresponding read request, the next read request can be processed to obtain the file data corresponding to the next read request, and the processing efficiency of the read file and the concurrent throughput utilization of the disk are improved.
可选的,为了尽快的将文件数据给客户端,防止获取到的文件数据阻塞线程影响后面磁盘的数据处理和磁盘的吞吐量。具体可以设置返回线程包括多个子返回线程,每个子返回线程对应一个数据缓存区;上述判断数据缓存区是否存在文件数据可以为服务端通过子返回线程根据预设规则查询其对应的数据缓存区是否存在文件数据;上述将文件数据通过预先建立的返回线程发送给客户端可以为将查询到的文件数据通过对应的子返回线程发送给客户端。可选的,这里的预设规则查询为轮询查询规则。Optionally, in order to quickly send file data to the client, the obtained file data blocking thread affects the data processing of the subsequent disk and the throughput of the disk. Specifically, the return thread may be configured to include multiple sub-return threads, and each sub-return thread corresponds to one data buffer area; whether the file data exists in the judgment data buffer area may be used by the server to query the corresponding data buffer area according to a preset rule by the sub-return thread. There is file data; the above file data is sent to the client through a pre-established return thread, and the file data that is queried can be sent to the client through the corresponding sub-return thread. Optionally, the preset rule query here is a polling query rule.
可选的,为了提高读请求的释放和更大的提高读请求的处理效率,最大限度的提升磁盘的吞吐能力。在上述步骤S101之后,步骤S102之前还可以 包括步骤,即在服务端通过读线程从客户端获取读请求后,根据读请求从对应的磁盘中读取到相应的文件数据之前包括步骤:将读请求存入内核异步处理队列;上述步骤S102即服务端根据读请求从对应的磁盘中获取到相应的文件数据具体可以为服务端按照预设处理规则从内核异步处理队列取出读请求,根据取出的读请求从对应的磁盘中获取到相应的文件数据。可选的,预设处理规则包括:按照预设周期取出内核异步处理队列中的所有读请求,将扇区位置在一定预设范围值内的读请求合并处理,同时获取扇区位置在一定预设范围值内的多个读请求各自对应的文件数据;或按照存入内核异步处理队列的先后的顺序从内核异步处理队列中的读请求,根据获取读请求对应的文件数据。当然,还可以设置其他规则来提高磁盘的最大吞吐量。Optionally, in order to improve the release of the read request and improve the processing efficiency of the read request, the throughput of the disk is maximized. After the above step S101, before step S102, The method includes the steps of: after the server obtains the read request from the client by the read thread, and before reading the corresponding file data from the corresponding disk according to the read request, the step of: storing the read request into the kernel asynchronous processing queue; the above step S102 That is, the server obtains the corresponding file data from the corresponding disk according to the read request, and the server may take the read request from the kernel asynchronous processing queue according to the preset processing rule, and obtain the corresponding request from the corresponding disk according to the read request. File data. Optionally, the preset processing rule includes: extracting all read requests in the core asynchronous processing queue according to the preset period, and combining the read requests in which the sector positions are within a certain preset range value, and acquiring the sector position at a certain pre-preparation The file data corresponding to each of the plurality of read requests in the range value is set; or the read request in the queue is asynchronously processed from the kernel according to the order in which the kernel asynchronously processes the queue, and the file data corresponding to the read request is obtained. Of course, other rules can be set to increase the maximum throughput of the disk.
本发明实施还提供了一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行上述的方法。The present invention also provides a computer storage medium having stored therein computer executable instructions for performing the above method.
实施例二:Embodiment 2:
本实施例提供的一种服务端,如图3所示,包括读请求获取模块201、文件数据获取模块202和返回线程模块203;读请求获取模块设置为通过读线程从客户端获取读请求;文件数据获取模块设置为根据读请求从对应的磁盘中获取到相应的文件数据;返回线程模块设置为将获取的文件数据通过预先建立的返回线程发送给客户端。The server provided in this embodiment, as shown in FIG. 3, includes a read request obtaining module 201, a file data obtaining module 202, and a returning thread module 203. The read request obtaining module is configured to obtain a read request from the client through the read thread. The file data obtaining module is configured to obtain corresponding file data from the corresponding disk according to the read request; the return thread module is configured to send the acquired file data to the client through a pre-established return thread.
可选的,本实施例还提供的一种服务端,如图4所示,文件数据获取模块202包括文件数据获取子模块2022和数据缓存子模块2021:数据获取子模块2022设置为根据读请求从对应的多个磁盘中分别读取对应的文件数据,数据缓存子模块2021设置为将数据获取子模块读取后的文件数据存入数据缓存区中;返回线程模块203还设置为判断数据缓存区是否存在文件数据,如果存在文件数据,立即将文件数据通过预先建立的返回线程发送给客户端。Optionally, the server is further provided by the embodiment. As shown in FIG. 4, the file data obtaining module 202 includes a file data obtaining submodule 2022 and a data buffer submodule 2021: the data obtaining submodule 2022 is configured to be based on the read request. The corresponding file data is respectively read from the corresponding plurality of disks, and the data cache sub-module 2021 is configured to store the file data read by the data acquisition sub-module into the data buffer; the return thread module 203 is further configured to determine the data cache. Whether the file data exists in the area, if there is file data, the file data is immediately sent to the client through a pre-established return thread.
可选的,返回线程包括多个子返回线程,每个子返回线程对应一个数据缓存区;数据获取子模块2021还设置为:通过子返回线程根据预设查询规则 查询其对应的数据缓存区是否存在文件数据;返回线程模块203还设置为:将查询到的文件数据通过对应的子返回线程发送给客户端。Optionally, the return thread includes multiple sub-return threads, and each sub-return thread corresponds to one data buffer area; the data acquisition sub-module 2021 is further configured to: pass the sub-return thread according to a preset query rule. Query whether there is file data in its corresponding data buffer; the return thread module 203 is further configured to: send the queried file data to the client through the corresponding sub-return thread.
可选的,本实施例还提供的一种服务端,如图5所示,还包括内核异步处理队列模块204;内核异步处理队列模块204设置为将读请求获取模块201获取的读请求存入内核异步处理队列;文件数据获取模块还包括接收子模块2023:接收子模块2023设置为按照预设处理规则从内核异步处理队列取出读请求,文件数据获取子模块2022还设置为根据取出的读请求从对应的磁盘中获取到相应的文件数据。Optionally, a server provided by the embodiment, as shown in FIG. 5, further includes a kernel asynchronous processing queue module 204. The kernel asynchronous processing queue module 204 is configured to store the read request acquired by the read request obtaining module 201. The kernel asynchronous processing queue; the file data obtaining module further includes a receiving sub-module 2023: the receiving sub-module 2023 is configured to fetch the read request from the kernel asynchronous processing queue according to a preset processing rule, and the file data obtaining sub-module 2022 is further configured to be based on the fetched read request. Obtain the corresponding file data from the corresponding disk.
可选的,预设处理规则包括:按照预设周期取出内核异步处理队列中的所有读请求,将扇区位置在一定预设范围值内的读请求合并处理,同时获取扇区位置在一定预设范围值内的多个读请求各自对应的文件数据;或按照存入内核异步处理队列的先后顺序从内核异步处理队列中获取读请求,根据读请求获取对应的文件数据。值得注意的是,这里的预设范围值内的读请求合并处理是指将扇区位置较近的读请求合并处理,减少不必要的寻道时间。Optionally, the preset processing rule includes: extracting all read requests in the core asynchronous processing queue according to the preset period, and combining the read requests in which the sector positions are within a certain preset range value, and acquiring the sector position at a certain pre-preparation The file data corresponding to each of the plurality of read requests in the range value is set; or the read request is obtained from the kernel asynchronous processing queue according to the order of storing the asynchronous processing queue of the kernel, and the corresponding file data is obtained according to the read request. It is worth noting that the read request merging process within the preset range value here refers to merging read requests with relatively close sectors to reduce unnecessary seek time.
实施例三:Embodiment 3:
图6为本发明实施例三提供的分布式存储系统中的文件读取方法流程示意图,包括以下步骤:FIG. 6 is a schematic flowchart of a file reading method in a distributed storage system according to Embodiment 3 of the present invention, which includes the following steps:
步骤S301:用户(这里的用户是针对文件系统而言,也就是调用文件系统接口的进程)调用文件系统的读数据接口;Step S301: The user (the user here is a process for the file system, that is, the process of calling the file system interface) calls the read data interface of the file system;
步骤S302:客户端程序根据用于提交的读请求参数(文件句柄、偏移、长度等)去元数据服务器获取对应的副本位置(服务器、磁盘),将读请求发到对应的服务端。Step S302: The client program obtains the corresponding copy location (server, disk) according to the read request parameter (file handle, offset, length, etc.) for submission, and sends the read request to the corresponding server.
步骤S303:服务端根据客户端在元数据服务器获取到的磁盘信息,将读请求放到对应磁盘的内核异步处理队列。Step S303: The server sends the read request to the kernel asynchronous processing queue of the corresponding disk according to the disk information obtained by the client at the metadata server.
步骤S304:内核的异步输入输出AIO模块会不停地扫描内核异步处理队列中的读请求,在一定的时间范围内,将扇区靠近的读请求合并执行,最大程度地降低寻道带来的耗时。磁盘的读请求返回后,会将这些得到响应的数 据请求放到响应队列中Step S304: The asynchronous input/output AIO module of the kernel continuously scans the read request in the kernel asynchronous processing queue, and combines the read requests of the sectors close to each other within a certain time range, thereby minimizing the seek channel. time consuming. After the disk read request returns, the number of these responses will be Placed in the response queue as requested
步骤S305:轮询线程在不停的查询对应磁盘AIO模块,如果AIO模块的等待区没有数据,继续轮询,一直到有数据为止,进入S306。Step S305: The polling thread continuously queries the corresponding disk AIO module. If there is no data in the waiting area of the AIO module, the polling is continued until the data is available, and the process proceeds to S306.
步骤S306:轮询线程获取到数据后,将这些数据返回给客户端驻留程序。继续轮询AIO模块。这里轮询线程的工作就是不停的扫描AIO模块的等待区,有数据就发给客户端驻留程序。Step S306: After the polling thread acquires the data, the data is returned to the client resident program. Continue to poll the AIO module. The job of polling the thread here is to constantly scan the waiting area of the AIO module, and the data is sent to the client resident program.
步骤S307:客户端驻留程序获取到数据后,给用户返回。Step S307: After the client resident program obtains the data, return to the user.
可选的,结合图7所示,图7中简要的展示了服务端的构成,值得注意的是,这里的结构构成仅是服务端的一种,当然还可以为其他不同结构的服务端。异步输入输出(AIO)模块是上述实施例二中文件数据获取模块的一种,轮询线程为返回线程的一种。可以比较明显的看出,每个读线程,只要将读请求放到内核异步处理队列,立即可以释放出来处理下一条请求,不会一直悬在那边。而这时有一个异步输入输出(AIO)模块会将放到异步处理队列中的请求取出后进行处理(图8做了详细说明),进行排序和聚合,最大程度的发挥磁盘的吞吐量。如图8所示,AIO模块主要分为三个部分:AIO接收器、AIO处理器和AIO等待区,AIO接收器设置为定期从AIO队列取出读请求,比如可以100us取一次,把这些请求发送给AIO处理器,AIO处理器设置为整理这些请求,将扇区位置较近的读请求合并处理,减少不必要的寻道时间,以及将处理完的请求数据发送至到AIO等待区;AIO等待区设置为等待轮询线程来获取请求数据。可选的,AIO接收器为接收子模块的一种,AIO处理器为数据获取子模块的一种,AIO等待区为缓存子模块的一种。Optionally, in combination with FIG. 7, FIG. 7 briefly shows the composition of the server. It is worth noting that the structure here is only one type of server, and of course, it can be a server of other different structures. The asynchronous input/output (AIO) module is one of the file data acquisition modules in the above second embodiment, and the polling thread is one of the return threads. It can be seen clearly that each read thread, as long as the read request is placed in the kernel asynchronous processing queue, can be released immediately to process the next request, and will not hang over there. At this time, an asynchronous input and output (AIO) module will take out the requests placed in the asynchronous processing queue and process them (detailed in Figure 8), sorting and aggregation to maximize the disk throughput. As shown in Figure 8, the AIO module is mainly divided into three parts: AIO receiver, AIO processor and AIO waiting area. The AIO receiver is set to periodically take out read requests from the AIO queue. For example, it can be taken once, and these requests are sent. For the AIO processor, the AIO processor is set to tidy up these requests, combine read requests with closer sector locations, reduce unnecessary seek times, and send processed request data to the AIO wait area; AIO waits The zone is set to wait for the polling thread to get the request data. Optionally, the AIO receiver is one of the receiving submodules, the AIO processor is one of the data acquiring submodules, and the AIO waiting area is one of the buffer submodules.
本发明实施还提供了一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行上述的方法。The present invention also provides a computer storage medium having stored therein computer executable instructions for performing the above method.
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序来指令相关硬件完成,上述程序可以存储于计算机可读存储介质中,如只读存储器、磁盘或光盘等。可选地,上述实施例的全部或部分步骤也可以使用 一个或多个集成电路来实现。相应地,上述实施例中的各模块/单元可以采用硬件的形式实现,也可以采用软件功能模块的形式实现。本申请不限制于任何特定形式的硬件和软件的结合。One of ordinary skill in the art will appreciate that all or a portion of the above steps may be accomplished by a program that instructs the associated hardware, such as a read-only memory, a magnetic disk, or an optical disk. Optionally, all or part of the steps of the above embodiments may also be used. One or more integrated circuits are implemented. Correspondingly, each module/unit in the foregoing embodiment may be implemented in the form of hardware or in the form of a software function module. This application is not limited to any specific combination of hardware and software.
以上实施例仅用以说明本申请的技术方案而非限制,仅仅参照较佳实施例对本申请进行了详细说明。The above embodiments are only used to illustrate the technical solutions of the present application, and are not intended to be limiting, and the present application is only described in detail with reference to the preferred embodiments.
工业实用性Industrial applicability
上述技术方案中读线程不必等到返回读的文件数据后,才能释放出来处理下一条读请求,能够尽早释放出来处理下一条读请求,提高了的读请求的处理效率,进一步提高获取文件数据的效率,节约处理时间,增强用户体验度。 In the above technical solution, the read thread does not have to wait for the returned file data to be released before processing the next read request, and can be released as soon as possible to process the next read request, thereby improving the processing efficiency of the read request and further improving the efficiency of acquiring the file data. , saving processing time and enhancing user experience.

Claims (11)

  1. 一种分布式存储系统中的文件读取方法,包括:A file reading method in a distributed storage system, comprising:
    服务端通过读线程从客户端获取读请求;The server obtains a read request from the client through the read thread;
    所述服务端根据所述读请求从对应的磁盘中获取到相应的文件数据;The server obtains corresponding file data from the corresponding disk according to the read request;
    所述服务端将获取的文件数据通过预先建立的返回线程发送给所述客户端。The server sends the acquired file data to the client through a pre-established return thread.
  2. 如权利要求1所述的分布式存储系统中的文件读取方法,其中,A file reading method in a distributed storage system according to claim 1, wherein
    服务端根据所述读请求从对应的磁盘中获取到相应的文件数据包括:The server obtains the corresponding file data from the corresponding disk according to the read request, including:
    服务端根据所述读请求从对应的多个磁盘中分别读取对应的文件数据,将读取后的文件数据存入数据缓存区中;The server reads the corresponding file data from the corresponding plurality of disks according to the read request, and stores the read file data in the data buffer area;
    服务端将获取的文件数据通过预先建立的返回线程发送给所述客户端包括:The server sends the obtained file data to the client through a pre-established return thread, including:
    服务端判断所述数据缓存区是否存在文件数据,如果存在文件数据,立即将所述文件数据通过预先建立的返回线程发送给所述客户端。The server determines whether the file data exists in the data buffer. If the file data exists, the file data is immediately sent to the client through a pre-established return thread.
  3. 如权利要求2所述的分布式存储系统中的文件读取方法,其中,A file reading method in a distributed storage system according to claim 2, wherein
    所述返回线程包括多个子返回线程,每个子返回线程对应一个数据缓存区;The return thread includes a plurality of sub-return threads, and each sub-return thread corresponds to one data buffer area;
    所述判断数据缓存区是否存在文件数据包括:所述服务端通过子返回线程根据预设规则查询其对应的数据缓存区是否存在文件数据;Determining whether the file data exists in the data buffer comprises: the server querying, by the sub-returning thread, whether the file data exists in the corresponding data buffer according to the preset rule;
    所述将所述文件数据通过预先建立的返回线程发送给所述客户端包括:The sending the file data to the client by using a pre-established return thread includes:
    将查询到的文件数据通过对应的子返回线程发送给所述客户端。The queried file data is sent to the client through a corresponding sub-return thread.
  4. 如权利要求1-3任一项所述的分布式存储系统中的文件读取方法,所述方法还包括:The method for reading a file in a distributed storage system according to any one of claims 1 to 3, further comprising:
    在服务端通过读线程从客户端获取读请求后,服务端根据所述读请求从对应的磁盘中读取到相应的文件数据之前,服务端将所述读请求存入内核异步处理队列; After the server obtains the read request from the client through the read thread, the server stores the read request into the kernel asynchronous processing queue before the server reads the corresponding file data from the corresponding disk according to the read request.
    所述服务端根据所述读请求从对应的磁盘中获取到相应的文件数据包括:And the server obtains the corresponding file data from the corresponding disk according to the read request, including:
    所述服务端按照预设处理规则从所述内核异步处理队列取出读请求,根据取出的读请求从对应的磁盘中获取到相应的文件数据。The server extracts the read request from the kernel asynchronous processing queue according to the preset processing rule, and obtains corresponding file data from the corresponding disk according to the read request.
  5. 如权利要求4所述的分布式存储系统中的文件读取方法,其中,所述预设处理规则包括:The file reading method in a distributed storage system according to claim 4, wherein the preset processing rule comprises:
    按照预设周期取出所述内核异步处理队列中的所有读请求,将扇区位置在预设范围值内的多个读请求合并处理,同时获取扇区位置在预设范围值内的多个读请求各自对应的文件数据;All read requests in the core asynchronous processing queue are fetched according to a preset period, and multiple read requests with sector positions within a preset range value are combined, and multiple reads with sector positions within a preset range value are acquired Request corresponding file data;
    or
    按照存入内核异步处理队列的先后的顺序从所述内核异步处理队列中获取读请求,根据所述读请求获取对应的文件数据。The read request is obtained from the kernel asynchronous processing queue in the order in which the kernel asynchronous processing queue is stored, and the corresponding file data is acquired according to the read request.
  6. 一种服务端,包括读请求获取模块、文件数据获取模块和返回线程模块:A server includes a read request acquisition module, a file data acquisition module, and a return thread module:
    所述读请求获取模块,设置为通过读线程从客户端获取读请求;The read request obtaining module is configured to acquire a read request from a client by using a read thread;
    所述文件数据获取模块,设置为根据所述读请求从对应的磁盘中获取到相应的文件数据;The file data obtaining module is configured to obtain corresponding file data from the corresponding disk according to the read request;
    所述返回线程模块,设置为将获取的文件数据通过预先建立的返回线程发送给所述客户端。The return thread module is configured to send the acquired file data to the client through a pre-established return thread.
  7. 如权利要求6所述的服务端,其中,所述文件数据获取模块包括文件数据获取子模块和数据缓存子模块:The server according to claim 6, wherein the file data obtaining module comprises a file data obtaining submodule and a data cache submodule:
    所述数据获取子模块,设置为根据所述读请求从对应的多个磁盘中分别读取对应的文件数据;The data acquisition submodule is configured to respectively read corresponding file data from the corresponding plurality of disks according to the read request;
    数据缓存子模块,设置为将数据获取子模块读取的文件数据存入数据缓存区中;a data buffer sub-module, configured to store the file data read by the data acquisition sub-module into the data buffer;
    所述返回线程模块,还设置为判断所述数据缓存区是否存在文件数据,如果存在文件数据,立即将所述文件数据通过预先建立的返回线程发送给所 述客户端。The returning thread module is further configured to determine whether file data exists in the data buffer area, and if there is file data, immediately send the file data to the pre-established return thread Said client.
  8. 如权利要求7所述的服务端,其中,The server according to claim 7, wherein
    所述返回线程包括多个子返回线程,每个子返回线程对应一个数据缓存区;The return thread includes a plurality of sub-return threads, and each sub-return thread corresponds to one data buffer area;
    所述数据获取子模块还设置为,通过子返回线程根据预设查询规则查询其对应的数据缓存区是否存在文件数据;The data acquisition sub-module is further configured to query, by the sub-returning thread, whether the file data exists in the corresponding data buffer area according to the preset query rule;
    所述返回线程模块还设置为,将查询到的文件数据通过对应的子返回线程发送给所述客户端。The return thread module is further configured to send the queried file data to the client through a corresponding sub-return thread.
  9. 如权利要求6-8任一项所述的服务端,还包括内核异步处理队列;The server according to any one of claims 6-8, further comprising a kernel asynchronous processing queue;
    所述内核异步处理队列,设置为在所述读请求获取模块通过读线程从客户端获取读请求后,将所述读请求存入内核异步处理队列;The kernel asynchronous processing queue is configured to store the read request in a kernel asynchronous processing queue after the read request acquisition module acquires a read request from a client through a read thread;
    所述文件数据获取模块还包括接收子模块:所述接收子模块,设置为按照预设处理规则从所述内核异步处理队列取出读请求;The file data obtaining module further includes a receiving submodule: the receiving submodule is configured to fetch a read request from the kernel asynchronous processing queue according to a preset processing rule;
    所述数据获取子模块,还设置为根据取出的读请求从对应的磁盘中获取到相应的文件数据。The data acquisition submodule is further configured to obtain corresponding file data from the corresponding disk according to the read request.
  10. 如权利要求9所述的服务端,其中,所述预设处理规则包括:The server according to claim 9, wherein the preset processing rule comprises:
    按照预设周期取出所述内核异步处理队列中的所有读请求,将扇区位置在预设范围值内的多个读请求合并处理,同时获取扇区位置在预设范围值内的多个读请求各自对应的文件数据;All read requests in the core asynchronous processing queue are fetched according to a preset period, and multiple read requests with sector positions within a preset range value are combined, and multiple reads with sector positions within a preset range value are acquired Request corresponding file data;
    or
    按照存入内核异步处理队列的先后的顺序从所述内核异步处理队列中获取读请求,根据所述读请求获取对应的文件数据。The read request is obtained from the kernel asynchronous processing queue in the order in which the kernel asynchronous processing queue is stored, and the corresponding file data is acquired according to the read request.
  11. 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行权利要求1~5中任一项所述的方法。 A computer storage medium having stored therein computer executable instructions for performing the method of any one of claims 1 to 5.
PCT/CN2015/088998 2015-03-27 2015-09-06 File reading method in distributed storage system, and server end WO2016155238A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510142266.4A CN106161503A (en) 2015-03-27 2015-03-27 File reading in a kind of distributed memory system and service end
CN201510142266.4 2015-03-27

Publications (1)

Publication Number Publication Date
WO2016155238A1 true WO2016155238A1 (en) 2016-10-06

Family

ID=57003866

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/088998 WO2016155238A1 (en) 2015-03-27 2015-09-06 File reading method in distributed storage system, and server end

Country Status (2)

Country Link
CN (1) CN106161503A (en)
WO (1) WO2016155238A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107133297A (en) * 2017-04-26 2017-09-05 努比亚技术有限公司 Data interactive method, system and computer-readable recording medium

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106790389B (en) * 2016-11-25 2020-09-08 中国石油天然气集团公司 Seismic channel data acquisition method, main node server and working node server
CN107704328A (en) * 2017-10-09 2018-02-16 郑州云海信息技术有限公司 Client accesses method, system, device and the storage medium of file system
CN108989392A (en) * 2018-06-21 2018-12-11 聚好看科技股份有限公司 A kind of server data caching method, device and server
CN108959519A (en) * 2018-06-28 2018-12-07 郑州云海信息技术有限公司 A kind of method, apparatus and computer readable storage medium reading data
CN111522787B (en) * 2019-02-01 2023-04-07 阿里巴巴集团控股有限公司 Data processing method and device of distributed system and storage medium
CN111881096B (en) * 2020-07-24 2022-06-17 北京浪潮数据技术有限公司 File reading method, device, equipment and storage medium
CN112711483A (en) * 2020-12-10 2021-04-27 广州广电运通金融电子股份有限公司 High-concurrency method, system and equipment for processing big data annotation service
CN113254415B (en) * 2021-05-19 2022-11-04 浪潮商用机器有限公司 Method and device for processing read request of distributed file system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102981805A (en) * 2012-11-02 2013-03-20 浪潮(北京)电子信息产业有限公司 Serial software response method and system
CN102981773A (en) * 2011-09-02 2013-03-20 深圳市快播科技有限公司 Storage device access method and storage device access system and storage device access supervisor
CN103338156A (en) * 2013-06-17 2013-10-02 南京国电南自美卓控制系统有限公司 Thread pool based named pipe server concurrent communication method
WO2013174305A1 (en) * 2012-05-24 2013-11-28 华为技术有限公司 Ssd-based key-value type local storage method and system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7774750B2 (en) * 2005-07-19 2010-08-10 Microsoft Corporation Common concurrency runtime
CN102682012A (en) * 2011-03-14 2012-09-19 成都市华为赛门铁克科技有限公司 Method and device for reading and writing data in file system
CN103577158B (en) * 2012-07-18 2017-03-01 阿里巴巴集团控股有限公司 Data processing method and device
CN103336672B (en) * 2013-06-28 2016-10-05 华为技术有限公司 Method for reading data, device and computing device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102981773A (en) * 2011-09-02 2013-03-20 深圳市快播科技有限公司 Storage device access method and storage device access system and storage device access supervisor
WO2013174305A1 (en) * 2012-05-24 2013-11-28 华为技术有限公司 Ssd-based key-value type local storage method and system
CN102981805A (en) * 2012-11-02 2013-03-20 浪潮(北京)电子信息产业有限公司 Serial software response method and system
CN103338156A (en) * 2013-06-17 2013-10-02 南京国电南自美卓控制系统有限公司 Thread pool based named pipe server concurrent communication method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107133297A (en) * 2017-04-26 2017-09-05 努比亚技术有限公司 Data interactive method, system and computer-readable recording medium

Also Published As

Publication number Publication date
CN106161503A (en) 2016-11-23

Similar Documents

Publication Publication Date Title
WO2016155238A1 (en) File reading method in distributed storage system, and server end
JP5537571B2 (en) Content rendering on computers
US7523228B2 (en) Method for performing a direct memory access block move in a direct memory access device
US9251272B2 (en) Reconfigurable hardware structures for functional pipelining of on-chip special purpose functions
US20080034146A1 (en) Systems and Methods for Transactions Between Processor and Memory
US8499102B2 (en) Managing read requests from multiple requestors
KR20080024156A (en) Back-off mechanism for search
JP2021511588A (en) Data query methods, devices and devices
US10956328B2 (en) Selective downstream cache processing for data access
US20070162637A1 (en) Method, apparatus and program storage device for enabling multiple asynchronous direct memory access task executions
JP2018531465A6 (en) System and method for storing message data
JP2018531465A (en) System and method for storing message data
US9424314B2 (en) Method and apparatus for joining read requests
US20150186192A1 (en) System and method for selecting a synchronous or asynchronous interprocess communication mechanism
US11537453B2 (en) Multithreaded lossy queue protocol
WO2018232736A1 (en) Memory access technology and computer system
WO2016078091A1 (en) Input output (io) request processing method and file server
CN110851276A (en) Service request processing method, device, server and storage medium
Faraji et al. Design considerations for GPU‐aware collective communications in MPI
WO2016090985A1 (en) Cache reading method and apparatus, and cache reading processing method and apparatus
US10846265B2 (en) Method and apparatus for accessing file, and storage system
JP2010128831A (en) Data retrieval system, method and computer program
KR101694301B1 (en) Method for processing files in storage system and data server thereof
CN110955461B (en) Processing method, device, system, server and storage medium for computing task
CN110764710B (en) Low-delay high-IOPS data access method and storage system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15887195

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15887195

Country of ref document: EP

Kind code of ref document: A1