[go: up one dir, main page]

CN110515711A - Operation request processing method and device - Google Patents

Operation request processing method and device Download PDF

Info

Publication number
CN110515711A
CN110515711A CN201910734847.5A CN201910734847A CN110515711A CN 110515711 A CN110515711 A CN 110515711A CN 201910734847 A CN201910734847 A CN 201910734847A CN 110515711 A CN110515711 A CN 110515711A
Authority
CN
China
Prior art keywords
word
mark
request
queue
flag
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
Application number
CN201910734847.5A
Other languages
Chinese (zh)
Inventor
刘耀丹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Wave Intelligent Technology Co Ltd
Original Assignee
Suzhou Wave Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Wave Intelligent Technology Co Ltd filed Critical Suzhou Wave Intelligent Technology Co Ltd
Priority to CN201910734847.5A priority Critical patent/CN110515711A/en
Publication of CN110515711A publication Critical patent/CN110515711A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/176Support for shared access to files; File sharing support
    • G06F16/1767Concurrency control, e.g. optimistic or pessimistic approaches
    • G06F16/1774Locking methods, e.g. locking methods for file systems allowing shared and concurrent access to files
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems
    • G06F16/1824Distributed file systems implemented using Network-attached Storage [NAS] architecture
    • G06F16/183Provision of network file services by network file servers, e.g. by using NFS, CIFS
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明提供了一种操作请求的处理方法及装置,该方法包括:获取客户端发送的操作请求,将操作请求中的每个操作字的标志进行或操作,得到操作请求的操作标志,将操作请求的操作标志和预设的配置文件中的预设操作字的标志进行匹配,若相匹配,则计算获得该操作字对应的待写入请求队列的队列编号,并将操作请求写入至该队列编号对应的请求队列中,若不匹配,则将操作请求写入至预设队列编号对应的请求队列中。应用本发明提供的操作请求的处理方法,将操作请求写入至与其对应的请求队列中,实现不同的操作请求写入至与其对应的请求队列中,使得网络文件系统中的各个线程能够并行处理处于不同队列中的各个操作请求,从而提高操作请求的处理效率。

The present invention provides a method and device for processing an operation request. The method includes: obtaining an operation request sent by a client, performing an OR operation on the flag of each operation word in the operation request to obtain the operation flag of the operation request, and The requested operation flag matches the flag of the preset operation word in the preset configuration file. If they match, calculate and obtain the queue number of the request queue to be written corresponding to the operation word, and write the operation request to the In the request queue corresponding to the queue number, if there is no match, the operation request will be written into the request queue corresponding to the preset queue number. By applying the processing method of the operation request provided by the present invention, the operation request is written into the corresponding request queue, and different operation requests are written into the corresponding request queue, so that each thread in the network file system can be processed in parallel Various operation requests in different queues, thereby improving the processing efficiency of operation requests.

Description

操作请求的处理方法及装置Operation request processing method and device

技术领域technical field

本发明涉及网络文件系统领域,尤其涉及一种操作请求的处理方法及装置。The invention relates to the field of network file systems, in particular to a method and device for processing operation requests.

背景技术Background technique

网络文件系统NFS是一种在网络环境下实现不同计算机之间直接共享数据的一套系统,在网络系统文件的应用中,客户端可以透明的读写位于远端服务器上的文件,即客户端可以像访问本地硬盘中的文件一样,访问位于远端的服务器上的文件。Network file system NFS is a set of systems that directly share data between different computers in a network environment. In the application of network system files, the client can transparently read and write files located on the remote server, that is, the client You can access files on a remote server just like you access files on a local hard disk.

现有技术中,服务器在接收到客户端的操作请求时,会将接收到的操作请求写入至同一请求队列中,然后按照顺序从请求队列中获取每个操作请求,并执行与每个操作请求中包含的每个操作字对应的操作逻辑,其中,操作字表征操作文件的方法。应用现有技术,将各个包含操作字的操作请求写入至同一请求队列中,使得只能逐一处理每个操作请求,从而造成处理操作请求的效率较低。In the prior art, when the server receives an operation request from the client, it will write the received operation request into the same request queue, and then obtain each operation request from the request queue in order, and execute the same operation request as each operation request. The operation logic corresponding to each operation word included in , where the operation word represents the method of operating the file. Applying the existing technology, each operation request containing the operation word is written into the same request queue, so that each operation request can only be processed one by one, resulting in low efficiency in processing operation requests.

发明内容Contents of the invention

本发明所要解决的技术问题是提供一种操作请求的处理方法,能够并行处理处于不同队列中的各个操作请求,从而提高操作请求的处理效率。The technical problem to be solved by the present invention is to provide a method for processing operation requests, which can process each operation request in different queues in parallel, thereby improving the processing efficiency of operation requests.

本发明还提供了一种操作请求的处理装置,用于保证上述方法在实际中的实现及应用。The present invention also provides an operation request processing device, which is used to ensure the realization and application of the above method in practice.

一种操作请求的处理方法,包括:A method for processing an operation request, comprising:

获取客户端发送的操作请求,所述操作请求中包括至少两个操作字;Obtain an operation request sent by the client, where the operation request includes at least two operation words;

将每个所述操作字的标志进行或操作,得到所述操作请求的操作标志;其中,每个所述操作字的标志用于唯一标识所述操作字;performing an OR operation on the mark of each operation word to obtain the operation mark of the operation request; wherein, the mark of each operation word is used to uniquely identify the operation word;

依据所述操作请求的操作标志和每个所述操作字的标志,从所述操作请求的各个操作字中确定主操作字;determining the main operation word from each operation word of the operation request according to the operation flag of the operation request and the flag of each of the operation words;

获取预设的配置文件,将所述配置文件中的预设操作字的标志和所述操作请求中的所述主操作字的标志进行匹配;Acquire a preset configuration file, and match the symbol of the preset operation word in the configuration file with the symbol of the main operation word in the operation request;

若所述配置文件中的预设操作字的标志和所述操作请求中的所述主操作字的标志相匹配,则计算获得所述操作请求对应的待写入请求队列的队列编号,并将所述操作请求写入至所述队列编号对应的请求队列中;If the flag of the preset operation word in the configuration file matches the flag of the main operation word in the operation request, calculate and obtain the queue number of the request queue to be written corresponding to the operation request, and set The operation request is written into the request queue corresponding to the queue number;

若所述配置文件中的预设操作字的标志和所述操作请求中的所述主操作字的标志不匹配,则将所述操作请求写入至预设队列编号对应的请求队列中。If the flag of the preset operation word in the configuration file does not match the flag of the main operation word in the operation request, write the operation request into the request queue corresponding to the preset queue number.

上述的方法,可选的,所述从所述操作请求的各个操作字中确定主操作字,包括:In the above method, optionally, the determining the main operation word from each operation word in the operation request includes:

判断所述操作请求中包含标志的操作字的个数是否为一个;Judging whether the number of operation words containing flags in the operation request is one;

若所述操作请求中包含标志的操作字的个数为一个,则将所述包含标志的操作字作为主操作字。If the number of operation words containing flags in the operation request is one, the operation word containing flags is used as the main operation word.

上述的方法,可选的,还包括:The above method, optionally, also includes:

若所述操作请求中包含标志的操作字为两个,则将所述操作请求的操作标志与预设第一标志进行异或操作,得到第一数值,并将与所述第一数值相匹配的标志所对应的操作字作为主操作字;If there are two operation words containing flags in the operation request, perform an XOR operation on the operation flag of the operation request and the preset first flag to obtain a first value, which will be matched with the first value The operation word corresponding to the sign of is used as the main operation word;

若所述操作请求中包含标志的操作字为三个,将所述操作请求的操作标志、所述预设第一标志和预设第二标志进行异或操作,得到第二数值,并将与所述第二数值相匹配的标志所对应的操作字作为主操作字。If the number of operation words containing flags in the operation request is three, perform an XOR operation on the operation flags of the operation request, the preset first flag, and the preset second flag to obtain a second value, and combine it with The operation word corresponding to the flag whose second value matches is used as the main operation word.

