[go: up one dir, main page]

CN115567590A - Data packet scheduling method, device, equipment and readable storage medium - Google Patents

Data packet scheduling method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN115567590A
CN115567590A CN202211439802.3A CN202211439802A CN115567590A CN 115567590 A CN115567590 A CN 115567590A CN 202211439802 A CN202211439802 A CN 202211439802A CN 115567590 A CN115567590 A CN 115567590A
Authority
CN
China
Prior art keywords
data packet
data
scheduled
destination address
cache table
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.)
Granted
Application number
CN202211439802.3A
Other languages
Chinese (zh)
Other versions
CN115567590B (en
Inventor
邱欣逸
贾焰
胡宁
韩伟红
王海燕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Peng Cheng Laboratory
Original Assignee
Peng Cheng Laboratory
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 Peng Cheng Laboratory filed Critical Peng Cheng Laboratory
Priority to CN202211439802.3A priority Critical patent/CN115567590B/en
Publication of CN115567590A publication Critical patent/CN115567590A/en
Application granted granted Critical
Publication of CN115567590B publication Critical patent/CN115567590B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a data packet scheduling method, a device, equipment and a readable storage medium, wherein the method comprises the following steps: acquiring an external data packet; determining a data packet to be scheduled, which accords with a preset data type, in the external data packet; matching the data packet to be scheduled with data in a preset cache table; and if the first destination address corresponding to the data packet to be scheduled in the preset cache table is obtained through matching, carrying out redirection processing on the data packet to be scheduled, and forwarding the redirected data packet to be scheduled to the first destination address. According to the method and the device, the external data packet is obtained, the data packet to be scheduled which accords with the preset data type is selected, the data packet to be scheduled is matched with the data in the preset cache table, if the first destination address corresponding to the data packet to be scheduled is obtained through matching, the data packet to be scheduled is redirected and forwarded to the first destination address, the data packet to be scheduled is prevented from being forwarded again through a user state, and therefore the scheduling performance of the data packet is improved.

Description

数据包调度方法、装置、设备及可读存储介质Data packet scheduling method, device, device and readable storage medium

技术领域technical field

本申请涉及数据处理领域,尤其涉及一种数据包调度方法、装置、设备及可读存储介质。The present application relates to the field of data processing, and in particular to a data packet scheduling method, device, equipment and readable storage medium.

背景技术Background technique

在网络技术仿真验证平台应用中,为了能模拟出更加真实、复杂的场景,多地的网络技术仿真验证平台会相互联动形成组合式仿真验证平台。为了能协调和监控网络流量,组合式仿真验证平台往往会选取出一个主平台对其他平台进行协调和调度。为了能让主平台对使用者以及分平台的行为进行监督和控制,所有分平台以及使用者的流量都需要经过主平台进行转发。In the application of the network technology simulation verification platform, in order to simulate more realistic and complex scenarios, the network technology simulation verification platforms in multiple places will be linked with each other to form a combined simulation verification platform. In order to coordinate and monitor network traffic, the combined simulation verification platform often selects a main platform to coordinate and schedule other platforms. In order for the main platform to supervise and control the behavior of users and sub-platforms, all sub-platforms and user traffic need to be forwarded through the main platform.

在常用的数据调度解决方案中,调度的策略以及算法都是运行在用户态的,这就导致当主平台进行转发时,所有数据包不仅需要经过内核中复杂的网络协议栈,还需要多次进行用户态与内核态之间的数据拷贝,以便让处于用户态的调度服务对数据包的转发地址进行决策。In commonly used data scheduling solutions, scheduling strategies and algorithms are run in user mode, which leads to the fact that when the main platform forwards, all data packets not only need to pass through the complex network protocol stack in the kernel, but also need to be processed multiple times. Data copying between the user state and the kernel state allows the scheduling service in the user state to make decisions on the forwarding address of the data packet.

由于内核中网络协议栈的复杂性以及频繁地在内核态与用户态之间进行数据传递,导致占用了很多不必要的机器资源,最终使得传统的数据调度解决方案在大数据流的场景下,性能急剧下降。Due to the complexity of the network protocol stack in the kernel and the frequent data transfer between the kernel state and the user state, a lot of unnecessary machine resources are occupied, and finally the traditional data scheduling solution is used in the scenario of large data flow. Performance drops drastically.

发明内容Contents of the invention

有鉴于此,本申请提供一种数据包调度方法、装置、设备及可读存储介质,旨在提高数据包的调度性能。In view of this, the present application provides a data packet scheduling method, device, device, and readable storage medium, aiming at improving the scheduling performance of data packets.

为实现上述目的,本申请提供一种数据包调度方法,所述数据包调度方法包括以下步骤:In order to achieve the above object, the present application provides a data packet scheduling method, the data packet scheduling method includes the following steps:

获取外部数据包;Get external data packets;

确定所述外部数据包中符合预设数据类型的待调度数据包;Determine the data packets to be scheduled that meet the preset data types in the external data packets;

将所述待调度数据包与预设缓存表中的数据进行匹配;Matching the data packet to be scheduled with the data in the preset cache table;

若匹配得到所述预设缓存表中与所述待调度数据包对应的第一目的地址,则对所述待调度数据包进行重定向处理,并转发重定向后的待调度数据包至所述第一目的地址。If the first destination address corresponding to the to-be-scheduled data packet in the preset cache table is matched, then the to-be-scheduled data packet is redirected, and the redirected to-be-scheduled data packet is forwarded to the The first destination address.

示例性的,所述将所述待调度数据包与预设缓存表中的数据进行匹配之后,包括:Exemplarily, after matching the data packet to be scheduled with the data in the preset cache table, it includes:

若未匹配得到第一目的地址,则对所述待调度数据包进行初始化处理,并输出初始化后的待调度数据包至用户态;If the first destination address is not matched, perform initialization processing on the to-be-scheduled data packet, and output the initialized to-be-scheduled data packet to the user state;

在所述用户态制定出所述初始化后的待调度数据包的调度策略后,获取所述调度策略的第二目的地址;After formulating the scheduling policy of the initialized data packet to be scheduled in the user state, acquiring the second destination address of the scheduling policy;

更新所述第二目的地址至所述预设缓存表,以保证所述初始化后的待调度数据包与所述预设缓存表匹配得到所述第二目的地址。updating the second destination address to the preset cache table to ensure that the initialized data packet to be scheduled matches the preset cache table to obtain the second destination address.

示例性的,所述若未匹配得到第一目的地址,则对所述待调度数据包进行初始化处理,包括:Exemplarily, if the first destination address is not matched, perform initialization processing on the data packet to be scheduled, including:

若未匹配得到第一目的地址,则计算所述待调度数据包的第一哈希值和第一键值组;If the first destination address is not matched, then calculate the first hash value and the first key value group of the data packet to be scheduled;

更新所述第一哈希值和所述第一键值组的数据至所述预设缓存表,以完成所述待调度数据包的初始化处理。Updating the data of the first hash value and the first key value group to the preset cache table, so as to complete the initialization process of the to-be-scheduled data packet.

示例性的,所述更新所述第二目的地址至所述预设缓存表,包括:Exemplarily, the updating the second destination address to the preset cache table includes:

对所述调度策略进行解析,得到解析后的第二目的地址和第二哈希值;Analyzing the scheduling policy to obtain a parsed second destination address and a second hash value;

在所述预设缓存表中匹配与所述第二哈希值对应的第二键值组;matching a second key-value group corresponding to the second hash value in the preset cache table;

基于所述第二键值组,确定待更新数据包;Determine the data packet to be updated based on the second key-value group;

更新所述第二目的地址至所述待更新数据包,以及更新所述第二目的地址至所述预设缓存表。updating the second destination address to the data packet to be updated, and updating the second destination address to the preset cache table.

示例性的,所述更新所述第二目的地址至所述待更新数据包,以及更新所述第二目的地址至所述预设缓存表,包括:Exemplarily, the updating the second destination address to the data packet to be updated, and updating the second destination address to the preset cache table include:

基于所述第二哈希值和所述第二键值组,确定所述预设缓存表中的所述第二目的地址和所述待更新数据包是否一致;Based on the second hash value and the second key value group, determine whether the second destination address in the preset cache table is consistent with the data packet to be updated;

若不一致,则更新所述第二目的地址至所述待更新数据包,以及更新所述第二目的地址至所述预设缓存表,并标记更新过程的匹配次数为一次;If inconsistent, update the second destination address to the data packet to be updated, and update the second destination address to the preset cache table, and mark the number of matches in the update process as one;

若一致,则确定所述第二目的地址和所述待更新数据包的匹配次数;If they are consistent, then determine the number of matches between the second destination address and the data packet to be updated;

若所述匹配次数大于或等于两次,则标记所述待更新数据包有效;If the number of matches is greater than or equal to two times, then marking the data packet to be updated is valid;

若所述匹配次数小于两次,则增加一次匹配次数。If the matching times are less than two times, then add one matching times.

示例性的,所述将所述待调度数据包与预设缓存表中的数据进行匹配,包括:Exemplarily, the matching the data packet to be scheduled with the data in the preset cache table includes:

计算得到所述待调度数据包的键值数据:所述键值数据包括协议、源端口、目的端口和源地址;Calculate key-value data of the data packet to be scheduled: the key-value data includes protocol, source port, destination port and source address;

将所述键值数据中的至少两个数据进行组合,得到检索键值;combining at least two data in the key-value data to obtain the retrieval key-value;

对所述检索键值与预设缓存表中的数据进行匹配。The retrieval key value is matched with the data in the preset cache table.

示例性的,所述若匹配得到所述预设缓存表中与所述待调度数据包对应的第一目的地址,则对所述待调度数据包进行重定向处理,包括:Exemplarily, if the first destination address corresponding to the to-be-scheduled data packet in the preset cache table is obtained by matching, redirecting the to-be-scheduled data packet includes:

若匹配得到所述预设缓存表中与所述待调度数据包对应的第一目的地址,则将所述待调度数据包传输至构造函数,以供所述构造函数使用所述第一目的地址更新至所述待调度数据包,以及使用当前节点数据更新所述待调度数据包的源端口和源地址。If the first destination address corresponding to the to-be-scheduled data packet in the preset cache table is matched, then the to-be-scheduled data packet is transmitted to the constructor, so that the constructor uses the first destination address update to the data packet to be scheduled, and update the source port and source address of the data packet to be scheduled by using the current node data.

示例性的,为实现上述目的,本申请还提供一种数据包调度装置,所述装置包括:Exemplarily, in order to achieve the above purpose, the present application also provides a data packet scheduling device, the device comprising:

获取模块,用于获取外部数据包;An acquisition module, used to acquire external data packets;

确定模块,用于基于预设数据类型,确定所述外部数据包中的待调度数据包;A determining module, configured to determine a data packet to be scheduled in the external data packet based on a preset data type;

匹配模块,用于将所述待调度数据包与预设缓存表中的数据进行匹配;A matching module, configured to match the data packet to be scheduled with the data in the preset cache table;

判断模块,用于若匹配得到所述预设缓存表中与所述待调度数据包对应的第一目的地址,则对所述待调度数据包进行重定向处理,并转发重定向后的待调度数据包至所述第一目的地址。A judging module, configured to perform redirection processing on the data packet to be scheduled and forward the redirected data packet to be scheduled if the first destination address corresponding to the data packet to be scheduled in the preset cache table is matched. The data packet is sent to the first destination address.

示例性的,为实现上述目的,本申请还提供一种数据包调度设备,所述设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的数据包调度程序,所述数据包调度程序配置为实现如上所述的数据包调度方法的步骤。Exemplarily, in order to achieve the above purpose, the present application also provides a data packet scheduling device, the device includes: a memory, a processor, and a data packet scheduler stored in the memory and operable on the processor , the data packet scheduling program is configured to implement the steps of the data packet scheduling method as described above.

示例性的,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有数据包调度程序,所述数据包调度程序被处理器执行时实现如上所述的数据包调度方法的步骤。Exemplarily, in order to achieve the above purpose, the present application also provides a computer-readable storage medium, on which a data packet scheduler is stored, and when the data packet scheduler is executed by a processor, the above-mentioned The steps of the data packet scheduling method described above.

与现有技术中,内核态与用户态之间进行多次数据拷贝,从而获取用户态处制定好的调度策略和转发地址等决策,内核态根据该决策数据,将数据包进行转发,从而导致数据包调度的性能低的情况相比,在本申请中,获取外部数据包,并根据预设数据类型,从外部数据包中确定符合预设数据类型的数据包为待调度数据包,并将待调度数据包与预设缓存表中的数据进行匹配,若匹配得到所述预设缓存表中与所述待调度数据包对应的第一目的地址,则对待调度数据包进行重定向处理,并将重定向后的待调度数据包转发至第一目的地址,即在内核态中直接确定出待调度数据包的第一目的地址,并将待调度数据包进行重定向,从而在内核态中直接将待调度数据包转发至第一目的地址,进而避免了从用户态处获取调度决策数据,也避免了用户态与内核态之间的多次数据拷贝的过程,因此,在本申请中,提高了数据包的调度性能。Compared with the existing technology, multiple data copies are performed between the kernel state and the user state to obtain decisions such as the scheduling strategy and forwarding address made in the user state. The kernel state forwards the data packet according to the decision data, resulting in Compared with the situation where the performance of data packet scheduling is low, in this application, the external data packets are obtained, and according to the preset data type, the data packets that meet the preset data type are determined from the external data packets as the data packets to be scheduled, and the The data packet to be scheduled is matched with the data in the preset cache table, and if the first destination address corresponding to the data packet to be scheduled in the preset cache table is matched, the data packet to be scheduled is redirected, and Forward the redirected data packet to be scheduled to the first destination address, that is, directly determine the first destination address of the data packet to be scheduled in the kernel state, and redirect the data packet to be scheduled, so that the data packet to be scheduled can be directly The data packet to be scheduled is forwarded to the first destination address, thereby avoiding obtaining scheduling decision data from the user state, and also avoiding the process of multiple data copies between the user state and the kernel state. Therefore, in this application, improving The scheduling performance of data packets is improved.

附图说明Description of drawings

图1是本申请数据包调度方法第一实施例的流程示意图;Fig. 1 is a schematic flow chart of the first embodiment of the data packet scheduling method of the present application;

图2为本申请数据包调度方法第二实施例的流程示意图;FIG. 2 is a schematic flow diagram of a second embodiment of the packet scheduling method of the present application;

图3为本申请数据包调度方法第二实施例的数据更新流程图;FIG. 3 is a data update flow chart of the second embodiment of the data packet scheduling method of the present application;

图4为本申请数据包调度方法第三实施例的示意图;FIG. 4 is a schematic diagram of a third embodiment of the packet scheduling method of the present application;

图5为本申请实施例方案涉及的硬件运行环境的结构示意图。FIG. 5 is a schematic structural diagram of the hardware operating environment involved in the solution of the embodiment of the present application.

本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional features and advantages of the present application will be further described in conjunction with the embodiments and with reference to the accompanying drawings.

具体实施方式detailed description

应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。It should be understood that the specific embodiments described here are only used to explain the present application, and are not intended to limit the present application.

本申请提供一种数据包调度方法,参照图1,图1为本申请数据包调度方法第一实施例的流程示意图。The present application provides a data packet scheduling method. Referring to FIG. 1 , FIG. 1 is a schematic flowchart of a first embodiment of the data packet scheduling method of the present application.

本申请实施例提供了数据包调度方法的实施例,需要说明的是,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。为了便于描述,以下省略执行主体描述数据包调度方法的各个步骤,数据包调度方法包括:The embodiment of the present application provides an embodiment of the data packet scheduling method. It should be noted that although the logic sequence is shown in the flow chart, in some cases, the sequence shown or described steps. For the convenience of description, the execution subject describes each step of the data packet scheduling method below, and the data packet scheduling method includes:

步骤S110:获取外部数据包;Step S110: Acquiring external data packets;

在网络技术仿真验证平台应用中,主平台会对应分平台和用户态的流量都通过主平台转发,从而使得主平台对分平台的调度进行协助和流量监控,但是调度的策略和算法均在用户态中,导致在主平台进行转发时,数据包需经过内核态中的网络协议栈,并到达用户态,将该数据包在用户态与内核态之间进行多次数据拷贝,以便获取用户态的调度策略和调度的目的地址等数据。In the application of the network technology simulation verification platform, the main platform will forward the traffic corresponding to the sub-platform and the user mode through the main platform, so that the main platform can assist and monitor the traffic of the sub-platform, but the scheduling strategy and algorithm are in the user In the state, when the main platform is forwarded, the data packet needs to pass through the network protocol stack in the kernel state and reach the user state, and the data packet is copied multiple times between the user state and the kernel state in order to obtain the user state Data such as the scheduling policy and the destination address of the scheduling.

外部数据包即为需要通过内核态进行调度的数据包。External data packets are data packets that need to be scheduled through the kernel mode.

获取过程为从XDP(eXpress Data Path,快速数据路径)hook(钩子)中获取外部数据包。The acquisition process is to acquire the external data packet from the XDP (eXpress Data Path, fast data path) hook (hook).

步骤S120:确定所述外部数据包中符合预设数据类型的待调度数据包;Step S120: Determine the data packets to be scheduled that meet the preset data type in the external data packets;

外部数据包均通过内核态进行转发,根据实际转发情况划分为两种转发模式,一种为传统的数据包经过内核态和用户态的多次拷贝,最终由内核态进行转发至目的地址,另一种为本实施例中,通过内核态确定数据包的目的地址,并在内核态中直接将数据包转发。External data packets are forwarded through the kernel state, and are divided into two forwarding modes according to the actual forwarding situation. One is that the traditional data packets are copied multiple times in the kernel state and user state, and finally forwarded to the destination address by the kernel state. One is that in this embodiment, the destination address of the data packet is determined through the kernel state, and the data packet is directly forwarded in the kernel state.

示例性的,以内核态直接转发数据包的方式,需先确定出数据包的数据类型,选取出直接用内核态转发的数据包,该类数据包即为待调度数据包,而除此之外的数据包均使用传统转发模式。Exemplarily, in the way of directly forwarding data packets in the kernel mode, it is necessary to determine the data type of the data packets first, and select the data packets that are directly forwarded in the kernel mode. All other packets use the traditional forwarding mode.

其中,外部数据包的数量庞大,且外部数据包的数据类型涵盖多种类型,例如:视频、音频等。针对实际应用场景,对不同种类型的数据进行转发时,数据量存在侧重,例如,转发视频数据包和音频数据包的场景下,视频数据包的数量超过总体外部数据包的70%或80%等(根据实际情况制定的权重比例),则当前场景的转发数据侧重点在于视频数据包的转发,因此,可根据该情况,对外部数据包进行过滤,使用内核态直接转发至目的地址的方式将视频数据包作相应处理,而音频视频仍旧保持在内核态与用户态多次拷贝的方式进行转发。Among them, the number of external data packets is huge, and the data types of the external data packets cover various types, such as: video, audio and so on. For actual application scenarios, when forwarding different types of data, the amount of data is emphasized. For example, in the scenario of forwarding video data packets and audio data packets, the number of video data packets exceeds 70% or 80% of the total external data packets. etc. (the weight ratio determined according to the actual situation), the forwarding data of the current scene focuses on the forwarding of video data packets. Therefore, according to this situation, the external data packets can be filtered and directly forwarded to the destination address using the kernel mode. The video data packets are processed accordingly, while the audio and video are still forwarded in the way of multiple copies between the kernel state and the user state.

同时,也可将外部数据包所包括的全部数据类型均使用内核态直接转发的方式,同样,也可选择预设数据类型的待调度数据包,该预设数据类型可为数据包中的任一类型,或多个类型,预设数据类型根据实际使用场景和使用用途而定。At the same time, all the data types included in the external data packet can also be directly forwarded in the kernel state. Similarly, the data packet to be scheduled can also be selected with a preset data type, which can be any data in the data packet. One type, or multiple types, and the preset data type depends on the actual usage scenario and purpose.

在确定待调度数据包时,可使用rx过滤器,在rx过滤器中对数据包进行解析,并根据分析出来的五元组进行过滤,找到与用户态相关的数据包。rx过滤器的匹配规则可以根据用户的需要灵活地配置。包括但不限于支持根据端口、协议等为依据进行过滤。When determining the data packet to be scheduled, the rx filter can be used to analyze the data packet in the rx filter, and filter according to the analyzed quintuple to find the data packet related to the user mode. The matching rules of the rx filter can be flexibly configured according to user needs. Including but not limited to supporting filtering based on ports, protocols, etc.

步骤S130:将所述待调度数据包与预设缓存表中的数据进行匹配;Step S130: matching the data packet to be scheduled with the data in the preset cache table;

示例性的,缓存数据使用eBPF(extended Berkeley Packet Filter,扩展伯克利数据包过滤器)中的per-cpu(每cpu变量) Hash(哈希)进行存储,为了避免缓存数据占用过多内核资源,e-schedule(调度函数)使用LRU(Least Recently Used,页面置换算法)策略对缓存内容进行替换。e-schedule的缓存内容存储在预设缓存表中,预设缓存表包括两个哈希表,即表1的redirect_cache_Map(源地址和目的地址对应关系的映射表),和表2的key_content_Map(业务数据的哈希值与源地址对应关系的映射表)。具体结构如表1、2所示:Exemplarily, cached data is stored using per-cpu (per-cpu variable) Hash (hash) in eBPF (extended Berkeley Packet Filter, extended Berkeley packet filter). In order to avoid cached data from occupying too many kernel resources, e -schedule (scheduling function) uses the LRU (Least Recently Used, page replacement algorithm) strategy to replace the cached content. The cache content of the e-schedule is stored in the preset cache table. The preset cache table includes two hash tables, namely redirect_cache_Map (mapping table of source address and destination address correspondence) in Table 1, and key_content_Map (business The mapping table of the corresponding relationship between the hash value of the data and the source address). The specific structure is shown in Table 1 and 2:

表1 源地址和目的地址对应关系的映射表Table 1 Mapping table of source address and destination address correspondence

Figure 849065DEST_PATH_IMAGE001
Figure 849065DEST_PATH_IMAGE001

表2 业务数据的哈希值与源地址对应关系的映射表Table 2 Mapping table of the correspondence between the hash value of business data and the source address

Figure 431225DEST_PATH_IMAGE002
Figure 431225DEST_PATH_IMAGE002

表1中保存的是源地址与重定向地址的对应关系。与匹配域计算函数对应,缓存的key(关键字)由协议、源、目的端口以及源IP(地址)组合。因为缓存中value(值),由key-value组成键值的数据需要由入链和出链的数据包共同组成,所以设置了valid字段来表示当前的数据是否可用,避免e-schedule误用不完整的缓存数据。Table 1 stores the corresponding relationship between the source address and the redirection address. Corresponding to the matching domain calculation function, the cache key (keyword) is composed of protocol, source, destination port and source IP (address). Because the value (value) in the cache, the key-value data composed of key-value needs to be composed of in-link and out-link data packets, so the valid field is set to indicate whether the current data is available to avoid misuse of the e-schedule. Full cache data.

表2中保存的是业务数据hash与表1中key(关键字,即为表1中的源地址等数据)的对应关系。Table 2 stores the corresponding relationship between the business data hash and the key (keyword, which is the source address and other data in Table 1) in Table 1.

在缓存项初始化函数中,本实施例会记录除了目的端口/IP(目的地址)以外的所有数据,并将其存入对应的缓存表中。In the cache item initialization function, this embodiment will record all data except the destination port/IP (destination address), and store it in the corresponding cache table.

将待调度数据包和预设缓存表进行匹配,匹配过程以预设缓存表中的存储数据的格式为主进行,根据数据包的相关数据,从预设缓存表中匹配出与该数据包对应的目的地址,该目的地址即为数据包的目的转发地址,即内核态需将该数据包转发至目的地址。Match the data packet to be scheduled with the preset cache table. The matching process is mainly carried out based on the format of the stored data in the preset cache table. According to the relevant data of the data packet, the corresponding The destination address, the destination address is the destination forwarding address of the data packet, that is, the kernel mode needs to forward the data packet to the destination address.

该匹配过程即为从预设缓存表中确定出数据包的去向。The matching process is to determine the whereabouts of the data packets from the preset cache table.

示例性的,所述将所述待调度数据包与预设缓存表中的数据进行匹配,包括:Exemplarily, the matching the data packet to be scheduled with the data in the preset cache table includes:

步骤a:计算得到所述待调度数据包的键值数据:所述键值数据包括协议、源端口、目的端口和源地址;Step a: Calculate the key-value data of the data packet to be scheduled: the key-value data includes protocol, source port, destination port and source address;

预设缓存表中的表1为源地址(键值)与重定向的目的地址的对应关系,表2为业务数据的哈希值与表1中的键值对应关系,因此,在进行待调度数据包与预设缓存表的匹配时,需先计算出数据包中的键值数据。Table 1 in the preset cache table is the correspondence between the source address (key value) and the redirected destination address, and Table 2 is the correspondence between the hash value of the business data and the key value in Table 1. When the data packet is matched with the preset cache table, the key-value data in the data packet needs to be calculated first.

示例性的,键值数据包括协议、源端口、目的端口和源地址,该键值数据根据待调度数据包的五元组而来,数据包的五元组数据包括:源地址,源端口,目的地址,目的端口,和协议这五个量组成的一个集合,解析待调度数据包的五元组数据,即可确定出该数据包的键值数据。Exemplarily, the key-value data includes protocol, source port, destination port and source address, and the key-value data comes according to the five-tuple of the data packet to be scheduled, and the five-tuple data of the data packet includes: source address, source port, A set of five quantities consisting of destination address, destination port, and protocol can be used to determine the key-value data of the data packet by analyzing the quintuple data of the data packet to be scheduled.

上述解析过程可在用于过滤符合预设数据类型的数据包的过滤器中解析。The above parsing process can be parsed in a filter for filtering data packets conforming to a preset data type.

步骤b:将所述键值数据中的至少两个数据进行组合,得到检索键值;Step b: combining at least two data in the key-value data to obtain the retrieval key-value;

键值数据中包括四种数据,将该上述四种数据进行随机组合,组合过程可依据键值数据中的至少两个数据任意组合,从而得到检索键值。The key-value data includes four kinds of data, and the above-mentioned four kinds of data are randomly combined, and the combination process can be arbitrarily combined according to at least two data in the key-value data, so as to obtain the retrieval key value.

示例性的,检索键值的数据可为任意两个或任意三个数据组合而来,例如,以源地址和源端口组合作为检索键值,又例如,以目的端口和源端口作为检索键值,又例如,以源地址和源端口和协议作为检索键值等随机组合情况。Exemplarily, the data of the retrieval key can be any combination of two or any three data, for example, the combination of the source address and the source port is used as the retrieval key, and for example, the destination port and the source port are used as the retrieval key , and for example, the random combination of source address, source port and protocol as the search key.

步骤c:对所述检索键值与预设缓存表中的数据进行匹配。Step c: matching the retrieval key value with the data in the preset cache table.

使用检索键值,在预设缓存表中进行匹配,将检索键值和预设缓存表中的数据进行匹配,若匹配成功,则可预设缓存表中确定出目的地址,若匹配失败,则无法从预设缓存表中获取到目的地址。Use the search key value to match in the preset cache table, and match the search key value with the data in the preset cache table. If the match is successful, the destination address can be determined in the preset cache table. If the match fails, then Unable to get the destination address from the preset cache table.

步骤S140:若匹配得到所述预设缓存表中与所述待调度数据包对应的第一目的地址,则对所述待调度数据包进行重定向处理,并转发重定向后的待调度数据包至所述第一目的地址。Step S140: If the first destination address corresponding to the data packet to be scheduled in the preset cache table is matched, perform redirection processing on the data packet to be scheduled, and forward the redirected data packet to be scheduled to the first destination address.

第一目的地址为预设缓存表为更新时,预设缓存表中保存的目的地址。The first destination address is the destination address stored in the preset cache table when the preset cache table is updated.

传统的转发模式为内核态与用户态多次进行数据拷贝,从而内核态获取用户态的转发策略,而在本实施例中,在从预设缓存表中匹配得到第一目的地址时,使用第一目的地址对待调度数据包进行重定向处理,直接在内核态中改变待调度数据包的目的地址,并直接转发重定向后的待调度数据包至第一目的地址。The traditional forwarding mode is to copy data between the kernel state and the user state multiple times, so that the kernel state obtains the forwarding strategy of the user state. In this embodiment, when the first destination address is obtained from the preset cache table, the second A destination address redirects the data packet to be scheduled, directly changes the destination address of the data packet to be scheduled in the kernel state, and directly forwards the redirected data packet to be scheduled to the first destination address.

在这一重定向过程中,将待调度数据包的五元组数据进行调整,改变目的地址、源地址,从而使得内核态直接将待调度数据包转发至目的地址中,从而避免待调度数据包经过网络协议栈和用户态与内核态之间的多次拷贝过程,从而提高数据包调度性能。In this redirection process, the quintuple data of the data packet to be scheduled is adjusted, and the destination address and source address are changed, so that the kernel state directly forwards the data packet to be scheduled to the destination address, thereby avoiding the data packet to be scheduled to pass through The network protocol stack and the multiple copy process between the user state and the kernel state, thereby improving the packet scheduling performance.

示例性的,所述若匹配得到所述预设缓存表中与所述待调度数据包对应的第一目的地址,则对所述待调度数据包进行重定向处理,包括:Exemplarily, if the first destination address corresponding to the to-be-scheduled data packet in the preset cache table is obtained by matching, redirecting the to-be-scheduled data packet includes:

步骤d:若匹配得到所述预设缓存表中与所述待调度数据包对应的第一目的地址,则将所述待调度数据包传输至构造函数,以供所述构造函数使用所述第一目的地址更新至所述待调度数据包,以及使用当前节点数据更新所述待调度数据包的源端口和源地址。Step d: If the first destination address corresponding to the to-be-scheduled data packet in the preset cache table is matched, then the to-be-scheduled data packet is transmitted to the constructor for the constructor to use the first destination address A destination address is updated to the data packet to be scheduled, and a source port and a source address of the data packet to be scheduled are updated using current node data.

在匹配得到第一目的地址时,需对待调度数据包的五元组数据进行更改,以便后续直接通过内核态,将待调度数据包进行转发。When the first destination address is matched, the quintuple data of the data packet to be scheduled needs to be changed, so that the data packet to be scheduled can be forwarded directly through the kernel state.

为更改待调度数据包,将该数据包传输至构造函数,通过构造函数,将第一目的地址更新至待调度数据包中,并将当前节点数据更新至待调度数据包的源端口和源地址,从而使得内核态直接转发待调度数据包,而避免需要经过网络协议栈,通过在内核态与用户态之间多次拷贝数据,从用户态中获取到调度策略相关数据,而对待调度数据包进行转发的过程,从而缩短转发流程,提高数据包的调度性能。In order to change the data packet to be scheduled, transmit the data packet to the constructor, update the first destination address to the data packet to be scheduled through the constructor, and update the current node data to the source port and source address of the data packet to be scheduled , so that the kernel state directly forwards the data packets to be scheduled, and avoids the need to go through the network protocol stack. By copying data between the kernel state and the user state multiple times, the data related to the scheduling policy is obtained from the user state, and the data packets to be scheduled are The forwarding process is performed, thereby shortening the forwarding process and improving the scheduling performance of data packets.

与现有技术中,内核态与用户态之间进行多次数据拷贝,从而获取用户态处制定好的调度策略和转发地址等决策,内核态根据该决策数据,将数据包进行转发,从而导致数据包调度的性能低的情况相比,在本申请中,获取外部数据包,并根据预设数据类型,从外部数据包中确定符合预设数据类型的数据包为待调度数据包,并将待调度数据包与预设缓存表中的数据进行匹配,若匹配得到所述预设缓存表中与所述待调度数据包对应的第一目的地址,则对待调度数据包进行重定向处理,并将重定向后的待调度数据包转发至第一目的地址,即在内核态中直接确定出待调度数据包的第一目的地址,并将待调度数据包进行重定向,从而在内核态中直接将待调度数据包转发至第一目的地址,进而避免了从用户态处获取调度决策数据,也避免了用户态与内核态之间的多次数据拷贝的过程,因此,在本申请中,提高了数据包的调度性能。Compared with the existing technology, multiple data copies are performed between the kernel state and the user state to obtain decisions such as the scheduling strategy and forwarding address made in the user state. The kernel state forwards the data packet according to the decision data, resulting in Compared with the situation where the performance of data packet scheduling is low, in this application, the external data packets are obtained, and according to the preset data type, the data packets that meet the preset data type are determined from the external data packets as the data packets to be scheduled, and the The data packet to be scheduled is matched with the data in the preset cache table, and if the first destination address corresponding to the data packet to be scheduled in the preset cache table is matched, the data packet to be scheduled is redirected, and Forward the redirected data packet to be scheduled to the first destination address, that is, directly determine the first destination address of the data packet to be scheduled in the kernel state, and redirect the data packet to be scheduled, so that the data packet to be scheduled can be directly The data packet to be scheduled is forwarded to the first destination address, thereby avoiding obtaining scheduling decision data from the user state, and also avoiding the process of multiple data copies between the user state and the kernel state. Therefore, in this application, improving The scheduling performance of data packets is improved.

示例性的,参照图2,图2是本申请数据包调度方法第二实施例的流程示意图,基于上述本申请数据包调度方法第一实施例,提出第二实施例,所述方法还包括:Exemplarily, referring to FIG. 2, FIG. 2 is a schematic flowchart of the second embodiment of the packet scheduling method of the present application. Based on the first embodiment of the packet scheduling method of the present application, a second embodiment is proposed, and the method further includes:

步骤S210:若未匹配得到第一目的地址,则对所述待调度数据包进行初始化处理,并输出初始化后的待调度数据包至用户态;Step S210: If the first destination address is not matched, perform initialization processing on the data packet to be scheduled, and output the initialized data packet to be scheduled to the user state;

在将待调度数据包与预设缓存表进行匹配的过程中,存在预设缓存表中未包含待调度数据包的情况,因此,在该匹配过程中,无法从预设缓存表中确定出第一目的地址,即,无法通过内核态直接重定向待调度数据包,同样也无法直接转发该数据包。In the process of matching the data packet to be scheduled with the preset cache table, there is a situation that the data packet to be scheduled is not included in the preset cache table, therefore, in the matching process, it is impossible to determine the first A destination address, that is, the data packet to be scheduled cannot be directly redirected through the kernel mode, and the data packet cannot be directly forwarded either.

此时,需要根据传统转发模式,内核态与用户态进行信息交互,从而获取到用户态对待调度数据包的调度决策数据,根据该决策数据,在对该调度数据包进行转发。因此,需要将待调度数据包经过网络协议栈传输至用户态,并从用户态处获取相应的调度决策数据。At this time, according to the traditional forwarding mode, it is necessary to perform information interaction between the kernel state and the user state, so as to obtain the scheduling decision data of the data packet to be scheduled in the user state, and forward the scheduling data packet according to the decision data. Therefore, it is necessary to transmit the data packets to be scheduled to the user state through the network protocol stack, and obtain corresponding scheduling decision data from the user state.

而为避免下一次遇到此类在预设缓存表中并未保存键值、目的地址的数据包,设立自学习的规划模式,在内核态中自学习用户态的调度决策机制,根据用户态的调度决策机制,记录相应的调度记录至预设缓存表,从而在下一次待调度数据包与预设缓存表匹配时,能够直接在内核态中获取到目的地址,避免针对同一类型的待调度数据包时,多次进行用户态与内核态的数据拷贝。In order to avoid encountering such data packets that do not save the key value and destination address in the preset cache table next time, a self-learning planning mode is set up, and the scheduling decision-making mechanism of the user state is self-learned in the kernel state. Scheduling decision-making mechanism, record the corresponding scheduling record to the preset cache table, so that when the next data packet to be scheduled matches the preset cache table, the destination address can be obtained directly in the kernel state, avoiding the same type of data to be scheduled When the package is packaged, data copies between the user state and the kernel state are performed multiple times.

在将待调度数据包输出至用户态之前,对该待调度数据包进行初始化处理,该初始化处理,即,将待调度数据包按照传统转发模式进行处理,同时,将该待调度数据包中的键值数据、业务数据的哈希值等数据更新至预设缓存表中,待获取到调度决策数据后,将预设缓存表完成更新。Before the data packet to be scheduled is output to the user state, the data packet to be scheduled is initialized. The initialization process, that is, the data packet to be scheduled is processed according to the traditional forwarding mode, and at the same time, the data packet to be scheduled is processed. Key-value data, hash values of business data and other data are updated to the preset cache table. After the scheduling decision data is obtained, the preset cache table is updated.

示例性的,初始化处理包括存储相应数据至预设缓存表中,同时,包含将待调度数据包按照传统转发模式进行相应处理。Exemplarily, the initialization process includes storing corresponding data in a preset cache table, and at the same time, includes performing corresponding processing on the data packets to be scheduled according to the traditional forwarding mode.

示例性的,所述若未匹配得到第一目的地址,则对所述待调度数据包进行初始化处理,包括:Exemplarily, if the first destination address is not matched, perform initialization processing on the data packet to be scheduled, including:

步骤e:若未匹配得到第一目的地址,则计算所述待调度数据包的第一哈希值和第一键值组;Step e: If the first destination address is not matched, then calculate the first hash value and the first key value group of the data packet to be scheduled;

在匹配未得到第一目的地址时,则需要将待调度数据包的键值数据和业务数据等相关数据保存至预设缓存表中,而预设缓存表的存储格式包括数据包的键值、目的地址和业务数据等相关数据,因此,需计算待调度数据包的第一哈希值和第一键值组。When the matching fails to obtain the first destination address, it is necessary to store relevant data such as key value data and service data of the data packet to be scheduled in the preset cache table, and the storage format of the preset cache table includes the key value of the data packet, For related data such as destination address and service data, it is necessary to calculate the first hash value and the first key-value group of the data packet to be scheduled.

其中,第一哈希值为业务数据的相关数据值,第一键值组则为待调度数据包的键值数据,包括协议、源端口、目的端口和源地址四项数据,在计算得到数据后,填入相应的预设缓存表中。Among them, the first hash value is the relevant data value of the service data, and the first key-value group is the key-value data of the data packet to be scheduled, including four data items of protocol, source port, destination port and source address, and the calculated data After that, fill in the corresponding preset cache table.

步骤f:更新所述第一哈希值和所述第一键值组的数据至所述预设缓存表,以完成所述待调度数据包的初始化处理。Step f: updating the data of the first hash value and the first key value group to the preset cache table, so as to complete the initialization process of the data packet to be scheduled.

更新数据至预设缓存表的过程中,将第一哈希值更新至表2中,将第一键值组更新至表1和表2中,将除去目的端口和目的地址的其余相应参数更新至预设缓存表中,以此完成待调度数据包的初始化处理。In the process of updating data to the preset cache table, update the first hash value to Table 2, update the first key-value group to Table 1 and Table 2, and update the remaining corresponding parameters except the destination port and destination address to the preset cache table, so as to complete the initialization processing of the data packets to be scheduled.

步骤S220:在所述用户态制定出所述初始化后的待调度数据包的调度策略后,获取所述调度策略的第二目的地址;Step S220: After formulating the scheduling strategy for the initialized data packets to be scheduled in the user state, obtain the second destination address of the scheduling strategy;

在待调度数据包经过初始化处理后输出至用户态,用户态会根据待调度数据包制定相应的调度策略,以及在调度策略中包含第二目的地址和相关业务数据等调度决策数据。After the data packets to be scheduled are initialized and output to the user state, the user state will formulate a corresponding scheduling policy according to the data packets to be scheduled, and include scheduling decision data such as the second destination address and related business data in the scheduling policy.

同时,在获取调度策略时,会获取到相应的待调度数据包(传统转发模式中多次拷贝数据包的过程),在获取数据包时,使用tx过滤器,对数据包进行筛选,该筛选过程与上述rx过滤器筛选的过程相同,过滤方式同样相同,在此不再赘述。At the same time, when obtaining the scheduling policy, the corresponding data packet to be scheduled will be obtained (the process of copying the data packet multiple times in the traditional forwarding mode). When obtaining the data packet, the tx filter is used to filter the data packet. The process is the same as the above-mentioned rx filter screening process, and the filtering method is also the same, and will not be repeated here.

在用户态制定出初始化后的待调度数据包的调度策略后,获取调度策略中包含的第二目的地址。After formulating the scheduling strategy for the initialized data packets to be scheduled in the user state, the second destination address contained in the scheduling strategy is obtained.

步骤S230:更新所述第二目的地址至所述预设缓存表,以保证所述初始化后的待调度数据包与所述预设缓存表匹配得到所述第二目的地址。Step S230: updating the second destination address to the preset cache table to ensure that the initialized data packet to be scheduled matches the preset cache table to obtain the second destination address.

在对待调度数据包进行初始化处理时,将该数据包中的键值和哈希值存储至预设缓存表,而为起到将待调度数据包进行调度,需确定该数据包的目的地址,因此,在从用户态处获取到调度策略的第二目的地址时,将该第二目的地址更新至预设缓存表中,从而使得预设缓存表中,针对该待调度数据包的键值和目的地址对应的数据完成,继而使得在后续调度该类待调度数据包时,直接根据预设缓存表即可完成目的地址的匹配,完成由内核态直接进行对数据包的重定向和转发。When the data packet to be scheduled is initialized, the key value and hash value in the data packet are stored in the preset cache table, and in order to schedule the data packet to be scheduled, the destination address of the data packet needs to be determined, Therefore, when the second destination address of the scheduling policy is obtained from the user state, the second destination address is updated into the preset cache table, so that in the preset cache table, the key value and The data corresponding to the destination address is completed, and then when the data packets to be scheduled are subsequently scheduled, the matching of the destination addresses can be completed directly according to the preset cache table, and the redirection and forwarding of the data packets are directly performed by the kernel state.

示例性的,所述更新所述第二目的地址至所述预设缓存表,包括:Exemplarily, the updating the second destination address to the preset cache table includes:

步骤g:对所述调度策略进行解析,得到解析后的第二目的地址和第二哈希值;Step g: Analyzing the scheduling policy to obtain the parsed second destination address and second hash value;

在将第二目的地址更新至预设缓存表中,需要确定第二目的地址的更新位置,即需确定第二目的地址和预设缓存表中的待调度数据包之间的对应关系,因此,需在将第二目的地址更新至预设缓存表之前,对调度策略进行解析,计算出第二目的地址和来自于用户态的调度策略的第二哈希值,该第二哈希值同样为业务数据的哈希值。In updating the second destination address to the preset cache table, it is necessary to determine the update position of the second destination address, that is, to determine the correspondence between the second destination address and the data packets to be scheduled in the preset cache table, therefore, Before updating the second destination address to the preset cache table, the scheduling strategy needs to be parsed to calculate the second destination address and the second hash value of the scheduling strategy from the user state. The second hash value is also Hash value of business data.

步骤h:在所述预设缓存表中匹配与所述第二哈希值对应的第二键值组;Step h: matching the second key-value group corresponding to the second hash value in the preset cache table;

当前预设缓存链表中,保存有待调度数据包的第一哈希值和第一键值组数据,在使用第二哈希值和预设缓存表进行匹配时,若匹配到结果,则确定在预设缓存表中匹配到与用户态的调度策略对应的待调度数据包,该匹配到的结果为第二哈希值在预设缓存表中对应的第二键值组,根据数据更新的逻辑而定,用户态给出的调度策略为针对待调度数据包的第二哈希值和第二目的地址,该第二哈希值和匹配得到的第二键值组均应为第一哈希值和第一目的地址对应的数据,以补全待调度数据包在预设缓存表中的数据对应关系。In the current preset cache linked list, the first hash value and the first key-value group data of the data packet to be scheduled are saved. When using the second hash value and the preset cache table for matching, if the result is matched, it is determined in The data packet to be scheduled corresponding to the scheduling policy in the user mode is matched in the preset cache table, and the result of the matching is the second key-value group corresponding to the second hash value in the preset cache table, according to the logic of data update However, the scheduling policy given by the user mode is the second hash value and the second destination address for the data packet to be scheduled, and the second hash value and the matched second key-value group should both be the first hash value value and the data corresponding to the first destination address, so as to complement the data correspondence relationship of the data packet to be scheduled in the preset cache table.

步骤i:基于所述第二键值组,确定待更新数据包;Step i: Determine the data package to be updated based on the second key-value group;

当前预设缓存表中的第一哈希值和第一键值组确定对应的待调度数据包,而根据第二哈希值和第二键值组确定与待调度数据包的对应关系后,即可对预设缓存表和待调度数据包进行更新处理。The first hash value and the first key value group in the current preset cache table determine the corresponding data packet to be scheduled, and after determining the corresponding relationship with the data packet to be scheduled according to the second hash value and the second key value group, The preset cache table and the data packets to be scheduled can be updated.

待更新数据包为待更新数据的待调度数据包。The to-be-updated data packet is a to-be-scheduled data packet of to-be-updated data.

步骤j:更新所述第二目的地址至所述待更新数据包,以及更新所述第二目的地址至所述预设缓存表。Step j: updating the second destination address to the data packet to be updated, and updating the second destination address to the preset cache table.

在更新过程中,除了将第二目的地址更新至待更新数据包,同时,需要将第二目的地址更新至预设缓存表。During the update process, in addition to updating the second destination address to the data packet to be updated, at the same time, it is necessary to update the second destination address to the preset cache table.

由于第一哈希值和第二哈希值、第一键值组和第二键值组均共同为待调度数据包的相关数据,即上述哈希值和键值组在预设缓存表中代表着同一类的待调度数据包,因此,在更新预设缓存表时,仅将第二目的地址更新至相应位置即可。Since the first hash value and the second hash value, the first key value group and the second key value group are all related data of the data packet to be scheduled, that is, the above hash value and key value group are in the preset cache table It represents the same type of data packets to be scheduled, so when updating the preset cache table, only the second destination address should be updated to the corresponding position.

示例性的,所述更新所述第二目的地址至所述待更新数据包,以及更新所述第二目的地址至所述预设缓存表,包括:Exemplarily, the updating the second destination address to the data packet to be updated, and updating the second destination address to the preset cache table include:

步骤k:基于所述第二哈希值和所述第二键值组,确定所述预设缓存表中的所述第二目的地址和所述待更新数据包是否一致;Step k: Based on the second hash value and the second key value group, determine whether the second destination address in the preset cache table is consistent with the data packet to be updated;

在更新数据之前,需确定调度策略中的数据与预设缓存表中的数据是否一一对应,保证数据的一致性,避免出现数据包和预设缓存表中的键值等数据不对应,造成内核态转发数据包存在错误的情况。Before updating the data, it is necessary to determine whether the data in the scheduling policy corresponds to the data in the preset cache table one by one to ensure the consistency of the data and avoid the mismatch between data packets and the key values in the preset cache table, which may cause There is an error in kernel mode forwarding packets.

根据第二哈希值和第二键值组,在预设缓存表中确定第一哈希值和第二键值组的数据对应位置,在双方数据经过匹配成功后,即可确定第二目的地址和待更新数据包是一致的。According to the second hash value and the second key value group, determine the corresponding position of the data of the first hash value and the second key value group in the preset cache table, and after the data of both parties are successfully matched, the second purpose can be determined The address is consistent with the packet to be updated.

示例性的,在当前确定数据是否一致的过程,即为调度策略中的数据和预设缓存表中的数据和待更新数据包中的数据进行匹配的过程,直接确定数据一致,则确定待更新数据包和预设缓存表中已存在用户态制定出的调度策略,而不一致,则确定待更新数据包和预设缓存表中不存在调度策略。Exemplarily, the current process of determining whether the data is consistent is the process of matching the data in the scheduling policy with the data in the preset cache table and the data in the data packet to be updated. If the data is directly determined to be consistent, then it is determined that the data to be updated If there is already a scheduling strategy formulated by the user state in the data packet and the preset cache table, but they are inconsistent, it is determined that there is no scheduling strategy in the data packet to be updated and the preset cache table.

在匹配确定数据为一致时,则确定当前调度策略已经为更新至预设缓存表中,则需进一步确定当前调度策略的相关数据的有效性。When the matching determination data is consistent, it is determined that the current scheduling strategy has been updated to the preset cache table, and it is necessary to further determine the validity of the relevant data of the current scheduling strategy.

在匹配确定数据不一致时,则确定当前预设缓存表中不存在调度策略的相关数据,则需要将调度策略中的相关数据更新至预设缓存表中。When the matching determines that the data is inconsistent, it is determined that there is no relevant data of the scheduling strategy in the current preset cache table, and then the relevant data in the scheduling strategy needs to be updated to the preset cache table.

其中,调度策略的相关数据包括哈希值、键值组和目的地址等数据。Wherein, the relevant data of the scheduling policy includes data such as hash value, key-value group, and destination address.

步骤l:若不一致,则更新所述第二目的地址至所述待更新数据包,以及更新所述第二目的地址至所述预设缓存表,并标记更新过程的匹配次数为一次;Step 1: If inconsistent, update the second destination address to the data packet to be updated, and update the second destination address to the preset cache table, and mark the number of matches in the update process as one;

当匹配结果不一致时,则更新第二目的地址更新至待更新数据包和与预设缓存表中,同时,为后续判断该数据的有效性,在更新完成后,标记该更新过程的匹配次数为一次。When the matching results are inconsistent, the second destination address is updated to the data packet to be updated and the preset cache table. At the same time, for subsequent judgment of the validity of the data, after the update is completed, the number of matches marked in the update process is once.

当匹配结果一致时,则证明当前的调度策略相关数据已经存储在预设缓存表和待更新数据包中,但是该预设缓存表中的数据的匹配次数为一,该数据为无效的数据,无法直接调用,因此,会需要将待调度数据包传输至用户态。When the matching results are consistent, it proves that the relevant data of the current scheduling strategy has been stored in the preset cache table and the data packet to be updated, but the number of matches of the data in the preset cache table is one, and the data is invalid data. It cannot be called directly, therefore, it will need to transfer the scheduled data packets to the user state.

因此,在匹配结果为一致时,需进一步判断匹配次数,从而确定该相关数据的有效性。Therefore, when the matching results are consistent, it is necessary to further judge the matching times, so as to determine the validity of the relevant data.

步骤m:若一致,则确定所述第二目的地址和所述待更新数据包的匹配次数;Step m: If they are consistent, determine the number of matches between the second destination address and the data packet to be updated;

步骤n:若所述匹配次数大于或等于两次,则标记所述待更新数据包有效;Step n: if the number of matches is greater than or equal to two times, mark the data packet to be updated as valid;

步骤o:若所述匹配次数小于两次,则增加一次匹配次数。Step o: If the number of matching times is less than two times, increase the number of matching times by one time.

若第二目的地址和待更新数据包一致,则证明该第二目的地址能应用于当前待调度数据包的转发,但为保证数据的准确性,在匹配成功时,需确定匹配的次数。If the second destination address is consistent with the data packet to be updated, it proves that the second destination address can be applied to the forwarding of the current data packet to be scheduled, but in order to ensure the accuracy of the data, when the matching is successful, the number of matching times needs to be determined.

示例性的,用户态不会对转发的业务数据进行修改。所以针对转发数据包(内核态处理的待调度数据包)与原始数据包(作为存储于预设缓存表中的数据包)的五元组不同的问题,利用业务数据的哈希值来找到转发数据包相匹配的原始数据包。Exemplarily, the user mode will not modify the forwarded service data. Therefore, for the problem that the five-tuple of the forwarded data packet (the data packet to be scheduled processed by the kernel mode) and the original data packet (as the data packet stored in the preset cache table) are different, the hash value of the business data is used to find the forwarding data packet. The packet matches the original packet.

在这一机制可能存在哈希值冲突的问题,因此,针对存在可能冲突的情况,在本实施例中要求匹配流的数据包连续两次能匹配成功(Match_count>=2,匹配次数大于等于2),才能将这一缓存项设置为有效。There may be a hash value conflict problem in this mechanism. Therefore, in the case of possible conflicts, in this embodiment, the data packets of the matching flow are required to be successfully matched twice in a row (Match_count>=2, the number of matches is greater than or equal to 2 ) to make this cache entry valid.

而匹配次数小于两次时,不能确保该数据的有效性,因此,在匹配次数小于两次时,增加一次匹配次数。However, when the number of matching times is less than two times, the validity of the data cannot be ensured. Therefore, when the number of matching times is less than two times, the number of matching times is increased once.

参照图3,图3为本实施例中的数据更新流程图。Referring to FIG. 3, FIG. 3 is a flow chart of data updating in this embodiment.

图3中,在获取调度策略的相关数据后,经过tx过滤器进行过滤,该过滤过程与上述阐述内容相同,在此不再赘述,在对数据过滤完成后,对该数据进行解析,该解析过程包括解析调度策略以及用户态传输过来的数据包,计算调度策略的第二哈希值,并根据第二哈希值,从预设缓存表中确定出第二键值组,并根据第二键值组,从预设缓存表中确定待更新数据包,并将调度策略的相关数据和预设缓存表中的数据、待更新数据包的数据进行匹配,确定是否一致,在数据不一致时,对预设缓存表和待更新数据包进行更新,并标记该更新过程的匹配次数为一次,而在数据一致时,则进一步判断匹配次数是否大于或等于两次,在匹配次数大于或等于两次时,即标记更新后的数据有效,而匹配次数小于两次时,在当前的匹配次数上增加一次,以使得在后续判断匹配次数时,保证后续匹配次数满足有效性的判断,保证有效的数据能够在预设缓存表中使用,而匹配次数不超过两次的数据则为无效数据,在内核态对待调度数据包进行匹配时,不使用在预设缓存表中存在的该类型数据。In Figure 3, after obtaining the relevant data of the scheduling policy, it is filtered through the tx filter. The filtering process is the same as the content described above, and will not be repeated here. The process includes parsing the scheduling policy and the data packets transmitted from the user mode, calculating the second hash value of the scheduling policy, and determining the second key-value group from the preset cache table according to the second hash value, and according to the second The key-value group determines the data packet to be updated from the preset cache table, and matches the relevant data of the scheduling policy with the data in the preset cache table and the data of the data packet to be updated to determine whether they are consistent. When the data is inconsistent, Update the preset cache table and the data package to be updated, and mark the number of matches in the update process as one, and when the data is consistent, further judge whether the number of matches is greater than or equal to two, and if the number of matches is greater than or equal to two , that is, the updated data is valid, and when the number of matches is less than twice, add one time to the current number of matches, so that when the number of matches is subsequently judged, the subsequent number of matches is guaranteed to meet the validity judgment and valid data It can be used in the preset cache table, and the data whose matching times do not exceed two times is invalid data. When the data packet to be scheduled is matched in the kernel state, this type of data existing in the preset cache table is not used.

在本实施例中,在匹配为得到第一目的地址时,对待调度数据包进行初始化处理,将该待调度数据包的相关数据存储在预设缓存表中,并将初始化处理后的待调度数据包输出至用户态,在用户态根据该待调度数据包制定出调度策略后,获取该调度策略中的第二目的地址,并将该第二目的地址存储在预设缓存表中,从而保证在后续内核态处理该类待调度数据包时,在预设缓存表中匹配到第二目的地址,进而达到内核态针对用户态的调度策略进行自学习的过程,避免后续转发该类待调度数据包时需要内核态与用户态之间进行多次数据拷贝的过程,因而,以自学习的方式,记录用户态的调度策略,提高后续数据包调度的性能。In this embodiment, when the matching is to obtain the first destination address, the data packet to be scheduled is initialized, the relevant data of the data packet to be scheduled is stored in the preset cache table, and the data packet to be scheduled is initialized The packet is output to the user mode, and after the user mode formulates a scheduling policy according to the data packet to be scheduled, the second destination address in the scheduling policy is obtained, and the second destination address is stored in the preset cache table, so as to ensure that When the subsequent kernel state processes this type of data packet to be scheduled, it matches the second destination address in the preset cache table, and then achieves the process of self-learning in the kernel state for the scheduling policy of the user state, avoiding subsequent forwarding of this type of data packet to be scheduled The process of multiple data copies between the kernel state and the user state is required. Therefore, the scheduling strategy of the user state is recorded in a self-learning manner to improve the performance of subsequent data packet scheduling.

示例性的,参照图4,图4是本申请数据包调度方法第三实施例的流程示意图,基于上述本申请数据包调度方法第一实施例和第二实施例,提出第三实施例:Exemplarily, referring to FIG. 4, FIG. 4 is a schematic flow chart of the third embodiment of the data packet scheduling method of the present application. Based on the above-mentioned first embodiment and the second embodiment of the data packet scheduling method of the present application, a third embodiment is proposed:

图4中包含用户态与内核态的数据处理过程和数据交互过程。Figure 4 includes the data processing process and data interaction process between the user state and the kernel state.

用户态中包含了制定调度策略的相关数据,因此,在用户态中存在数据调度系统,内核态在从用户态处获取到的调度策略均为数据调度系统制定而来的。The user state contains relevant data for formulating scheduling policies. Therefore, there is a data scheduling system in the user state, and the scheduling policies obtained by the kernel state from the user state are all formulated by the data scheduling system.

用户态与内核态之间存在网络协议栈作为信息交互保证,内核态直接与网络设备相连。There is a network protocol stack between the user state and the kernel state as an information exchange guarantee, and the kernel state is directly connected to the network device.

在内核态中包含两个数据处理模块,分别为入链处理模块和出链处理模块,在两个模块中分别执行不同的数据处理操作。There are two data processing modules in the kernel state, namely the in-chain processing module and the out-chain processing module, and different data processing operations are performed in the two modules.

内核态中的入链模块的数据处理过程如下:The data processing process of the in-chain module in the kernel mode is as follows:

在内核态通过XDP钩子获取外部数据包后,外部数据包通过rx过滤器,筛选出部分用于内核态直接转发的数据类型,并对筛选后的数据包进行匹配域计算,即匹配数据包与预设缓存表中的数据,在匹配得到目的地址即匹配通过后,将数据包传输至构造函数,对数据包进行构造、重定向,而在匹配计算时,无法匹配到相关目的地址时,会报MISS,即未匹配成功(在匹配成功时,会报HIT),即证明预设缓存表中不存在该数据包的相关数据,此时,对该数据包进行初始化处理,并通过网络协议栈,将该数据包输出至用户态的数据调度系统中。After the kernel state obtains the external data packet through the XDP hook, the external data packet passes through the rx filter to filter out some data types used for direct forwarding in the kernel state, and performs matching domain calculation on the filtered data packet, that is, the matching data packet and The data in the preset cache table, after the destination address is matched, the data packet is transmitted to the constructor, and the data packet is constructed and redirected. When the matching calculation fails to match the relevant destination address, it will MISS is reported, that is, the matching is not successful (when the matching is successful, HIT will be reported), that is, it proves that the relevant data of the data packet does not exist in the preset cache table. At this time, the data packet is initialized and passed through the network protocol stack. , output the data packet to the data scheduling system in user mode.

内核态的出链模块的数据处理过程如下:The data processing process of the out-of-chain module in the kernel mode is as follows:

在用户态的数据调度系统制定出数据包的调度策略后,通过tc钩子将该调度策略进行获取,该获取过程同样包括获取相关的数据包等数据,此时通过tx过滤器进行数据过滤,该过滤过程与rx过滤器的过滤过程相同,均为筛选出特定类型的数据包,在筛选后,并对调度策略进行解析,确定目的地址、哈希值等数据,并根据该数据与预设缓存表的匹配结果,进行相应的数据项进行更新,数据更新包括预设缓存表和待调度数据包等数据。After the data scheduling system in the user mode formulates the scheduling policy of the data packet, the scheduling policy is obtained through the tc hook. The obtaining process also includes obtaining relevant data packets and other data. At this time, the data is filtered through the tx filter. The filtering process is the same as that of the rx filter, which filters out specific types of data packets. After filtering, the scheduling policy is analyzed to determine the destination address, hash value and other data, and according to the data and the preset cache The corresponding data item is updated according to the matching result of the table, and the data update includes data such as a preset cache table and data packets to be scheduled.

在本实施例中,通过入链处理模块,直接在内核态进行数据包的转发,通过出链处理模块,使得内核态进行用户态的调度策略自学习,使得内核态保存更多的调度策略,以应对不同的数据包,避免用户态和内核态之间的多次数据拷贝。In this embodiment, through the in-chain processing module, data packets are directly forwarded in the kernel state, and through the out-of-chain processing module, the kernel state performs self-learning of the scheduling strategy of the user state, so that the kernel state saves more scheduling strategies, To deal with different data packets, avoid multiple data copies between user mode and kernel mode.

此外,本申请还提供一种数据包调度装置,所述一种数据包调度装置包括:In addition, the present application also provides a data packet scheduling device, and the data packet scheduling device includes:

获取模块,用于获取外部数据包;An acquisition module, used to acquire external data packets;

确定模块,用于基于预设数据类型,确定所述外部数据包中的待调度数据包;A determining module, configured to determine a data packet to be scheduled in the external data packet based on a preset data type;

匹配模块,用于将所述待调度数据包与预设缓存表中的数据进行匹配;A matching module, configured to match the data packet to be scheduled with the data in the preset cache table;

判断模块,用于若匹配得到所述预设缓存表中与所述待调度数据包对应的第一目的地址,则对所述待调度数据包进行重定向处理,并转发重定向后的待调度数据包至所述第一目的地址。A judging module, configured to perform redirection processing on the data packet to be scheduled and forward the redirected data packet to be scheduled if the first destination address corresponding to the data packet to be scheduled in the preset cache table is matched. The data packet is sent to the first destination address.

示例性的,所述匹配模块包括:Exemplarily, the matching module includes:

第一判断子模块,用于若未匹配得到第一目的地址,则对所述待调度数据包进行初始化处理,并输出初始化后的待调度数据包至用户态;The first judging submodule is used to initialize the data packet to be scheduled if the first destination address is not matched, and output the initialized data packet to be scheduled to the user state;

获取子模块,用于在所述用户态制定出所述初始化后的待调度数据包的调度策略后,获取所述调度策略的第二目的地址;The obtaining submodule is used to obtain the second destination address of the scheduling policy after the scheduling policy of the initialized data packet to be scheduled is formulated in the user state;

更新子模块,用于更新所述第二目的地址至所述预设缓存表,以保证所述初始化后的待调度数据包与所述预设缓存表匹配得到所述第二目的地址。The update submodule is configured to update the second destination address to the preset cache table, so as to ensure that the initialized data packet to be scheduled matches the preset cache table to obtain the second destination address.

示例性的,所述判断子模块包括:Exemplarily, the judging submodule includes:

判断单元,用于若未匹配得到第一目的地址,则计算所述待调度数据包的第一哈希值和第一键值组;A judging unit, configured to calculate the first hash value and the first key value group of the data packet to be scheduled if the first destination address is not matched;

第一更新单元,用于更新所述第一哈希值和所述第一键值组的数据至所述预设缓存表,以完成所述待调度数据包的初始化处理。A first update unit, configured to update the first hash value and the data of the first key value group to the preset cache table, so as to complete the initialization process of the data packet to be scheduled.

示例性的,所述更新子模块包括:Exemplarily, the update submodule includes:

解析单元,用于对所述调度策略进行解析,得到解析后的第二目的地址和第二哈希值;A parsing unit, configured to parse the scheduling policy to obtain a parsed second destination address and a second hash value;

匹配单元,用于在所述预设缓存表中匹配与所述第二哈希值对应的第二键值组;a matching unit, configured to match a second key-value group corresponding to the second hash value in the preset cache table;

确定单元,用于基于所述第二键值组,确定待更新数据包;a determining unit, configured to determine the data package to be updated based on the second key-value group;

第二更新单元,用于更新所述第二目的地址至所述待更新数据包,以及更新所述第二目的地址至所述预设缓存表。A second updating unit, configured to update the second destination address to the data packet to be updated, and update the second destination address to the preset cache table.

示例性的,所述第二更新单元包括:Exemplarily, the second updating unit includes:

确定子单元,用于基于所述第二哈希值和所述第二键值组,确定所述预设缓存表中的所述第二目的地址和所述待更新数据包是否一致;A determination subunit, configured to determine whether the second destination address in the preset cache table is consistent with the data packet to be updated based on the second hash value and the second key value group;

第一判断子单元,用于若不一致,则更新所述第二目的地址至所述待更新数据包,以及更新所述第二目的地址至所述预设缓存表,并标记更新过程的匹配次数为一次;The first judging subunit is configured to update the second destination address to the data packet to be updated if inconsistent, update the second destination address to the preset cache table, and mark the number of matches in the update process for one time;

第二判断子单元,用于若一致,则确定所述第二目的地址和所述待更新数据包的匹配次数;The second judging subunit is configured to determine the number of matches between the second destination address and the data packet to be updated if they are consistent;

第三判断子单元,用于若所述匹配次数大于或等于两次,则标记所述待更新数据包有效;A third judging subunit, configured to mark the data packet to be updated as valid if the number of matches is greater than or equal to two;

第四判断子单元,用于若所述匹配次数小于两次,则增加一次匹配次数。The fourth judging subunit is configured to increase the matching times by one if the matching times are less than two times.

示例性的,所述匹配模块包括:Exemplarily, the matching module includes:

计算子模块,用于计算得到所述待调度数据包的键值数据:所述键值数据包括协议、源端口、目的端口和源地址;A calculation submodule, configured to calculate key-value data of the data packet to be scheduled: the key-value data includes protocol, source port, destination port and source address;

组合子模块,用于将所述键值数据中的至少两个数据进行组合,得到检索键值;A combination submodule, configured to combine at least two data in the key-value data to obtain a retrieval key value;

匹配子模块,用于对所述检索键值与预设缓存表中的数据进行匹配。The matching submodule is used to match the retrieval key value with the data in the preset cache table.

示例性的,所述判断模块包括:Exemplarily, the judgment module includes:

第二判断子模块,用于若匹配得到所述预设缓存表中与所述待调度数据包对应的第一目的地址,则将所述待调度数据包传输至构造函数,以供所述构造函数使用所述第一目的地址更新至所述待调度数据包,以及使用当前节点数据更新所述待调度数据包的源端口和源地址。The second judging submodule is configured to transmit the to-be-scheduled data packet to the constructor if the first destination address corresponding to the to-be-scheduled data packet in the preset cache table is matched, for the construction The function uses the first destination address to update the to-be-scheduled data packet, and uses current node data to update the source port and source address of the to-be-scheduled data packet.

本申请数据包调度装置具体实施方式与上述数据包调度方法各实施例基本相同,在此不再赘述。The specific implementation manners of the data packet scheduling device of the present application are basically the same as the embodiments of the above data packet scheduling method, and will not be repeated here.

此外,本申请还提供一种数据包调度设备。如图5所示,图5是本申请实施例方案涉及的硬件运行环境的结构示意图。In addition, the present application also provides a data packet scheduling device. As shown in FIG. 5 , FIG. 5 is a schematic structural diagram of a hardware operating environment involved in the solution of the embodiment of the present application.

示例性的,图5即可为数据包调度设备的硬件运行环境的结构示意图。Exemplarily, FIG. 5 is a schematic structural diagram of a hardware operating environment of a data packet scheduling device.

如图5所示,该数据包调度设备可以包括处理器501、通信接口502、存储器503和通信总线504,其中,处理器501、通信接口502和存储器503通过通信总线504完成相互间的通信,存储器503,用于存放计算机程序;处理器501,用于执行存储器503上所存放的程序时,实现数据包调度方法的步骤。As shown in FIG. 5, the data packet scheduling device may include a processor 501, a communication interface 502, a memory 503, and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 complete mutual communication through the communication bus 504, The memory 503 is used to store computer programs; the processor 501 is used to implement the steps of the data packet scheduling method when executing the programs stored in the memory 503 .

上述数据包调度设备提到的通信总线504可以是外设部件互连标准(PeripheralComponent Interconnect,PCI)总线或扩展工业标准结构(Extended Industry StandardArchitecture,EISA)总线等。该通信总线504可以分为地址总线、数据总线和控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The communication bus 504 mentioned in the above data packet scheduling device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (Extended Industry Standard Architecture, EISA) bus or the like. The communication bus 504 can be divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

通信接口502用于上述数据包调度设备与其他设备之间的通信。The communication interface 502 is used for communication between the data packet scheduling device and other devices.

存储器503可以包括随机存取存储器(Random Access Memory,RMD),也可以包括非易失性存储器(Non- Volatile Memory,NM),例如至少一个磁盘存储器。可选的,存储器503还可以是至少一个位于远离前述处理器501的存储装置。The memory 503 may include a random access memory (Random Access Memory, RMD), and may also include a non-volatile memory (Non-Volatile Memory, NM), such as at least one disk memory. Optionally, the memory 503 may also be at least one storage device located away from the aforementioned processor 501 .

上述的处理器501可以是通用处理器,包括中央处理器(Central ProcessingUnit,CPU)、网络处理器( Network Processor,NP)等;还可以是数字信号处理器(DigitalSignal Processor,DSP)、专用集成电路( Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field- Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。The above-mentioned processor 501 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; it may also be a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

本申请数据包调度设备具体实施方式与上述数据包调度方法各实施例基本相同,在此不再赘述。The specific implementation manner of the data packet scheduling device of the present application is basically the same as the embodiments of the above data packet scheduling method, and will not be repeated here.

此外,本申请实施例还提出一种计算机可读存储介质,所述计算机可读存储介质上存储有数据包调度程序,所述数据包调度程序被处理器执行时实现如上所述的数据包调度方法的步骤。In addition, the embodiment of the present application also proposes a computer-readable storage medium, where a data packet scheduler is stored on the computer-readable storage medium, and when the data packet scheduler is executed by a processor, the above-mentioned data packet schedule is implemented. method steps.

本申请计算机可读存储介质具体实施方式与上述数据包调度方法各实施例基本相同,在此不再赘述。The specific implementation manners of the computer-readable storage medium of the present application are basically the same as the embodiments of the data packet scheduling method described above, and will not be repeated here.

需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。It should be noted that, as used herein, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or system comprising a set of elements includes not only those elements, It also includes other elements not expressly listed, or elements inherent in the process, method, article, or system. Without further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article or system comprising that element.

上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The serial numbers of the above embodiments of the present application are for description only, and do not represent the advantages and disadvantages of the embodiments.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is better implementation. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product in essence or the part that contributes to the prior art, and the computer software product is stored in a storage medium as described above (such as ROM/RAM , magnetic disk, optical disk), including several instructions to enable a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present application.

以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structures or equivalent process transformations made by using the description of the application and the accompanying drawings are directly or indirectly used in other related technical fields. , are all included in the patent protection scope of the present application in the same way.

Claims (10)

1.一种数据包调度方法,其特征在于,所述数据包调度方法包括以下步骤:1. A packet scheduling method, characterized in that, the packet scheduling method comprises the following steps: 获取外部数据包;Get external data packets; 确定所述外部数据包中符合预设数据类型的待调度数据包;Determine the data packets to be scheduled that meet the preset data types in the external data packets; 将所述待调度数据包与预设缓存表中的数据进行匹配;Matching the data packet to be scheduled with the data in the preset cache table; 若匹配得到所述预设缓存表中与所述待调度数据包对应的第一目的地址,则对所述待调度数据包进行重定向处理,并转发重定向后的待调度数据包至所述第一目的地址。If the first destination address corresponding to the to-be-scheduled data packet in the preset cache table is matched, then the to-be-scheduled data packet is redirected, and the redirected to-be-scheduled data packet is forwarded to the The first destination address. 2.如权利要求1所述的数据包调度方法,其特征在于,所述将所述待调度数据包与预设缓存表中的数据进行匹配之后,包括:2. The data packet scheduling method according to claim 1, wherein, after matching the data packet to be scheduled with the data in the preset cache table, the method includes: 若未匹配得到第一目的地址,则对所述待调度数据包进行初始化处理,并输出初始化后的待调度数据包至用户态;If the first destination address is not matched, perform initialization processing on the to-be-scheduled data packet, and output the initialized to-be-scheduled data packet to the user state; 在所述用户态制定出所述初始化后的待调度数据包的调度策略后,获取所述调度策略的第二目的地址;After formulating the scheduling policy of the initialized data packet to be scheduled in the user state, acquiring the second destination address of the scheduling policy; 更新所述第二目的地址至所述预设缓存表,以保证所述初始化后的待调度数据包与所述预设缓存表匹配得到所述第二目的地址。updating the second destination address to the preset cache table to ensure that the initialized data packet to be scheduled matches the preset cache table to obtain the second destination address. 3.如权利要求2所述的数据包调度方法,其特征在于,所述若未匹配得到第一目的地址,则对所述待调度数据包进行初始化处理,包括:3. The data packet scheduling method according to claim 2, wherein if the first destination address is obtained without matching, then the data packet to be scheduled is initialized, including: 若未匹配得到第一目的地址,则计算所述待调度数据包的第一哈希值和第一键值组;If the first destination address is not matched, then calculate the first hash value and the first key value group of the data packet to be scheduled; 更新所述第一哈希值和所述第一键值组的数据至所述预设缓存表,以完成所述待调度数据包的初始化处理。Updating the data of the first hash value and the first key value group to the preset cache table, so as to complete the initialization process of the to-be-scheduled data packet. 4.如权利要求3所述的数据包调度方法,其特征在于,所述更新所述第二目的地址至所述预设缓存表,包括:4. The data packet scheduling method according to claim 3, wherein said updating said second destination address to said preset cache table comprises: 对所述调度策略进行解析,得到解析后的第二目的地址和第二哈希值;Analyzing the scheduling policy to obtain a parsed second destination address and a second hash value; 在所述预设缓存表中匹配与所述第二哈希值对应的第二键值组;matching a second key-value group corresponding to the second hash value in the preset cache table; 基于所述第二键值组,确定待更新数据包;Determine the data packet to be updated based on the second key-value group; 更新所述第二目的地址至所述待更新数据包,以及更新所述第二目的地址至所述预设缓存表。updating the second destination address to the data packet to be updated, and updating the second destination address to the preset cache table. 5.如权利要求4所述的数据包调度方法,其特征在于,所述更新所述第二目的地址至所述待更新数据包,以及更新所述第二目的地址至所述预设缓存表,包括:5. The data packet scheduling method according to claim 4, wherein the updating the second destination address to the data packet to be updated, and updating the second destination address to the preset cache table ,include: 基于所述第二哈希值和所述第二键值组,确定所述预设缓存表中的所述第二目的地址和所述待更新数据包是否一致;Based on the second hash value and the second key value group, determine whether the second destination address in the preset cache table is consistent with the data packet to be updated; 若不一致,则更新所述第二目的地址至所述待更新数据包,以及更新所述第二目的地址至所述预设缓存表,并标记更新过程的匹配次数为一次;If inconsistent, update the second destination address to the data packet to be updated, and update the second destination address to the preset cache table, and mark the number of matches in the update process as one; 若一致,则确定所述第二目的地址和所述待更新数据包的匹配次数;If they are consistent, then determine the number of matches between the second destination address and the data packet to be updated; 若所述匹配次数大于或等于两次,则标记所述待更新数据包有效;If the number of matches is greater than or equal to two times, then marking the data packet to be updated is valid; 若所述匹配次数小于两次,则增加一次匹配次数。If the matching times are less than two times, then add one matching times. 6.如权利要求1所述的数据包调度方法,其特征在于,所述将所述待调度数据包与预设缓存表中的数据进行匹配,包括:6. The packet scheduling method according to claim 1, wherein said matching said packet to be scheduled with data in a preset cache table comprises: 计算得到所述待调度数据包的键值数据:所述键值数据包括协议、源端口、目的端口和源地址;Calculate key-value data of the data packet to be scheduled: the key-value data includes protocol, source port, destination port and source address; 将所述键值数据中的至少两个数据进行组合,得到检索键值;combining at least two data in the key-value data to obtain the retrieval key-value; 对所述检索键值与预设缓存表中的数据进行匹配。The retrieval key value is matched with the data in the preset cache table. 7.如权利要求6所述的数据包调度方法,其特征在于,所述若匹配得到所述预设缓存表中与所述待调度数据包对应的第一目的地址,则对所述待调度数据包进行重定向处理,包括:7. The data packet scheduling method according to claim 6, wherein if the first destination address corresponding to the data packet to be scheduled in the preset cache table is obtained by matching, then the data packet to be scheduled is Packets are redirected, including: 若匹配得到所述预设缓存表中与所述待调度数据包对应的第一目的地址,则将所述待调度数据包传输至构造函数,以供所述构造函数使用所述第一目的地址更新至所述待调度数据包,以及使用当前节点数据更新所述待调度数据包的源端口和源地址。If the first destination address corresponding to the to-be-scheduled data packet in the preset cache table is matched, then the to-be-scheduled data packet is transmitted to the constructor, so that the constructor uses the first destination address update to the data packet to be scheduled, and update the source port and source address of the data packet to be scheduled by using the current node data. 8.一种数据包调度装置,其特征在于,所述数据包调度装置包括:8. A data packet scheduling device, characterized in that, the data packet scheduling device comprises: 获取模块,用于获取外部数据包;An acquisition module, used to acquire external data packets; 确定模块,用于基于预设数据类型,确定所述外部数据包中的待调度数据包;A determining module, configured to determine a data packet to be scheduled in the external data packet based on a preset data type; 匹配模块,用于将所述待调度数据包与预设缓存表中的数据进行匹配;A matching module, configured to match the data packet to be scheduled with the data in the preset cache table; 判断模块,用于若匹配得到所述预设缓存表中与所述待调度数据包对应的第一目的地址,则对所述待调度数据包进行重定向处理,并转发重定向后的待调度数据包至所述第一目的地址。A judging module, configured to perform redirection processing on the to-be-scheduled data packet and forward the redirected to-be-scheduled data packet if the first destination address corresponding to the to-be-scheduled data packet in the preset cache table is matched. The data packet is sent to the first destination address. 9.一种数据包调度设备,其特征在于,所述设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的数据包调度程序,所述数据包调度程序配置为实现如权利要求1至7中任一项所述的数据包调度方法的步骤。9. A data packet scheduling device, characterized in that the device includes: a memory, a processor, and a data packet scheduler stored on the memory and operable on the processor, the data packet scheduler It is configured to realize the steps of the data packet scheduling method according to any one of claims 1 to 7. 10.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有数据包调度程序,所述数据包调度程序被处理器执行时实现如权利要求1至7中任一项所述的数据包调度方法的步骤。10. A computer-readable storage medium, characterized in that, a data packet scheduler is stored on the computer-readable storage medium, and when the data packet scheduler is executed by a processor, any one of claims 1 to 7 is implemented. The steps of the packet scheduling method described in item.
CN202211439802.3A 2022-11-17 2022-11-17 Data packet scheduling method, device, device and readable storage medium Active CN115567590B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211439802.3A CN115567590B (en) 2022-11-17 2022-11-17 Data packet scheduling method, device, device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211439802.3A CN115567590B (en) 2022-11-17 2022-11-17 Data packet scheduling method, device, device and readable storage medium

Publications (2)

Publication Number Publication Date
CN115567590A true CN115567590A (en) 2023-01-03
CN115567590B CN115567590B (en) 2023-03-10

Family

ID=84769680

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211439802.3A Active CN115567590B (en) 2022-11-17 2022-11-17 Data packet scheduling method, device, device and readable storage medium

Country Status (1)

Country Link
CN (1) CN115567590B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115842789A (en) * 2023-02-23 2023-03-24 鹏城实验室 Data packet scheduling method and device and readable storage medium
CN117082142A (en) * 2023-08-03 2023-11-17 鹏城实验室 Data packet caching method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015180649A1 (en) * 2014-05-30 2015-12-03 华为技术有限公司 Method for moving data between storage devices, controller and storage system
CN106856455A (en) * 2016-12-27 2017-06-16 京信通信技术(广州)有限公司 A kind of method and apparatus of GTPU user face datas forwarding
CN107360268A (en) * 2017-06-23 2017-11-17 北京奇艺世纪科技有限公司 A kind of data package processing method, device and equipment
CN111262784A (en) * 2020-01-13 2020-06-09 杭州朗和科技有限公司 Message forwarding method, message forwarding device, storage medium and electronic equipment
CN113986811A (en) * 2021-09-23 2022-01-28 北京东方通网信科技有限公司 High-performance kernel-mode network data packet acceleration method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2015180649A1 (en) * 2014-05-30 2015-12-03 华为技术有限公司 Method for moving data between storage devices, controller and storage system
CN106856455A (en) * 2016-12-27 2017-06-16 京信通信技术(广州)有限公司 A kind of method and apparatus of GTPU user face datas forwarding
CN107360268A (en) * 2017-06-23 2017-11-17 北京奇艺世纪科技有限公司 A kind of data package processing method, device and equipment
CN111262784A (en) * 2020-01-13 2020-06-09 杭州朗和科技有限公司 Message forwarding method, message forwarding device, storage medium and electronic equipment
CN113986811A (en) * 2021-09-23 2022-01-28 北京东方通网信科技有限公司 High-performance kernel-mode network data packet acceleration method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115842789A (en) * 2023-02-23 2023-03-24 鹏城实验室 Data packet scheduling method and device and readable storage medium
CN117082142A (en) * 2023-08-03 2023-11-17 鹏城实验室 Data packet caching method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN115567590B (en) 2023-03-10

Similar Documents

Publication Publication Date Title
CN115567590B (en) Data packet scheduling method, device, device and readable storage medium
US20220100852A1 (en) Distributed security introspection
US20030231632A1 (en) Method and system for packet-level routing
CN108363621B (en) Message forwarding method and device under numa architecture, storage medium and electronic equipment
US8631465B2 (en) Terminal of an environment management station and a service user provided a service, method for processing an evaluation value of a terminal, a service request and a service providing
CN108476179A (en) Simplified quadrature network set of strategies selection
CN110830564A (en) CDN scheduling method, apparatus, system, and computer-readable storage medium
US20170034058A1 (en) Pipeline table identification
CN105939284B (en) The matching process and device of message control strategy
US10911583B1 (en) System and method for processing a network message
CN109672558A (en) A kind of polymerization and Method of Optimal Matching towards third party's service resource, equipment and storage medium
CN111181964A (en) Security policy matching method and device, network device and storage medium
WO2021017907A1 (en) Method and device for optimized inter-microservice communication
WO2023219718A1 (en) Re-simulation of updated sdn connection flows
JP2002016623A (en) Method and system for downloading a software management tree in a network processing system
WO2025167849A1 (en) Method and apparatus for implementing data service, electronic device, and storage medium
US7293158B2 (en) Systems and methods for implementing counters in a network processor with cost effective memory
JP2009077030A (en) Rule controller, rule control method, and rule control program
CN106598747A (en) Network data package parallel processing method and device
US20240356858A1 (en) Flow table aging method and device, computer apparatus and storage medium
US8806059B1 (en) Rule tree for network device
CN104506440B (en) The data packet sending method and routing table amending method of router
JP2006508597A (en) Method and computer system for triggering action based on digital communication data
US20050100019A1 (en) Rule based packet processing engine
JP6623702B2 (en) A network monitoring device and a virus detection method in the network monitoring 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
GR01 Patent grant
GR01 Patent grant