CN107679148A - Session lookup method, device and the equipment of a kind of distributed file system - Google Patents
Session lookup method, device and the equipment of a kind of distributed file system Download PDFInfo
- Publication number
- CN107679148A CN107679148A CN201710882539.8A CN201710882539A CN107679148A CN 107679148 A CN107679148 A CN 107679148A CN 201710882539 A CN201710882539 A CN 201710882539A CN 107679148 A CN107679148 A CN 107679148A
- Authority
- CN
- China
- Prior art keywords
- hash
- session
- message
- processed
- pending
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/18—File system types
- G06F16/182—Distributed file systems
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/13—File access structures, e.g. distributed indices
- G06F16/137—Hash-based
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/14—Details of searching files based on file metadata
- G06F16/148—File search processing
- G06F16/152—File search processing using file content signatures, e.g. hash values
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/54—Interprogram communication
- G06F9/546—Message passing systems or structures, e.g. queues
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Software Systems (AREA)
- Library & Information Science (AREA)
- Multi Processors (AREA)
Abstract
本发明实施例提供了一种分布式文件系统的会话查找方法、装置、设备及计算机可读存储介质,包括接收待处理消息,并依据待处理消息计算出与待处理消息对应的hash键值;依据hash键值从hash表中找到与hash键值对应的hash链表;判断hash链表是否具有多个节点,如果是,则依据待处理信息对hash链表进行遍历,找到与待处理信息对应的会话;将会话的指针移动至hash链表的头部。由于当下一个待处理消息到来时很大概率是与当前的待处理消息属于同一个会话,因此,将当前的待处理信息对应的会话的指针移动至hash链表的头部,当查找与下一个待处理消息对应的会话时,就可以减少比较次数,提高会话的查找速度,从而提高系统的处理性能。
Embodiments of the present invention provide a session search method, device, device, and computer-readable storage medium of a distributed file system, including receiving a message to be processed, and calculating a hash key value corresponding to the message to be processed according to the message to be processed; Find the hash linked list corresponding to the hash key value from the hash table according to the hash key value; judge whether the hash linked list has multiple nodes, if so, traverse the hash linked list according to the pending information, and find the session corresponding to the pending information; Move the session pointer to the head of the hash list. Since the next message to be processed is likely to belong to the same session as the current message to be processed when it arrives, the pointer of the session corresponding to the current message to be processed is moved to the head of the hash list. When processing the session corresponding to the message, the number of comparisons can be reduced, the search speed of the session can be increased, and the processing performance of the system can be improved.
Description
技术领域technical field
本发明实施例涉及分布式文件系统技术领域,特别是涉及一种分布式文件系统的会话查找方法、装置、设备及计算机可读存储介质。Embodiments of the present invention relate to the technical field of distributed file systems, and in particular, relate to a session search method, device, device, and computer-readable storage medium of a distributed file system.
背景技术Background technique
分布式文件系统运行过程中,各个进程之间的通信是通过socket通信来完成,进程收到消息后对消息进行处理,会话是消息处理的一个基本单元,一个连接对应一个会话。当收到一个消息后,需要找到该消息对应的会话,从而才能进行下一步的处理流程。通常是通过hash表查找与消息相应的会话,hash表中包括多个hash链表,由于hash表的大小是有限的,当进程对外存在大量连接时,就会出现大量的hash冲突,并且每个hash链表中的多个会话的顺序是固定不变的,从而使会话查找过程中的比较次数增多,增加了查找会话需要的时间,降低了系统的处理性能。During the operation of the distributed file system, the communication between the various processes is completed through socket communication. After the process receives the message, it processes the message. The session is a basic unit of message processing, and a connection corresponds to a session. After receiving a message, it is necessary to find the session corresponding to the message, so as to proceed to the next processing flow. Usually, the session corresponding to the message is found through the hash table. The hash table includes multiple hash linked lists. Since the size of the hash table is limited, when a process has a large number of external connections, a large number of hash conflicts will occur, and each hash The sequence of multiple sessions in the linked list is fixed, which increases the number of comparisons in the session search process, increases the time required for session search, and reduces the processing performance of the system.
因此,如何提供一种解决上述技术问题的分布式文件系统的会话查找方法、装置、设备及计算机可读存储介质成为本领域技术人员目前需要解决的问题。Therefore, how to provide a session lookup method, device, device, and computer-readable storage medium of a distributed file system that solves the above-mentioned technical problems has become a problem that those skilled in the art need to solve.
发明内容Contents of the invention
本发明实施例的目的是提供一种分布式文件系统的会话查找方法、装置、设备及计算机可读存储介质,在使用过程中可以减少比较次数,提高会话的查找速度,从而提高系统的处理性能。The purpose of the embodiments of the present invention is to provide a session search method, device, device, and computer-readable storage medium of a distributed file system, which can reduce the number of comparisons during use, increase the search speed of sessions, and thereby improve the processing performance of the system .
为解决上述技术问题,本发明实施例提供了一种分布式文件系统的会话查找方法,包括:In order to solve the above technical problems, an embodiment of the present invention provides a session search method for a distributed file system, including:
接收待处理消息,并依据所述待处理消息计算出与所述待处理消息对应的hash键值;receiving a message to be processed, and calculating a hash key value corresponding to the message to be processed according to the message to be processed;
依据所述hash键值从hash表中找到与所述hash键值对应的hash链表;Find the hash linked list corresponding to the hash key value from the hash table according to the hash key value;
判断所述hash链表是否具有多个节点,如果是,则依据所述待处理信息对所述hash链表进行遍历,找到与所述待处理信息对应的会话;Judging whether the hash linked list has multiple nodes, if so, traversing the hash linked list according to the information to be processed, and finding the session corresponding to the information to be processed;
将所述会话的指针移动至所述hash链表的头部。Move the pointer of the session to the head of the hash list.
可选的,所述依据所述待处理信息对所述hash链表进行遍历,找到与所述待处理信息对应的会话的过程为:Optionally, the process of traversing the hash list according to the information to be processed to find the session corresponding to the information to be processed is:
依据所述待处理信息中的关键字对所述hash链表进行遍历,找到与所述关键字匹配的会话。The hash list is traversed according to the keyword in the information to be processed, and a session matching the keyword is found.
可选的,所述待处理信息中包括源端口号、目的端口号、源IP地址及目的IP地址;Optionally, the information to be processed includes source port number, destination port number, source IP address and destination IP address;
所述依据所述待处理消息计算与所述待处理消息对应的hash键值的过程为:The process of calculating the hash key value corresponding to the message to be processed according to the message to be processed is:
依据所述待处理信息中的源端口号、目的端口号、源IP地址及目的IP地址计算出与所述待处理消息对应的hash键值。Calculate the hash key value corresponding to the message to be processed according to the source port number, the destination port number, the source IP address and the destination IP address in the message to be processed.
本发明实施例相应的提供了一种分布式文件系统的会话查找装置,包括:Correspondingly, an embodiment of the present invention provides a session search device for a distributed file system, including:
接收模块,用于接收待处理消息;A receiving module, configured to receive messages to be processed;
计算模块,用于依据所述待处理消息计算出与所述待处理消息对应的hash键值;A calculation module, configured to calculate a hash key value corresponding to the message to be processed according to the message to be processed;
查找模块,用于依据所述hash键值从hash表中找到与所述hash键值对应的hash链表;The search module is used to find the hash linked list corresponding to the hash key value from the hash table according to the hash key value;
判断模块,用于判断所述hash链表是否具有多个节点,如果是,则触发遍历模块;A judging module, configured to judge whether the hash linked list has multiple nodes, and if so, trigger the traversal module;
所述遍历模块,用于依据所述待处理信息对所述hash链表进行遍历,找到与所述待处理信息对应的会话;The traversal module is configured to traverse the hash list according to the information to be processed, and find a session corresponding to the information to be processed;
移动模块,用于将所述会话的指针移动至所述hash链表的头部。The moving module is used to move the pointer of the session to the head of the hash list.
可选的,所述依据所述待处理信息对所述hash链表进行遍历,找到与所述待处理信息对应的会话的过程为:Optionally, the process of traversing the hash list according to the information to be processed to find the session corresponding to the information to be processed is:
依据所述待处理信息中的关键字对所述hash链表进行遍历,找到与所述关键字匹配的会话。The hash list is traversed according to the keyword in the information to be processed, and a session matching the keyword is found.
可选的,所述待处理信息中包括源端口号、目的端口号、源IP地址及目的IP地址;Optionally, the information to be processed includes source port number, destination port number, source IP address and destination IP address;
所述依据所述待处理消息计算与所述待处理消息对应的hash键值的过程为:The process of calculating the hash key value corresponding to the message to be processed according to the message to be processed is:
依据所述待处理信息中的源端口号、目的端口号、源IP地址及目的IP地址计算出与所述待处理消息对应的hash键值。Calculate the hash key value corresponding to the message to be processed according to the source port number, the destination port number, the source IP address and the destination IP address in the message to be processed.
本发明实施例提供了一种分布式文件系统的会话查找设备,包括:An embodiment of the present invention provides a session search device for a distributed file system, including:
存储器,用于存储计算机程序;memory for storing computer programs;
处理器,用于执行所述计算机程序时实现上述所述的分布式文件系统的会话查找方法的步骤。A processor, configured to implement the steps of the above-mentioned session lookup method for a distributed file system when executing the computer program.
本发明实施例提供了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如上述所述的分布式文件系统的会话查找方法的步骤。An embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the session lookup method of the distributed file system as described above is implemented A step of.
本发明实施例提供了一种分布式文件系统的会话查找方法、装置、设备及计算机可读存储介质,包括接收待处理消息,并依据待处理消息计算出与待处理消息对应的hash键值;依据hash键值从hash表中找到与hash键值对应的hash链表;判断hash链表是否具有多个节点,如果是,则依据待处理信息对hash链表进行遍历,找到与待处理信息对应的会话;将会话的指针移动至hash链表的头部。Embodiments of the present invention provide a session search method, device, device, and computer-readable storage medium of a distributed file system, including receiving a message to be processed, and calculating a hash key value corresponding to the message to be processed according to the message to be processed; Find the hash linked list corresponding to the hash key value from the hash table according to the hash key value; judge whether the hash linked list has multiple nodes, if so, traverse the hash linked list according to the pending information, and find the session corresponding to the pending information; Move the session pointer to the head of the hash list.
通过待处理消息从hash表中确定出相应的hash链表,当该hash具有多个节点时,说明产生hash冲突,需要根据当前的待处理消息对hash链表进行遍历,从hash链表的头部开始逐个比较直至找到与待处理消息对应的会话,并将该会话的指针移动hash链表的头部,当下一个待处理消息到来时很大概率是与当前的待处理消息属于同一个会话,因此,当查找与下一个待处理消息对应的会话时,就可以减少比较次数,提高会话的查找速度,从而提高系统的处理性能。Determine the corresponding hash linked list from the hash table through the pending message. When the hash has multiple nodes, it means that a hash conflict occurs. It is necessary to traverse the hash linked list according to the current pending message, starting from the head of the hash linked list one by one. Compare until the session corresponding to the message to be processed is found, and move the pointer of the session to the head of the hash list. When the next message to be processed arrives, there is a high probability that it belongs to the same session as the current message to be processed. Therefore, when searching When identifying the session corresponding to the next message to be processed, the number of comparisons can be reduced, the search speed of the session can be improved, and the processing performance of the system can be improved.
附图说明Description of drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对现有技术和实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the prior art and the accompanying drawings that need to be used in the embodiments. Obviously, the accompanying drawings in the following description are only some of the present invention. Embodiments, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.
图1为一种分布式文件系统的会话查找方法的流程示意图;Fig. 1 is a schematic flow chart of a session search method of a distributed file system;
图2为本发明实施例提供的一种分布式文件系统的会话查找装置的结构示意图。FIG. 2 is a schematic structural diagram of a session search device for a distributed file system provided by an embodiment of the present invention.
具体实施方式detailed description
本发明实施例提供了一种分布式文件系统的会话查找方法、装置、设备及计算机可读存储介质,在使用过程中可以减少比较次数,提高会话的查找速度,从而提高系统的处理性能。Embodiments of the present invention provide a session search method, device, device, and computer-readable storage medium of a distributed file system, which can reduce the number of comparisons during use, increase session search speed, and thereby improve system processing performance.
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
请参照图1,图1为本发明实施例提供的一种分布式文件系统的会话查找方法的流程示意图。Please refer to FIG. 1 . FIG. 1 is a schematic flowchart of a session search method for a distributed file system provided by an embodiment of the present invention.
该方法包括:The method includes:
S11:接收待处理消息,并依据待处理消息计算出与待处理消息对应的hash键值;S11: Receive the message to be processed, and calculate the hash key value corresponding to the message to be processed according to the message to be processed;
需要说明的是,接收端收到发送端发送的待处理消息,该待处理消息中可以包括源端口号、目的端口号、源IP地址及目的IP地址,由于需要根据待处理消息到hash表中查找相应的会话,并且hash表中包括多个hash链表,每一个hash链表对应一个hash键值,所以接收端可以所接收到的待处理信息中所包含的源端口号、目的端口号、源IP地址及目的IP地址的信息计算出与该待处理消息对应的hash键值,其中,接收端可以为一个进程,发送端可以为另一个进程,也即两个进程直接的通信。It should be noted that the receiving end receives the pending message sent by the sending end. The pending message may include source port number, destination port number, source IP address and destination IP address. Find the corresponding session, and the hash table includes multiple hash linked lists, each hash linked list corresponds to a hash key value, so the receiving end can receive the source port number, destination port number, and source IP contained in the received information to be processed The information of the address and the destination IP address calculates the hash key value corresponding to the message to be processed, wherein, the receiving end can be a process, and the sending end can be another process, that is, the two processes communicate directly.
S12:依据hash键值从hash表中找到与hash键值对应的hash链表;S12: Find the hash linked list corresponding to the hash key value from the hash table according to the hash key value;
具体的,当计算出与待处理消息对应的hash键值时,根据该hash键值即可从hash表中找到相应的hash链表。Specifically, when the hash key value corresponding to the message to be processed is calculated, the corresponding hash linked list can be found from the hash table according to the hash key value.
S13:判断hash链表是否具有多个节点,如果是,则进入S14;S13: judging whether the hash linked list has multiple nodes, if so, proceed to S14;
S14:依据待处理信息对hash链表进行遍历,找到与待处理信息对应的会话;S14: traverse the hash list according to the information to be processed, and find the session corresponding to the information to be processed;
需要说明的是,在找到相应的hash链表后,可以根据该hash链表所具有的节点判断该hash链表中所包含的会话的数量,也即当hash链表的节点数为一个时,则该节点对应的会话即为当前的待处理消息对应的会话,此时无需进行对比匹配,该会话即为所要查找的会话;当hash链表的节点数为两个或两个以上时,说明该hash链表中包含多个会话,需要从这多个会话中查找出与当前的待处理信息对于的会话。在具体查找时,是从hash链表的头部的第一个会话起逐个进行对比,待处理信息中包含有与之唯一对于的标识码,每个会话也对应于一个唯一的标识码,可以根据待处理信息中的标识码与hash链表中的标识码进行匹配,当查找到与待处理信息中的标识码一致的标识码时,该标识码对于的会话即为所要查找的会话。It should be noted that after finding the corresponding hash linked list, the number of sessions contained in the hash linked list can be judged according to the nodes of the hash linked list, that is, when the number of nodes in the hash linked list is one, then the node corresponds to The session is the session corresponding to the current message to be processed. At this time, there is no need to compare and match, and the session is the session to be searched; when the number of nodes in the hash list is two or more, it means that the hash list contains For multiple sessions, it is necessary to find a session corresponding to the current pending information from the multiple sessions. In the specific search, it is compared one by one from the first session at the head of the hash linked list. The information to be processed contains a unique identification code, and each session also corresponds to a unique identification code. According to The identification code in the information to be processed is matched with the identification code in the hash list. When an identification code consistent with the identification code in the information to be processed is found, the session corresponding to the identification code is the session to be found.
S15:将会话的指针移动至hash链表的头部。S15: Move the session pointer to the head of the hash list.
还需要说明的是,在查找到当前的待处理信息对应的会话后,将该会话的指针移动至hash链表的头部,根据时间局部性原理,下一个待处理消息到来时,很大概率上与当前的待处理消息属于同一个会话,所以在查找与下一个待处理消息相应的会话时所需比较的次数和查找时间将会大大降低,并且,移动会话的指针简单易行。因此,在发生hash冲突时,本发明实施例可以提高会话的查找速度,提升整个集群处理性能和小文件场景下的IOPS(即每秒进行读写操作的次数)。It should also be noted that after finding the session corresponding to the current message to be processed, the pointer of the session is moved to the head of the hash list. According to the principle of time locality, when the next message to be processed arrives, there is a high probability that The current pending message belongs to the same session, so the number of comparisons and search time required to find the session corresponding to the next pending message will be greatly reduced, and the moving session pointer is simple and easy. Therefore, when a hash conflict occurs, the embodiment of the present invention can increase the search speed of the session, improve the processing performance of the entire cluster and the IOPS (that is, the number of read and write operations per second) in the small file scenario.
进一步的,上述S14中依据待处理信息对hash链表进行遍历,找到与待处理信息对应的会话的过程为:Further, in the above S14, the process of traversing the hash list according to the information to be processed, and finding the session corresponding to the information to be processed is as follows:
依据待处理信息中的关键字对hash链表进行遍历,找到与关键字匹配的会话。According to the keyword in the information to be processed, the hash list is traversed to find the session matching the keyword.
需要说明的是,待处理消息中所包含的标识码可以为关键字,故,具体可以根据待处理信息中的关键字与hash表中的关键字逐一进行匹配,以找到与之对应的关键字,从而查找到与待处理消息对于的会话。It should be noted that the identification code contained in the message to be processed can be a keyword, so the keyword in the message to be processed can be matched one by one with the keyword in the hash table to find the corresponding keyword , so as to find the session corresponding to the message to be processed.
进一步的,上述S14中的待处理信息中包括源端口号、目的端口号、源IP地址及目的IP地址;Further, the information to be processed in the above S14 includes source port number, destination port number, source IP address and destination IP address;
依据待处理消息计算与待处理消息对应的hash键值的过程为:The process of calculating the hash key value corresponding to the message to be processed according to the message to be processed is:
依据待处理信息中的源端口号、目的端口号、源IP地址及目的IP地址计算出与待处理消息对应的hash键值。Calculate the hash key value corresponding to the message to be processed according to the source port number, destination port number, source IP address and destination IP address in the message to be processed.
需要说明的是,本发明实施例中的待处理信息中不仅包括上述几种信息,也可以包括其他信息,具体不限。另外,本发明实施例中不仅限于根据源端口号、目的端口号、源IP地址及目的IP地址计算出与待处理消息对应的hash键值,还可以根据其他的参数计算出与待处理信息对应的hash键值,具体不限。It should be noted that the information to be processed in the embodiment of the present invention includes not only the above information, but also other information, which is not limited. In addition, the embodiment of the present invention is not limited to calculating the hash key value corresponding to the message to be processed according to the source port number, the destination port number, the source IP address and the destination IP address, but also can calculate the hash key value corresponding to the message to be processed according to other parameters. The hash key value is not limited.
本发明实施例提供了一种分布式文件系统的会话查找方法,包括接收待处理消息,并依据待处理消息计算出与待处理消息对应的hash键值;依据hash键值从hash表中找到与hash键值对应的hash链表;判断hash链表是否具有多个节点,如果是,则依据待处理信息对hash链表进行遍历,找到与待处理信息对应的会话;将会话的指针移动至hash链表的头部。The embodiment of the present invention provides a method for searching a session of a distributed file system, including receiving a message to be processed, and calculating a hash key value corresponding to the message to be processed according to the message to be processed; The hash linked list corresponding to the hash key value; determine whether the hash linked list has multiple nodes, if so, traverse the hash linked list according to the information to be processed, and find the session corresponding to the pending information; move the pointer of the session to the head of the hash linked list department.
通过待处理消息从hash表中确定出相应的hash链表,当该hash具有多个节点时,说明产生hash冲突,需要根据当前的待处理消息对hash链表进行遍历,从hash链表的头部开始逐个比较直至找到与待处理消息对应的会话,并将该会话的指针移动hash链表的头部,当下一个待处理消息到来时很大概率是与当前的待处理消息属于同一个会话,因此,当查找与下一个待处理消息对应的会话时,就可以减少比较次数,提高会话的查找速度,从而提高系统的处理性能。Determine the corresponding hash linked list from the hash table through the pending message. When the hash has multiple nodes, it means that a hash conflict occurs. It is necessary to traverse the hash linked list according to the current pending message, starting from the head of the hash linked list one by one. Compare until the session corresponding to the message to be processed is found, and move the pointer of the session to the head of the hash list. When the next message to be processed arrives, there is a high probability that it belongs to the same session as the current message to be processed. Therefore, when searching When identifying the session corresponding to the next message to be processed, the number of comparisons can be reduced, the search speed of the session can be improved, and the processing performance of the system can be improved.
相应的本发明实施例还公开了一种分布式文件系统的会话查找装置,具体请参照图2,图2为本发明实施例提供的一种分布式文件系统的会话查找装置的结构示意图。在上述实施例的基础上:Correspondingly, the embodiment of the present invention also discloses a session search device for a distributed file system. Please refer to FIG. 2 for details. FIG. 2 is a schematic structural diagram of a session search device for a distributed file system provided by an embodiment of the present invention. On the basis of above-mentioned embodiment:
该装置包括:The unit includes:
接收模块1,用于接收待处理消息;Receiving module 1, configured to receive messages to be processed;
计算模块2,用于依据待处理消息计算出与待处理消息对应的hash键值;Calculation module 2, used to calculate the hash key value corresponding to the message to be processed according to the message to be processed;
查找模块3,用于依据hash键值从hash表中找到与hash键值对应的hash链表;The search module 3 is used to find the hash linked list corresponding to the hash key value from the hash table according to the hash key value;
判断模块4,用于判断hash链表是否具有多个节点,如果是,则触发遍历模块5;Judgment module 4, used to judge whether the hash linked list has multiple nodes, if so, trigger the traversal module 5;
遍历模块5,用于依据待处理信息对hash链表进行遍历,找到与待处理信息对应的会话;The traversal module 5 is used to traverse the hash linked list according to the information to be processed to find the session corresponding to the information to be processed;
移动模块6,用于将会话的指针移动至hash链表的头部。The moving module 6 is used to move the pointer of the session to the head of the hash list.
可选的,依据待处理信息对hash链表进行遍历,找到与待处理信息对应的会话的过程为:Optionally, the process of traversing the hash list according to the information to be processed to find the session corresponding to the information to be processed is:
依据待处理信息中的关键字对hash链表进行遍历,找到与关键字匹配的会话。According to the keyword in the information to be processed, the hash list is traversed to find the session matching the keyword.
可选的,待处理信息中包括源端口号、目的端口号、源IP地址及目的IP地址;Optionally, the information to be processed includes source port number, destination port number, source IP address and destination IP address;
依据待处理消息计算与待处理消息对应的hash键值的过程为:The process of calculating the hash key value corresponding to the message to be processed according to the message to be processed is:
依据待处理信息中的源端口号、目的端口号、源IP地址及目的IP地址计算出与待处理消息对应的hash键值。Calculate the hash key value corresponding to the message to be processed according to the source port number, destination port number, source IP address and destination IP address in the message to be processed.
需要说明的是,本发明实施例通过待处理消息从hash表中确定出相应的hash链表,当该hash具有多个节点时,说明产生hash冲突,需要根据当前的待处理消息对hash链表进行遍历,从hash链表的头部开始逐个比较直至找到与待处理消息对应的会话,并将该会话的指针移动hash链表的头部,当下一个待处理消息到来时很大概率是与当前的待处理消息属于同一个会话,因此,当查找与下一个待处理消息对应的会话时,就可以减少比较次数,提高会话的查找速度,从而提高系统的处理性能。It should be noted that the embodiment of the present invention determines the corresponding hash linked list from the hash table through the message to be processed. When the hash has multiple nodes, it means that a hash conflict occurs, and the hash linked list needs to be traversed according to the current message to be processed , compare one by one from the head of the hash list until the session corresponding to the message to be processed is found, and move the pointer of the session to the head of the hash list. When the next message to be processed arrives, there is a high probability that it will be the same message as the current message belong to the same session, therefore, when looking for the session corresponding to the next message to be processed, the number of comparisons can be reduced, the search speed of the session can be improved, and the processing performance of the system can be improved.
另外,对于本发明实施例中所涉及到的分布式文件系统的会话查找方法的具体介绍请参照上述方法实施例,本申请在此不再赘述。In addition, for the specific introduction of the session lookup method of the distributed file system involved in the embodiment of the present invention, please refer to the above method embodiment, and the present application will not repeat it here.
本发明实施例提供了一种分布式文件系统的会话查找设备,包括:An embodiment of the present invention provides a session search device for a distributed file system, including:
存储器,用于存储计算机程序;memory for storing computer programs;
处理器,用于执行计算机程序时实现上述的分布式文件系统的会话查找方法的步骤。The processor is configured to implement the steps of the above-mentioned session search method for the distributed file system when executing the computer program.
本发明实施例提供了一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现如上述的分布式文件系统的会话查找方法的步骤。An embodiment of the present invention provides a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned session search method for a distributed file system are implemented.
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same and similar parts of each embodiment can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and for the related part, please refer to the description of the method part.
还需要说明的是,在本说明书中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should also be noted that in this specification, relative terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that these entities or operations There is no such actual relationship or order between the operations. 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 apparatus. 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.
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Professionals can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software or a combination of the two. In order to clearly illustrate the possible For interchangeability, in the above description, the composition and steps of each example have been generally described according to their functions. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present invention.
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其他形式的存储介质中。The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be directly implemented by hardware, software modules executed by a processor, or a combination of both. Software modules can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other Any other known storage medium.
对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本发明。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其他实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (8)
- A kind of 1. session lookup method of distributed file system, it is characterised in that including:Receive pending message, and hash key assignments corresponding with the pending message is calculated according to the pending message;Hash chained lists corresponding with the hash key assignments are found from hash tables according to the hash key assignments;Judge whether the hash chained lists have multiple nodes, if it is, according to the pending information to the hash chains Table is traveled through, and finds session corresponding with the pending information;The pointer of the session is moved to the head of the hash chained lists.
- 2. the session lookup method of distributed file system according to claim 1, it is characterised in that described in the foundation Pending information travels through to the hash chained lists, and the process for finding session corresponding with the pending information is:The hash chained lists are traveled through according to the keyword in the pending information, found and the keyword match Session.
- 3. the session lookup method of distributed file system according to claim 2, it is characterised in that the pending letter Breath includes source port number, destination slogan, source IP address and purpose IP address;It is described hash key assignments corresponding with the pending message is calculated according to the pending message process be:Calculated according to source port number, destination slogan, source IP address and the purpose IP address in the pending information and institute State hash key assignments corresponding to pending message.
- 4. device is searched in a kind of session of distributed file system, it is characterised in that including:Receiving module, for receiving pending message;Computing module, for calculating hash key assignments corresponding with the pending message according to the pending message;Searching modul, for finding hash chained lists corresponding with the hash key assignments from hash tables according to the hash key assignments;Judge module, for judging whether the hash chained lists have multiple nodes, if it is, triggering spider module;The spider module, for being traveled through according to the pending information to the hash chained lists, find and wait to locate with described Manage session corresponding to information;Mobile module, for the pointer of the session to be moved to the head of the hash chained lists.
- 5. the session lookup method of distributed file system according to claim 4, it is characterised in that described in the foundation Pending information travels through to the hash chained lists, and the process for finding session corresponding with the pending information is:The hash chained lists are traveled through according to the keyword in the pending information, found and the keyword match Session.
- 6. the session lookup method of distributed file system according to claim 5, it is characterised in that the pending letter Breath includes source port number, destination slogan, source IP address and purpose IP address;It is described hash key assignments corresponding with the pending message is calculated according to the pending message process be:Calculated according to source port number, destination slogan, source IP address and the purpose IP address in the pending information and institute State hash key assignments corresponding to pending message.
- 7. equipment is searched in a kind of session of distributed file system, it is characterised in that including:Memory, for storing computer program;Processor, the distributed document as described in claims 1 to 3 any one is realized during for performing the computer program The step of session lookup method of system.
- 8. a kind of computer-readable recording medium, it is characterised in that be stored with computer on the computer-readable recording medium Program, the distributed field system as described in claims 1 to 3 any one is realized when the computer program is executed by processor The step of session lookup method of system.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710882539.8A CN107679148A (en) | 2017-09-26 | 2017-09-26 | Session lookup method, device and the equipment of a kind of distributed file system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710882539.8A CN107679148A (en) | 2017-09-26 | 2017-09-26 | Session lookup method, device and the equipment of a kind of distributed file system |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN107679148A true CN107679148A (en) | 2018-02-09 |
Family
ID=61137116
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201710882539.8A Pending CN107679148A (en) | 2017-09-26 | 2017-09-26 | Session lookup method, device and the equipment of a kind of distributed file system |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN107679148A (en) |
Cited By (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109857913A (en) * | 2019-01-15 | 2019-06-07 | 苏州链读文化传媒有限公司 | A kind of distributed content lookup method |
| CN110392059A (en) * | 2019-08-02 | 2019-10-29 | 中国工商银行股份有限公司 | A kind of conversation managing method, device and storage medium |
| CN112261168A (en) * | 2020-09-30 | 2021-01-22 | 厦门市美亚柏科信息股份有限公司 | Multi-IP port user information searching method, terminal equipment and storage medium |
| CN114221847A (en) * | 2021-12-10 | 2022-03-22 | 北京天融信网络安全技术有限公司 | Network session management method, device and equipment and storage medium |
| CN115914001A (en) * | 2022-10-27 | 2023-04-04 | 河北时代电子有限公司 | A distributed message flow management platform |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1777194A (en) * | 2005-12-16 | 2006-05-24 | 中国科学院计算技术研究所 | Network address translation method supporting multi-session application layer protocol in PAT mode |
| US20060190613A1 (en) * | 2005-02-23 | 2006-08-24 | International Business Machines Corporation | Method, program and system for efficiently hashing packet keys into a firewall connection table |
| US8239550B2 (en) * | 2008-05-14 | 2012-08-07 | Nokia Corporation | Methods, apparatuses, and computer program products for facilitating establishing a communications session |
| CN103856462A (en) * | 2012-12-05 | 2014-06-11 | 深圳市快播科技有限公司 | Method and system for managing sessions |
| CN106790556A (en) * | 2016-12-26 | 2017-05-31 | 深圳市风云实业有限公司 | A kind of NAT conversation managing methods based on distributed system |
-
2017
- 2017-09-26 CN CN201710882539.8A patent/CN107679148A/en active Pending
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20060190613A1 (en) * | 2005-02-23 | 2006-08-24 | International Business Machines Corporation | Method, program and system for efficiently hashing packet keys into a firewall connection table |
| CN1777194A (en) * | 2005-12-16 | 2006-05-24 | 中国科学院计算技术研究所 | Network address translation method supporting multi-session application layer protocol in PAT mode |
| US8239550B2 (en) * | 2008-05-14 | 2012-08-07 | Nokia Corporation | Methods, apparatuses, and computer program products for facilitating establishing a communications session |
| CN103856462A (en) * | 2012-12-05 | 2014-06-11 | 深圳市快播科技有限公司 | Method and system for managing sessions |
| CN106790556A (en) * | 2016-12-26 | 2017-05-31 | 深圳市风云实业有限公司 | A kind of NAT conversation managing methods based on distributed system |
Non-Patent Citations (1)
| Title |
|---|
| 唐红娥等: "《实用计算机绘图教程》", 31 March 1999, 湖南科学技术出版社 * |
Cited By (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109857913A (en) * | 2019-01-15 | 2019-06-07 | 苏州链读文化传媒有限公司 | A kind of distributed content lookup method |
| CN110392059A (en) * | 2019-08-02 | 2019-10-29 | 中国工商银行股份有限公司 | A kind of conversation managing method, device and storage medium |
| CN112261168A (en) * | 2020-09-30 | 2021-01-22 | 厦门市美亚柏科信息股份有限公司 | Multi-IP port user information searching method, terminal equipment and storage medium |
| CN114221847A (en) * | 2021-12-10 | 2022-03-22 | 北京天融信网络安全技术有限公司 | Network session management method, device and equipment and storage medium |
| CN114221847B (en) * | 2021-12-10 | 2024-01-23 | 北京天融信网络安全技术有限公司 | Network session management method, device and equipment and storage medium |
| CN115914001A (en) * | 2022-10-27 | 2023-04-04 | 河北时代电子有限公司 | A distributed message flow management platform |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN108664812B (en) | Information desensitization method, device and system | |
| CN108153757B (en) | Hash table management method and device | |
| CN107679148A (en) | Session lookup method, device and the equipment of a kind of distributed file system | |
| WO2019200714A1 (en) | Server connection method, computer readable storage medium, terminal device, and apparatus | |
| WO2019100921A1 (en) | Information pushing method and device | |
| CN104346401B (en) | The method and apparatus of each inter-module message forwarding in cloud management platform | |
| WO2017114205A1 (en) | Short link processing method, device and server | |
| US9665716B2 (en) | Discovery of malicious strings | |
| WO2015043392A1 (en) | Method, apparatus and system for forwarding messages | |
| WO2017128701A1 (en) | Method and apparatus for storing data | |
| CN104579970B (en) | A policy matching device for IPv6 packets | |
| WO2016029441A1 (en) | File scanning method and apparatus | |
| CN102308296A (en) | Hash calculating and processing method and device | |
| CN104750718B (en) | The searching method and equipment of a kind of data information | |
| WO2016101759A1 (en) | Data routing method, data management device and distributed storage system | |
| CN104601645A (en) | Data packet processing method and device | |
| CN104539538B (en) | The IP address matching process of router and the data packet forwarding method of router | |
| CN106657436B (en) | Message processing method and device | |
| CN110855810A (en) | NAT (network Address translation) conversion method and device, network security equipment and storage medium | |
| US9008096B2 (en) | Data packet routing | |
| CN106302374A (en) | A kind of for improving list item access bandwidth and the device and method of atomicity operation | |
| CN103761060A (en) | Data processing method and server | |
| CN103186570A (en) | Cloud-server-based data source inquiring system and method | |
| CN111352938A (en) | Data processing method, computer device and storage medium | |
| CN106790441B (en) | Method and device for creating policy template table and method and device for session processing |
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: 20180209 |