上述的方法,可选的,所述计算获得所述操作请求对应的待写入请求队列的队列编号,包括:In the above method, optionally, the calculation to obtain the queue number of the request queue to be written corresponding to the operation request includes:

从所述操作请求的各个操作字中确定表征请求文件句柄的操作字;determining an operation word representing a requested file handle from each operation word in the operation request;

依据所述表征请求文件句柄的操作字,通过预设的哈希计算公式,获得哈希值;Obtain a hash value through a preset hash calculation formula according to the operation word characterizing the request file handle;

确定请求队列的总队列数,并将所述哈希值对所述总队列数进行取模运算,得到所述操作请求对应的待写入请求队列的队列编号。Determining the total number of queues in the request queue, and performing a modulo operation on the total number of queues with the hash value to obtain a queue number corresponding to the operation request to be written into the request queue.

上述的方法,可选的,所述将所述操作请求写入至所述队列编号对应的请求队列之后,还包括:In the above method, optionally, after writing the operation request into the request queue corresponding to the queue number, it further includes:

将所述队列编号对应的请求队列进行加锁操作。Perform a locking operation on the request queue corresponding to the queue number.

上述的方法,可选的,还包括:The above method, optionally, also includes:

从所述队列编号对应的请求队列中,或从所述预设队列编号对应的请求队列中获取所述操作请求;Obtain the operation request from the request queue corresponding to the queue number, or from the request queue corresponding to the preset queue number;

执行与所述操作请求中每个操作字对应的操作逻辑。Execute the operation logic corresponding to each operation word in the operation request.

一种操作请求的处理装置,包括:A device for processing an operation request, comprising:

第一获取单元,用于获取客户端发送的操作请求,所述操作请求中包括至少两个操作字;A first obtaining unit, configured to obtain an operation request sent by the client, where the operation request includes at least two operation words;

或操作单元,用于将每个所述操作字的标志进行或操作,得到所述操作请求的操作标志;其中,每个所述操作字的标志用于唯一标识所述操作字;An OR operation unit, configured to perform an OR operation on the flag of each operation word to obtain the operation flag of the operation request; wherein, the flag of each operation word is used to uniquely identify the operation word;

确定单元,用于依据所述操作请求的操作标志和每个所述操作字的标志,从所述操作请求的各个操作字中确定主操作字;A determining unit, configured to determine a main operation word from each operation word of the operation request according to the operation flag of the operation request and the flag of each of the operation words;

匹配单元,用于获取预设的配置文件,将所述配置文件中的预设操作字的标志和所述操作请求中的所述主操作字的标志进行匹配;A matching unit, configured to obtain a preset configuration file, and match the symbol of the preset operation word in the configuration file with the symbol of the main operation word in the operation request;

第一写入单元,用于若所述配置文件中的预设操作字的标志和所述操作请求中的所述主操作字的标志相匹配,则计算获得所述操作请求对应的待写入请求队列的队列编号,并将所述操作请求写入至所述队列编号对应的请求队列中;The first writing unit is configured to calculate and obtain the to-be-written value corresponding to the operation request if the flag of the preset operation word in the configuration file matches the flag of the main operation word in the operation request request the queue number of the queue, and write the operation request into the request queue corresponding to the queue number;

第二写入单元,用于若所述配置文件中的预设操作字的标志和所述操作请求中的所述主操作字的标志不匹配,则将所述操作请求写入至预设队列编号对应的请求队列中。The second writing unit is configured to write the operation request into a preset queue if the flag of the preset operation word in the configuration file does not match the flag of the main operation word in the operation request number corresponding to the request queue.

上述的装置,可选的,所述确定单元,包括:In the above device, optionally, the determining unit includes:

判断子单元,用于判断所述操作请求中包含标志的操作字的个数是否为一个;A judging subunit, configured to judge whether the number of operation words containing flags in the operation request is one;

第一确定子单元,用于若所述操作请求中包含标志的操作字的个数为一个,则将所述包含标志的操作字作为主操作字。The first determination subunit is configured to use the operation word containing the flag as the main operation word if the number of the operation word containing the flag in the operation request is one.

上述的装置,可选的,所述确定单元,还包括:In the above device, optionally, the determining unit further includes:

第二确定子单元,用于若所述操作请求中包含标志的操作字为两个,则将所述操作请求的操作标志与预设第一标志进行异或操作,得到第一数值,并将与所述第一数值相匹配的标志所对应的操作字作为主操作字;The second determining subunit is configured to perform an XOR operation on the operation flag of the operation request and the preset first flag if there are two operation words including flags in the operation request to obtain the first value, and The operation word corresponding to the flag matching the first value is used as the main operation word;

第三确定子单元,用于若所述操作请求中包含标志的操作字为三个,将所述操作请求的操作标志、所述预设第一标志和预设第二标志进行异或操作,得到第二数值,并将与所述第二数值相匹配的标志所对应的操作字作为主操作字。The third determining subunit is configured to perform an XOR operation on the operation flag of the operation request, the preset first flag, and the preset second flag if the number of operation words containing flags in the operation request is three, The second value is obtained, and the operation word corresponding to the flag matching the second value is used as the main operation word.

上述的装置,可选的,所述第一写入单元,包括:In the above device, optionally, the first writing unit includes:

第四确定子单元,用于从所述操作请求的各个操作字中确定表征请求文件句柄的操作字;The fourth determination subunit is used to determine the operation word representing the requested file handle from each operation word in the operation request;

获取子单元,用于依据所述表征请求文件句柄的操作字,通过预设的哈希计算公式,获得哈希值;The obtaining subunit is used to obtain a hash value through a preset hash calculation formula according to the operation word characterizing the request file handle;

计算子单元,用于确定请求队列的总队列数,并将所述哈希值对所述总队列数进行取模运算,得到所述操作请求对应的待写入请求队列的队列编号。The calculation subunit is configured to determine the total queue number of the request queue, and perform a modulo operation on the total queue number with the hash value to obtain the queue number of the request queue to be written corresponding to the operation request.

上述的装置,可选的,还包括:The above-mentioned device, optionally, also includes:

加锁单元,用于将所述队列编号对应的请求队列进行加锁操作。The locking unit is configured to perform a locking operation on the request queue corresponding to the queue number.

上述的装置,可选的,还包括:The above-mentioned device, optionally, also includes:

第二获取单元,用于从所述队列编号对应的请求队列中,或从所述预设队列编号对应的请求队列中获取所述操作请求;The second acquiring unit is configured to acquire the operation request from the request queue corresponding to the queue number, or from the request queue corresponding to the preset queue number;

执行单元,用于执行与所述操作请求中每个操作字对应的操作逻辑。An execution unit, configured to execute the operation logic corresponding to each operation word in the operation request.

一种存储介质,其特征在于,所述存储介质包括存储的指令,其中,在所述指令运行时控制所述存储介质所在的设备执行上述的操作请求的处理方法。A storage medium is characterized in that the storage medium includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the above-mentioned method for processing an operation request.

一种电子设备,包括存储器,以及一个或者一个以上的指令,其中一个或者一个以上指令存储于存储器中,且经配置以由一个或者一个以上处理器执行上述的操作请求的处理方法。An electronic device includes a memory, and one or more instructions, wherein the one or more instructions are stored in the memory, and are configured to be executed by one or more processors to perform the above-mentioned method for processing an operation request.

与现有技术相比,本发明包括以下优点:Compared with the prior art, the present invention includes the following advantages:

本发明提供了一种操作请求的处理方法,包括:获取客户端发送的操作请求,将操作请求中的每个操作字的标志进行或操作,得到操作请求的操作标志,获取预设的配置文件,将操作请求的操作标志和配置文件中的预设操作字的标志进行匹配,若相匹配,则计算获得该操作字对应的待写入请求队列的队列编号,并将操作请求写入至该队列编号对应的请求队列中,若不匹配,则将操作请求写入至预设队列编号对应的请求队列中。应用本发明提供的操作请求的处理方法,将操作请求写入至与其对应的请求队列中,实现不同的操作请求写入至与其对应的请求队列中,使得网络文件系统中的各个线程能够并行处理处于不同队列中的各个操作请求,从而提高操作请求的处理效率。The present invention provides a method for processing an operation request, comprising: obtaining an operation request sent by a client, performing an OR operation on the symbol of each operation word in the operation request to obtain the operation symbol of the operation request, and obtaining a preset configuration file , match the operation flag of the operation request with the flag of the preset operation word in the configuration file, if they match, calculate and obtain the queue number of the request queue to be written corresponding to the operation word, and write the operation request to the In the request queue corresponding to the queue number, if there is no match, the operation request will be written into the request queue corresponding to the preset queue number. By applying the processing method of the operation request provided by the present invention, the operation request is written into the corresponding request queue, and different operation requests are written into the corresponding request queue, so that each thread in the network file system can process in parallel Various operation requests in different queues, thereby improving the processing efficiency of operation requests.

附图说明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 method flowchart of a method for processing an operation request provided by the present invention;

图2为本发明提供的一种操作请求的处理方法的又一方法流程图;Fig. 2 is another method flowchart of a method for processing an operation request provided by the present invention;

图3为本发明提供的一种操作请求的处理方法的又一方法流程图;Fig. 3 is another method flowchart of a method for processing an operation request provided by the present invention;

图4为本发明提供的一种操作请求的处理装置的结构示意图;FIG. 4 is a schematic structural diagram of an operation request processing device provided by the present invention;

图5为本发明提供的一种电子设备的结构示意图。FIG. 5 is a schematic structural diagram of an electronic device provided by the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. 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.

本发明实施例提供了一种操作请求的处理方法,该方法可以应用在第四版本的网络文件系统NFSv4中,其执行主体可以为网络文件系统的服务器,所述方法的方法流程图如图1所示,具体包括:An embodiment of the present invention provides a method for processing an operation request. This method can be applied to the fourth version of the network file system NFSv4, and its execution body can be a server of the network file system. The method flow chart of the method is shown in Figure 1 shown, including:

S101:获取客户端发送的操作请求。S101: Obtain an operation request sent by a client.

本发明实施例提供的方法中,获取客户端发送的操作请求,该操作请求可以为COMPOUND复合请求,每个复合请求中包括至少两个操作字,每个操作字用于指示操作文件的方法,其中操作字包括但不限于操作字open用于指示打开文件,操作字create用于指示创建文件,操作字remove用于指示删除文件。In the method provided by the embodiment of the present invention, the operation request sent by the client is obtained. The operation request can be a COMPOUND composite request, and each composite request includes at least two operation words, and each operation word is used to indicate the method of operating the file. The operation word includes but not limited to the operation word open for instructing to open a file, the operation word create for instructing to create a file, and the operation word remove for instructing to delete a file.

S102:将每个所述操作字的标志进行或操作,得到所述操作请求的操作标志。S102: Perform an OR operation on the flags of each operation word to obtain the operation flag of the operation request.

本发明实施例提供的方法中,将操作请求中的每个操作字的标志进行或操作,得到操作请求的操作标志,可选的,操作请求中至少包括一个存在标志的操作字,操作请求中包含表征请求文件句柄的操作字,其中操作字的标志用于唯一标识该操作字。In the method provided by the embodiment of the present invention, the flag of each operation word in the operation request is ORed to obtain the operation flag of the operation request. Optionally, the operation request includes at least one operation word with a flag. Contains the operation word representing the requested file handle, where the flag of the operation word is used to uniquely identify the operation word.

对将每个操作字的标志进行或操作,得到操作请求的操作标志进行举例说明如下:The operation flag of the operation request obtained by ORing the flags of each operation word is illustrated as follows:

操作请求中包括的操作字为:putfh、write、getattr和aceess,其中putfh为请求文件句柄,不为其分配标志,write的标志为0x0001,getattr的标志为0x 0010,aceess的标志为0x 0100,将write、getattr和aceess的标志进行或操作,也就是将0x 0001、0x 0010和0x 0100进行或操作,得到的0x 0111即为操作请求的操作标志。The operation words included in the operation request are: putfh, write, getattr and aceess, among which putfh is the request file handle, no flag is assigned to it, the flag of write is 0x0001, the flag of getattr is 0x 0010, the flag of aceess is 0x 0100, The flags of write, getattr, and aceess are ORed, that is, 0x 0001, 0x 0010, and 0x 0100 are ORed, and the obtained 0x 0111 is the operation flag of the operation request.

S103:依据所述操作请求的操作标志和每个所述操作字的标志,从所述操作请求的各个操作字中确定主操作字。S103: Determine a main operation word from each operation word in the operation request according to the operation flag of the operation request and the flag of each of the operation words.

本发明实施例提供的方法中,基于操作请求的操作标志和每个操作字的标志,从操作请求的各个操作字中确定主操作字。需要说明的是,每个操作请求中只有一个主操作字。In the method provided by the embodiment of the present invention, based on the operation flag of the operation request and the flag of each operation word, the main operation word is determined from each operation word of the operation request. It should be noted that there is only one main operation word in each operation request.

S104:获取预设的配置文件,将所述配置文件中的预设操作字的标志和所述操作请求中的所述主操作字的标志进行匹配。S104: Obtain a preset configuration file, and match the flag of the preset operation word in the configuration file with the flag of the main operation word in the operation request.

本发明实施例提供的方法中,预先对配置文件进行配置,即配置需要多线程优化的开关参数,开关参数包括但不限于允许客户端发送的操作请求的个数Nb_Worker_Req、每个请求队列中操作请求的个数Nb_Worker_Queue和需要进行优化的操作字Op_Thread_V4,其中需要进行优化的操作字为预设操作字。In the method provided by the embodiment of the present invention, the configuration file is configured in advance, that is, switch parameters that require multi-thread optimization are configured. The switch parameters include but are not limited to the number of operation requests Nb_Worker_Req that is allowed to be sent by the client, and the number of operation requests in each request queue. The number of requests Nb_Worker_Queue and the operation word Op_Thread_V4 that needs to be optimized, among which the operation word that needs to be optimized is the default operation word.

本发明实施例提供的方法中,将配置文件中的预设操作字的标志和操作请求中的主操作字的标志进行匹配,以确定该主操作字是否为需要优化的操作字,从而确定该操作请求是否为需要线程优化的操作请求,其中,需要线程优化的操作请求需要写入至特定的请求队列中。In the method provided by the embodiment of the present invention, the flag of the preset operation word in the configuration file is matched with the flag of the main operation word in the operation request to determine whether the main operation word is an operation word that needs to be optimized, so as to determine the Whether the operation request is an operation request requiring thread optimization, where the operation request requiring thread optimization needs to be written into a specific request queue.

需要说明的是,本发明实施例提供的方法中,若不在配置文件设置需要进行优化的操作字,则直接将该操作请求写入至预设队列编号对应的请求队列中。It should be noted that, in the method provided by the embodiment of the present invention, if the operation word to be optimized is not set in the configuration file, the operation request is directly written into the request queue corresponding to the preset queue number.

S105:若配置文件中的预设操作字的标志和操作请求中的主操作字的标志相匹配,则计算获得操作请求对应的待写入请求队列的队列编号,并将操作请求写入至队列编号对应的请求队列中。S105: If the flag of the preset operation word in the configuration file matches the flag of the main operation word in the operation request, calculate and obtain the queue number of the request queue to be written corresponding to the operation request, and write the operation request into the queue number corresponding to the request queue.

本发明实施例提供的方法中,预先创建多个请求队列,若配置文件中的预设操作字的标志和操作请求中的主操作字的标志相匹配,则说明该主操作字为需要线程优化的操作字,即该操作请求为需要线程优化的操作请求,对于需要线程优化的主操作字,计算该操作请求对应的待写入请求队列的队列编号,获得该操作请求对应的待写入请求队列的队列编号,并将该操作请求写入至队列编号对应的请求队列中。In the method provided by the embodiment of the present invention, multiple request queues are created in advance, and if the flag of the preset operation word in the configuration file matches the flag of the main operation word in the operation request, it means that the main operation word needs thread optimization The operation word, that is, the operation request is an operation request that requires thread optimization. For the main operation word that requires thread optimization, calculate the queue number of the request queue to be written corresponding to the operation request, and obtain the request to be written corresponding to the operation request The queue number of the queue, and write the operation request into the request queue corresponding to the queue number.

S106:若配置文件中的预设操作字的标志和操作请求中的主操作字的标志不匹配,则将操作请求写入至预设队列编号对应的请求队列中。S106: If the flag of the preset operation word in the configuration file does not match the flag of the main operation word in the operation request, write the operation request into the request queue corresponding to the preset queue number.

本发明实施例提供的方法中,若配置文件中的预设操作字的标志和操作请求中的主操作字的标志不匹配,则说明该操作请求中的主操作字不需要进行线程优化,并将该操作请求写入至不需要进行线程优化的请求队列中,也就是将该操作请求写入至预设编号对应的请求队列中。In the method provided by the embodiment of the present invention, if the flag of the preset operation word in the configuration file does not match the flag of the main operation word in the operation request, it means that the main operation word in the operation request does not need to be optimized for threads, and The operation request is written into the request queue that does not require thread optimization, that is, the operation request is written into the request queue corresponding to the preset number.

本发明实施例提供的操作请求的处理方法,预先创建多个请求队列,获取客户端发送的操作请求,将操作请求中的每个操作字的标志进行或操作,得到操作请求的操作标志,获取预设的配置文件,将操作请求的操作标志和配置文件中的预设操作字的标志进行匹配,若相匹配,则计算获得该操作字对应的待写入请求队列的队列编号,并将操作请求写入至该队列编号对应的请求队列中,若不匹配,则将操作请求写入至预设队列编号对应的请求队列中。应用本发明实施例提供的操作请求的处理方法,将操作请求写入至与其对应的请求队列中,实现不同的操作请求写入至与其对应的请求队列中,使得网络文件系统中的各个线程能够并行处理处于不同队列中的各个操作请求,从而提高操作请求的处理效率。The method for processing the operation request provided by the embodiment of the present invention pre-creates multiple request queues, obtains the operation request sent by the client, and performs OR operation on the symbol of each operation word in the operation request to obtain the operation symbol of the operation request, and obtains In the preset configuration file, match the operation flag of the operation request with the flag of the preset operation word in the configuration file. If they match, calculate and obtain the queue number corresponding to the operation word to be written into the request queue, and put the operation The request is written into the request queue corresponding to the queue number. If there is no match, the operation request is written into the request queue corresponding to the preset queue number. Apply the processing method of the operation request provided by the embodiment of the present invention, write the operation request into the request queue corresponding to it, and realize that different operation requests are written into the request queue corresponding to it, so that each thread in the network file system can Each operation request in different queues is processed in parallel, thereby improving the processing efficiency of operation requests.

上述本发明实施例图1公开的步骤S103涉及的从所述操作请求的各个操作字中确定主操作字,如图2所示,具体可以包括:The step S103 disclosed in FIG. 1 of the above-mentioned embodiment of the present invention involves determining the main operation word from each operation word in the operation request, as shown in FIG. 2 , which may specifically include:

S201:判断操作请求中包含标志的操作字的个数是否为一个。S201: Determine whether the number of operation words containing flags in the operation request is one.

本发明实施例提供的方法中,本发明实施例提供的方法中,操作请求可以包含多个操作字,可选的,操作请求中包含表征请求文件句柄的操作字,该表征请求文件句柄的操作字可以不为其分配标志,也就是说,操作请求中表征请求文件句柄的操作字没有标志;对操作请求中包含标志的操作字的个数进行判断,若操作请求中包含标志的操作字的个数为一个,则执行步骤S202,若操作请求中包含标志的操作字的个数不为一个,则执行步骤S203。In the method provided by the embodiment of the present invention, in the method provided by the embodiment of the present invention, the operation request may contain multiple operation words. Optionally, the operation request includes an operation word representing the requested file handle, which represents the operation of the requested file handle Words may not be assigned flags, that is to say, there is no flag for the operation word representing the requested file handle in the operation request; the number of operation words containing flags in the operation request is judged, if the number of operation words containing flags in the operation request is If the number is one, execute step S202, and if the number of operation words containing flags in the operation request is not one, execute step S203.

S202:将包含标志的操作字作为主操作字。S202: Use the operation word containing the flag as the main operation word.

本发明实施例提供的方法中,若操作请求中包含标志的操作字的个数为一个,则将包含标志的操作字作为主操作字。例如,操作请求包含的操作字为putfh和getattr,其中,putfh为请求文件句柄,没有标志,getattr有标志,则将getattr作为主操作字;操作请求中包含操作字为putfh、savefh和write,其中,putfh和savefh没有标志,write有标志,则将write作为主操作字。In the method provided by the embodiment of the present invention, if the number of the operation word containing the flag in the operation request is one, the operation word containing the flag is used as the main operation word. For example, the operation words contained in the operation request are putfh and getattr, wherein, putfh is the request file handle, there is no flag, and getattr has a flag, then getattr is used as the main operation word; the operation words contained in the operation request are putfh, savefh and write, among which , putfh and savefh have no flags, and write has flags, then use write as the main operation word.

S203:判断操作请求中包含标志的操作字的个数是否两个。S203: Determine whether the number of operation words containing flags in the operation request is two.

本发明实施例提供的方法中,若操作请求中包含标志的操作字的个数不为一个,则判断操作请求中包含标志的操作字的个数是否有为两个,若操作请求中包含标志的操作字的个数为两个,则执行步骤S204,若操作请求中包含标志的操作请求不为两个,则执行步骤S205。In the method provided by the embodiment of the present invention, if the number of operation words containing flags in the operation request is not one, it is judged whether the number of operation words containing flags in the operation request is two, if the number of operation words containing flags in the operation request is If the number of operation words is two, execute step S204, and if there are not two operation requests including flags in the operation request, execute step S205.

S204:将操作请求的操作标志与预设第一标志进行异或操作,得到第一数值,并将与第一数值相匹配的标志所对应的操作字作为主操作字。S204: Perform an XOR operation on the operation flag of the operation request and the preset first flag to obtain a first value, and use the operation word corresponding to the flag matching the first value as the main operation word.

本发明实施例提供的方法中,若操作请求中包含标志的操作字为两个,则需要排除预设的第一操作字,需要说明的是,每次排除的第一操作字都是固定的,而第一操作字的标志也是可知的,即第一操作字的标志为预设第一标志,可选的,预设的第一操作字为操作字getattr。通过将操作请求的操作标志与预设第一标志进行异或操作,可排除第一操作字,得到第一数值,并将操作请求中与第一数值相匹配的标志所对应的操作字作为主操作字。例如,操作请求中包含的操作字为putfh、write和getattr,其中putfh不包含标志,write的标志为0x0001,getattr的标志为0x0010,则操作请求的操作标志为0x0011,预设第一标志为0x0010,将0x0011与0x0010进行异或操作,得到0x0001,0x0001与操作字write的标志0x0001相匹配,则将操作字write作为主操作字。In the method provided by the embodiment of the present invention, if there are two operation words containing flags in the operation request, the preset first operation word needs to be excluded. It should be noted that the first operation word excluded each time is fixed , and the flag of the first operation word is also known, that is, the flag of the first operation word is the default first flag, and optionally, the default first operation word is the operation word getattr. By XORing the operation flag of the operation request with the preset first flag, the first operation word can be excluded to obtain the first value, and the operation word corresponding to the flag in the operation request that matches the first value can be used as the main Operation word. For example, the operation words contained in the operation request are putfh, write and getattr, where putfh does not contain flags, the flag of write is 0x0001, and the flag of getattr is 0x0010, then the operation flag of the operation request is 0x0011, and the default first flag is 0x0010 , perform XOR operation on 0x0011 and 0x0010 to get 0x0001, and 0x0001 matches the flag 0x0001 of the operation word write, then use the operation word write as the main operation word.

S205:将操作请求的操作标志、预设第一标志和预设第二标志进行异或操作,得到第二数值,将与第二数值相匹配的标志所对应的操作字作为主操作字。S205: Perform an XOR operation on the operation flag of the operation request, the preset first flag, and the preset second flag to obtain a second value, and use the operation word corresponding to the flag matching the second value as the main operation word.

本发明实施例提供的方法中,若操作请求中包含标志的操作字不为两个,则说明操作请求中包含标志的操作字为三个,需要排除预设的第一操作字和预设的第二操作字,可选的,预设的第一操作字为getattr,预设的第二操作字为access,其中,预设的第一操作字的标志为预设第一标志,预设的第二操作字的操作标志为预设第二标志,通过将操作请求的操作标志、预设第一标志和预设第二标志进行异或操作,排除操作请求中的第一操作字和第二操作字,得到第二数值,与第二数值相匹配的标志所对应的操作字即为主操作字,例如,操作请求中包含的操作字为putfh、write、getattr和access,其中putfh不包含标志,write的标志为0x0001,getattr的标志为0x0010,access的标志为0x0100,则操作请求的操作标志为0x0111,预设第一标志为0x0010,预设第二标志为0x0100,将0x0011、0x0010和0x0100进行异或操作,得到0x0001,0x0001与操作字write的标志0x0001相匹配,则将操作字write作为主操作字。In the method provided by the embodiment of the present invention, if there are not two operation words containing flags in the operation request, it means that there are three operation words containing flags in the operation request, and it is necessary to exclude the preset first operation word and the preset The second operation word, optionally, the preset first operation word is getattr, and the preset second operation word is access, wherein, the preset first operation word flag is the preset first flag, and the preset The operation flag of the second operation word is the preset second flag, and the first operation word and the second preset flag in the operation request are excluded by XORing the operation flag of the operation request, the preset first flag and the preset second flag. Operation word, to obtain the second value, the operation word corresponding to the flag matching the second value is the main operation word, for example, the operation words contained in the operation request are putfh, write, getattr and access, where putfh does not contain the flag , the flag of write is 0x0001, the flag of getattr is 0x0010, the flag of access is 0x0100, then the operation flag of the operation request is 0x0111, the default first flag is 0x0010, the preset second flag is 0x0100, set 0x0011, 0x0010 and 0x0100 Exclusive OR operation is performed to obtain 0x0001, and 0x0001 matches the flag 0x0001 of the operation word write, then the operation word write is used as the main operation word.

需要说明的是,只有当操作字getattr所在的操作请求中只包含一个存在标志的操作字时,操作字getattr才能作为主操作字,其他情况下,getattr都不能作为主操作字;操作字access所在的操作请求中包含一个存在标志的操作字或所包含两个存在标志的操作字时,操作字access都能作为主操作字。It should be noted that the operation word getattr can be used as the main operation word only when the operation request where the operation word getattr is located contains only one operation word with an existing flag. In other cases, getattr cannot be used as the main operation word; When the operation request contains an operation word with an existence flag or two operation words with an existence flag, the operation word access can be used as the main operation word.

本发明实施例提供的操作请求的处理方法中,若操作请求中包含标志的操作字为一个,则将包含标志的操作字为主操作字,若操作请求中包含标志的操作字为两个,则通过将操作请求的操作标志和预设第一标志进行异或操作,排除getattr操作字,得到第一数值,将与第一数值相匹配的标志所对应的操作字作为主操作字,若操作请求中包含标志的操作字为三个,则通过将操作请求的操作标志、预设第一标志和预设第二标志进行异或操作,排除getattr操作字和access操作字,得到第二数值,将与第二数值相匹配的标志所对应的操作字作为主操作字。In the method for processing an operation request provided in the embodiment of the present invention, if there is one operation word containing a flag in the operation request, the operation word containing the flag is the main operation word; if there are two operation words containing the flag in the operation request, Then, by XORing the operation flag of the operation request and the preset first flag, excluding the getattr operation word, the first value is obtained, and the operation word corresponding to the flag matching the first value is used as the main operation word, if the operation If there are three operation words including flags in the request, the second value is obtained by performing an XOR operation on the operation flag of the operation request, the preset first flag, and the preset second flag, excluding the getattr operation word and the access operation word, The operation word corresponding to the flag matching the second value is used as the main operation word.

需要说明的是,本发明实施例提供的方法中,还可以为表征请求文件句柄的操作字分配标志,若为表征请问文件句柄的操作字分配标志,需通过异或操作进行排除,从而确定出操作请求中的主操作字。It should be noted that, in the method provided by the embodiment of the present invention, a flag can also be assigned to the operation word representing the request file handle. If the flag is assigned to the operation word representing the request file handle, it needs to be excluded through the XOR operation, so as to determine the Primary operation word in operation request.

上述本发明实施例图1公开的步骤S105涉及到的计算获得所述操作请求对应的待写入请求队列的队列编号,如图3所示,具体可以包括:The calculation involved in step S105 disclosed in FIG. 1 of the above-mentioned embodiment of the present invention obtains the queue number of the request queue to be written corresponding to the operation request, as shown in FIG. 3 , which may specifically include:

S301:从所述操作请求的各个操作字中确定表征请求文件句柄的操作字。S301: Determine an operation word representing a requested file handle from each operation word in the operation request.

本发明实施例提供的方法中,操作请求中包含表征请求文件句柄的操作字,从操作请求的各个操作字中确定表征请求文件句柄的操作字,可选的,可以是通过解析操作请求中包含的各个操作字,获得表征请求文件句柄的操作字。In the method provided by the embodiment of the present invention, the operation request includes the operation word representing the request file handle, and the operation word representing the request file handle is determined from each operation word in the operation request. Each operation word of each operation word to obtain the operation word representing the request file handle.

S302:依据所述表征请求文件句柄的操作字,通过预设的哈希计算公式,获得哈希值。S302: Obtain a hash value through a preset hash calculation formula according to the operation word representing the request file handle.

本发明实施例提供的方法中,通过预设的哈希计算公式,对表征请求文件句柄的操作进行哈希计算,获得哈希值。In the method provided by the embodiment of the present invention, the hash calculation is performed on the operation representing the requested file handle through a preset hash calculation formula to obtain a hash value.

S303:确定请求队列的总队列数,并将所述哈希值对所述总队列数进行取模运算,得到所述操作请求对应的待写入请求队列的队列编号。S303: Determine the total number of queues of the request queue, and perform a modulo operation on the total number of queues with the hash value, to obtain a queue number of the request queue to be written corresponding to the operation request.

本发明实施例提供的方法中,依据配置文件的开关参数中的允许客户端发送的操作请求的个数Nb_Worker_Req,每个请求队列中操作请求的个数Nb_Worker_Queue,确定请求队列的总队列数,可选的,通过将开关参数Nb_Worker_Req对应的值与开关参数Nb_Worker_Queue对应的值进行除法运算,获得请求队列的总队列数,将哈希值对总队列数进行取模运行,得到操作请求对应的待写入请求队列的队列编号,可选的,待写入请求队列的队列编号为取模运算获得的值加一,例如取模运算获得的值为1,则待写入请求队列的队列编号为2。In the method provided by the embodiment of the present invention, according to the number Nb_Worker_Req of the operation request that the client is allowed to send in the switch parameter of the configuration file, and the number Nb_Worker_Queue of the operation request in each request queue, determine the total queue number of the request queue, which can be Optionally, by dividing the value corresponding to the switch parameter Nb_Worker_Req and the value corresponding to the switch parameter Nb_Worker_Queue, the total number of queues in the request queue is obtained, and the hash value is modulo-run on the total number of queues to obtain the pending write corresponding to the operation request. The queue number of the incoming request queue. Optionally, the queue number to be written into the request queue is the value obtained by the modulo operation plus one. For example, if the value obtained by the modulo operation is 1, the queue number to be written into the request queue is 2 .

本发明实施例提供的方法中,从操作请求的各个操作字中确定表征请求文件句柄的操作字,依据表征请求文件句柄的操作字,通过预设的哈希计算公式,获得哈希值,确定请求队列的总队列数,并将哈希值对总队列数进行取模运算,得到所述操作请求对应的待写入请求队列的队列编号。In the method provided by the embodiment of the present invention, the operation word representing the request file handle is determined from each operation word in the operation request, and according to the operation word representing the request file handle, the hash value is obtained through the preset hash calculation formula, and determined The total number of queues in the request queue, and a modulo operation is performed on the hash value to the total number of queues to obtain the queue number to be written into the request queue corresponding to the operation request.

上述本发明实施例图1公开的步骤S105涉及到的计算获得所述操作请求对应的待写入请求队列的队列编号之后,还可以包括:After the calculation involved in step S105 disclosed in FIG. 1 of the above-mentioned embodiment of the present invention obtains the queue number of the request queue to be written corresponding to the operation request, it may also include:

将所述队列编号对应的请求队列进行加锁操作。Perform a locking operation on the request queue corresponding to the queue number.

本发明实施例提供的方法中,通过对队列编号对应的请求队列进行加锁操作,避免冲突事件的发生,提高网络文件系统的稳定性。In the method provided by the embodiment of the present invention, the request queue corresponding to the queue number is locked to avoid the occurrence of conflict events and improve the stability of the network file system.

需要说明的是,若对请求队列进行加锁操作,则在操作请求出队前,先对已加锁的请求队列进行解锁操作。It should be noted that if the request queue is locked, the locked request queue should be unlocked before the operation request is dequeued.

上述本发明实施图1公开的步骤还可以包括:The steps disclosed in the implementation of the above-mentioned present invention shown in FIG. 1 may also include:

从所述队列编号对应的请求队列中,或从所述预设队列编号对应的请求队列中获取所述操作请求。The operation request is acquired from the request queue corresponding to the queue number, or from the request queue corresponding to the preset queue number.

执行与所述操作请求中每个操作字对应的操作逻辑。Execute the operation logic corresponding to each operation word in the operation request.

本发明实施例提供的方法中,在将操作请求写入队列之后,该操作请求等待出请求队列,在操作请求出队之后,操作请求中的每个操作字并行执行与其对应的操作逻辑,即若操作请求中包含操作字create,则执行与create对应的创建文件的操作。In the method provided by the embodiment of the present invention, after the operation request is written into the queue, the operation request waits to be dequeued, and after the operation request is dequeued, each operation word in the operation request executes its corresponding operation logic in parallel, that is If the operation request contains the operation word create, the operation of creating a file corresponding to create is executed.

需要说明的是,本发明实施例提供的方法中,通过创建多个请求队列,将各个操作请求写入至与其对应的请求队列中,并等待出队,服务器的系统调用多个线程同时处理各个请求队列中的操作请求,当任意一个请求队列的操作请求中的操作字在执行与其对应的操作逻辑的过程中出现异常,不影响其他请求队列的操作请求的处理,从而实现线程优化,提高计算机资源的利用率。It should be noted that, in the method provided by the embodiment of the present invention, by creating multiple request queues, each operation request is written into the corresponding request queue, and waits to be dequeued. The system of the server calls multiple threads to process each operation request at the same time. For the operation requests in the request queue, when the operation word in any operation request of the request queue is abnormal in the process of executing the corresponding operation logic, it will not affect the processing of the operation requests of other request queues, so as to realize thread optimization and improve computer performance. resource utilization.

与图1所述的方法相对应,本发明实施例还提供了一种操作请求的处理装置,用于对图1中方法的具体实现,其结构示意图如图4所示,具体包括:Corresponding to the method described in FIG. 1, the embodiment of the present invention also provides an operation request processing device, which is used to implement the method in FIG. 1. Its structural diagram is shown in FIG. 4, specifically including:

第一获取单元401,用于获取客户端发送的操作请求,所述操作请求中包括至少两个操作字;The first obtaining unit 401 is configured to obtain an operation request sent by the client, where the operation request includes at least two operation words;

或操作单元402,用于将每个所述操作字的标志进行或操作,得到所述操作请求的操作标志;其中,每个所述操作字的标志用于唯一标识所述操作字;An OR operation unit 402, configured to perform an OR operation on the flag of each operation word to obtain the operation flag of the operation request; wherein, the flag of each operation word is used to uniquely identify the operation word;

确定单元403,用于依据所述操作请求的操作标志和每个所述操作字的标志,从所述操作请求的各个操作字中确定主操作字;A determining unit 403, configured to determine the main operation word from each operation word of the operation request according to the operation flag of the operation request and the flag of each of the operation words;

匹配单元404,用于获取预设的配置文件,将所述配置文件中的预设操作字的标志和所述操作请求中的所述主操作字的标志进行匹配;A matching unit 404, configured to acquire a preset configuration file, and match the symbol of the preset operation word in the configuration file with the symbol of the main operation word in the operation request;

第一写入单元405,用于若所述配置文件中的预设操作字的标志和所述操作请求中的所述主操作字的标志相匹配,则计算获得所述操作请求对应的待写入请求队列的队列编号,并将所述操作请求写入至所述队列编号对应的请求队列中;The first writing unit 405 is configured to calculate and obtain the to-be-written value corresponding to the operation request if the flag of the preset operation word in the configuration file matches the flag of the main operation word in the operation request. enter the queue number of the request queue, and write the operation request into the request queue corresponding to the queue number;

第二写入单元406,用于若所述配置文件中的预设操作字的标志和所述操作请求中的所述主操作字的标志不匹配,则将所述操作请求写入至预设队列编号对应的请求队列中。The second writing unit 406 is configured to write the operation request into the preset if the flag of the preset operation word in the configuration file does not match the flag of the main operation word in the operation request In the request queue corresponding to the queue number.

本发明实施例提供的操作请求的处理装置,预先创建多个请求队列,获取客户端发送的操作请求,将操作请求中的每个操作字的标志进行或操作,得到操作请求的操作标志,获取预设的配置文件,将操作请求的操作标志和配置文件中的预设操作字的标志进行匹配,若相匹配,则计算获得该操作字对应的待写入请求队列的队列编号,并将操作请求写入至该队列编号对应的请求队列中,若不匹配,则将操作请求写入至预设队列编号对应的请求队列中。应用本发明实施例提供的操作请求的处理装置,将操作请求写入至与其对应的请求队列中,实现不同的操作请求写入至与其对应的请求队列中,使得网络文件系统中的各个线程能够并行处理处于不同队列中的各个操作请求,从而提高操作请求的处理效率。The operation request processing device provided by the embodiment of the present invention creates multiple request queues in advance, acquires the operation request sent by the client, and performs OR operation on the sign of each operation word in the operation request to obtain the operation sign of the operation request, and obtains In the preset configuration file, match the operation flag of the operation request with the flag of the preset operation word in the configuration file. If they match, calculate and obtain the queue number corresponding to the operation word to be written into the request queue, and put the operation The request is written into the request queue corresponding to the queue number. If there is no match, the operation request is written into the request queue corresponding to the preset queue number. Application of the operation request processing device provided by the embodiment of the present invention writes the operation request into the corresponding request queue, realizes that different operation requests are written into the corresponding request queue, so that each thread in the network file system can Each operation request in different queues is processed in parallel, thereby improving the processing efficiency of operation requests.

在本发明的一个实施例中,基于前述方案,确定单元403配置为:In an embodiment of the present invention, based on the foregoing solutions, the determining unit 403 is configured to:

判断子单元,用于判断所述操作请求中包含标志的操作字的个数是否为一个;A judging subunit, configured to judge whether the number of operation words containing flags in the operation request is one;

第一确定子单元,用于若所述操作请求中包含标志的操作字的个数为一个,则将所述包含标志的操作字作为主操作字。The first determination subunit is configured to use the operation word containing the flag as the main operation word if the number of the operation word containing the flag in the operation request is one.

在本发明的一个实施例中,基于前述方案,确定单元403还配置为:In an embodiment of the present invention, based on the foregoing solution, the determining unit 403 is further configured to:

第二确定子单元,用于若所述操作请求中包含标志的操作字为两个,则将所述操作请求的操作标志与预设第一标志进行异或操作,得到第一数值,并将与所述第一数值相匹配的标志所对应的操作字作为主操作字;The second determining subunit is configured to perform an XOR operation on the operation flag of the operation request and the preset first flag if there are two operation words including flags in the operation request to obtain the first value, and The operation word corresponding to the flag matching the first value is used as the main operation word;

第三确定子单元,用于若所述操作请求中包含标志的操作字为三个,将所述操作请求的操作标志、所述预设第一标志和预设第二标志进行异或操作,得到第二数值,并将与所述第二数值相匹配的标志所对应的操作字作为主操作字。The third determining subunit is configured to perform an XOR operation on the operation flag of the operation request, the preset first flag, and the preset second flag if the number of operation words containing flags in the operation request is three, The second value is obtained, and the operation word corresponding to the flag matching the second value is used as the main operation word.

在本发明的一个实施例中,基于前述方案,第一写入单元405配置为:In an embodiment of the present invention, based on the foregoing solution, the first writing unit 405 is configured as:

第四确定子单元,用于从所述操作请求的各个操作字中确定表征请求文件句柄的操作字;The fourth determination subunit is used to determine the operation word representing the requested file handle from each operation word in the operation request;

获取子单元,用于依据所述表征请求文件句柄的操作字,通过预设的哈希计算公式,获得哈希值;The obtaining subunit is used to obtain a hash value through a preset hash calculation formula according to the operation word characterizing the request file handle;

计算子单元,用于确定请求队列的总队列数,并将所述哈希值对所述总队列数进行取模运算,得到所述操作请求对应的待写入请求队列的队列编号。The calculation subunit is configured to determine the total queue number of the request queue, and perform a modulo operation on the total queue number with the hash value to obtain the queue number of the request queue to be written corresponding to the operation request.

在本发明的一个实施例中,基于前述方案,还可以配置为:In one embodiment of the present invention, based on the foregoing solution, it can also be configured as:

加锁单元,用于将所述队列编号对应的请求队列进行加锁操作。The locking unit is configured to perform a locking operation on the request queue corresponding to the queue number.

在本发明的一个实施例中,基于前述方案,还可以配置为:In one embodiment of the present invention, based on the foregoing solution, it can also be configured as:

第二获取单元,用于从所述队列编号对应的请求队列中,或从所述预设队列编号对应的请求队列中获取所述操作请求;The second acquiring unit is configured to acquire the operation request from the request queue corresponding to the queue number, or from the request queue corresponding to the preset queue number;

执行单元,用于执行与所述操作请求中每个操作字对应的操作逻辑。An execution unit, configured to execute the operation logic corresponding to each operation word in the operation request.

本发明实施例还提供了一种存储介质,所述存储介质包括存储的指令,其中,在所述指令运行时控制所述存储介质所在的设备执行上述操作请求的处理方法。An embodiment of the present invention also provides a storage medium, the storage medium includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the above method for processing the operation request.

本发明实施例还提供了一种电子设备,其结构示意图如图5所示,具体包括存储器501,以及一个或者一个以上的指令502,其中一个或者一个以上指令502存储于存储器501中,且经配置以由一个或者一个以上处理器503执行所述一个或者一个以上指令502进行以下操作:The embodiment of the present invention also provides an electronic device, the structural diagram of which is shown in FIG. Configured to execute the one or more instructions 502 by one or more processors 503 to perform the following operations:

获取客户端发送的操作请求,所述操作请求中包括至少两个操作字;Obtain an operation request sent by the client, where the operation request includes at least two operation words;

将每个所述操作字的标志进行或操作,得到所述操作请求的操作标志;其中,每个所述操作字的标志用于唯一标识所述操作字;performing an OR operation on the flag of each operation word to obtain the operation flag of the operation request; wherein, the flag of each operation word is used to uniquely identify the operation word;

依据所述操作请求的操作标志和每个所述操作字的标志,从所述操作请求的各个操作字中确定主操作字;determining the main operation word from each operation word of the operation request according to the operation flag of the operation request and the flag of each of the operation words;

获取预设的配置文件,将所述配置文件中的预设操作字的标志和所述操作请求中的所述主操作字的标志进行匹配;Acquire a preset configuration file, and match the symbol of the preset operation word in the configuration file with the symbol of the main operation word in the operation request;

若所述配置文件中的预设操作字的标志和所述操作请求中的所述主操作字的标志相匹配,则计算获得所述操作请求对应的待写入请求队列的队列编号,并将所述操作请求写入至所述队列编号对应的请求队列中;If the flag of the preset operation word in the configuration file matches the flag of the main operation word in the operation request, calculate and obtain the queue number of the request queue to be written corresponding to the operation request, and set The operation request is written into the request queue corresponding to the queue number;

若所述配置文件中的预设操作字的标志和所述操作请求中的所述主操作字的标志不匹配,则将所述操作请求写入至预设队列编号对应的请求队列中。If the flag of the preset operation word in the configuration file does not match the flag of the main operation word in the operation request, write the operation request into the request queue corresponding to the preset queue number.

需要说明的是,本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。对于装置类实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. For the same and similar parts in each embodiment, refer to each other, that is, Can. As for the device-type embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for related parts, please refer to part of the description of the method embodiments.

最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。Finally, it should also be noted that in this text, relational terms such as first and second etc. are only used to distinguish one entity or operation from another, and do not necessarily require or imply that these entities or operations, any such actual relationship or order exists. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.

为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本发明时可以把各单元的功能在同一个或多个软件和/或硬件中实现。For the convenience of description, when describing the above devices, functions are divided into various units and described separately. Of course, when implementing the present invention, the functions of each unit can be implemented in one or more pieces of software and/or hardware.

通过以上的实施方式的描述可知,本领域的技术人员可以清楚地了解到本发明可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例或者实施例的某些部分所述的方法。It can be seen from the above description of the implementation manners that those skilled in the art can clearly understand that the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art can be embodied in the form of software products, and the computer software products can be stored in storage media, such as ROM/RAM, disk , CD, etc., including several instructions to make a computer device (which may be a personal computer, server, or network device, etc.) execute the methods described in various embodiments or some parts of the embodiments of the present invention.

以上对本发明所提供的一种操作请求的处理方法及装置进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The method and device for processing an operation request provided by the present invention have been described above in detail. In this paper, specific examples are used to illustrate the principle and implementation of the present invention. The description of the above embodiments is only used to help understand the present invention. method and its core idea; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation and scope of application. In summary, the content of this specification should not be understood as Limitations on the Invention.

Claims (10)

1. a kind of processing method of operation requests characterized by comprising
The operation requests that client is sent are obtained, include at least two operational words in the operation requests;
The mark of each operational word is carried out or operated, the operation flag of the operation requests is obtained;Wherein, each described The mark of operational word is for operational word described in unique identification;
According to the operation flag of the operation requests and the mark of each operational word, from each operation of the operation requests Main operation word is determined in word;
Preset configuration file is obtained, by the institute in the mark of the predetermined registration operation word in the configuration file and the operation requests The mark for stating main operation word is matched;
If the mark of the predetermined registration operation word in the configuration file and the mark phase of the main operation word in the operation requests Matching then calculates the queue number for obtaining the corresponding request queue to be written of the operation requests, and the operation requests is write Enter into the corresponding request queue of the queue number;
If the mark of the predetermined registration operation word in the configuration file and the mark of the main operation word in the operation requests are not Matching, then the operation requests are written into the corresponding request queue of default queue number.
2. the method according to claim 1, wherein being determined in each operational word from the operation requests Main operation word, comprising:
Whether the number for judging the operational word comprising mark in the operation requests is one;
If in the operation requests comprising mark operational word number be one, using it is described comprising mark operational word as Main operation word.
3. according to the method described in claim 2, it is characterized by further comprising:
If the operational word comprising mark in the operation requests is two, by the operation flag of the operation requests and default the One mark carries out xor operation, obtains the first numerical value, and by operational word corresponding to the mark to match with first numerical value As main operation word;
If the operational word comprising mark in the operation requests is three, by the operation flag of the operation requests, described default First mark and default second mark carry out xor operation, obtain second value, and the mark that will be matched with the second value Operational word corresponding to will is as main operation word.
4. the method according to claim 1, wherein the calculating acquisition operation requests are corresponding to be written The queue number of request queue, comprising:
The operational word of characterization demand file handle is determined from each operational word of the operation requests;
Operational word according to the characterization demand file handle obtains cryptographic Hash by preset Hash calculation formula;
It determines army unit's columns of request queue, and the cryptographic Hash is subjected to modulo operation to army unit's columns, obtain described The queue number of the corresponding request queue to be written of operation requests.
5. the method according to claim 1, wherein described the operation requests are written to the queue number After corresponding request queue, further includes:
The corresponding request queue of the queue number is subjected to locking operation.
6. the method according to claim 1, wherein further include:
Institute is obtained from the corresponding request queue of the queue number, or from the corresponding request queue of the default queue number State operation requests;
Execute operation logic corresponding with operational word each in the operation requests.
7. a kind of processing unit of operation requests characterized by comprising
First acquisition unit includes at least two operations in the operation requests for obtaining the operation requests of client transmission Word;
Or operating unit obtains the operation mark of the operation requests for carrying out or operating the mark of each operational word Will;Wherein, the mark of each operational word is for operational word described in unique identification;
Determination unit, for the mark of operation flag and each operational word according to the operation requests, from the operation Main operation word is determined in each operational word of request;
Matching unit, for obtaining preset configuration file, by the mark of the predetermined registration operation word in the configuration file and described The mark of the main operation word in operation requests is matched;
First writing unit, if for the predetermined registration operation word in the configuration file mark and the operation requests in described in The mark of main operation word matches, then calculates the queue number for obtaining the corresponding request queue to be written of the operation requests, and The operation requests are written into the corresponding request queue of the queue number;
Second writing unit, if for the predetermined registration operation word in the configuration file mark and the operation requests in described in The mark of main operation word mismatches, then the operation requests is written into the corresponding request queue of default queue number.
8. device according to claim 7, which is characterized in that the determination unit, comprising:
Judgment sub-unit, for judging whether the number of the operational word comprising mark in the operation requests is one;
First determines subelement, will be described if the number for the operational word comprising mark in the operation requests is one Operational word comprising mark is as main operation word.
9. device according to claim 8, which is characterized in that the determination unit, further includes:
Second determines subelement, if being two for the operational word comprising mark in the operation requests, the operation is asked The operation flag and default first mark asked carry out xor operation, obtain the first numerical value, and will match with first numerical value Mark corresponding to operational word as main operation word;
Third determines subelement, if being three for the operational word comprising mark in the operation requests, by the operation requests Operation flag, default first mark and default second mark carry out xor operation, obtain second value, and will with it is described Operational word corresponding to the mark that second value matches is as main operation word.
10. device according to claim 7, which is characterized in that first writing unit, comprising:
4th determines subelement, for determining the operation of characterization demand file handle from each operational word of the operation requests Word;
Subelement is obtained, for obtaining according to the operational word of the characterization demand file handle by preset Hash calculation formula Obtain cryptographic Hash;
Computation subunit takes army unit's columns for determining army unit's columns of request queue, and by the cryptographic Hash Modular arithmetic obtains the queue number of the corresponding request queue to be written of the operation requests.
CN201910734847.5A 2019-08-09 2019-08-09 Operation request processing method and device Pending CN110515711A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910734847.5A CN110515711A (en) 2019-08-09 2019-08-09 Operation request processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910734847.5A CN110515711A (en) 2019-08-09 2019-08-09 Operation request processing method and device

Publications (1)

Publication Number Publication Date
CN110515711A true CN110515711A (en) 2019-11-29

Family

ID=68624743

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910734847.5A Pending CN110515711A (en) 2019-08-09 2019-08-09 Operation request processing method and device

Country Status (1)

Country Link
CN (1) CN110515711A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114090112A (en) * 2021-10-27 2022-02-25 青岛海尔科技有限公司 Configuration file loading method and device, storage medium and electronic device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6973455B1 (en) * 1999-03-03 2005-12-06 Emc Corporation File server system providing direct data sharing between clients with a server acting as an arbiter and coordinator
CN107341056A (en) * 2017-07-05 2017-11-10 郑州云海信息技术有限公司 A kind of method and device of the thread distribution based on NFS
CN108762930A (en) * 2018-05-30 2018-11-06 郑州云海信息技术有限公司 A kind of optimization method, system and the associated component of User space NFS threads
CN109240995A (en) * 2018-08-22 2019-01-18 郑州云海信息技术有限公司 A kind of statistical method and device of operational word time delay
CN109309720A (en) * 2018-10-11 2019-02-05 郑州云海信息技术有限公司 A method and system for processing file access requests based on nfs protocol
CN109309631A (en) * 2018-08-15 2019-02-05 新华三技术有限公司成都分公司 A kind of method and device based on universal network file system write-in data

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6973455B1 (en) * 1999-03-03 2005-12-06 Emc Corporation File server system providing direct data sharing between clients with a server acting as an arbiter and coordinator
CN107341056A (en) * 2017-07-05 2017-11-10 郑州云海信息技术有限公司 A kind of method and device of the thread distribution based on NFS
CN108762930A (en) * 2018-05-30 2018-11-06 郑州云海信息技术有限公司 A kind of optimization method, system and the associated component of User space NFS threads
CN109309631A (en) * 2018-08-15 2019-02-05 新华三技术有限公司成都分公司 A kind of method and device based on universal network file system write-in data
CN109240995A (en) * 2018-08-22 2019-01-18 郑州云海信息技术有限公司 A kind of statistical method and device of operational word time delay
CN109309720A (en) * 2018-10-11 2019-02-05 郑州云海信息技术有限公司 A method and system for processing file access requests based on nfs protocol

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114090112A (en) * 2021-10-27 2022-02-25 青岛海尔科技有限公司 Configuration file loading method and device, storage medium and electronic device
CN114090112B (en) * 2021-10-27 2023-06-16 青岛海尔科技有限公司 Method and device for loading configuration file, storage medium and electronic device

Similar Documents

Publication Publication Date Title
CN103959264B (en) Using deduplication in a storage cloud to manage immutable redundant files
US10255108B2 (en) Parallel execution of blockchain transactions
US9846702B2 (en) Indexing of file in a hadoop cluster
US8682868B2 (en) Removal of data remanence in deduplicated storage clouds
TW202107319A (en) Restore from a cloud-based data protection service
US8806489B2 (en) Virtual machine image distribution network
US11221992B2 (en) Storing data files in a file system
JP2016001480A (en) Content-based file chunking
CN109032803B (en) Data processing method and device and client
EP3844937B1 (en) Synchronizing in-use source data and an unmodified migrated copy thereof
US20190215363A1 (en) Dynamic pool-based tiering for synchronization storage
CN110781159B (en) Ceph directory file information reading method and device, server and storage medium
US10048991B2 (en) System and method for parallel processing data blocks containing sequential label ranges of series data
EP3555767A1 (en) Partial storage of large files in distinct storage systems
CN110515711A (en) Operation request processing method and device
US20090328229A1 (en) System, method and computer program product for performing a data protection operation
US11290532B2 (en) Tape reconstruction from object storage
Kariyattin et al. Evaluating NextCloud as a file storage for apache airavata
US20180341717A1 (en) Providing instant preview of cloud based file
US20110055816A1 (en) Method to derive software use and software data object use characteristics by analyzing attributes of related files
US10747729B2 (en) Device specific chunked hash size tuning
CN115842818A (en) Big data transmission method and device, computer equipment and storage medium
CN115016724A (en) Data processing method, data processing device, data processing equipment and storage medium
CN107577429A (en) A kind of data storage and restoration methods 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: 20191129