WO2015143904A1 - Method for managing parallel user mode protocol stacks and protocol stack system - Google Patents

Method for managing parallel user mode protocol stacks and protocol stack system Download PDF

Info

Publication number
WO2015143904A1
WO2015143904A1 PCT/CN2014/095248 CN2014095248W WO2015143904A1 WO 2015143904 A1 WO2015143904 A1 WO 2015143904A1 CN 2014095248 W CN2014095248 W CN 2014095248W WO 2015143904 A1 WO2015143904 A1 WO 2015143904A1
Authority
WO
WIPO (PCT)
Prior art keywords
instance
load
protocol stack
migrated
determining
Prior art date
Application number
PCT/CN2014/095248
Other languages
French (fr)
Chinese (zh)
Inventor
戴芬
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2015143904A1 publication Critical patent/WO2015143904A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system

Definitions

  • the instance identifier Determining, according to the instance identifier and the instance load average, an operation state of an instance corresponding to each protocol stack in the user state protocol stack,
  • the instance identifier is used to represent instances of a viable state
  • the instance identifier is stored in the shared memory region or a shared file, an identifier which corresponds to one example of the instance.
  • the method further includes: terminating the first instance.
  • the protocol control block PCB corresponding to the at least one load to be migrated in the shared resource pool in the first instance is in the second
  • the rebuilding the at least one load to be migrated in the example is implemented as follows: the second load corresponding to the second load of the at least one load to be migrated in the first instance is in the second PCB corresponding to the shared resource pool, and the second load is in the first
  • the binding rule of the second RSS queue bound in the instance is modified to be bound to the second load of the second instance, so that the second instance implements a process of receiving and processing data packets from the second RSS queue;
  • the second load is bound in the first instance in the first instance.
  • determining that the at least one to-be-migrated load in the first instance is specifically implemented as Determining that the third load in the first instance is the load to be migrated of the first instance, where the third RSS queue bound by the third load in the first instance satisfies the following condition: when the third RSS queue When the second instance is bound to the second instance, at least two of the three parameters of the number of connections, the number of received bytes, and the number of transmitted bytes are not greater than the corresponding parameters of the first instance.
  • system further includes: an instance stopping unit, configured to terminate the first instance.
  • FIG. 8 is a schematic diagram of still another structure of a protocol stack system according to an embodiment of the present invention.
  • the first instance is an instance of a running state abnormality
  • the second instance has a capability of moving into at least one load to be migrated in the first instance.
  • the protocol stack only stores some basic information of the PCB, such as a PCB identifier.
  • the shared resource pool stores the key data structure of the PCB, mainly including the connection structure information, which has a key role for quick response recovery connection.
  • the second instance interfaces with an upper layer service of the user state protocol stack.
  • FIG. 4 is a schematic flow chart of thread load balancing according to an embodiment of the present invention.
  • the first instance unbinds the queue of the migrated load.
  • the thread corresponding to the stack4 may obtain the information of the PCB4 from the protocol control block allocation pool PCB Alloc according to the identification information of the PCB4 in the second indication message or the identification information of the load corresponding to the PCB4, and based on the information of the PCB4.
  • the load corresponding to the stack4 rebuilds the load, and the RSS queue bound by the load corresponding to the PCB4 is bound to the load corresponding to the thread PCB4 corresponding to the stack4.
  • step S501 the protocol stack system monitors the high-order running of the thread corresponding to stack1 through the common thread (Common Thread), and the thread corresponding to stack2 and stack3 does not have the ability to move into the load.
  • Common Thread Common Thread
  • the Common Thread may send a first notification (notify) message to the thread corresponding to the stack1, indicating that the thread corresponding to the stack1 determines the migration load and releases the binding to the migration load. Binding of the RSS queue.
  • the running state of the instance includes the load state and the survival state of the instance.
  • the memory 803 is configured to store a program.
  • the program can include program code, the program code including computer operating instructions.
  • the memory 803 may include a high speed RAM memory and may also include a non-volatile memory such as at least one disk memory.
  • the one instance corresponds to a protocol stack in the user state protocol stack
  • the first instance is an instance of an abnormal running state
  • the second instance has the capability of moving into at least one load to be migrated in the first instance
  • the to-be-migrated load corresponds to a protocol control block PCB in the protocol stack corresponding to the first instance
  • the PCB corresponds to a PCB storing the connection parameters of the load to be migrated in the shared resource pool, and the load to be migrated
  • the connection parameters can be used to reconstruct the load to be migrated.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Computer And Data Communications (AREA)

Abstract

Embodiments of the present invention provide a method for managing parallel user mode protocol stacks and a protocol stack system, and the method comprises: monitoring the running state of the instance corresponding to each protocol stack of the user mode protocol stacks, one instance corresponding to one protocol stack of the user mode protocol stacks; determining a first instance and a second instance, wherein the first instance is the instance in an abnormal running state, and the second instance has the capability of moving into at least one load to be migrated in the first instance; and re-establishing the at least one load to be migrated in the second instance according to a PCB in a shared resource pool, wherein the PCB corresponds to the at least one load to be migrated in the first instance. In the embodiments of the present invention, as the load to be migrated is reestablished in the instance with the capacity of moving into the load according to the PCB in the shared resource pool, wherein the PCB corresponds to the load to be migrated in the abnormal instance, the system distributing bottleneck caused by the protocol stacks sharing one distributing module is overcome, and the load balance and failure recovery are quickly performed, and therefore the performance of the protocol stack system is improved.

Description

并行用户态协议栈的管理方法和协议栈系统Parallel user state protocol stack management method and protocol stack system 技术领域Technical field
本发明实施例涉及计算机领域,并且更具体地,涉及一种并行用户态协议栈的管理方法和协议栈系统。Embodiments of the present invention relate to the field of computers, and, more particularly, to a management method and a protocol stack system for a parallel user state protocol stack.
背景技术Background technique
随着以太网技术的发展,10G、40G网卡的出现和普及,传统基于单核的协议栈已经无法跟上网卡速度的需要。此外,处理器体系结构已从强调高频单处理器发展到多核多处理器,计算机的并行处理能力越来越强。With the development of Ethernet technology, the emergence and popularity of 10G and 40G network cards, the traditional single-core based protocol stack has been unable to meet the needs of network card speed. In addition, the processor architecture has evolved from emphasizing high-frequency single-processors to multi-core multi-processors, and the parallel processing power of computers is growing.
现有技术中,数据包在多个协议栈实例之间分发时,采用公用的分发模块以连接作为粒度进行数据分发,分发模块可能成为系统的分发瓶颈,在负载均衡和负载故障恢复时需要维护大量的数据,消耗较多的系统时间,不利于负载的连接数据的快速恢复。在并行协议栈中如何快速进行负载均衡和故障恢复,是需要考虑解决的问题。In the prior art, when a data packet is distributed among multiple protocol stack instances, a public distribution module is used to distribute data as a granularity. The distribution module may become a distribution bottleneck of the system, and needs maintenance during load balancing and load failure recovery. A large amount of data consumes a lot of system time, which is not conducive to the rapid recovery of the connection data of the load. How to quickly perform load balancing and fault recovery in the parallel protocol stack is a problem that needs to be considered.
发明内容Summary of the invention
本发明实施例提供一种并行用户态协议栈的管理方法和协议栈系统,能够克服协议栈共用一个分发模块带来的系统分发瓶颈,快速进行负载均衡和故障恢复,提高协议栈系统的性能。The embodiment of the invention provides a management method and a protocol stack system for a parallel user state protocol stack, which can overcome the system distribution bottleneck caused by a distribution module sharing a distribution module, quickly perform load balancing and fault recovery, and improve performance of the protocol stack system.
第一方面,提供了一种并行用户态协议栈的管理方法,该方法包括:监控用户态协议栈中每个协议栈对应的实例的运行状态,一个该实例对应于该用户态协议栈中的一个协议栈;确定第一实例和第二实例,其中该第一实例为运行状态异常的实例,该第二实例具备迁入该第一实例中至少一个待迁移负载的能力,一个该待迁移负载在该第一实例所对应的协议栈内对应于一个协议控制块PCB,该PCB在共享资源池中对应于一个存储着该待迁移负载连接参数的PCB,该待迁移负载的连接参数能够用于重建该待迁移负载;根据该第一实例中至少一个待迁移负载在该共享资源池中所对应的PCB在该第二实例中重建该至少一个待迁移负载。 In a first aspect, a method for managing a parallel user state protocol stack is provided. The method includes: monitoring an operating state of an instance corresponding to each protocol stack in a user state protocol stack, where the instance corresponds to the user state protocol stack. a protocol stack; the first instance and the second instance are determined, wherein the first instance is an instance of an abnormal running state, and the second instance has the capability of migrating to at least one load to be migrated in the first instance, and the load to be migrated Corresponding to a protocol control block PCB in the protocol stack corresponding to the first instance, the PCB corresponds to a PCB storing the load connection parameters to be migrated in the shared resource pool, and the connection parameter of the load to be migrated can be used for Rebuilding the load to be migrated; and reconstructing the at least one load to be migrated in the second instance according to the PCB corresponding to the at least one load to be migrated in the shared resource pool in the first instance.
结合第一方面,在第一种可能的实现方式中,在该根据该第一实例中至少一个待迁移负载在共享资源池中所对应的协议控制块PCB在该第二实例中重建该至少一个待迁移负载之前,该方法还包括:确定该第一实例中的至少一个待迁移负载。With reference to the first aspect, in a first possible implementation, the protocol control block PCB corresponding to the at least one load to be migrated in the shared resource pool according to the first instance rebuilds the at least one in the second instance Before the load is to be migrated, the method further includes: determining at least one load to be migrated in the first instance.
结合第一方面的第一种可能的实现方式,在第二种可能的实现方式中,该实例的运行状态包括实例的负载状态和存活状态,该监控用户态协议栈中每个协议栈对应的实例的运行状态包括:分别向该用户态协议栈中每个协议栈对应的实例发送心跳消息并监控该心跳消息响应时延,并监控该用户态协议栈中每个协议栈对应的实例在第一预定时间内的实例负载均值,以根据该心跳消息的响应时延和该实例负载均值确定该用户态协议栈中每个协议栈对应的实例的运行状态,其中,一条心跳消息对应于一个该实例;或者分别轮询该用户态协议栈中每个协议栈对应的实例的实例标识,并监控该用户态协议栈中每个协议栈对应的实例在第一预定时间内的实例负载均值,以根据该实例标识和该实例负载均值确定该用户态协议栈中每个协议栈对应的实例的运行状态,其中,该实例标识用于表示实例的存活状态,该实例标识存储于共享内存区域或共享文件,一个该实例标识对应于一个该实例。With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner, the running state of the instance includes a load state and a survival state of the instance, where each protocol stack in the monitoring user state protocol stack corresponds to The running state of the instance includes: sending a heartbeat message to the instance corresponding to each protocol stack in the user state protocol stack, and monitoring the heartbeat message response delay, and monitoring an instance corresponding to each protocol stack in the user state protocol stack. An instance load average value for a predetermined time period to determine an operation state of an instance corresponding to each protocol stack in the user mode protocol stack according to the response delay of the heartbeat message and the instance load average value, wherein one heartbeat message corresponds to one An instance identifier of the instance corresponding to each protocol stack in the user-mode protocol stack is separately polled, and an instance load average of the instance corresponding to each protocol stack in the user-mode protocol stack in the first predetermined time is monitored. Determining, according to the instance identifier and the instance load average, an operation state of an instance corresponding to each protocol stack in the user state protocol stack, In the instance identifier is used to represent instances of a viable state, the instance identifier is stored in the shared memory region or a shared file, an identifier which corresponds to one example of the instance.
结合第一方面的第二种可能的实现方式,在第三种可能的实现方式中,确定第一实例具体实现为:确定距离发送心跳消息时刻达到第二预定时间后仍然未反馈心跳响应的实例为该第一实例;或者,确定第一预定时间内实例标识表示僵死或失效状态的实例为该第一实例。With reference to the second possible implementation manner of the first aspect, in a third possible implementation manner, determining that the first instance is specifically implemented as: determining an example that the heartbeat response is not fed back after the second predetermined time is reached after the heartbeat message is sent. For the first instance; or, determining that the instance identifier indicates a dead or dead state in the first predetermined time is the first instance.
结合第一方面的第三种可能的实现方式,在第四种可能的实现方式中,确定第二实例具体实现为创建并确定新的实例为该第二实例;此时,根据该第一实例中至少一个待迁移负载在共享资源池中所对应的协议控制块PCB在该第二实例中重建该至少一个待迁移负载具体实现为:根据该至少一个待迁移负载之第一负载在共享资源池中所对应的第一PCB在该第二实例中实现该第一负载与该用户态协议栈的上层服务的对接,并将该第一负载在该第一实例中绑定的第一接收端扩展RSS队列重绑定到该第二实例的该第一负载中,其中,该至少一个待迁移负载包括该第一实例的所有负载。In conjunction with the third possible implementation of the first aspect, in a fourth possible implementation, determining that the second instance is specifically implemented to create and determine that the new instance is the second instance; The protocol control block PCB corresponding to the at least one load to be migrated in the shared resource pool rebuilds the at least one load to be migrated in the second instance, and is implemented as: according to the first load of the at least one load to be migrated in the shared resource pool The first PCB corresponding to the first PCB implements the docking of the first load with the upper layer service of the user state protocol stack in the second instance, and expands the first load end of the first load bound in the first instance. The RSS queue is rebinded into the first load of the second instance, wherein the at least one load to be migrated includes all loads of the first instance.
结合第一方面的第四种可能的实现方式,在第五种可能的实现方式中,该方法还包括:终止该第一实例。In conjunction with the fourth possible implementation of the first aspect, in a fifth possible implementation, the method further includes: terminating the first instance.
结合第一方面的第二种可能的实现方式,在第六种可能的实现方式中, 确定第一实例具体实现为:确定第一预定时间内实例总负载均值大于第一预定阈值的实例为该第一实例。In conjunction with the second possible implementation of the first aspect, in a sixth possible implementation, Determining that the first instance is specifically implemented is: determining that the instance total load average value in the first predetermined time is greater than the first predetermined threshold is the first instance.
结合第一方面的第六种可能的实现方式,在第七种可能的实现方式中,确定第二实例具体实现为:如果存在第一预定时间内实例总负载均值低于第二预定阈值的实例,则确定该第一预定时间内实例总负载均值低于第二预定阈值的一个或多个实例作为该第二实例,其中,迁入该第二实例的所有负载的负载值与该第二预定阈值之和小于该第一预定阈值。With reference to the sixth possible implementation manner of the first aspect, in a seventh possible implementation manner, determining that the second instance is specifically implemented as: if there is an instance that the average total load of the instance is lower than the second predetermined threshold in the first predetermined time And determining, as the second instance, one or more instances in which the average total load of the instance in the first predetermined time is lower than a second predetermined threshold, wherein a load value of all loads moved into the second instance is related to the second predetermined The sum of the thresholds is less than the first predetermined threshold.
结合第一方面的第七种可能的实现方式,在第八种可能的实现方式中,根据该第一实例中至少一个待迁移负载在共享资源池中所对应的协议控制块PCB在该第二实例中重建该至少一个待迁移负载具体实现为:根据该第一实例的至少一个待迁移负载之第二负载在该共享资源池中所对应的第二PCB,将该第二负载在该第一实例中绑定的第二RSS队列的绑定规则修改为绑定到该第二实例的第二负载中,以使得该第二实例实现从该第二RSS队列进行数据包接收及处理的过程;或者,根据该第一实例的至少一个待迁移负载之第二负载在该共享资源池中所对应的第二PCB,在该第一实例中解除该第二负载在该第一实例中绑定的第二RSS队列,并在该第二实例中将该第二RSS队列绑定到该第二负载中,以使得该第二实例实现从该第二RSS队列进行数据包接收及处理的过程。In conjunction with the seventh possible implementation of the first aspect, in an eighth possible implementation, the protocol control block PCB corresponding to the at least one load to be migrated in the shared resource pool in the first instance is in the second The rebuilding the at least one load to be migrated in the example is implemented as follows: the second load corresponding to the second load of the at least one load to be migrated in the first instance is in the second PCB corresponding to the shared resource pool, and the second load is in the first The binding rule of the second RSS queue bound in the instance is modified to be bound to the second load of the second instance, so that the second instance implements a process of receiving and processing data packets from the second RSS queue; Or, according to the second PCB corresponding to the second load of the at least one load to be migrated in the first instance, the second load is bound in the first instance in the first instance. a second RSS queue, and binding the second RSS queue to the second payload in the second instance, such that the second instance implements a process of receiving and processing data packets from the second RSS queue.
结合第一方面的第七种可能的实现方式或第一方面的第八种可能的实现方式,在第九种可能的实现方式中,确定该第一实例中的至少一个待迁移负载具体实现为:确定该第一实例中的第三负载为该第一实例的待迁移负载,其中该第三负载在该第一实例中所绑定的第三RSS队列满足以下条件:当该第三RSS队列绑定到该第二实例时该第二实例的连接数、接收字节数、发送字节数3个参数中至少有2个参数不大于该第一实例的相应参数。With reference to the seventh possible implementation manner of the first aspect or the eighth possible implementation manner of the first aspect, in a ninth possible implementation manner, determining that the at least one to-be-migrated load in the first instance is specifically implemented as Determining that the third load in the first instance is the load to be migrated of the first instance, where the third RSS queue bound by the third load in the first instance satisfies the following condition: when the third RSS queue When the second instance is bound to the second instance, at least two of the three parameters of the number of connections, the number of received bytes, and the number of transmitted bytes are not greater than the corresponding parameters of the first instance.
结合第一方面的第六种可能的实现方式,在第十种可能的实现方式中,确定第二实例具体实现为:如果不存在预定时间内实例总负载均值低于第二预定阈值的实例,则创建并确定新的实例为该第二实例。With reference to the sixth possible implementation manner of the first aspect, in the tenth possible implementation manner, determining that the second instance is specifically implemented is: if there is no instance in which the total instance load average value is lower than the second predetermined threshold in a predetermined time, Then create and determine the new instance as the second instance.
结合第一方面的第十种可能的实现方式,在第十一种可能的实现方式中,根据该第一实例中至少一个待迁移负载在共享资源池中所对应的协议控制块PCB在该第二实例中重建该至少一个待迁移负载具体实现为:根据该第一实例的至少一个待迁移负载之第二负载在该共享资源池中所对应的第二PCB 在该第二实例中实现该第二负载与该用户态协议栈的上层服务的对接以使得该第二实例实现与该第二负载对应的应用app的交互,并在该第一实例中解除该第二负载在该第一实例中绑定的第二RSS队列,在该第二实例中将该第二RSS队列绑定到该第二负载中,以使得该第二实例实现从该第二RSS队列进行数据包接收及处理的过程。With reference to the tenth possible implementation manner of the first aspect, in an eleventh possible implementation manner, the protocol control block PCB corresponding to the at least one load to be migrated in the shared resource pool in the first instance is in the first Rebuilding the at least one load to be migrated in the second instance is implemented as: the second PCB corresponding to the second load of the load to be migrated according to the first instance in the shared resource pool In the second instance, the second load is connected to the upper layer service of the user state protocol stack to enable the second instance to implement the interaction of the application app corresponding to the second load, and the first instance is released in the first instance. The second load is bound to the second RSS queue bound in the first instance, and the second RSS queue is bound to the second load in the second instance, such that the second instance is implemented from the second RSS The process of receiving and processing data packets by the queue.
结合第一方面的第十种可能的实现方式或第一方面的第十一种可能的实现方式,在第十二种可能的实现方式中,确定该第一实例中的至少一个待迁移负载具体实现为:确定该第一实例中的第三负载为该第一实例的待迁移负载,该第三负载在该第一实例中所绑定的第三RSS队列满足以下条件:该第三RSS队列的连接数、接收字节数、发送字节数3个参数中都达到该第一实例的所有负载中对应参数的均值。With reference to the tenth possible implementation manner of the first aspect, or the eleventh possible implementation manner of the first aspect, in the twelfth possible implementation manner, determining that at least one load to be migrated in the first instance is specific The implementation is as follows: determining that the third load in the first instance is the load to be migrated of the first instance, and the third RSS queue bound by the third load in the first instance satisfies the following condition: the third RSS queue The average of the corresponding parameters among all the loads of the first instance is reached in the three parameters of the number of connections, the number of received bytes, and the number of bytes sent.
第二方面,提供了一种协议栈系统,该系统包括:监控单元,用于监控该协议栈系统的用户态协议栈中每个协议栈对应的运行状态,一个该实例对应于该用户态协议栈中的一个协议栈;确定单元,用于确定第一实例和第二实例,该第一实例为运行状态异常的实例,该第二实例具备迁入该第一实例中至少一个待迁移负载的能力,一个该待迁移负载在该第一实例所对应的协议栈内对应于一个协议控制块PCB,该PCB在该协议栈系统的共享资源池中对应于一个存储着该待迁移负载的连接参数的PCB,该待迁移负载的连接参数能够用于重建该待迁移负载;负载迁移单元,用于根据该第一实例中至少一个待迁移负载在该共享资源池中所对应的PCB在该第二实例中重建该至少一个待迁移负载。In a second aspect, a protocol stack system is provided, the system includes: a monitoring unit, configured to monitor an operating state of each protocol stack in a user state protocol stack of the protocol stack system, and the instance corresponds to the user state protocol a protocol stack in the stack, the determining unit, configured to determine the first instance and the second instance, where the first instance is an instance of a running state exception, and the second instance has at least one load to be migrated into the first instance Capabilities, a load to be migrated corresponds to a protocol control block PCB in a protocol stack corresponding to the first instance, and the PCB corresponds to a connection parameter storing the load to be migrated in a shared resource pool of the protocol stack system. The PCB, the connection parameter of the load to be migrated can be used to reconstruct the load to be migrated; the load migration unit is configured to: according to the PCB in the first instance, the corresponding PCB in the shared resource pool is in the second Rebuilding the at least one load to be migrated in the instance.
结合第二方面,在第一种可能的实现方式中,该确定单元还用于确定该第一实例中的至少一个待迁移负载。In conjunction with the second aspect, in a first possible implementation, the determining unit is further configured to determine at least one load to be migrated in the first instance.
结合第二方面的第一种可能的实现方式,在第二种可能的实现方式中,该实例的运行状态包括实例的负载状态和存活状态,该监控单元具体用于:分别向该用户态协议栈中每个协议栈对应的实例发送心跳消息并监控该心跳消息响应时延,并监控该用户态协议栈中每个协议栈对应的实例在第一预定时间内的实例负载均值,以根据该心跳消息的响应时延和该实例负载均值确定该用户态协议栈中每个协议栈对应的实例的运行状态,其中,一条心跳消息对应于一个该实例;或者,分别轮询该用户态协议栈中每个协议栈对应的实例的实例标识,并监控该用户态协议栈中每个协议栈对应的实例在第一预 定时间内的实例负载均值,以根据该实例标识和该实例负载均值确定该用户态协议栈中每个协议栈对应的实例的运行状态,其中,该实例标识用于表示实例的存活状态,该实例标识存储于共享内存区域或共享文件,一个该实例标识对应于一个该实例。With reference to the first possible implementation manner of the second aspect, in a second possible implementation manner, the running state of the instance includes a load state and a survival state of the instance, where the monitoring unit is specifically configured to: respectively: to the user state protocol The instance corresponding to each protocol stack in the stack sends a heartbeat message and monitors the heartbeat message response delay, and monitors an instance load average of the instance corresponding to each protocol stack in the user state protocol stack in the first predetermined time, according to the The response delay of the heartbeat message and the average value of the instance load determine the running state of the instance corresponding to each protocol stack in the user state protocol stack, where one heartbeat message corresponds to one instance; or, the user state protocol stack is polled separately An instance identifier of an instance corresponding to each protocol stack, and monitoring an instance corresponding to each protocol stack in the user state protocol stack in the first pre- An instance load average value for determining the running state of the instance corresponding to each protocol stack in the user mode protocol stack according to the instance identifier and the instance load average value, where the instance identifier is used to indicate the survival state of the instance, The instance identifier is stored in a shared memory area or a shared file, and one instance identifier corresponds to one instance.
结合第二方面的第二种可能的实现方式,在第三种可能的实现方式中,在用于确定第一实例的过程中,该确定单元具体用于:确定距离发送心跳消息时刻达到第二预定时间后仍然未反馈心跳响应的实例为该第一实例;或者,确定第一预定时间内实例标识都表示僵死或失效状态的实例为该第一实例。With reference to the second possible implementation of the second aspect, in a third possible implementation, in the process for determining the first instance, the determining unit is specifically configured to: determine that the distance to send the heartbeat message reaches the second time An example in which the heartbeat response is still not fed back after the predetermined time is the first instance; or an instance in which the instance identifier indicates a dead or dead state in the first predetermined time is the first instance.
结合第二方面的第三种可能的实现方式,在第四种可能的实现方式中,在用于确定第二实例的过程中,该确定单元具体用于创建并确定新的实例为该第二实例;该负载迁移单元具体用于根据该至少一个待迁移负载之第一负载在共享资源池中所对应的第一PCB在该第二实例中实现该第一负载与该用户态协议栈的上层服务的对接,并将该第一负载在该第一实例中绑定的第一接收端扩展RSS队列重绑定到该第二实例的该第一负载中,其中,该至少一个待迁移负载包括该第一实例的所有负载。In conjunction with the third possible implementation of the second aspect, in a fourth possible implementation, in the process for determining the second instance, the determining unit is specifically configured to create and determine a new instance as the second The load migration unit is configured to implement, in the second instance, the first load and the upper layer of the user state protocol stack according to the first PCB corresponding to the first load of the at least one load to be migrated in the shared resource pool. Interfacing the service, and rebinding the first receiver extended RSS queue bound by the first load in the first instance to the first load of the second instance, where the at least one load to be migrated includes All loads of this first instance.
结合第二方面的第四种可能的实现方式,在第五种可能的实现方式中,该系统还包括:实例停止单元,用于终止该第一实例。In conjunction with the fourth possible implementation of the second aspect, in a fifth possible implementation, the system further includes: an instance stopping unit, configured to terminate the first instance.
结合第二方面的第二种可能的实现方式,在第六种可能的实现方式中,在用于确定第一实例的过程中,该确定单元具体用于:确定第一预定时间内实例总负载均值大于第一预定阈值的实例为该第一实例。With reference to the second possible implementation of the second aspect, in a sixth possible implementation, in the process for determining the first instance, the determining unit is specifically configured to: determine the total load of the instance in the first predetermined time An example where the mean is greater than the first predetermined threshold is the first instance.
结合第二方面的第六种可能的实现方式,在第七种可能的实现方式中,在用于确定该第二实例的过程中,该确定单元具体用于:如果存在第一预定时间内实例总负载均值低于第二预定阈值的实例,则确定预定时间内实例总负载均值低于第二预定阈值的一个或多个实例作为该第二实例,其中,迁入该第二实例的所有负载的负载值与该第二预定阈值之和小于该第一预定阈值。With reference to the sixth possible implementation of the second aspect, in a seventh possible implementation, in the process for determining the second instance, the determining unit is specifically configured to: if there is an instance in the first predetermined time The instance in which the total load average is lower than the second predetermined threshold determines one or more instances in which the instance total load average is lower than the second predetermined threshold within the predetermined time as the second instance, wherein all loads moved into the second instance The sum of the load value and the second predetermined threshold is less than the first predetermined threshold.
结合第二方面的第七种可能的实现方式,在第八种可能的实现方式中,该负载迁移单元具体用于:根据该第一实例的至少一个待迁移负载之第二负载在该共享资源池中所对应的第二PCB,将该第二负载在该第一实例中绑定的第二RSS队列的绑定规则修改为绑定到该第二实例的第二负载中,以使得该第二实例实现从该第二RSS队列进行数据包接收及处理的过程;或者,根 据该第一实例的至少一个待迁移负载之第二负载在该共享资源池中所对应的第二PCB,在该第一实例中解除该第二负载在该第一实例中绑定的第二RSS队列,并在该第二实例中将该第二RSS队列绑定到该第二负载中,以使得该第二实例实现从该第二RSS队列进行数据包接收及处理的过程。With reference to the seventh possible implementation of the second aspect, in an eighth possible implementation, the load migration unit is specifically configured to: use the second load of the at least one load to be migrated according to the first instance in the shared resource The second PCB corresponding to the pool, the binding rule of the second RSS queue bound by the second load in the first instance is modified to be bound to the second load of the second instance, so that the first The second instance implements a process of receiving and processing data packets from the second RSS queue; or According to the second load of the at least one load to be migrated of the first instance in the shared resource pool, in the first instance, the second load is bound in the second instance. An RSS queue, and binding the second RSS queue to the second payload in the second instance, such that the second instance implements a process of receiving and processing data packets from the second RSS queue.
结合第二方面的第七种可能的实现方式或第二方面的第八种可能的实现方式,在第九种可能的实现方式中,在用于确定该第一实例中的至少一个待迁移负载的过程中,该确定单元具体用于:确定该第一实例中的第三负载为该第一实例的待迁移负载,该第三负载在该第一实例中所绑定的第三RSS队列满足以下条件:当该第三RSS队列绑定到该第二实例时该第二实例的连接数、接收字节数、发送字节数3个参数中至少有2个参数不大于该第一实例的相应参数。确定该第一实例中的至少一个待迁移负载具体实现为:确定该第一实例中的第三负载为该第一实例的待迁移负载,其中该第三负载在该第一实例中所绑定的第三RSS队列满足以下条件:当该第三RSS队列绑定到该第二实例时该第二实例的连接数、接收字节数、发送字节数3个参数中至少有2个参数不大于该第一实例的相应参数。With reference to the seventh possible implementation of the second aspect or the eighth possible implementation manner of the second aspect, in the ninth possible implementation manner, at least one load to be migrated is determined in the first instance The determining unit is specifically configured to: determine that the third load in the first instance is the to-be-migrated load of the first instance, where the third load is satisfied in the third RSS queue bound in the first instance. The following condition: when the third RSS queue is bound to the second instance, at least two parameters of the connection number, the number of received bytes, and the number of bytes sent by the second instance are not greater than the first instance. Corresponding parameters. Determining that the at least one load to be migrated in the first instance is specifically implemented as: determining that the third load in the first instance is the load to be migrated of the first instance, where the third load is bound in the first instance The third RSS queue satisfies the following condition: when the third RSS queue is bound to the second instance, at least two parameters of the connection number, the number of received bytes, and the number of bytes sent by the second instance are not Greater than the corresponding parameter of the first instance.
结合第二方面的第六种可能的实现方式,在第十种可能的实现方式中,在用于确定第二实例的过程中,该确定单元具体用于:如果不存在预定时间内实例总负载均值低于第二预定阈值的实例,则创建并确定新的实例为该第二实例。In conjunction with the sixth possible implementation of the second aspect, in a tenth possible implementation, in the process for determining the second instance, the determining unit is specifically configured to: if there is no total load of the instance within a predetermined time If the mean is below the second predetermined threshold, then a new instance is created and determined to be the second instance.
结合第二方面的第十种可能的实现方式,在第十一种可能的实现方式中,该负载迁移单元具体用于:根据该第一实例的至少一个待迁移负载之第二负载在该共享资源池中所对应的第二PCB在该第二实例中实现该第二负载与该用户态协议栈的上层服务的对接以使得该第二实例实现与该第二负载对应的应用app的交互,并在该第一实例中解除该第二负载在该第一实例中绑定的第二RSS队列,在该第二实例中将该第二RSS队列绑定到该第二负载中,以使得该第二实例实现从该第二RSS队列进行数据包接收及处理的过程。根据该第一实例中至少一个待迁移负载在共享资源池中所对应的协议控制块PCB在该第二实例中重建该至少一个待迁移负载具体实现为:根据该第一实例的至少一个待迁移负载之第二负载在该共享资源池中所对应的第二PCB在该第二实例中实现该第二负载与该用户态协议栈的上层服务的对接以使得该第二实例实现与该第二负载对应的应用app的交互,并在该第一实例中解 除该第二负载在该第一实例中绑定的第二RSS队列,在该第二实例中将该第二RSS队列绑定到该第二负载中,以使得该第二实例实现从该第二RSS队列进行数据包接收及处理的过程。With reference to the tenth possible implementation manner of the second aspect, in the eleventh possible implementation, the load migration unit is specifically configured to: use the second load of the at least one load to be migrated according to the first instance in the sharing The second PCB corresponding to the resource pool in the second instance implements the docking of the second load with the upper layer service of the user state protocol stack to enable the second instance to implement the interaction of the application app corresponding to the second load. And in the first instance, the second RSS queue bound by the second load in the first instance is released, and the second RSS queue is bound to the second load in the second instance, so that the The second example implements a process of receiving and processing data packets from the second RSS queue. Reconstructing the at least one load to be migrated in the second instance according to the protocol control block PCB corresponding to the at least one load to be migrated in the shared resource pool is implemented as follows: at least one to be migrated according to the first instance The second PCB corresponding to the load in the shared resource pool in the second instance implements the docking of the second load with the upper layer service of the user state protocol stack to enable the second instance to implement the second Load the interaction of the app app and solve it in the first instance In addition to the second RSS queue bound by the second payload in the first instance, the second RSS queue is bound to the second payload in the second instance, such that the second instance is implemented from the first The process of receiving and processing data packets by the second RSS queue.
结合第二方面的第十种可能的实现方式或第二方面的第十一种可能的实现方式,在第十二种可能的实现方式中,在用于确定该第一实例中的至少一个待迁移负载的过程中,该确定单元具体用于:With reference to the tenth possible implementation manner of the second aspect or the eleventh possible implementation manner of the second aspect, in the twelfth possible implementation manner, at least one to be used in determining the first instance In the process of migrating the load, the determining unit is specifically used to:
确定该第一实例中的第三负载为该第一实例的待迁移负载,该第三负载在该第一实例中所绑定的第三RSS队列满足以下条件:该第三RSS队列的连接数、接收字节数、发送字节数3个参数中都达到该第一实例的所有负载中对应参数的均值。确定该第一实例中的至少一个待迁移负载具体实现为:确定该第一实例中的第三负载为该第一实例的待迁移负载,该第三负载在该第一实例中所绑定的第三RSS队列满足以下条件:该第三RSS队列的连接数、接收字节数、发送字节数3个参数中都达到该第一实例的所有负载中对应参数的均值。Determining that the third load in the first instance is the load to be migrated of the first instance, and the third RSS queue bound by the third load in the first instance satisfies the following condition: the number of connections of the third RSS queue The average of the corresponding parameters in all the loads of the first instance is reached in the three parameters of the number of received bytes and the number of transmitted bytes. Determining that the at least one load to be migrated in the first instance is specifically implemented as: determining that the third load in the first instance is a load to be migrated of the first instance, where the third load is bound in the first instance The third RSS queue satisfies the following conditions: the number of connections, the number of received bytes, and the number of transmitted bytes of the third RSS queue reach the mean of the corresponding parameters in all the loads of the first instance.
基于以上技术方案,本发明实施例的并行用户态协议栈的管理方法和协议栈系统,通过根据异常实例中待迁移负载在共享资源池对应的PCB在具备迁入负载能力的实例中重建待迁移负载,能够克服协议栈共用一个分发模块带来的系统分发瓶颈,快速进行负载均衡和故障恢复,从而提高协议栈系统的性能。Based on the foregoing technical solution, the management method and the protocol stack system of the parallel user state protocol stack in the embodiment of the present invention rebuild the migration to be performed in the instance with the load-bearing capability according to the PCB corresponding to the shared resource pool according to the load to be migrated in the abnormal instance. The load can overcome the system distribution bottleneck caused by the protocol stack sharing a distribution module, and quickly perform load balancing and fault recovery, thereby improving the performance of the protocol stack system.
附图说明DRAWINGS
为了更清楚地说明本发明实施例的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description are only some of the present invention. For the embodiments, those skilled in the art can obtain other drawings according to the drawings without any creative work.
图1是本发明实施例并行用户态协议栈的管理方法流程图。FIG. 1 is a flowchart of a method for managing a parallel user state protocol stack according to an embodiment of the present invention.
图2是本发明实施例并行用户态协议栈的另一管理方法流程图。2 is a flow chart of another management method of a parallel user state protocol stack according to an embodiment of the present invention.
图3是本发明实施例故障线程恢复的流程示意图。FIG. 3 is a schematic flowchart of fault thread recovery according to an embodiment of the present invention.
图4是本发明实施例线程负载均衡的流程示意图。4 is a schematic flow chart of thread load balancing according to an embodiment of the present invention.
图5是本发明实施例线程负载均衡的另一流程示意图。 FIG. 5 is another schematic flowchart of thread load balancing according to an embodiment of the present invention.
图6是本发明实施例协议栈系统的结构示意图。FIG. 6 is a schematic structural diagram of a protocol stack system according to an embodiment of the present invention.
图7是本发明实施例协议栈系统的另一结构示意图。FIG. 7 is another schematic structural diagram of a protocol stack system according to an embodiment of the present invention.
图8是本发明实施例协议栈系统的再一结构示意图。FIG. 8 is a schematic diagram of still another structure of a protocol stack system according to an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
为了方便理解本发明实施例,首先在此介绍本发明实施例描述中会引入的几个要素。In order to facilitate the understanding of the embodiments of the present invention, several elements introduced in the description of the embodiments of the present invention are first described herein.
用户栈与内核栈:内核在创建进程/线程的时候,会为进程/线程创建相应的堆栈。每个进程/线程会有两个栈,一个用户栈,存在于用户空间,一个内核栈,存在于内核空间。当进程/线程在用户空间运行时,cpu堆栈指针寄存器里面的内容是用户堆栈地址,使用用户栈;当进程/线程在内核空间时,cpu堆栈指针寄存器里面的内容是内核栈空间地址,使用内核栈。User Stack and Kernel Stack: When the kernel creates a process/thread, it creates a stack for the process/thread. Each process/thread has two stacks, a user stack, which exists in user space, and a kernel stack that exists in kernel space. When the process/thread runs in user space, the contents of the cpu stack pointer register are the user stack address, using the user stack; when the process/thread is in kernel space, the contents of the cpu stack pointer register are the kernel stack space address, using the kernel Stack.
用户态协议栈:协议栈是操作系统的网络处理部分通常都会包含的模块。当与网络处理部分相关的进程/线程在用户空间运行时,cpu堆栈指针寄存器指向的协议栈即为用户态协议栈,本发明实施例中,用户态协议栈指在用户空间运行的所有协议栈的集合。User State Protocol Stack: A protocol stack is a module that is usually included in the network processing part of the operating system. When the process/thread associated with the network processing part is running in the user space, the protocol stack pointed to by the cpu stack pointer register is the user mode protocol stack. In the embodiment of the present invention, the user mode protocol stack refers to all protocol stacks running in the user space. Collection.
连接数:连接的数量。连接作为CPU负载的最终载体,具有直观意义。而且,接收端(Recv)接收到数据时需要进行连接查找,进而转入连接状态处理,因此考虑平衡各协议栈线程连接数量,对优化查找速度也很有意义。Number of connections: The number of connections. The connection is the ultimate carrier of the CPU load and is intuitive. Moreover, when the receiving end (Recv) receives the data, it needs to perform connection lookup and then transfer to the connection state processing. Therefore, it is meaningful to balance the number of thread connections of each protocol stack to optimize the search speed.
接收字节数(Recv Bytes):接收端扩展(Receive Side Scaling,RSS)本身主要是针对Recv端的分组发送(Packets dispatch),因此接收包的数据量很能反映对协议栈线程负载的影响。Recv Bytes: Receive Side Scaling (RSS) itself is mainly for Packet transmission of Recv. Therefore, the amount of data received by the packet can reflect the impact on the protocol stack thread load.
发送字节数(Send Bytes):发送分组(Send Packets)由于受到Recv数据与连接亲和性关系的影响,也影响协议栈处理相关连接的Send负载。Send Bytes: Send Packets are affected by the relationship between the Recv data and the connection affinity, and also affect the Send load of the protocol stack processing related connections.
图1是本发明实施例并行协议栈的处理方法流程图,图1的方法由协议栈系统执行。 1 is a flowchart of a processing method of a parallel protocol stack according to an embodiment of the present invention, and the method of FIG. 1 is executed by a protocol stack system.
101,监控用户态协议栈中每个协议栈对应的实例的运行状态。101. Monitor an operating state of an instance corresponding to each protocol stack in the user state protocol stack.
其中,一个该实例对应于该用户态协议栈中的一个协议栈。One of the instances corresponds to a protocol stack in the user state protocol stack.
应理解,本发明实施例中,实例可以是协议栈系统内的一个进程或一个线程。内核在创建进程/线程的时候,会为进程/线程创建相应的堆栈。每个进程/线程会有两个栈,一个用户栈,存在于用户空间,一个内核栈,存在于内核空间。It should be understood that in an embodiment of the present invention, an instance may be a process or a thread within a protocol stack system. When the kernel creates a process/thread, it creates a stack for the process/thread. Each process/thread has two stacks, a user stack, which exists in user space, and a kernel stack that exists in kernel space.
应理解,本发明实施例中,用户态协议栈用于表示存在于用户空间的所有协议栈。在用户态协议栈中,可包含一个或多个协议栈,每个协议栈与协议栈系统的一个实例形成一一对应的关系。It should be understood that in the embodiment of the present invention, the user state protocol stack is used to represent all protocol stacks existing in the user space. In the user state protocol stack, one or more protocol stacks may be included, and each protocol stack forms a one-to-one correspondence with an instance of the protocol stack system.
应理解,本发明实施例中,实例的运行状态包括实例的负载状态和存活状态。It should be understood that, in the embodiment of the present invention, the running state of the instance includes the load state and the survival state of the instance.
应理解,实例的负载状态是指当前实例对系统资源的占用情况,通常情况下指该实例对CPU的资源利用率。It should be understood that the load status of the instance refers to the occupancy of the system resources by the current instance, and generally refers to the resource utilization of the CPU by the instance.
102,确定第一实例和第二实例。102. Determine a first instance and a second instance.
其中,第一实例为运行状态异常的实例,第二实例该第二实例具备迁入该第一实例中至少一个待迁移负载的能力。The first instance is an instance of a running state abnormality, and the second instance has a capability of moving into at least one load to be migrated in the first instance.
另外,一个该待迁移负载在该第一实例所对应的协议栈内对应于一个协议控制块PCB,该PCB在共享资源池中对应于一个存储着该待迁移负载的连接参数的PCB,该待迁移负载的连接参数能够用于重建该待迁移负载。In addition, a load to be migrated corresponds to a protocol control block PCB in the protocol stack corresponding to the first instance, and the PCB corresponds to a PCB storing the connection parameters of the load to be migrated in the shared resource pool. The connection parameters of the migration load can be used to reconstruct the load to be migrated.
应理解,本发明实施例中,一个负载对应于一个PCB,一个负载在数据处理上等于一个PCB所对应的连接的数据处理量。It should be understood that, in the embodiment of the present invention, one load corresponds to one PCB, and one load is equal in data processing to the data processing amount of the connection corresponding to one PCB.
当一个实例被创建并初始化后,相应地会生成一个协议栈。如果实例内还不存在任何负载,则协议栈中也不会有PCB的信息。实例中有几个负载,其对应的协议栈中就会有相同个数的PCB。When an instance is created and initialized, a protocol stack is generated accordingly. If there is no load in the instance, there will be no PCB information in the protocol stack. There are several loads in the instance, and there will be the same number of PCBs in the corresponding protocol stack.
另外,本发明实施例中,协议栈只是存储着PCB的一些基本信息,例如PCB标识等。共享资源池中存储着PCB的关键数据结构,主要包括连接结构体信息,该连接结构体信息对快速响应恢复连接具有关键作用。In addition, in the embodiment of the present invention, the protocol stack only stores some basic information of the PCB, such as a PCB identifier. The shared resource pool stores the key data structure of the PCB, mainly including the connection structure information, which has a key role for quick response recovery connection.
应理解,运行状态异常的实例,一般可包括存活状态异常的实例或负载状态异常的实例。It should be understood that instances of operational state anomalies may generally include instances of surviving state anomalies or instances of load state anomalies.
存活状态异常的实例可包括僵死或失效的实例。Examples of abnormal state of survival may include instances of zombie or failure.
负载状态异常的实例,可包括负载高位运行的实例。在判断实例是否是 负载高位运行时,可通过比较一段时间内实例总负载均值与预定阈值的关系来确定实例是否处于负载高位运行状态。An instance of a load state exception can include an instance of a load high bit operation. In judging whether the instance is When the load is running high, the relationship between the instance total load average and the predetermined threshold can be compared to determine whether the instance is in the load high operating state.
103,根据该第一实例中至少一个待迁移负载在该共享资源池中所对应的协议控制块PCB在该第二实例中重建该至少一个待迁移负载。103. The protocol control block PCB corresponding to the at least one load to be migrated in the shared resource pool in the first instance rebuilds the at least one to be migrated load in the second instance.
本发明实施例中,根据异常实例中待迁移负载在共享资源池对应的PCB在具备迁入负载能力的实例中重建待迁移负载,能够克服协议栈共用一个分发模块带来的系统分发瓶颈,快速进行负载均衡和故障恢复,从而提高协议栈系统的性能。In the embodiment of the present invention, according to the load to be migrated in the abnormal instance, the PCB corresponding to the shared resource pool rebuilds the load to be migrated in the instance with the load-bearing capability, which can overcome the system distribution bottleneck caused by the protocol stack sharing a distribution module. Perform load balancing and fault recovery to improve the performance of the protocol stack system.
图2是本发明实施例并行用户态协议栈的另一管理方法流程图。可选地,如图2所示,在步骤103之前,该方法还可包括步骤104:确定该第一实例中的至少一个待迁移负载。2 is a flow chart of another management method of a parallel user state protocol stack according to an embodiment of the present invention. Optionally, as shown in FIG. 2, before step 103, the method may further include step 104: determining at least one load to be migrated in the first instance.
可选地,步骤101具体可实现为:分别向该用户态协议栈中每个协议栈对应的实例发送心跳消息并监控该心跳消息响应时延,并监控该用户态协议栈中每个协议栈对应的实例在第一预定时间内的实例负载均值,以根据该心跳消息的响应时延和该实例负载均值确定该用户态协议栈中每个协议栈对应的实例的运行状态,其中,一条心跳消息对应于一个该实例;或者,分别轮询该用户态协议栈中每个协议栈对应的实例的实例标识,并监控该用户态协议栈中每个协议栈对应的实例在第一预定时间内的实例负载均值,以根据该实例标识和该实例负载均值确定该用户态协议栈中每个协议栈对应的实例的运行状态,其中,该实例标识用于表示实例的存活状态,该实例标识存储于共享内存区域或共享文件,一个该实例标识对应于一个该实例。Optionally, the step 101 is specifically implemented to: send a heartbeat message to the instance corresponding to each protocol stack in the user state protocol stack, monitor the heartbeat message response delay, and monitor each protocol stack in the user state protocol stack. The instance load average of the corresponding instance in the first predetermined time, to determine the running state of the instance corresponding to each protocol stack in the user state protocol stack according to the response delay of the heartbeat message and the average value of the instance load, wherein a heartbeat The message corresponds to one instance; or, respectively, the instance identifier of the instance corresponding to each protocol stack in the user state protocol stack is polled, and the instance corresponding to each protocol stack in the user state protocol stack is monitored in the first predetermined time. The instance load average value is used to determine an running state of an instance corresponding to each protocol stack in the user mode protocol stack according to the instance identifier and the instance load average value, where the instance identifier is used to indicate a survival state of the instance, and the instance identifier is stored. For a shared memory area or shared file, one instance ID corresponds to one instance.
可选地,作为一个实施例,步骤102中确定第一实例具体实现为:确定距离发送心跳消息时刻达到第二预定时间后仍然未反馈心跳响应的实例为该第一实例;或者,确定第一预定时间内实例标识表示僵死或失效状态的实例为该第一实例。Optionally, as an embodiment, determining, in step 102, the first instance is specifically implemented as: determining that an instance of the heartbeat response is not fed back after the second predetermined time is sent after the time when the heartbeat message is sent is the first instance; or determining the first An instance of the instance identifier indicating a dead or dead state within a predetermined time is the first instance.
在本实施例中,步骤102确定第二实例的过程具体可实现为:创建并确定新的实例为该第二实例。此时,步骤103具体实现为:根据该至少一个待迁移负载之第一负载在共享资源池中所对应的第一PCB在该第二实例中实现该第一负载与该用户态协议栈的上层服务的对接,并将该第一负载在该第一实例中绑定的第一接收端扩展RSS队列重绑定到该第二实例的该第一负载中,其中,该至少一个待迁移负载包括该第一实例的所有负载。 In this embodiment, the step 102 determines that the process of the second instance is specifically implemented as: creating and determining that the new instance is the second instance. In this case, the step 103 is implemented as follows: the first PCB corresponding to the first load in the shared resource pool according to the first load of the at least one load to be migrated implements the first load and the upper layer of the user state protocol stack in the second instance. Interfacing the service, and rebinding the first receiver extended RSS queue bound by the first load in the first instance to the first load of the second instance, where the at least one load to be migrated includes All loads of this first instance.
可选地,作为另一实施例,步骤102中确定第一实例的过程具体实现为:确定第一预定时间内实例总负载均值大于第一预定阈值的实例为该第一实例。Optionally, as another embodiment, the process of determining the first instance in step 102 is specifically implemented as: determining that the instance total load average value in the first predetermined time is greater than the first predetermined threshold is the first instance.
可选地,在本实施例的一种具体实现方式中,步骤102中确定第二实例具体可实现为:如果存在第一预定时间内实例总负载均值低于第二预定阈值的实例,则确定预定时间内实例总负载均值低于第二预定阈值的一个或多个实例作为该第二实例,其中,迁入该第二实例的所有负载的负载值与该第二预定阈值之和小于该第一预定阈值。Optionally, in a specific implementation manner of the embodiment, determining the second instance in step 102 may be specifically implemented as: if there is an instance in which the average total load of the instance is lower than the second predetermined threshold in the first predetermined time, then determining As the second instance, one or more instances in which the instance total load average is lower than a second predetermined threshold within a predetermined time period, wherein a sum of a load value of all loads moved into the second instance and the second predetermined threshold is less than the first A predetermined threshold.
进一步地,在当前的具体实现方式中,步骤103具体可实现为:根据该第一实例的至少一个待迁移负载之第二负载在该共享资源池中所对应的第二PCB,将该第二负载在该第一实例中绑定的第二RSS队列的绑定规则修改为绑定到该第二实例的第二负载中,以使得该第二实例实现从该第二RSS队列进行数据包接收及处理的过程;或者,根据该第一实例的至少一个待迁移负载之第二负载在该共享资源池中所对应的第二PCB,在该第一实例中解除该第二负载在该第一实例中绑定的第二RSS队列,并在该第二实例中将该第二RSS队列绑定到该第二负载中,以使得该第二实例实现从该第二RSS队列进行数据包接收及处理的过程。Further, in the current specific implementation, the step 103 may be specifically implemented as: according to the second load of the at least one load to be migrated in the first instance, the second PCB corresponding to the shared resource pool, the second The binding rule of the second RSS queue bound in the first instance is modified to be bound to the second load of the second instance, so that the second instance implements data packet reception from the second RSS queue. And the process of processing; or, according to the second load of the at least one load to be migrated of the first instance in the shared resource pool, the second load is released in the first instance in the first a second RSS queue bound in the instance, and binding the second RSS queue to the second load in the second instance, so that the second instance implements data packet reception from the second RSS queue and The process of processing.
另外,在当前的具体实现方式中,步骤104具体可实现为:确定该第一实例中的第三负载为该第一实例的待迁移负载,该第三负载在该第一实例中所绑定的第三RSS队列满足以下条件:当该第三RSS队列绑定到该第二实例时该第二实例的连接数、接收字节数、发送字节数3个参数中至少有2个参数不大于该第一实例的相应参数。In addition, in the current specific implementation, the step 104 is specifically implemented as: determining that the third load in the first instance is the to-be-migrated load of the first instance, where the third load is bound in the first instance. The third RSS queue satisfies the following condition: when the third RSS queue is bound to the second instance, at least two parameters of the connection number, the number of received bytes, and the number of bytes sent by the second instance are not Greater than the corresponding parameter of the first instance.
可选地,在本实施例的一种具体实现方式中,步骤102中确定第二实例具体可实现为:如果不存在预定时间内实例总负载均值低于第二预定阈值的实例,则创建并确定新的实例为该第二实例。Optionally, in a specific implementation manner of the embodiment, determining the second instance in step 102 may be specifically implemented as: if there is no instance in which the total instance load average value is lower than the second predetermined threshold in the predetermined time, then Determine the new instance as the second instance.
进一步地,在当前的具体实现方式中,步骤103具体可实现为:根据该第一实例的至少一个待迁移负载之第二负载在该共享资源池中所对应的第二PCB在该第二实例中实现该第二负载与该用户态协议栈的上层服务的对接以使得该第二实例实现与该第二负载对应的应用app的交互,并在该第一实例中解除该第二负载在该第一实例中绑定的第二RSS队列,在该第二实例中将该第二RSS队列绑定到该第二负载中,以使得该第二实例实现从该第二RSS 队列进行数据包接收及处理的过程。Further, in the current specific implementation, the step 103 is specifically implemented as: the second PCB corresponding to the second load of the at least one load to be migrated according to the first instance in the shared resource pool is in the second instance. Interacting the second load with an upper layer service of the user state protocol stack to enable the second instance to implement an interaction of an application app corresponding to the second load, and releasing the second load in the first instance a second RSS queue bound in the first instance, in which the second RSS queue is bound to the second payload, such that the second instance is implemented from the second RSS The process of receiving and processing data packets by the queue.
另外,在当前的具体实现方式下,步骤104具体可实现为:确定该第一实例中的第三负载为该第一实例的待迁移负载,该第三负载在该第一实例中所绑定的第三RSS队列满足以下条件:该第三RSS队列的连接数、接收字节数、发送字节数3个参数中都达到该第一实例的所有负载中对应参数的均值。In addition, in the current specific implementation, the step 104 is specifically implemented as follows: determining that the third load in the first instance is the to-be-migrated load of the first instance, where the third load is bound in the first instance. The third RSS queue satisfies the following conditions: the number of connections, the number of received bytes, and the number of transmitted bytes of the third RSS queue reach the mean of the corresponding parameters in all the loads of the first instance.
下面,将结合具体的实施例,对本发明实施例的方法作进一步的描述。下述具体实施例中,以协议栈线程作为用户态协议栈的实例进行描述。Hereinafter, the method of the embodiment of the present invention will be further described in conjunction with specific embodiments. In the following specific embodiments, the protocol stack thread is described as an example of a user state protocol stack.
图3是本发明实施例故障线程恢复的流程示意图。FIG. 3 is a schematic flowchart of fault thread recovery according to an embodiment of the present invention.
在图3所示的场景中,用户态协议栈包含正在运行的应用所对应的多个协议栈。协议栈内协议控制块(Protocol Control Block,PCB)的关键数据结构存储于系统内存的共享资源池中。共享资源池在图3表现为协议控制块分配池(PCB Alloc),存储着PCB的关键数据结构,主要包括连接结构体信息,可用于快速响应恢复连接。协议栈中,PCB作为表示连接的主要数据结构,因此可以将其作为协议栈工作负载的主要衡量指标。如图3所示,用户态协议栈可包括协议栈stack1、stack2和stack3。其中,stack1所对应的线程包括2个负载,其对应的PCB分别为PCB1和PCB4;stack2所对应的线程包括1个负载,其对应的PCB为PCB3;stack3所对应的线程包括1个负载,其对应的PCB为PCB2。In the scenario shown in Figure 3, the user mode protocol stack contains multiple protocol stacks corresponding to the running application. The key data structures of the Protocol Control Block (PCB) in the protocol stack are stored in a shared resource pool of system memory. The shared resource pool is shown in Figure 3 as a protocol control block allocation pool (PCB Alloc), which stores the key data structure of the PCB, mainly including the connection structure information, which can be used to quickly respond to the recovery connection. In the protocol stack, the PCB serves as the main data structure for the connection, so it can be used as the main metric for the protocol stack workload. As shown in FIG. 3, the user mode protocol stack may include protocol stacks stack1, stack2, and stack3. The thread corresponding to stack1 includes 2 loads, and the corresponding PCBs are PCB1 and PCB4 respectively; the thread corresponding to stack2 includes 1 load, and the corresponding PCB is PCB3; the thread corresponding to stack3 includes 1 load, The corresponding PCB is PCB2.
S301,协议栈系统监控用户态协议栈中每个协议栈对应的实例的运行状态。S301. The protocol stack system monitors an running state of an instance corresponding to each protocol stack in the user state protocol stack.
协议栈系统可通过多种方式监控用户态协议栈中每个协议栈对应的实例的运行状态。其中,实例的运行状态可包括实例的负载状态和存活状态。The protocol stack system can monitor the running status of the instance corresponding to each protocol stack in the user state protocol stack in multiple ways. The running state of the instance may include a load state and a live state of the instance.
实例的存活状态包括实例是否僵死(或失效)。对于僵死(或失效)的实例,协议栈系统应启动实例恢复流程。The surviving state of an instance includes whether the instance is dead (or invalid). For a dead (or failed) instance, the stack system should initiate an instance recovery process.
实例的负载状态包括实例是处于高位运行、低位运行还是其它。其中,低位运行的实例,具备迁入负载的能力。对于高位运行的实例,应启动负载均衡流程,将实例内的部分负载迁出。The load status of an instance includes whether the instance is running at a high level, running at a low level, or otherwise. Among them, the example of low-level operation has the ability to move into the load. For an instance running at a high level, the load balancing process should be initiated to move out some of the load within the instance.
本发明实施例中,协议栈系统通过向每个协议栈对应的实例发送心跳消息并监控每个协议栈对应的实例对各自的心跳消息的响应时延以及监控第一预定时间内的实例负载均值来监控实例的运行状态。其中,一条心跳消息对 应于一个该实例。In the embodiment of the present invention, the protocol stack system sends a heartbeat message to the instance corresponding to each protocol stack, monitors the response delay of the instance corresponding to each protocol stack to the respective heartbeat message, and monitors the average load of the instance in the first predetermined time. To monitor the running status of the instance. Among them, a heartbeat message pair Should be one of the examples.
如图3所示,协议栈系统通过一个公共线程(Common Thread)对线程进行监控。本发明实施例中,Common Thread可包括一个看门狗(Watch Dog)模块,用于实现对线程的计时监控。Common Thread可通过Watch Dog可分别向用户态协议栈的每个协议栈对应的线程发送心跳(keep alive)消息。用户态协议栈的每个协议栈对应的线程接收到心跳消息后,可反馈心跳响应。此外,Common Thread还可监控线程的负载情况,可通过Watch Dog进行监控,或者通过访问线程的负载参数获取,其具体实现可参考现有技术,本发明实施例在此不再赘述。As shown in Figure 3, the protocol stack system monitors threads through a common thread (Common Thread). In the embodiment of the present invention, the Common Thread may include a Watch Dog module for implementing timing monitoring of threads. The Common Thread can send a keep alive message to the thread corresponding to each protocol stack of the user mode protocol stack by Watch Dog. After receiving the heartbeat message, the thread corresponding to each protocol stack of the user state protocol stack can feedback the heartbeat response. In addition, the Common Thread can also monitor the load of the thread, and can be monitored by the Watch Dog, or can be obtained by accessing the load parameter of the thread. For the specific implementation, reference may be made to the prior art, and details are not described herein again.
Common Thread可监控线程的存活状态。Common Thread可向用户态协议栈的每个协议栈对应的线程发送心跳消息并监控每个协议栈对应的对各自的心跳消息的响应时延。如果Common Thread在向线程发送心跳消息后的第二预定时间内接收到线程反馈的心跳响应,则Common Thread可认为该线程的存活状态为有效状态(或活动状态);反之,如果Common Thread在向线程发送心跳消息后的第二预定时间内没有接收到线程反馈的心跳响应,则Common Thread可认为该线程的存活状态为僵死或失效状态。其中,该第二预定时间由协议栈系统确定。Common Thread monitors the survival of threads. The Common Thread can send a heartbeat message to the thread corresponding to each protocol stack of the user mode protocol stack and monitor the response delay of each protocol stack corresponding to the respective heartbeat message. If the Common Thread receives the heartbeat response of the thread feedback within the second predetermined time after sending the heartbeat message to the thread, the Common Thread may consider the thread's survival state to be in a valid state (or active state); conversely, if the Common Thread is in the direction After the thread does not receive the heartbeat response of the thread feedback within the second predetermined time after the thread sends the heartbeat message, the Common Thread may consider the thread's survival state to be a dead or dead state. The second predetermined time is determined by the protocol stack system.
另外,Common Thread还可监控线程的负载状态。应理解,为避免瞬时峰值及瞬时低值导致对负载状态的误判,可取一段时间内的线程负载均值作为线程负载状态的判断标准。Common Thread可确定第一预定时间内线程的总负载均值大于第一预定阈值的实例为高位运行的线程,Common Thread还可确定第一预定时间内线程总负载均值低于第二预定阈值的线程为低位运行线程。其中,第一预定时间、第一预定阈值、第二预定阈值均可由协议栈系统确定。In addition, Common Thread can also monitor the load status of threads. It should be understood that in order to avoid the false alarm of the load state caused by the instantaneous peak and the instantaneous low value, the thread load average value for a period of time may be taken as the criterion for determining the thread load state. The Common Thread may determine that the thread whose total load average value of the thread is greater than the first predetermined threshold in the first predetermined time is a thread running at a high level, and the Common Thread may also determine that the thread whose total thread load average is lower than the second predetermined threshold in the first predetermined time is Run the thread low. The first predetermined time, the first predetermined threshold, and the second predetermined threshold may all be determined by the protocol stack system.
S302,协议栈系统指示创建新的实例作为第二实例。S302. The protocol stack system instructs to create a new instance as the second instance.
当协议栈系统监控到僵死(或失效)的实例后,可创建一个新的实例,并确定该新建实例为第二实例,用于恢复僵死(或失效)的实例。After the stack system monitors the dead (or failed) instance, a new instance can be created and the new instance determined to be the second instance for recovering the dead (or failed) instance.
不妨假设图3中stack1所对应的线程在第二预定时间内没有反馈心跳响应,则此时Common Thread可确认stack1所对应的线程为僵死(或失效)的线程。It may be assumed that the thread corresponding to the stack1 in FIG. 3 does not feed back the heartbeat response within the second predetermined time, then the Common Thread can confirm that the thread corresponding to the stack1 is a dead (or invalid) thread.
此时,Common Thread可新建一个线程,并在用户态协议栈中建立相应 的栈元素stack4,完成线程的初始化工作。线程初始化的具体流程可参考现有技术,本发明实施例在此不再赘述。At this point, Common Thread can create a new thread and establish a corresponding in the user state protocol stack. The stack element stack4, completes the initialization of the thread. For a specific process of thread initialization, reference may be made to the prior art, and details are not described herein again.
S303,第二实例绑定RSS队列。S303. The second instance binds the RSS queue.
第二实例可获取第一实例中的所有负载对应的PCB的标识信息,从共享资源池中获取对应的PCB信息,并基于共享资源池中对应的PCB信息,将原先第一实例所绑定的RSS队列绑定到第二实例中。The second instance may obtain the identification information of the PCB corresponding to all the loads in the first instance, obtain the corresponding PCB information from the shared resource pool, and bind the original first instance based on the corresponding PCB information in the shared resource pool. The RSS queue is bound to the second instance.
在图3中,共享资源池为协议控制块分配池(PCB Alloc),存储着协议栈的实例中所有负载的PCB。PCB中包括连接的主要数据结构。In Figure 3, the shared resource pool is a protocol control block allocation pool (PCB Alloc) that stores the PCBs of all the loads in the instance of the protocol stack. The main data structure of the connection is included in the PCB.
根据第一实例中的负载对应的PCBAccording to the load corresponding to the PCB in the first example
第二实例可根据第一实例中的负载对应的PCB,获取第一实例中的负载所绑定的RSS队列,并将第一实例中的负载所绑定的RSS队列绑定到第二实例中。The second instance may acquire the RSS queue bound by the load in the first instance according to the PCB corresponding to the load in the first instance, and bind the RSS queue bound by the load in the first instance to the second instance. .
如图3所示,stack4所对应的线程从stack1或stack1所对应的线程中获取负载所对应的协议控制块PCB1和PCB4,并从PCB1和PCB4中获取绑定到stack1所对应的线程的的RSS队列信息,并将该RSS队列重绑定到stack4所对应的线程中。As shown in Figure 3, the thread corresponding to stack4 obtains the protocol control blocks PCB1 and PCB4 corresponding to the load from the thread corresponding to stack1 or stack1, and obtains the RSS bound to the thread corresponding to stack1 from PCB1 and PCB4. Queue information and re-binding the RSS queue to the thread corresponding to stack4.
S304,第二实例与用户态协议栈的上层服务对接。S304. The second instance interfaces with an upper layer service of the user state protocol stack.
第二实例还可根据第一实例中的负载对应的PCB建立与用户态协议栈的上层服务的对接。The second instance may also establish a docking with an upper layer service of the user mode protocol stack according to the PCB corresponding to the load in the first instance.
具体地,如图3所示,stack4所对应的线程可根据PCB Alloc中的PCB1和PCB4,重新绑定stack4所对应的线程与上层套接字应用接口层(Socket API)中的消息盒子(msg box),完成线程与协议栈上层服务的重新对接,从而恢复线程与应用(app)的交互。Specifically, as shown in FIG. 3, the thread corresponding to stack4 can re-bind the thread corresponding to stack4 and the message box in the upper socket application interface layer (Socket API) according to PCB1 and PCB4 in the PCB Alloc (msg). Box), complete the re-docking of the thread and the upper layer of the protocol stack, thereby restoring the interaction between the thread and the application (app).
另外,应理解,步骤S303和步骤S304之间不存在先后的关系,新建实例在完成初始化之后,可先绑定RSS队列,也可先完成与协议栈上层服务的重新对接,本发明实施例在此不作限制。In addition, it should be understood that there is no relationship between the step S303 and the step S304. After the initialization is completed, the newly created instance may be bound to the RSS queue first, or may be re-connected with the upper layer service of the protocol stack. This is not a limitation.
S305,协议栈系统销毁第一实例。S305. The protocol stack system destroys the first instance.
在第二实例完成对第一实例的恢复过程后,可销毁第一实例。After the second instance completes the recovery process for the first instance, the first instance can be destroyed.
基于系统的稳定性考虑,在恢复过程完成后,原有僵死(或失效)的实例需要被销毁。Based on system stability considerations, after the recovery process is completed, the original dead (or failed) instances need to be destroyed.
如图3所示,当stack1所对应的线程的负载在stack4所对应的线程中重 建以后,stack1所对应的线程应被销毁,其对应的栈stack1也会被释放。As shown in Figure 3, when the load of the thread corresponding to stack1 is heavy in the thread corresponding to stack4 After the build, the thread corresponding to stack1 should be destroyed, and the corresponding stack stack1 will be released.
本发明实施例中,协议栈系统基于僵死(或失效)的实例的负载在共享资源池的PCB在新建立的实例中重建负载,可以对失效协议栈负责的连接信息快速接管,快速恢复,下至网卡信息,上至与应用(app)交互的信息,都能快速恢复,损失很小。In the embodiment of the present invention, the protocol stack system rebuilds the load in the newly established instance in the PCB of the shared resource pool based on the load of the dead (or failed) instance, and can quickly take over the connection information responsible for the invalid protocol stack, and quickly recover, From the network card information, the information that interacts with the application (app) can be quickly recovered with little loss.
另外,本发明实施例中,协议控制块信息,保持一种全局共享的存储机制,对于恢复处理中的连接非常有用,尤其对传输控制协议(Transmission Control Protocol TCP)监听(Listen)、UDP连接、超文本传输协议(Hypertext Transfer Protocol,HTTP)1.1协议中的长连接等对短暂中断不敏感的连接,可以达到无损恢复的目的;而对于其他类的TCP连接等,可能由于中断导致超时断开或者TCP窗口进入慢速启动的模式,但这些都是协议栈本身可以正确处理恢复到正确的状态,对系统整体状态无影响。In addition, in the embodiment of the present invention, the protocol control block information maintains a global shared storage mechanism, which is very useful for recovering the connection in the processing, especially for the Transmission Control Protocol (TCP) Listening (Listen), UDP connection, The Hypertext Transfer Protocol (HTTP) 1.1 protocol, such as long connections, is not sensitive to transient interruptions, and can achieve non-destructive recovery. For other types of TCP connections, etc., it may be timed out due to interruption or The TCP window enters the slow start mode, but these are all correctly processed by the protocol stack to restore the correct state, and have no effect on the overall state of the system.
另外,在图3的实施例中,也可从现有低位运行的线程中选择一个或多个作为第二实例,并在第二实例中重建第一实例的负载,然后再执行销毁第一实例的操作。In addition, in the embodiment of FIG. 3, one or more of the existing low-level running threads may be selected as the second instance, and the load of the first instance is reconstructed in the second instance, and then the first instance is destroyed. Operation.
图4是本发明实施例线程负载均衡的流程示意图。4 is a schematic flow chart of thread load balancing according to an embodiment of the present invention.
在图4所示的场景中,用户态协议栈包含正在运行的应用所对应的多个协议栈。协议栈内协议控制块(Protocol Control Block,PCB)的关键数据结构存储于系统内存的共享资源池中。共享资源池在图4表现为协议控制块分配池(PCB Alloc),存储着PCB的关键数据结构,主要包括连接结构体信息,可用于快速响应恢复连接。协议栈中,PCB作为表示连接的主要数据结构,因此可以将其作为协议栈工作负载的主要衡量指标。如图4所示,用户态协议栈可包括协议栈stack1、stack2、stack3、stack4。其中,stack1所对应的线程内存在2个负载,其对应的PCB分别为PCB1和PCB4;stack2所对应的线程内存在1个负载,其对应的PCB为PCB3;stack3所对应的线程内存在1个负载,其对应的PCB为PCB2;stack4所对应的线程内存在1个负载,其对应的PCB为PCB5。In the scenario shown in Figure 4, the user mode protocol stack contains multiple protocol stacks corresponding to the running application. The key data structures of the Protocol Control Block (PCB) in the protocol stack are stored in a shared resource pool of system memory. The shared resource pool is shown in Figure 4 as a protocol control block allocation pool (PCB Alloc), which stores the key data structure of the PCB, mainly including the connection structure information, which can be used to quickly respond to the recovery connection. In the protocol stack, the PCB serves as the main data structure for the connection, so it can be used as the main metric for the protocol stack workload. As shown in FIG. 4, the user mode protocol stack may include protocol stacks stack1, stack2, stack3, and stack4. Among them, the thread corresponding to stack1 has 2 loads, and the corresponding PCBs are PCB1 and PCB4 respectively; the corresponding thread of stack2 has 1 load, and the corresponding PCB is PCB3; the corresponding thread of stack3 has 1 memory. The load, the corresponding PCB is PCB2; the corresponding thread of stack4 has 1 load, and the corresponding PCB is PCB5.
S401,协议栈系统监控用户态协议栈中每个协议栈对应的实例的运行状态。S401. The protocol stack system monitors an operation state of an instance corresponding to each protocol stack in the user state protocol stack.
步骤S401与图3的步骤S301类似,本发明实施例在此不再赘述。The step S401 is similar to the step S301 of FIG. 3, and details are not described herein again.
S402,协议栈系统分别向第一实例和第二实例发送指示消息。 S402. The protocol stack system sends an indication message to the first instance and the second instance, respectively.
协议栈系统根据监控的结果,可确定需要迁出负载的实例和能够迁入负载的实例。Based on the results of the monitoring, the protocol stack system can determine which instances need to be moved out of the load and instances that can move into the load.
如果用户态协议栈的多个实例中存在至少一个高位运行的实例,则可确定该至少一个高位运行的实例为第一实例。If there is at least one instance of the high-level operation in the plurality of instances of the user-mode protocol stack, it may be determined that the instance of the at least one high-order operation is the first instance.
同时,如果用户态协议栈的多个实例中存在至少一个低位运行的实例,则可确定该至少一个低位运行的实例中的一个或多个实例为第二实例。Meanwhile, if there is at least one instance of low-level operation in multiple instances of the user-mode protocol stack, it may be determined that one or more instances of the at least one low-level running instance are the second instance.
如图4所示,不妨假设步骤S401中,协议栈系统通过公共线程(Common Thread)监控到stack1所对应的线程高位运行,stack4和stack2所对应的线程低位运行,也就是说stack1所对应的线程的负载需要迁出,stack4和stack2所对应的线程具备迁入负载的能力。As shown in FIG. 4, it is assumed that in step S401, the protocol stack system monitors the thread high bit corresponding to stack1 through the common thread (Common Thread), and the thread corresponding to stack4 and stack2 runs low, that is, the thread corresponding to stack1. The load needs to be moved out, and the thread corresponding to stack4 and stack2 has the ability to move into the load.
此时,Common Thread可确定stack1所对应的线程为第一实例,并确定stack4或stack2所对应的线程为第二实例,或者确定stack4和stack2所对应的线程都为第二实例。由于stack1所对应的线程只有PCB1和PCB4对应的两个负载,显然只要迁出一个负载即可,只需要一个第二实例。本发明实施例中,选中stack4所对应的线程为第二实例。At this time, Common Thread can determine that the thread corresponding to stack1 is the first instance, and determine that the thread corresponding to stack4 or stack2 is the second instance, or that the thread corresponding to stack4 and stack2 is the second instance. Since the thread corresponding to stack1 has only two loads corresponding to PCB1 and PCB4, it is obvious that only one second instance is needed as long as one load is moved out. In the embodiment of the present invention, the thread corresponding to stack4 is selected as the second instance.
首先,Common Thread可向stack1所对应的线程发送第一指示(notify)消息,指示stack1所对应的线程确定迁出负载并解除对迁出负载所对应的RSS队列的绑定。First, the Common Thread may send a first notification (notify) message to the thread corresponding to the stack1, indicating that the thread corresponding to the stack1 determines the migration load and unbinds the RSS queue corresponding to the migrated load.
stack1所对应的线程接收到第一指示消息后,首先要确定待迁出负载。After the thread corresponding to stack1 receives the first indication message, it first determines the load to be moved out.
要达到负载均衡,必然要慎重选择重新绑定的问题:对迁出负载的线程达到了有效减负的目的;对迁入的线程,不能过分导致单方面负载很高,因此需要在迁入和迁出线程间达到1个平衡。In order to achieve load balancing, it is necessary to carefully choose the problem of rebinding: the thread that has moved out of the load has achieved the purpose of effectively reducing the burden; the thread that is moved in can not excessively cause the unilateral load to be high, so it needs to be moved in and moved. A balance is reached between threads.
上层,可以进行各队列对RSS队列负载的影响进行排序,进而更好的进行负载均摊。并综合考虑发送和接收等各方面影响。In the upper layer, the impact of each queue on the RSS queue load can be sorted, so that the load is evenly distributed. And comprehensive consideration of the impact of all aspects of transmission and reception.
TCP/UDP连接,以及要处理的其他类型协议,有各自的特点,每个连接的双向负载是变化的,生存时间也是不确定的,非常精细的划分和配比对系统的开销很大。TCP/UDP connections, as well as other types of protocols to be processed, have their own characteristics. The bidirectional load of each connection is variable, and the lifetime is also uncertain. Very fine partitioning and matching are expensive for the system.
因此,综合考虑,希望利用最小的开销,达到最好的负载均衡效果,采用以下几个维度来衡量重新绑定的选取过程:连接数,接收字节数(Recv Bytes)和发送字节数(Send Bytes)。Therefore, considering this, we hope to achieve the best load balancing effect with the least overhead, and use the following dimensions to measure the rebinding selection process: number of connections, number of received bytes (Recv Bytes) and number of bytes sent ( Send Bytes).
连接数:连接的数量,连接作为CPU负载的最终载体,具有直观意义; 而且,Recv到数据时需要进行连接查找,进而转入连接状态处理,因此考虑平衡各协议栈线程连接数量,对优化查找速度也很有意义。Number of connections: the number of connections, the connection as the final carrier of the CPU load, has an intuitive meaning; Moreover, when Recv arrives at the data, it needs to perform connection lookup and then transfer to the connection state processing. Therefore, it is meaningful to balance the number of thread connections of each protocol stack.
Recv Bytes:rss本身主要是针对Recv端的数据包调度(Packets Dispatch),因此接收包的数据量很能反映对协议栈线程负载的影响。Recv Bytes: rss itself is mainly for Packets Dispatch on the Recv side, so the amount of data received by the packet can reflect the impact on the protocol stack thread load.
Send Bytes:发送数据包(Send Packets)由于受到Recv端数据与连接亲和性关系的影响,也会影响协议栈处理相关连接的Send负载。Send Bytes: Send Packets are affected by the relationship between the Recv end data and the connection affinity, and also affect the Send load of the protocol stack processing related connections.
本发明实施例中,负载均衡在原有线程间进行。因此,迁出的负载应满足:迁移前负载轻的线程(第二实例),迁移后的负载总值不应高于迁出线程(第一实例)未迁移前的负载总值;迁移前负载轻的线程(第二实例),迁移后绑定的所有RSS队列的连接数,Recv Bytes和Send Bytes 3个参数中至少有2个参数的值不应超出迁出线程(第一实例)未迁移前的对应参数值。In the embodiment of the present invention, load balancing is performed between original threads. Therefore, the migrated load should satisfy: the load-loaded thread before migration (second instance), the total load after migration should not be higher than the total load before the migration thread (first instance) is not migrated; pre-migration load Light thread (second instance), the number of connections of all RSS queues bound after migration, the value of at least 2 of the 3 parameters of Recv Bytes and Send Bytes should not exceed the value of the migration thread (first instance). The corresponding parameter value before.
不妨假设stack1所对应的线程中PCB4所对应的负载满足迁出负载的判定条件,则第一实例可将确定PCB4所对应的负载为待迁出负载。It may be assumed that the load corresponding to PCB4 in the thread corresponding to stack1 satisfies the determination condition of the outbound load, and the first instance may determine that the load corresponding to PCB4 is the load to be moved out.
stack1所对应的线程可将PCB4的标识或PCB4所对应的负载的标识反馈给Common Thread,并执行步骤S403。The thread corresponding to the stack1 can feed back the identifier of the PCB 4 or the identifier of the load corresponding to the PCB 4 to the Common Thread, and step S403 is performed.
另外,Common Thread在接收到stack1所对应的线程的反馈后,可向stack4所对应的线程发送第二指示消息,指示stack4所对应的线程准备迁入负载。该第二指示消息中可携带待迁入负载的信息。In addition, after receiving the feedback of the thread corresponding to the stack1, the Common Thread may send a second indication message to the thread corresponding to the stack4, indicating that the thread corresponding to the stack4 is ready to move into the load. The second indication message may carry information to be moved into the load.
S403,第一实例对待迁移负载的队列解除绑定。S403. The first instance unbinds the queue of the migrated load.
如图4所示,stack1所对应的线程在确定PCB4对应的负载为待迁出负载后,可解绑定PCB4所对应的负载在stack1所对应的线程所绑定的RSS队列。As shown in FIG. 4, after the thread corresponding to the stack1 determines that the load corresponding to the PCB4 is the load to be moved out, the load corresponding to the PCB4 can be unbound to the RSS queue bound by the thread corresponding to the stack1.
S404,第二实例绑定待迁移负载的队列。S404. The second instance binds the queue of the load to be migrated.
第二实例在收到第二指示消息后,可根据待迁移负载在共享资源池中的PCB,将待迁移负载在第一实例所绑定的RSS队列绑定到第二实例中,并将接收从该RSS队列进行接收数据包的过程,以及由此产生的数据包处理过程。After receiving the second indication message, the second instance may bind the RSS queue to which the load to be migrated is bound to the second instance to the second instance according to the PCB to be migrated in the shared resource pool, and receive the The process of receiving a packet from the RSS queue, and the resulting packet processing.
本发明实施例中,stack4所对应的线程可根据第二指示消息中PCB4的标识信息或PCB4所对应的负载的标识信息,从协议控制块分配池PCB Alloc中获取PCB4的信息并基于PCB4的信息在stack4所对应的线程重建负载,并将PCB4所对应的负载在stack1所对应的线程中绑定的RSS队列重绑定到stack4所对应的线程PCB4对应的负载上。 In the embodiment of the present invention, the thread corresponding to the stack4 may obtain the information of the PCB4 from the protocol control block allocation pool PCB Alloc according to the identification information of the PCB4 in the second indication message or the identification information of the load corresponding to the PCB4, and based on the information of the PCB4. The load corresponding to the stack4 rebuilds the load, and the RSS queue bound by the load corresponding to the PCB4 is bound to the load corresponding to the thread PCB4 corresponding to the stack4.
本发明实施例中,通过待迁移负载在共享资源池的PCB在原有实例间进行负载均衡,避免了负载均衡时不必要的数据传输,提高了负载均衡的效率。In the embodiment of the present invention, load balancing between the original instances is performed on the PCB of the shared resource pool through the load to be migrated, thereby avoiding unnecessary data transmission during load balancing, and improving the efficiency of load balancing.
另外,本发明实施例中,还可以直接修改待迁移负载所绑定的RSS队列的绑定规则,直接将迁移负载所绑定的RSS队列的绑定规则修改为绑定到第二实例对应的负载上,避免第一实例解绑定和第二实例绑定的操作。监控实例状态和确定高位运行实例的待迁移负载的步骤可参考本发明实施例的相关过程,本发明实施例在此不再赘述。In addition, in the embodiment of the present invention, the binding rule of the RSS queue bound to the load to be migrated can be directly modified, and the binding rule of the RSS queue bound to the migration load is directly modified to be bound to the second instance. On the load, avoid the operation of the first instance unbinding and the second instance binding. For the steps of monitoring the instance status and determining the load to be migrated of the high-level running instance, reference may be made to the related process in the embodiment of the present invention, and details are not described herein again.
图5是本发明实施例线程负载均衡的另一流程示意图。FIG. 5 is another schematic flowchart of thread load balancing according to an embodiment of the present invention.
在图5所示的场景中,用户态协议栈包含正在运行的应用所对应的多个协议栈。协议栈内协议控制块(Protocol Control Block,PCB)的关键数据结构存储于系统内存的共享资源池中。共享资源池在图5表现为协议控制块分配池(PCB Alloc),存储着PCB的关键数据结构,主要包括连接结构体信息,可用于快速响应恢复连接。协议栈中,PCB作为表示连接的主要数据结构,因此可以将其作为协议栈工作负载的主要衡量指标。如图5所示,用户态协议栈可包括协议栈stack1、stack2和stack3。其中,stack1所对应的线程包括2个负载,其对应的PCB分别为PCB1和PCB4;stack2所对应的线程包括1个负载,其对应的PCB为PCB3;stack3所对应的线程包括1个负载,其对应的PCB为PCB2。In the scenario shown in Figure 5, the user mode protocol stack contains multiple protocol stacks corresponding to the running application. The key data structures of the Protocol Control Block (PCB) in the protocol stack are stored in a shared resource pool of system memory. The shared resource pool is shown in Figure 5 as a protocol control block allocation pool (PCB Alloc), which stores the key data structure of the PCB, mainly including the connection structure information, which can be used to quickly respond to the recovery connection. In the protocol stack, the PCB serves as the main data structure for the connection, so it can be used as the main metric for the protocol stack workload. As shown in FIG. 5, the user mode protocol stack may include protocol stacks stack1, stack2, and stack3. The thread corresponding to stack1 includes 2 loads, and the corresponding PCBs are PCB1 and PCB4 respectively; the thread corresponding to stack2 includes 1 load, and the corresponding PCB is PCB3; the thread corresponding to stack3 includes 1 load, The corresponding PCB is PCB2.
S501,协议栈系统监控用户态协议栈中每个协议栈对应的实例的运行状态。S501. The protocol stack system monitors an running state of an instance corresponding to each protocol stack in the user state protocol stack.
步骤S501与图3的步骤S301类似,本发明实施例在此不再赘述。Step S501 is similar to step S301 of FIG. 3, and details are not described herein again.
S502,协议栈系统向第一实例发送指示消息。S502. The protocol stack system sends an indication message to the first instance.
协议栈系统根据监控的结果,可确定需要迁出负载的实例和能够迁入负载的实例。Based on the results of the monitoring, the protocol stack system can determine which instances need to be moved out of the load and instances that can move into the load.
如果用户态协议栈中每个协议栈对应的实例中存在至少一个高位运行的实例,则可确定该至少一个高位运行的实例为第一实例。If there is at least one instance of the high-bit operation in the instance corresponding to each protocol stack in the user-mode protocol stack, it may be determined that the instance of the at least one high-order operation is the first instance.
如图5所示,不妨假设步骤S501中,协议栈系统通过公共线程(Common Thread)监控到stack1所对应的线程高位运行,stack2和stack3所对应的线程不具备迁入负载的能力。As shown in FIG. 5, it is assumed that in step S501, the protocol stack system monitors the high-order running of the thread corresponding to stack1 through the common thread (Common Thread), and the thread corresponding to stack2 and stack3 does not have the ability to move into the load.
首先,Common Thread可向stack1所对应的线程发送第一指示(notify)消息,指示stack1所对应的线程确定迁出负载并解除对迁出负载所绑定的 RSS队列的绑定。First, the Common Thread may send a first notification (notify) message to the thread corresponding to the stack1, indicating that the thread corresponding to the stack1 determines the migration load and releases the binding to the migration load. Binding of the RSS queue.
stack1所对应的线程接收到第一指示消息后,首先要确定待迁出负载。After the thread corresponding to stack1 receives the first indication message, it first determines the load to be moved out.
类似的,为了利用最小的开销,达到最好的负载均衡效果,可采用以下几个维度来衡量重新绑定的选取过程:连接数,Recv Bytes和Send Bytes三个参数。Similarly, in order to achieve the best load balancing effect with the least overhead, the following dimensions can be used to measure the rebinding selection process: connection number, Recv Bytes and Send Bytes.
本发明实施例中,负载均衡在从原有线程迁入新建线程。在挑选迁出负载时,应选择连接数,Recv Bytes和Send Bytes三个参数整体上达到均值的RSS队列所对应的负载进行迁移。或者,可以分别对连接数,Recv Bytes和Send Bytes三个参数设定三个预定参数阈值,选择三个参数整体上达到对应的预定参数阈值的负载作为待迁出负载。In the embodiment of the present invention, the load balancing is moved from the original thread to the newly created thread. When selecting the migrating load, you should select the number of connections, and the three parameters of Recv Bytes and Send Bytes migrate to the load corresponding to the average RSS queue. Alternatively, three predetermined parameter thresholds may be set for the three parameters of the connection number, the Recv Bytes and the Send Bytes, and the load whose three parameters reach the corresponding predetermined parameter threshold as a whole is selected as the to-be-migrated load.
不妨假设PCB4对应的负载所绑定的RSS满足迁出负载的判定条件,则stack1所对应的线程可将PCB4的标识或PCB4所对应的负载的标识反馈给Common Thread,并解绑定PCB4所对应的负载在stack1所对应的线程所绑定的RSS队列。It may be assumed that the RSS bound to the load corresponding to PCB4 satisfies the determination condition of the outbound load, and the thread corresponding to stack1 can feed back the identifier of PCB4 or the load corresponding to PCB4 to Common Thread, and unbind the corresponding PCB4. The load is in the RSS queue bound to the thread corresponding to stack1.
stack1所对应的线程确定待迁移负载后,可向Common Thread反馈待迁移负载的信息,例如待迁移负载的标识,或者待迁移负载对应的PCB的标识,等等,并执行步骤S504。After the thread corresponding to the stack1 determines the load to be migrated, the information about the load to be migrated, such as the identifier of the load to be migrated, or the identifier of the PCB corresponding to the load to be migrated, is sent to the Common Thread, and so on, and step S504 is performed.
同时,如果用户态协议栈的多个实例中不存在至少一个低位运行的实例,则协议栈系统可指示创建新的实例作为第二实例,即执行步骤S503。Meanwhile, if at least one instance of the low-level operation does not exist in the plurality of instances of the user-mode protocol stack, the protocol stack system may instruct to create a new instance as the second instance, that is, perform step S503.
S503,协议栈系统指示创建新的实例作为第二实例。S503. The protocol stack system instructs to create a new instance as the second instance.
当协议栈系统监控到高位运行的实例且现有实例中不存在低位运行的实例,协议栈系统可创建一个新的实例,并确定该新建实例为第二实例,用于迁入负载以实现负载均衡。When the protocol stack system monitors the high-level running instance and there is no low-level running instance in the existing instance, the protocol stack system can create a new instance and determine that the newly created instance is the second instance, and is used to move into the load to implement the load. balanced.
如图5所示,协议栈系统通过Common Thread发送一条新建线程(new stack)的指令,创建新的线程,即stack4所对应的线程,并确定stack4所对应的线程为第二实例,同时完成对新建线程的初始化操作。线程初始化的具体流程可参考现有技术,本发明实施例在此不再赘述。As shown in Figure 5, the protocol stack system sends a new thread instruction via Common Thread, creates a new thread, that is, the thread corresponding to stack4, and determines that the thread corresponding to stack4 is the second instance, and completes the pair. The initialization operation of the new thread. For a specific process of thread initialization, reference may be made to the prior art, and details are not described herein again.
S504,第一实例对待迁移负载的队列解除绑定。S504. The first instance unbinds the queue of the migrated load.
如图5所示,stack1所对应的线程在确定PCB4对应的负载为待迁出负载后,可解绑定PCB4所对应的负载在stack1所对应的线程所绑定的RSS队列。 As shown in FIG. 5, after the thread corresponding to the stack1 determines that the load corresponding to the PCB4 is the load to be moved out, the load corresponding to the PCB4 can be unbound to the RSS queue bound by the thread corresponding to the stack1.
S505,第二实例绑定待迁移负载的队列。S505. The second instance binds the queue of the load to be migrated.
stack4所对应的线程可根据协议控制块分配池(PCB Alloc)中的PCB4的信息,将PCB4所对应的负载在stack1所对应的线程中所绑定的RSS队列绑定到第二实例中。此时,stack4所对应的线程将接收从这个队列进行接收数据包的过程,以及由此产生的数据包处理过程。The thread corresponding to the stack4 can control the information of the PCB4 in the block allocation pool (PCB Alloc) according to the protocol, and bind the RSS queue bound by the load corresponding to the PCB4 to the second instance in the thread queue bound to the thread corresponding to the stack1. At this point, the thread corresponding to stack4 will receive the process of receiving packets from this queue, and the resulting packet processing.
S506,第二实例与协议栈上层服务实现对接。S506. The second instance is connected to the upper layer service of the protocol stack.
第二实例为新建实例,还需完成与用户态协议栈的上层服务的对接,才能实现与负载对应的应用的交互。The second instance is to create a new instance, and the interface with the upper layer service of the user state protocol stack is also required to implement the interaction of the application corresponding to the load.
本发明实施例中,stack4所对应的线程可根据协议控制块分配池中的PCB4的信息,重新绑定stack4所对应的线程与上层套接字应用接口层(Socket API)中的消息盒子(msg box),完成线程与协议栈上层服务的重新对接,从而恢复线程与应用(app)的交互。In the embodiment of the present invention, the thread corresponding to the stack4 can control the information of the PCB4 in the block allocation pool according to the protocol, and re-bind the message box corresponding to the stack4 and the message box in the upper socket application interface layer (Socket API) (msg). Box), complete the re-docking of the thread and the upper layer of the protocol stack, thereby restoring the interaction between the thread and the application (app).
应理解,步骤S505和步骤S506之间不存在时间上的先后关系。It should be understood that there is no temporal relationship between step S505 and step S506.
本发明实施例中,通过待迁移负载在共享资源池的PCB在新建实例迁入高负载实例的负载,从而实现负载均衡,避免了负载均衡时不必要的数据传输,提高了负载均衡的效率。In the embodiment of the present invention, load balancing is performed on the PCB of the shared resource pool in the shared resource pool, thereby implementing load balancing, avoiding unnecessary data transmission during load balancing, and improving load balancing efficiency.
除了上述图3-图5所示实施例的监控实例运行状态的方法外,协议栈系统还可通过其它方式来监控实例的运行状态。本发明的另一种监控方式,协议栈系统可用实例标识来表征实例的存活状态,并通过监控实例的实例标识监控实例的存活状态,通过预定时间内实例的总负载均值来监控实例的负载状态,从而实现对实例的运行状态的监控。其中,每个实例标识对应于协议栈的一个实例,该实例标识可存储于内存共享空间,或者是共享文件,协议栈系统可通过轮询计时器轮询实例的实例标识。协议栈系统可用轮询计时器代替图3-图5中的Watch Dog,通过轮询计时器轮询线程的存活标识以实现对线程的存活状态的监控。其中,线程的存活标识可存储于内存共享空间,或者是共享文件,并与线程一一对应。另外,对实例的负载监控及实例负载迁移、负载重建的具体实现可参考图3-图5所示的实施例,本发明实施例在此不再赘述。当然,还可能存在其它监控实例运行状态的方式,本发明实施例对此不作限制。In addition to the above-described methods for monitoring the running state of the embodiment of the embodiment shown in FIG. 3 to FIG. 5, the protocol stack system can also monitor the running state of the instance by other means. In another monitoring mode of the present invention, the protocol stack system can use the instance identifier to represent the surviving state of the instance, and monitor the survival state of the instance by monitoring the instance ID of the instance, and monitor the load status of the instance by the total load average of the instance within a predetermined time. To achieve monitoring of the running state of the instance. Each instance identifier corresponds to an instance of the protocol stack, and the instance identifier can be stored in a memory shared space or a shared file, and the protocol stack system can poll the instance identifier of the instance by using a polling timer. The protocol stack system can use the polling timer instead of the Watch Dog in FIG. 3 to FIG. 5 to poll the thread's survival identifier by polling the timer to monitor the survival state of the thread. The thread's survival identifier can be stored in the memory shared space, or shared files, and one-to-one correspondence with the thread. In addition, for the specific implementation of the load monitoring and the instance load migration and the load reconstruction of the example, reference may be made to the embodiments shown in FIG. 3 to FIG. 5 , and details are not described herein again. Certainly, there may be other ways of monitoring the running state of the instance, which is not limited by the embodiment of the present invention.
图6是本发明实施例协议栈系统600的结构示意图。协议栈系统600可包括监控单元601、确定单元602和负载迁移单元603。 FIG. 6 is a schematic structural diagram of a protocol stack system 600 according to an embodiment of the present invention. The protocol stack system 600 can include a monitoring unit 601, a determining unit 602, and a load migration unit 603.
监控单元601,用于监控用户态协议栈中每个协议栈对应的实例的运行状态。The monitoring unit 601 is configured to monitor an running state of an instance corresponding to each protocol stack in the user state protocol stack.
其中,一个该实例对应于该用户态协议栈中的一个协议栈。One of the instances corresponds to a protocol stack in the user state protocol stack.
应理解,本发明实施例中,实例可以是协议栈系统内的一个进程或一个线程。内核在创建进程/线程的时候,会为进程/线程创建相应的堆栈。每个进程/线程会有两个栈,一个用户栈,存在于用户空间,一个内核栈,存在于内核空间。It should be understood that in an embodiment of the present invention, an instance may be a process or a thread within a protocol stack system. When the kernel creates a process/thread, it creates a stack for the process/thread. Each process/thread has two stacks, a user stack, which exists in user space, and a kernel stack that exists in kernel space.
应理解,本发明实施例中,用户态协议栈用于表示存在于用户空间的所有协议栈。在用户态协议栈中,可包含一个或多个协议栈,每个协议栈与协议栈系统的一个实例形成一一对应的关系。It should be understood that in the embodiment of the present invention, the user state protocol stack is used to represent all protocol stacks existing in the user space. In the user state protocol stack, one or more protocol stacks may be included, and each protocol stack forms a one-to-one correspondence with an instance of the protocol stack system.
应理解,本发明实施例中,实例的运行状态包括实例的负载状态和存活状态。It should be understood that, in the embodiment of the present invention, the running state of the instance includes the load state and the survival state of the instance.
确定单元602,用于确定第一实例和第二实例。The determining unit 602 is configured to determine the first instance and the second instance.
其中,第一实例为运行状态异常的实例,第二实例该第二实例具备迁入该第一实例中至少一个待迁移负载的能力。The first instance is an instance of a running state abnormality, and the second instance has a capability of moving into at least one load to be migrated in the first instance.
另外,一个该待迁移负载在该第一实例所对应的协议栈内对应于一个协议控制块PCB,该PCB在共享资源池中对应于一个存储着该待迁移负载的连接参数的PCB,该待迁移负载的连接参数能够用于重建该待迁移负载。In addition, a load to be migrated corresponds to a protocol control block PCB in the protocol stack corresponding to the first instance, and the PCB corresponds to a PCB storing the connection parameters of the load to be migrated in the shared resource pool. The connection parameters of the migration load can be used to reconstruct the load to be migrated.
应理解,本发明实施例中,一个负载对应于一个PCB,一个负载在数据处理上等于一个PCB所对应的连接的数据处理量。It should be understood that, in the embodiment of the present invention, one load corresponds to one PCB, and one load is equal in data processing to the data processing amount of the connection corresponding to one PCB.
当一个实例被创建并初始化后,相应地会生成一个协议栈。如果实例内还不存在任何负载,则协议栈中也不会有PCB的信息。实例中有几个负载,其对应的协议栈中就会有相同个数的PCB。When an instance is created and initialized, a protocol stack is generated accordingly. If there is no load in the instance, there will be no PCB information in the protocol stack. There are several loads in the instance, and there will be the same number of PCBs in the corresponding protocol stack.
另外,本发明实施例中,协议栈只是存储着PCB的一些基本信息,例如PCB标识等。共享资源池中存储着PCB的关键数据结构,主要包括连接结构体信息,该连接结构体信息对快速响应恢复连接具有关键作用。In addition, in the embodiment of the present invention, the protocol stack only stores some basic information of the PCB, such as a PCB identifier. The shared resource pool stores the key data structure of the PCB, mainly including the connection structure information, which has a key role for quick response recovery connection.
应理解,运行状态异常的实例,一般可包括存活状态异常的实例或负载状态异常的实例。It should be understood that instances of operational state anomalies may generally include instances of surviving state anomalies or instances of load state anomalies.
存活状态异常的实例可包括僵死或失效的实例。Examples of abnormal state of survival may include instances of zombie or failure.
负载状态异常的实例,可包括负载高位运行的实例。在判断实例是否是负载高位运行时,可通过比较一段时间内实例总负载均值与预定阈值的关系 来确定实例是否处于负载高位运行状态。An instance of a load state exception can include an instance of a load high bit operation. When judging whether the instance is running at a high load, the relationship between the average total load of the instance and the predetermined threshold can be compared by comparing the time period. To determine if the instance is in a high load state.
负载迁移单元603,用于根据该第一实例中至少一个待迁移负载在共享资源池中所对应的协议控制块PCB在该第二实例中重建该至少一个待迁移负载。The load migration unit 603 is configured to rebuild the at least one load to be migrated in the second instance according to the protocol control block PCB corresponding to the at least one load to be migrated in the shared resource pool.
本发明实施例中,协议栈系统600根据异常实例中待迁移负载在共享资源池对应的PCB在具备迁入负载能力的实例中重建待迁移负载,能够克服协议栈共用一个分发模块带来的系统分发瓶颈,快速进行负载均衡和故障恢复,从而提高协议栈系统的性能。In the embodiment of the present invention, the protocol stack system 600 rebuilds the load to be migrated in the instance with the load-bearing capability in the PCB corresponding to the shared resource pool according to the load to be migrated in the abnormal instance, and can overcome the system brought by the protocol stack sharing a distribution module. Distribution bottlenecks, rapid load balancing and failure recovery improve the performance of the protocol stack system.
可选地,确定单元602还可用于确定该第一实例中的至少一个待迁移负载。Optionally, the determining unit 602 is further configured to determine at least one load to be migrated in the first instance.
可选地,监控单元601具体用于:分别向该用户态协议栈中每个协议栈对应的实例发送心跳消息并监控该心跳消息响应时延,并监控该用户态协议栈中每个协议栈对应的实例在第一预定时间内的实例负载均值,以根据该心跳消息的响应时延和该实例负载均值确定该用户态协议栈中每个协议栈对应的实例的运行状态,其中,一条心跳消息对应于一个该实例;或者,分别轮询该用户态协议栈中每个协议栈对应的实例的实例标识,并监控该用户态协议栈中每个协议栈对应的实例在第一预定时间内的实例负载均值,以根据该实例标识和该实例负载均值确定该用户态协议栈中每个协议栈对应的实例的运行状态,其中,该实例标识用于表示实例的存活状态,该实例标识存储于共享内存区域或共享文件,一个该实例标识对应于一个该实例。Optionally, the monitoring unit 601 is configured to: separately send a heartbeat message to the instance corresponding to each protocol stack in the user state protocol stack, and monitor the heartbeat message response delay, and monitor each protocol stack in the user state protocol stack. The instance load average of the corresponding instance in the first predetermined time, to determine the running state of the instance corresponding to each protocol stack in the user state protocol stack according to the response delay of the heartbeat message and the average value of the instance load, wherein a heartbeat The message corresponds to one instance; or, respectively, the instance identifier of the instance corresponding to each protocol stack in the user state protocol stack is polled, and the instance corresponding to each protocol stack in the user state protocol stack is monitored in the first predetermined time. The instance load average value is used to determine an running state of an instance corresponding to each protocol stack in the user mode protocol stack according to the instance identifier and the instance load average value, where the instance identifier is used to indicate a survival state of the instance, and the instance identifier is stored. For a shared memory area or shared file, one instance ID corresponds to one instance.
可选地,作为一个实施例,在用于确定第一实例的过程中,确定单元602具体用于:确定距离发送心跳消息时刻达到第二预定时间后仍然未反馈心跳响应的实例为该第一实例;或者,确定第一预定时间内实例标识都表示僵死或失效状态的实例为该第一实例。Optionally, as an embodiment, in the process for determining the first instance, the determining unit 602 is specifically configured to: determine, by the first time after the sending of the heartbeat message, that the heartbeat response is not fed back after the second predetermined time is the first An instance; or, determining that the instance identifier indicates a dead or dead state in the first predetermined time is the first instance.
本实施例中,在用于确定第二实例的过程中,确定单元602具体用于创建并确定新的实例为该第二实例;负载迁移单元603具体用于根据该至少一个待迁移负载之第一负载在共享资源池中所对应的第一PCB在该第二实例中实现该第一负载与该用户态协议栈的上层服务的对接,并将该第一负载在该第一实例中绑定的第一接收端扩展RSS队列重绑定到该第二实例的该第一负载中,其中,该至少一个待迁移负载包括该第一实例的所有负载。In this embodiment, in the process for determining the second instance, the determining unit 602 is specifically configured to create and determine that the new instance is the second instance; the load migration unit 603 is specifically configured to use the at least one load to be migrated The first PCB corresponding to the load in the shared resource pool implements the docking of the first load with the upper layer service of the user state protocol stack in the second instance, and binds the first load in the first instance. The first receiving end extended RSS queue is rebinded into the first load of the second instance, wherein the at least one load to be migrated includes all loads of the first instance.
图7是本发明实施例协议栈系统600的另一结构示意图。如图7所示, 协议栈系统600还可包括:实例停止单元604,用于终止该第一实例。FIG. 7 is another schematic structural diagram of a protocol stack system 600 according to an embodiment of the present invention. As shown in Figure 7, The protocol stack system 600 can also include an instance stop unit 604 for terminating the first instance.
可选地,作为另一实施例,在用于确定第一实例的过程中,确定单元602具体用于:确定第一预定时间内实例总负载均值大于第一预定阈值的实例为该第一实例。Optionally, in another process, in the process for determining the first instance, the determining unit 602 is specifically configured to: determine that the instance total load average value is greater than the first predetermined threshold in the first predetermined time is the first instance .
可选地,在本具体实现方式的一种场景中,在用于确定第二实例的过程中,确定单元602具体用于:如果存在第一预定时间内实例总负载均值低于第二预定阈值的实例,则确定预定时间内实例总负载均值低于第二预定阈值的一个或多个实例作为该第二实例,其中,迁入该第二实例的所有负载的负载值与该第二预定阈值之和小于该第一预定阈值。Optionally, in a scenario of the specific implementation, in the process for determining the second instance, the determining unit 602 is specifically configured to: if there is an instance total load average value lower than a second predetermined threshold in the first predetermined time And determining, as the second instance, one or more instances in which the average total load of the instance is lower than a second predetermined threshold within a predetermined time, wherein a load value of all loads moved into the second instance and the second predetermined threshold The sum is less than the first predetermined threshold.
进一步地,在当前的具体实现方式中,负载迁移单元603具体用于:根据该第一实例的至少一个待迁移负载之第二负载在该共享资源池中所对应的第二PCB,将该第二负载在该第一实例中绑定的第二RSS队列的绑定规则修改为绑定到该第二实例的第二负载中,以使得该第二实例实现从该第二RSS队列进行数据包接收及处理的过程;或者,根据该第一实例的至少一个待迁移负载之第二负载在该共享资源池中所对应的第二PCB,在该第一实例中解除该第二负载在该第一实例中绑定的第二RSS队列,并在该第二实例中将该第二RSS队列绑定到该第二负载中,以使得该第二实例实现从该第二RSS队列进行数据包接收及处理的过程。Further, in the current specific implementation, the load migration unit 603 is specifically configured to: according to the second load corresponding to the second load of the at least one load to be migrated in the first instance, the second PCB corresponding to the shared resource pool Binding rules of the second RSS queue bound by the second load in the first instance are modified to be bound to the second load of the second instance, so that the second instance implements data packet from the second RSS queue. a process of receiving and processing; or, according to the second load corresponding to the second load of the at least one load to be migrated in the shared resource, the second load is released in the first instance in the first instance a second RSS queue bound in an instance, and binding the second RSS queue to the second payload in the second instance, so that the second instance implements data packet reception from the second RSS queue And the process of processing.
另外,在当前的具体实现方式中,在用于确定该第一实例中的至少一个待迁移负载的过程中,确定单元602具体用于:确定该第一实例中的第三负载为该第一实例的待迁移负载,该第三负载在该第一实例中所绑定的第三RSS队列满足以下条件:当该第三RSS队列绑定到该第二实例时该第二实例的连接数、接收字节数、发送字节数3个参数中至少有2个参数不大于该第一实例的相应参数。In addition, in the current specific implementation, in the process for determining the at least one load to be migrated in the first instance, the determining unit 602 is specifically configured to: determine that the third load in the first instance is the first The load to be migrated of the instance, the third RSS queue bound by the third load in the first instance satisfies the following condition: the number of connections of the second instance when the third RSS queue is bound to the second instance, At least two of the three parameters of the number of received bytes and the number of transmitted bytes are not greater than the corresponding parameters of the first instance.
可选地,在本实施例的一种具体实现方式中,在用于确定第二实例的过程中,确定单元602具体用于:如果不存在预定时间内实例总负载均值低于第二预定阈值的实例,则创建并确定新的实例为该第二实例。Optionally, in a specific implementation manner of the embodiment, in the process for determining the second instance, the determining unit 602 is specifically configured to: if there is no instance time, the total load average value is lower than the second predetermined threshold. For an instance, create and determine a new instance for the second instance.
进一步地,在当前的具体实现方式中,负载迁移单元603具体用于:根据该第一实例的至少一个待迁移负载之第二负载在该共享资源池中所对应的第二PCB在该第二实例中实现该第二负载与该用户态协议栈的上层服务的对接以使得该第二实例实现与该第二负载对应的应用app的交互,并在该第 一实例中解除该第二负载在该第一实例中绑定的第二RSS队列,在该第二实例中将该第二RSS队列绑定到该第二负载中,以使得该第二实例实现从该第二RSS队列进行数据包接收及处理的过程。Further, in the current specific implementation, the load migration unit 603 is specifically configured to: the second PCB corresponding to the second load of the at least one load to be migrated according to the first instance in the shared resource pool is in the second In the example, the second load is implemented to be connected to the upper layer service of the user state protocol stack, so that the second instance implements the interaction of the application app corresponding to the second load, and in the Dissolving, in an instance, the second RSS queue bound by the second payload in the first instance, and binding the second RSS queue to the second payload in the second instance, so that the second instance is implemented The process of receiving and processing data packets from the second RSS queue.
另外,在当前的具体实现方式中,在用于确定该第一实例中的至少一个待迁移负载的过程中,确定单元602具体用于:确定该第一实例中的第三负载为该第一实例的待迁移负载,该第三负载在该第一实例中所绑定的第三RSS队列满足以下条件:该第三RSS队列的连接数、接收字节数、发送字节数3个参数中都达到该第一实例的所有负载中对应参数的均值。In addition, in the current specific implementation, in the process for determining the at least one load to be migrated in the first instance, the determining unit 602 is specifically configured to: determine that the third load in the first instance is the first The load of the instance to be migrated, the third RSS queue bound by the third load in the first instance satisfies the following conditions: the number of connections, the number of received bytes, and the number of bytes sent in the third RSS queue are three parameters. Both reach the mean of the corresponding parameters in all loads of the first instance.
协议栈系统600还可执行图1、图2的方法,并能实现协议栈系统在上述如图1至图5所示的实施例的功能,具体实现可参考图1至图5所示实施例,本发明实施例在此不再赘述。The protocol stack system 600 can also perform the functions of the embodiment shown in FIG. 1 and FIG. 2, and can implement the functions of the protocol stack system in the embodiment shown in FIG. 1 to FIG. 5, and the specific implementation can refer to the embodiment shown in FIG. 1 to FIG. The embodiments of the present invention are not described herein again.
图8是本发明实施例协议栈系统800的结构示意图。协议栈系统可包括IO通道801、处理器802和存储器803。FIG. 8 is a schematic structural diagram of a protocol stack system 800 according to an embodiment of the present invention. The protocol stack system can include an IO channel 801, a processor 802, and a memory 803.
IO通道801、处理器802和存储器803通过总线804系统相互连接;总线804可以是ISA总线、PCI总线或EISA总线等。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图8中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The IO channel 801, the processor 802, and the memory 803 are interconnected by a bus 804 system; the bus 804 may be an ISA bus, a PCI bus, or an EISA bus. The bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in Figure 8, but it does not mean that there is only one bus or one type of bus.
存储器803,用于存放程序。具体地,程序可以包括程序代码,所述程序代码包括计算机操作指令。存储器803可能包含高速RAM存储器,也可能还包括非易失性存储器(non-volatile memory),例如至少一个磁盘存储器。The memory 803 is configured to store a program. In particular, the program can include program code, the program code including computer operating instructions. The memory 803 may include a high speed RAM memory and may also include a non-volatile memory such as at least one disk memory.
处理器802执行存储器803所存放的程序,用于监控用户态协议栈中每个协议栈对应的实例的运行状态,确定第一实例和第二实例,并根据该第一实例中至少一个待迁移负载在存储器803的共享资源池中所对应的协议控制块PCB在该第二实例中重建该至少一个待迁移负载。其中,一个该实例对应于该用户态协议栈中的一个协议栈,该第一实例为运行状态异常的实例,该第二实例具备迁入该第一实例中至少一个待迁移负载的能力,一个该待迁移负载在该第一实例所对应的协议栈内对应于一个协议控制块PCB,该PCB在共享资源池中对应于一个存储着该待迁移负载的连接参数的PCB,该待迁移负载的连接参数能够用于重建该待迁移负载。The processor 802 executes a program stored in the memory 803, and is configured to monitor an operation state of an instance corresponding to each protocol stack in the user mode protocol stack, determine the first instance and the second instance, and perform at least one to be migrated according to the first instance. The protocol control block PCB corresponding to the shared resource pool of the memory 803 rebuilds the at least one load to be migrated in the second instance. The one instance corresponds to a protocol stack in the user state protocol stack, the first instance is an instance of an abnormal running state, and the second instance has the capability of moving into at least one load to be migrated in the first instance, and one The to-be-migrated load corresponds to a protocol control block PCB in the protocol stack corresponding to the first instance, and the PCB corresponds to a PCB storing the connection parameters of the load to be migrated in the shared resource pool, and the load to be migrated The connection parameters can be used to reconstruct the load to be migrated.
应理解,本发明实施例中,用户态协议栈用于表示存在于用户空间的所有协议栈。在用户态协议栈中,可包含一个或多个协议栈,每个协议栈与协 议栈系统的一个实例形成一一对应的关系。It should be understood that in the embodiment of the present invention, the user state protocol stack is used to represent all protocol stacks existing in the user space. In the user state protocol stack, one or more protocol stacks may be included, and each protocol stack and protocol An example of a stacking system forms a one-to-one correspondence.
应理解,本发明实施例中,一个负载对应于一个PCB,一个负载在数据处理上等于一个PCB所对应的连接的数据处理量。It should be understood that, in the embodiment of the present invention, one load corresponds to one PCB, and one load is equal in data processing to the data processing amount of the connection corresponding to one PCB.
存储器803可以包括只读存储器和随机存取存储器,并向处理器802提供指令和数据。存储器803的一部分还可以包括非易失性随机存取存储器(NVRAM)。 Memory 803 can include read only memory and random access memory and provides instructions and data to processor 802. A portion of the memory 803 may also include non-volatile random access memory (NVRAM).
上述如本发明图1至图5任一实施例揭示的方法可以应用于处理器802中,或者由处理器802实现。处理器802可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器802中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器802可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、网络处理器(Network Processor,简称NP)等;还可以是数字信号处理器(DSP)、专用集成电路(ASIC)、现成可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本发明实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本发明实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器803,处理器802读取存储器803中的信息,结合其硬件完成上述方法的步骤。The method disclosed in any of the embodiments of FIG. 1 to FIG. 5 of the present invention may be applied to the processor 802 or implemented by the processor 802. Processor 802 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the foregoing method may be completed by an integrated logic circuit of hardware in the processor 802 or an instruction in a form of software. The processor 802 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP Processor, etc.), or a digital signal processor (DSP), an application specific integrated circuit. (ASIC), off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component. The methods, steps, and logical block diagrams disclosed in the embodiments of the present invention may be implemented or carried out. The general purpose processor may be a microprocessor or the processor or any conventional processor or the like. The steps of the method disclosed in the embodiments of the present invention may be directly implemented by the hardware decoding processor, or may be performed by a combination of hardware and software modules in the decoding processor. The software module can be located in a conventional storage medium such as random access memory, flash memory, read only memory, programmable read only memory or electrically erasable programmable memory, registers, and the like. The storage medium is located in the memory 803, and the processor 802 reads the information in the memory 803 and completes the steps of the above method in combination with its hardware.
可选地,处理器802还用于确定该第一实例中的至少一个待迁移负载。Optionally, the processor 802 is further configured to determine at least one load to be migrated in the first instance.
可选地,在用于监控用户态协议栈中多个实例的运行状态的过程中,处理器802具体用于:分别向该用户态协议栈中每个协议栈对应的实例发送心跳消息并监控该心跳消息响应时延,并监控该用户态协议栈中每个协议栈对应的实例在第一预定时间内的实例负载均值,以根据该心跳消息的响应时延和该实例负载均值确定该用户态协议栈中每个协议栈对应的实例的运行状态,其中,一条心跳消息对应于一个该实例;或者,分别轮询该用户态协议栈中每个协议栈对应的实例的实例标识,并监控该用户态协议栈中每个协议栈对应的实例在第一预定时间内的实例负载均值,以根据该实例标识和该实例负载均值确定该用户态协议栈中每个协议栈对应的实例的运行状态,其中, 该实例标识用于表示实例的存活状态,该实例标识存储于共享内存区域或共享文件,一个该实例标识对应于一个该实例。Optionally, in the process of monitoring the running status of multiple instances in the user-mode protocol stack, the processor 802 is specifically configured to: separately send a heartbeat message to the instance corresponding to each protocol stack in the user-mode protocol stack, and monitor The heartbeat message responds to the delay, and monitors an instance load average of the instance corresponding to each protocol stack in the user state protocol stack in the first predetermined time to determine the user according to the response delay of the heartbeat message and the average value of the instance load. An operation state of an instance corresponding to each protocol stack in the protocol stack, wherein one heartbeat message corresponds to one instance; or, respectively, polling instance identifiers of instances corresponding to each protocol stack in the user state protocol stack, and monitoring The instance load average of the instance corresponding to each protocol stack in the user-mode protocol stack in the first predetermined time, to determine the running of the instance corresponding to each protocol stack in the user-mode protocol stack according to the instance identifier and the instance load average State, where The instance identifier is used to indicate the survival state of the instance, and the instance identifier is stored in a shared memory area or a shared file, and one instance identifier corresponds to one instance.
可选地,作为一个实施例,在用于确定第一实例的过程中,处理器802具体用于:确定距离发送心跳消息时刻达到第二预定时间后仍然未反馈心跳响应的实例为该第一实例;或者,确定第一预定时间内实例标识都表示僵死或失效状态的实例为该第一实例。Optionally, as an embodiment, in the process for determining the first instance, the processor 802 is specifically configured to: determine that the first time after the sending of the heartbeat message time reaches the second predetermined time, the instance that still does not feed back the heartbeat response is the first An instance; or, determining that the instance identifier indicates a dead or dead state in the first predetermined time is the first instance.
本实施例中,在用于确定第二实例的过程中,处理器802具体用于创建并确定新的实例为该第二实例;在用于根据该第一实例中至少一个待迁移负载在存储器803的共享资源池中所对应的协议控制块PCB在该第二实例中重建该至少一个待迁移负载的过程中,处理器802具体用于根据该至少一个待迁移负载之第一负载在共享资源池中所对应的第一PCB在该第二实例中实现该第一负载与该用户态协议栈的上层服务的对接,并将该第一负载在该第一实例中绑定的第一接收端扩展RSS队列重绑定到该第二实例的该第一负载中,其中,该至少一个待迁移负载包括该第一实例的所有负载。此时,处理器802还可用于终止该第一实例。In this embodiment, in the process for determining the second instance, the processor 802 is specifically configured to create and determine a new instance as the second instance; in the memory for at least one load to be migrated according to the first instance In the process of rebuilding the at least one load to be migrated in the second instance, the processor 802 is specifically configured to share the resource according to the first load of the at least one load to be migrated. The first PCB corresponding to the pool implements the connection between the first load and the upper layer service of the user state protocol stack in the second instance, and binds the first load to the first receiving end bound in the first instance. The extended RSS queue is rebinded into the first load of the second instance, wherein the at least one load to be migrated includes all loads of the first instance. At this time, the processor 802 can also be used to terminate the first instance.
可选地,作为另一实施例,在用于确定第一实例的过程中,处理器802具体用于:确定第一预定时间内实例总负载均值大于第一预定阈值的实例为该第一实例。Optionally, in another process, in the process for determining the first instance, the processor 802 is specifically configured to: determine that the instance total load average value is greater than the first predetermined threshold in the first predetermined time is the first instance .
可选地,在本具体实现方式的一种场景中,在用于确定第二实例的过程中,处理器802具体用于:如果存在第一预定时间内实例总负载均值低于第二预定阈值的实例,则确定预定时间内实例总负载均值低于第二预定阈值的一个或多个实例作为该第二实例,其中,迁入该第二实例的所有负载的负载值与该第二预定阈值之和小于该第一预定阈值。Optionally, in a scenario of the specific implementation, in the process for determining the second instance, the processor 802 is specifically configured to: if there is an instance total load average value lower than a second predetermined threshold in the first predetermined time And determining, as the second instance, one or more instances in which the average total load of the instance is lower than a second predetermined threshold within a predetermined time, wherein a load value of all loads moved into the second instance and the second predetermined threshold The sum is less than the first predetermined threshold.
进一步地,在当前的具体实现方式下,在用于根据该第一实例中至少一个待迁移负载在存储器803的共享资源池中所对应的协议控制块PCB在该第二实例中重建该至少一个待迁移负载的过程中,处理器802具体用于:根据该第一实例的至少一个待迁移负载之第二负载在该共享资源池中所对应的第二PCB,将该第二负载在该第一实例中绑定的第二RSS队列的绑定规则修改为绑定到该第二实例的第二负载中,以使得该第二实例实现从该第二RSS队列进行数据包接收及处理的过程;或者,根据该第一实例的至少一个待迁移负载之第二负载在该共享资源池中所对应的第二PCB,在该第一实例中解除 该第二负载在该第一实例中绑定的第二RSS队列,并在该第二实例中将该第二RSS队列绑定到该第二负载中,以使得该第二实例实现从该第二RSS队列进行数据包接收及处理的过程。Further, in the current specific implementation, the at least one protocol is reconstructed in the second instance in a shared resource pool corresponding to the at least one load to be migrated in the shared resource pool in the first instance. The processor 802 is specifically configured to: in the second PCB corresponding to the second load of the at least one load to be migrated according to the first instance, the second load is in the first The binding rule of the second RSS queue bound in an instance is modified to be bound to the second load of the second instance, so that the second instance implements the process of receiving and processing data packets from the second RSS queue. Or the second PCB corresponding to the second load of the load to be migrated according to the first instance in the shared resource pool is released in the first instance. The second load is bound to the second RSS queue in the first instance, and the second RSS queue is bound to the second load in the second instance, such that the second instance is implemented from the first The process of receiving and processing data packets by the second RSS queue.
另外,在当前的具体实现方式下,在用于确定该第一实例中的至少一个待迁移负载的过程中,处理器802具体用于:确定该第一实例中的第三负载为该第一实例的待迁移负载,该第三负载在该第一实例中所绑定的第三RSS队列满足以下条件:当该第三RSS队列绑定到该第二实例时该第二实例的连接数、接收字节数、发送字节数3个参数中至少有2个参数不大于该第一实例的相应参数。In addition, in the current specific implementation, in the process for determining the at least one load to be migrated in the first instance, the processor 802 is specifically configured to: determine that the third load in the first instance is the first The load to be migrated of the instance, the third RSS queue bound by the third load in the first instance satisfies the following condition: the number of connections of the second instance when the third RSS queue is bound to the second instance, At least two of the three parameters of the number of received bytes and the number of transmitted bytes are not greater than the corresponding parameters of the first instance.
可选地,在本实施例的一种具体实现方式中,在用于确定第二实例的过程中,处理器802具体用于:如果不存在预定时间内实例总负载均值低于第二预定阈值的实例,则创建并确定新的实例为该第二实例。Optionally, in a specific implementation manner of this embodiment, in the process for determining the second instance, the processor 802 is specifically configured to: if there is no predetermined time, the total load average of the instance is lower than a second predetermined threshold. For an instance, create and determine a new instance for the second instance.
进一步地,在当前的具体实现方式下,在用于根据该第一实例中至少一个待迁移负载在存储器803的共享资源池中所对应的协议控制块PCB在该第二实例中重建该至少一个待迁移负载的过程中,处理器802具体用于:根据该第一实例的至少一个待迁移负载之第二负载在该共享资源池中所对应的第二PCB在该第二实例中实现该第二负载与该用户态协议栈的上层服务的对接以使得该第二实例实现与该第二负载对应的应用app的交互,并在该第一实例中解除该第二负载在该第一实例中绑定的第二RSS队列,在该第二实例中将该第二RSS队列绑定到该第二负载中,以使得该第二实例实现从该第二RSS队列进行数据包接收及处理的过程。Further, in the current specific implementation, the at least one protocol is reconstructed in the second instance in a shared resource pool corresponding to the at least one load to be migrated in the shared resource pool in the first instance. The processor 802 is specifically configured to: implement, according to the second PCB corresponding to the second load of the at least one load to be migrated in the shared resource pool, the second PCB in the second instance according to the first instance Interfacing the upper load with the upper layer service of the user mode protocol stack to enable the second instance to implement the interaction of the application app corresponding to the second load, and releasing the second load in the first instance in the first instance Binding a second RSS queue, in the second instance, binding the second RSS queue to the second load, so that the second instance implements a process of receiving and processing data packets from the second RSS queue .
另外,在当前的具体实现方式下,在用于确定该第一实例中的至少一个待迁移负载的过程中,处理器802具体用于:确定该第一实例中的第三负载为该第一实例的待迁移负载,该第三负载在该第一实例中所绑定的第三RSS队列满足以下条件:该第三RSS队列的连接数、接收字节数、发送字节数3个参数中都达到该第一实例的所有负载中对应参数的均值。In addition, in the current specific implementation, in the process for determining the at least one load to be migrated in the first instance, the processor 802 is specifically configured to: determine that the third load in the first instance is the first The load of the instance to be migrated, the third RSS queue bound by the third load in the first instance satisfies the following conditions: the number of connections, the number of received bytes, and the number of bytes sent in the third RSS queue are three parameters. Both reach the mean of the corresponding parameters in all loads of the first instance.
协议栈系统800还可执行图1、图2的方法,并能实现协议栈系统在上述如图1至图5所示的实施例的功能,具体实现可参考图1至图5所示实施例,本发明实施例在此不再赘述。The protocol stack system 800 can also perform the functions of the embodiment shown in FIG. 1 and FIG. 2, and can implement the functions of the protocol stack system in the embodiment shown in FIG. 1 to FIG. 5, and the specific implementation can refer to the embodiment shown in FIG. 1 to FIG. The embodiments of the present invention are not described herein again.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结 合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those of ordinary skill in the art will appreciate that the elements and algorithm steps of the various examples described in connection with the embodiments disclosed herein can be implemented in electronic hardware, or in computer software and electronic hardware. Come together to achieve. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the solution. A person skilled in the art can use different methods for implementing the described functions for each particular application, but such implementation should not be considered to be beyond the scope of the present invention.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。A person skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the system, the device and the unit described above can refer to the corresponding process in the foregoing method embodiment, and details are not described herein again.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of the unit is only a logical function division. In actual implementation, there may be another division manner, for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The functions may be stored in a computer readable storage medium if implemented in the form of a software functional unit and sold or used as a standalone product. Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, or a part of the technical solution, may be embodied in the form of a software product, which is stored in a storage medium, including The instructions are used to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易 想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。 The above is only a specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily within the technical scope disclosed by the present invention. Any changes or substitutions are contemplated as being within the scope of the invention. Therefore, the scope of the invention should be determined by the scope of the claims.

Claims (26)

  1. 一种并行用户态协议栈的管理方法,其特征在于,包括:A method for managing a parallel user state protocol stack, comprising:
    监控用户态协议栈中每个协议栈对应的实例的运行状态,一个所述实例对应于所述用户态协议栈中的一个协议栈;Monitoring an operating state of an instance corresponding to each protocol stack in the user mode protocol stack, where the instance corresponds to a protocol stack in the user state protocol stack;
    确定第一实例和第二实例,其中所述第一实例为运行状态异常的实例,所述第二实例具备迁入所述第一实例中至少一个待迁移负载的能力,一个所述待迁移负载在所述第一实例所对应的协议栈内对应于一个协议控制块PCB,所述PCB在共享资源池中对应于一个存储着所述待迁移负载连接参数的PCB,所述待迁移负载的连接参数能够用于重建所述待迁移负载;Determining a first instance and a second instance, wherein the first instance is an instance of a running state abnormality, and the second instance has a capability of migrating to at least one load to be migrated in the first instance, and the load to be migrated Corresponding to a protocol control block PCB in the protocol stack corresponding to the first instance, the PCB corresponds to a PCB storing the load connection parameters to be migrated in the shared resource pool, and the connection of the load to be migrated The parameter can be used to reconstruct the load to be migrated;
    根据所述第一实例中至少一个待迁移负载在所述共享资源池中所对应的PCB在所述第二实例中重建所述至少一个待迁移负载。The at least one to-be-migrated load is reconstructed in the second instance according to the PCB corresponding to the at least one load to be migrated in the shared resource pool in the first instance.
  2. 如权利要求1所述的方法,其特征在于,在所述根据所述第一实例中至少一个待迁移负载在共享资源池中所对应的PCB在所述第二实例中重建所述至少一个待迁移负载之前,所述方法还包括:The method of claim 1, wherein the at least one to be rebuilt in the second instance in the PCB corresponding to the at least one load to be migrated in the shared resource pool according to the first instance Before the load is migrated, the method further includes:
    确定所述第一实例中的至少一个待迁移负载。Determining at least one load to be migrated in the first instance.
  3. 如权利要求2所述的方法,其特征在于,所述实例的运行状态包括实例的负载状态和存活状态,所述监控用户态协议栈中每个协议栈对应的实例的运行状态包括:The method of claim 2, wherein the running state of the instance comprises a load state and a surviving state of the instance, and the running states of the instance corresponding to each protocol stack in the monitoring user mode protocol stack include:
    分别向所述用户态协议栈中每个协议栈对应的实例发送心跳消息并监控所述心跳消息响应时延,并监控所述用户态协议栈中每个协议栈对应的实例在第一预定时间内的实例负载均值,以根据所述心跳消息的响应时延和所述实例负载均值确定所述用户态协议栈中每个协议栈对应的实例的运行状态,其中,一条心跳消息对应于一个所述实例;或者Sending a heartbeat message to the instance corresponding to each protocol stack in the user-mode protocol stack, and monitoring the heartbeat message response delay, and monitoring the instance corresponding to each protocol stack in the user-mode protocol stack at the first predetermined time. An instance load average value to determine an operation state of an instance corresponding to each protocol stack in the user mode protocol stack according to a response delay of the heartbeat message and the instance load average value, where a heartbeat message corresponds to a location An example; or
    分别轮询所述用户态协议栈中每个协议栈对应的实例的实例标识,并监控所述用户态协议栈中每个协议栈对应的实例在第一预定时间内的实例负载均值,以根据所述实例标识和所述实例负载均值确定所述用户态协议栈中每个协议栈对应的实例的运行状态,其中,所述实例标识用于表示实例的存活状态,所述实例标识存储于共享内存区域或共享文件,一个所述实例标识对应于一个所述实例。 Detecting, respectively, an instance identifier of an instance corresponding to each protocol stack in the user-mode protocol stack, and monitoring an instance load average of the instance corresponding to each protocol stack in the user-mode protocol stack in a first predetermined time, according to The instance identifier and the instance load average determine an operational state of an instance corresponding to each protocol stack in the user state protocol stack, where the instance identifier is used to indicate a survival state of the instance, and the instance identifier is stored in the share A memory area or shared file, one of the instance identifiers corresponding to one of the instances.
  4. 如权利要求3所述的方法,其特征在于,所述确定第一实例包括:The method of claim 3 wherein said determining the first instance comprises:
    确定距离发送心跳消息时刻达到第二预定时间后仍然未反馈心跳响应的实例为所述第一实例;或者An example of determining that the heartbeat response has not been fed back after the time when the heartbeat message is sent for a second predetermined time is the first instance; or
    确定第一预定时间内实例标识表示僵死或失效状态的实例为所述第一实例。An example of determining that the instance identifier represents a dead or dead state during the first predetermined time is the first instance.
  5. 如权利要求4所述的方法,其特征在于,The method of claim 4 wherein:
    所述确定第二实例包括:创建并确定新的实例为所述第二实例;The determining the second instance includes: creating and determining that the new instance is the second instance;
    所述根据所述第一实例中至少一个待迁移负载在共享资源池中所对应的PCB在所述第二实例中重建所述至少一个待迁移负载包括:Reconstructing the at least one to-be-migrated load in the second instance according to the PCB corresponding to the at least one load to be migrated in the shared resource pool in the first instance includes:
    根据所述至少一个待迁移负载之第一负载在共享资源池中所对应的第一PCB在所述第二实例中实现所述第一负载与所述用户态协议栈的上层服务的对接,并将所述第一负载在所述第一实例中绑定的第一接收端扩展RSS队列重绑定到所述第二实例的所述第一负载中,其中,所述至少一个待迁移负载包括所述第一实例的所有负载。The first PCB corresponding to the first load in the shared resource pool according to the first load of the at least one load to be migrated implements the docking of the first load and the upper layer service of the user state protocol stack in the second instance, and Rebinding the first receiver extended RSS queue bound by the first load in the first instance to the first load of the second instance, where the at least one load to be migrated includes All loads of the first instance.
  6. 如权利要求5所述的方法,其特征在于,还包括:终止所述第一实例。The method of claim 5 further comprising terminating said first instance.
  7. 如权利要求3所述的方法,其特征在于,The method of claim 3 wherein:
    所述确定第一实例包括:确定第一预定时间内实例总负载均值大于第一预定阈值的实例为所述第一实例。The determining the first instance includes: determining that the instance total load average value is greater than the first predetermined threshold in the first predetermined time period is the first instance.
  8. 如权利要求7所述的方法,其特征在于,所述确定第二实例包括:The method of claim 7 wherein said determining the second instance comprises:
    如果存在第一预定时间内实例总负载均值低于第二预定阈值的实例,则确定所述第一预定时间内实例总负载均值低于第二预定阈值的一个或多个实例作为所述第二实例,其中,迁入所述第二实例的所有负载的负载值与所述第二预定阈值之和小于所述第一预定阈值。Determining, as the second, one or more instances in which the instance total load mean is lower than a second predetermined threshold in the first predetermined time if there is an instance in which the instance total load mean is lower than a second predetermined threshold in the first predetermined time An example wherein a sum of a load value of all loads moved into the second instance and the second predetermined threshold is less than the first predetermined threshold.
  9. 如权利要求8所述的方法,其特征在于,所述根据所述第一实例中至少一个待迁移负载在共享资源池中所对应的PCB在所述第二实例中重建所述至少一个待迁移负载包括:The method according to claim 8, wherein the PCB corresponding to the at least one load to be migrated in the shared resource pool in the first instance reconstructs the at least one to be migrated in the second instance The load includes:
    根据所述第一实例的至少一个待迁移负载之第二负载在所述共享资源池中所对应的第二PCB,将所述第二负载在所述第一实例中绑定的第二RSS队列的绑定规则修改为绑定到所述第二实例的第二负载中,以使得所述第二实例实现从所述第二RSS队列进行数据包接收及处理的过程;或者 And the second RSS that is bound to the second load in the first instance according to the second PCB corresponding to the at least one load to be migrated of the first instance in the shared resource pool Modifying the binding rule to be bound to the second load of the second instance, such that the second instance implements a process of receiving and processing data packets from the second RSS queue; or
    根据所述第一实例的至少一个待迁移负载之第二负载在所述共享资源池中所对应的第二PCB,在所述第一实例中解除所述第二负载在所述第一实例中绑定的第二RSS队列,并在所述第二实例中将所述第二RSS队列绑定到所述第二负载中,以使得所述第二实例实现从所述第二RSS队列进行数据包接收及处理的过程。Deactivating the second load in the first instance in the first instance according to the second PCB corresponding to the second load of the at least one load to be migrated in the first instance Binding a second RSS queue, and binding the second RSS queue to the second payload in the second instance, such that the second instance implements data from the second RSS queue The process of receiving and processing packets.
  10. 如权利要求8或9所述的方法,其特征在于,所述确定所述第一实例中的至少一个待迁移负载包括:The method according to claim 8 or 9, wherein the determining the at least one load to be migrated in the first instance comprises:
    确定所述第一实例中的第三负载为所述第一实例的待迁移负载,所述第三负载在所述第一实例中所绑定的第三RSS队列满足以下条件:当所述第三RSS队列绑定到所述第二实例时所述第二实例的连接数、接收字节数、发送字节数3个参数中至少有2个参数不大于所述第一实例的相应参数。Determining that the third load in the first instance is the load to be migrated of the first instance, and the third RSS queue bound by the third load in the first instance satisfies the following condition: when the When the three RSS queues are bound to the second instance, at least two of the three parameters of the connection number, the number of received bytes, and the number of transmitted bytes of the second instance are not greater than corresponding parameters of the first instance.
  11. 如权利要求7所述的方法,其特征在于,所述确定第二实例包括:如果不存在预定时间内实例总负载均值低于第二预定阈值的实例,则创建并确定新的实例为所述第二实例。The method of claim 7, wherein the determining the second instance comprises: if there is no instance in which the instance total load mean is lower than a second predetermined threshold within a predetermined time, creating and determining that the new instance is the Second example.
  12. 如权利要求11所述的方法,其特征在于,所述根据所述第一实例中至少一个待迁移负载在共享资源池中所对应的PCB在所述第二实例中重建所述至少一个待迁移负载包括:The method according to claim 11, wherein the PCB corresponding to the at least one load to be migrated in the shared resource pool in the first instance reconstructs the at least one to be migrated in the second instance The load includes:
    根据所述第一实例的至少一个待迁移负载之第二负载在所述共享资源池中所对应的第二PCB在所述第二实例中实现所述第二负载与所述用户态协议栈的上层服务的对接以使得所述第二实例实现与所述第二负载对应的应用app的交互,并在所述第一实例中解除所述第二负载在所述第一实例中绑定的第二RSS队列,在所述第二实例中将所述第二RSS队列绑定到所述第二负载中,以使得所述第二实例实现从所述第二RSS队列进行数据包接收及处理的过程。The second PCB corresponding to the second load of the at least one load to be migrated according to the first instance in the shared resource pool implements the second load and the user state protocol stack in the second instance. Interfacing of an upper layer service such that the second instance implements an interaction of an application app corresponding to the second load, and in the first instance, disengages the second load bound in the first instance a second RSS queue, in the second instance, binding the second RSS queue to the second load, so that the second instance implements data packet reception and processing from the second RSS queue. process.
  13. 如权利要求11或12所述的方法,其特征在于,所述确定所述第一实例中的至少一个待迁移负载包括:The method according to claim 11 or 12, wherein the determining the at least one load to be migrated in the first instance comprises:
    确定所述第一实例中的第三负载为所述第一实例的待迁移负载,所述第三负载在所述第一实例中所绑定的第三RSS队列满足以下条件:所述第三RSS队列的连接数、接收字节数、发送字节数3个参数中都达到所述第一实例的所有负载中对应参数的均值。Determining that the third load in the first instance is the load to be migrated of the first instance, and the third RSS queue bound by the third load in the first instance satisfies the following condition: the third The average number of corresponding parameters among all the loads of the first instance is reached in the three parameters of the number of connections, the number of received bytes, and the number of bytes sent by the RSS queue.
  14. 一种协议栈系统,其特征在于,包括: A protocol stack system, comprising:
    监控单元,用于监控所述协议栈系统的用户态协议栈中每个协议栈对应的运行状态,一个所述实例对应于所述用户态协议栈中的一个协议栈;a monitoring unit, configured to monitor an operating state of each protocol stack in the user state protocol stack of the protocol stack system, where the instance corresponds to a protocol stack in the user state protocol stack;
    确定单元,用于确定第一实例和第二实例,所述第一实例为运行状态异常的实例,所述第二实例具备迁入所述第一实例中至少一个待迁移负载的能力,一个所述待迁移负载在所述第一实例所对应的协议栈内对应于一个协议控制块PCB,所述PCB在所述协议栈系统的共享资源池中对应于一个存储着所述待迁移负载的连接参数的PCB,所述待迁移负载的连接参数能够用于重建所述待迁移负载;a determining unit, configured to determine a first instance and a second instance, where the first instance is an instance of a running state abnormality, and the second instance has an ability to move into at least one load to be migrated in the first instance, The migration load is corresponding to a protocol control block PCB in the protocol stack corresponding to the first instance, and the PCB corresponds to a connection storing the load to be migrated in the shared resource pool of the protocol stack system. a PCB of the parameter, the connection parameter of the load to be migrated can be used to reconstruct the load to be migrated;
    负载迁移单元,用于根据所述第一实例中至少一个待迁移负载在所述共享资源池中所对应的PCB在所述第二实例中重建所述至少一个待迁移负载。And a load migration unit, configured to rebuild the at least one to-be-migrated load in the second instance according to the PCB corresponding to the at least one load to be migrated in the shared resource pool in the first instance.
  15. 如权利要求14所述的系统,其特征在于,所述确定单元还用于确定所述第一实例中的至少一个待迁移负载。The system of claim 14, wherein the determining unit is further configured to determine at least one load to be migrated in the first instance.
  16. 如权利要求15所述的系统,其特征在于,所述实例的运行状态包括实例的负载状态和存活状态,所述监控单元具体用于:The system according to claim 15, wherein the operating state of the instance comprises a load state and a survival state of the instance, and the monitoring unit is specifically configured to:
    分别向所述用户态协议栈中每个协议栈对应的实例发送心跳消息并监控所述心跳消息响应时延,并监控所述用户态协议栈中每个协议栈对应的实例在第一预定时间内的实例负载均值,以根据所述心跳消息的响应时延和所述实例负载均值确定所述用户态协议栈中每个协议栈对应的实例的运行状态,其中,一条心跳消息对应于一个所述实例;或者Sending a heartbeat message to the instance corresponding to each protocol stack in the user-mode protocol stack, and monitoring the heartbeat message response delay, and monitoring the instance corresponding to each protocol stack in the user-mode protocol stack at the first predetermined time. An instance load average value to determine an operation state of an instance corresponding to each protocol stack in the user mode protocol stack according to a response delay of the heartbeat message and the instance load average value, where a heartbeat message corresponds to a location An example; or
    分别轮询所述用户态协议栈中每个协议栈对应的实例的实例标识,并监控所述用户态协议栈中每个协议栈对应的实例在第一预定时间内的实例负载均值,以根据所述实例标识和所述实例负载均值确定所述用户态协议栈中每个协议栈对应的实例的运行状态,其中,所述实例标识用于表示实例的存活状态,所述实例标识存储于共享内存区域或共享文件,一个所述实例标识对应于一个所述实例。Detecting, respectively, an instance identifier of an instance corresponding to each protocol stack in the user-mode protocol stack, and monitoring an instance load average of the instance corresponding to each protocol stack in the user-mode protocol stack in a first predetermined time, according to The instance identifier and the instance load average determine an operational state of an instance corresponding to each protocol stack in the user state protocol stack, where the instance identifier is used to indicate a survival state of the instance, and the instance identifier is stored in the share A memory area or shared file, one of the instance identifiers corresponding to one of the instances.
  17. 如权利要求16所述的系统,其特征在于,在用于确定所述第一实例的过程中,所述确定单元具体用于:The system according to claim 16, wherein in the process for determining the first instance, the determining unit is specifically configured to:
    确定距离发送心跳消息时刻达到第二预定时间后仍然未反馈心跳响应的实例为所述第一实例;或者An example of determining that the heartbeat response has not been fed back after the time when the heartbeat message is sent for a second predetermined time is the first instance; or
    确定第一预定时间内实例标识都表示僵死或失效状态的实例为所述第一实例。 An example of determining that the instance identifier indicates a dead or dead state during the first predetermined time is the first instance.
  18. 如权利要求17所述的系统,其特征在于,The system of claim 17 wherein:
    在用于确定所述第二实例的过程中,所述确定单元具体用于创建并确定新的实例为所述第二实例;In the process for determining the second instance, the determining unit is specifically configured to create and determine that the new instance is the second instance;
    所述负载迁移单元具体用于根据所述至少一个待迁移负载之第一负载在所述共享资源池中所对应的第一PCB在所述第二实例中实现所述第一负载与所述用户态协议栈的上层服务的对接,并将所述第一负载在所述第一实例中绑定的第一接收端扩展RSS队列重绑定到所述第二实例的所述第一负载中,其中,所述至少一个待迁移负载包括所述第一实例的所有负载。The load migration unit is configured to implement the first load and the user in the second instance according to the first PCB corresponding to the first load of the at least one load to be migrated in the shared resource pool. Interfacing the upper layer service of the state protocol stack, and rebinding the first receiver extended RSS queue bound by the first load in the first instance to the first load of the second instance, The at least one load to be migrated includes all loads of the first instance.
  19. 如权利要求18所述的系统,其特征在于,所述系统还包括:实例停止单元,用于终止所述第一实例。The system of claim 18, wherein the system further comprises: an instance stop unit for terminating the first instance.
  20. 如权利要求16所述的系统,其特征在于,The system of claim 16 wherein:
    在用于确定所述第一实例的过程中,所述确定单元具体用于确定第一预定时间内实例总负载均值大于第一预定阈值的实例为所述第一实例。In the process for determining the first instance, the determining unit is specifically configured to determine that the instance total load average value is greater than the first predetermined threshold in the first predetermined time is the first instance.
  21. 如权利要求20所述的系统,其特征在于,The system of claim 20 wherein:
    在用于确定所述第二实例的过程中,如果存在第一预定时间内实例总负载均值低于第二预定阈值的实例,则所述确定单元具体用于确定所述第一预定时间内实例总负载均值低于第二预定阈值的一个或多个实例作为所述第二实例,其中,迁入所述第二实例的所有负载的负载值与所述第二预定阈值之和小于所述第一预定阈值。In the process for determining the second instance, if there is an instance that the instance total load average is lower than the second predetermined threshold in the first predetermined time, the determining unit is specifically configured to determine the first predetermined time instance One or more instances in which the total load average is lower than a second predetermined threshold, wherein the sum of the load value of all loads moved into the second instance and the second predetermined threshold is less than the first A predetermined threshold.
  22. 如权利要求21所述的系统,其特征在于,所述负载迁移单元具体用于:The system of claim 21, wherein the load migration unit is specifically configured to:
    根据所述第一实例的至少一个待迁移负载之第二负载在所述共享资源池中所对应的第二PCB,将所述第二负载在所述第一实例中绑定的第二RSS队列的绑定规则修改为绑定到所述第二实例的第二负载中,以使得所述第二实例实现从所述第二RSS队列进行数据包接收及处理的过程;或者And the second RSS that is bound to the second load in the first instance according to the second PCB corresponding to the at least one load to be migrated of the first instance in the shared resource pool Modifying the binding rule to be bound to the second load of the second instance, such that the second instance implements a process of receiving and processing data packets from the second RSS queue; or
    根据所述第一实例的至少一个待迁移负载之第二负载在所述共享资源池中所对应的第二PCB,在所述第一实例中解除所述第二负载在所述第一实例中绑定的第二RSS队列,并在所述第二实例中将所述第二RSS队列绑定到所述第二负载中,以使得所述第二实例实现从所述第二RSS队列进行数据包接收及处理的过程。Deactivating the second load in the first instance in the first instance according to the second PCB corresponding to the second load of the at least one load to be migrated in the first instance Binding a second RSS queue, and binding the second RSS queue to the second payload in the second instance, such that the second instance implements data from the second RSS queue The process of receiving and processing packets.
  23. 如权利要求21或22所述的系统,其特征在于,在用于确定所述第 一实例中的至少一个待迁移负载的过程中,所述确定单元具体用于:确定所述第一实例中的第三负载为所述第一实例的待迁移负载,所述第三负载在所述第一实例中所绑定的第三RSS队列满足以下条件:当所述第三RSS队列绑定到所述第二实例时所述第二实例的连接数、接收字节数、发送字节数3个参数中至少有2个参数不大于所述第一实例的相应参数。A system according to claim 21 or 22, wherein In the process of at least one load to be migrated, the determining unit is specifically configured to: determine that the third load in the first instance is the load to be migrated in the first instance, and the third load is in the The third RSS queue bound in the first instance satisfies the condition that the number of connections, the number of received bytes, and the transmission byte of the second instance when the third RSS queue is bound to the second instance At least two of the three parameters are not greater than the corresponding parameters of the first instance.
  24. 如权利要求20所述的系统,其特征在于,在用于确定所述第二实例的过程中,如果不存在预定时间内实例总负载均值低于第二预定阈值的实例,则所述确定单元具体用于创建并确定新的实例为所述第二实例。The system according to claim 20, wherein in the process for determining the second instance, if there is no instance in which the instance total load mean is lower than a second predetermined threshold within a predetermined time, the determining unit Specifically, it is used to create and determine a new instance as the second instance.
  25. 如权利要求25所述的系统,其特征在于,所述负载迁移单元具体用于:The system of claim 25, wherein the load migration unit is specifically configured to:
    根据所述第一实例的至少一个待迁移负载之第二负载在所述共享资源池中所对应的第二PCB在所述第二实例中实现所述第二负载与所述用户态协议栈的上层服务的对接以使得所述第二实例实现与所述第二负载对应的应用app的交互,并在所述第一实例中解除所述第二负载在所述第一实例中绑定的第二RSS队列,在所述第二实例中将所述第二RSS队列绑定到所述第二负载中,以使得所述第二实例实现从所述第二RSS队列进行数据包接收及处理的过程。The second PCB corresponding to the second load of the at least one load to be migrated according to the first instance in the shared resource pool implements the second load and the user state protocol stack in the second instance. Interfacing of an upper layer service such that the second instance implements an interaction of an application app corresponding to the second load, and in the first instance, disengages the second load bound in the first instance a second RSS queue, in the second instance, binding the second RSS queue to the second load, so that the second instance implements data packet reception and processing from the second RSS queue. process.
  26. 如权利要求24或25所述的系统,其特征在于,在用于确定所述第一实例中的至少一个待迁移负载的过程中,所述确定单元具体用于:The system according to claim 24 or 25, wherein in the process for determining at least one load to be migrated in the first instance, the determining unit is specifically configured to:
    确定所述第一实例中的第三负载为所述第一实例的待迁移负载,所述第三负载在所述第一实例中所绑定的第三RSS队列满足以下条件:所述第三RSS队列的连接数、接收字节数、发送字节数3个参数中都达到所述第一实例的所有负载中对应参数的均值。 Determining that the third load in the first instance is the load to be migrated of the first instance, and the third RSS queue bound by the third load in the first instance satisfies the following condition: the third The average number of corresponding parameters among all the loads of the first instance is reached in the three parameters of the number of connections, the number of received bytes, and the number of bytes sent by the RSS queue.
PCT/CN2014/095248 2014-03-28 2014-12-29 Method for managing parallel user mode protocol stacks and protocol stack system WO2015143904A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410124239.X 2014-03-28
CN201410124239.XA CN104951357B (en) 2014-03-28 2014-03-28 The management method and protocol stack system of concurrent user state protocol stack

Publications (1)

Publication Number Publication Date
WO2015143904A1 true WO2015143904A1 (en) 2015-10-01

Family

ID=54166026

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/095248 WO2015143904A1 (en) 2014-03-28 2014-12-29 Method for managing parallel user mode protocol stacks and protocol stack system

Country Status (2)

Country Link
CN (1) CN104951357B (en)
WO (1) WO2015143904A1 (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109032799A (en) * 2018-07-25 2018-12-18 郑州云海信息技术有限公司 Storage resource management method, apparatus, equipment and readable storage medium storing program for executing
CN111240833A (en) * 2019-12-31 2020-06-05 厦门网宿有限公司 Resource migration method and device
CN111756780A (en) * 2019-03-27 2020-10-09 厦门网宿有限公司 Method for synchronizing connection information and load balancing system
US10904719B2 (en) 2019-05-06 2021-01-26 Advanced New Technologies Co., Ltd. Message shunting method, device and system based on user mode protocol stack
CN114064302A (en) * 2020-07-30 2022-02-18 华为技术有限公司 Method and device for interprocess communication
WO2023030178A1 (en) * 2021-08-31 2023-03-09 华为技术有限公司 Communication method based on user-mode protocol stack, and corresponding apparatus

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893141A (en) * 2015-12-17 2016-08-24 乐视致新电子科技(天津)有限公司 Regulation control method and apparatus for multi-core processor and mobile terminal using method
CN106953857B (en) * 2017-03-16 2020-03-10 郑州云海信息技术有限公司 Server-side multithread management method based on CS framework
CN108737465A (en) * 2017-04-19 2018-11-02 中兴通讯股份有限公司 A kind of User Agreement stack operation method and device
CN108549574B (en) * 2018-03-12 2022-03-15 深圳市万普拉斯科技有限公司 Thread scheduling management method and device, computer equipment and storage medium
CN108984376B (en) * 2018-05-31 2021-11-19 创新先进技术有限公司 System anomaly detection method, device and equipment
CN111294220B (en) * 2018-12-07 2022-06-21 网宿科技股份有限公司 Nginx-based network isolation configuration method and device
CN109547580B (en) * 2019-01-22 2021-05-25 网宿科技股份有限公司 Method and device for processing data message
CN110278161B (en) * 2019-05-06 2020-08-11 阿里巴巴集团控股有限公司 Message distribution method, device and system based on user mode protocol stack
CN110493329A (en) * 2019-08-08 2019-11-22 西藏宁算科技集团有限公司 A kind of concurrent Push Service method and system based on User space protocol stack
CN111143062A (en) * 2019-12-19 2020-05-12 上海交通大学 Balanced partitioning strategy for external load process by user mode protocol stack
CN116820801A (en) * 2023-06-15 2023-09-29 中科驭数(北京)科技有限公司 Optimization method, device and equipment of IO multiplexing mechanism

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040264481A1 (en) * 2003-06-30 2004-12-30 Darling Christopher L. Network load balancing with traffic routing
CN101001255A (en) * 2006-12-19 2007-07-18 华为技术有限公司 Method and device for load control of session initial protocol stack
CN101741832A (en) * 2008-11-25 2010-06-16 宝利通公司 Method and system for dispatching received sessions between a plurality of instances of an application using the same ip port

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101859263B (en) * 2010-06-12 2012-07-25 中国人民解放军国防科学技术大学 Quick communication method between virtual machines supporting online migration

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040264481A1 (en) * 2003-06-30 2004-12-30 Darling Christopher L. Network load balancing with traffic routing
CN101001255A (en) * 2006-12-19 2007-07-18 华为技术有限公司 Method and device for load control of session initial protocol stack
CN101741832A (en) * 2008-11-25 2010-06-16 宝利通公司 Method and system for dispatching received sessions between a plurality of instances of an application using the same ip port

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109032799A (en) * 2018-07-25 2018-12-18 郑州云海信息技术有限公司 Storage resource management method, apparatus, equipment and readable storage medium storing program for executing
CN111756780A (en) * 2019-03-27 2020-10-09 厦门网宿有限公司 Method for synchronizing connection information and load balancing system
CN111756780B (en) * 2019-03-27 2022-04-22 厦门网宿有限公司 Method for synchronizing connection information and load balancing system
US10904719B2 (en) 2019-05-06 2021-01-26 Advanced New Technologies Co., Ltd. Message shunting method, device and system based on user mode protocol stack
CN111240833A (en) * 2019-12-31 2020-06-05 厦门网宿有限公司 Resource migration method and device
CN111240833B (en) * 2019-12-31 2023-03-17 厦门网宿有限公司 Resource migration method and device
CN114064302A (en) * 2020-07-30 2022-02-18 华为技术有限公司 Method and device for interprocess communication
CN114064302B (en) * 2020-07-30 2024-05-14 华为技术有限公司 Inter-process communication method and device
WO2023030178A1 (en) * 2021-08-31 2023-03-09 华为技术有限公司 Communication method based on user-mode protocol stack, and corresponding apparatus

Also Published As

Publication number Publication date
CN104951357B (en) 2018-06-26
CN104951357A (en) 2015-09-30

Similar Documents

Publication Publication Date Title
WO2015143904A1 (en) Method for managing parallel user mode protocol stacks and protocol stack system
EP3675432B1 (en) Intelligent and dynamic overlay tunnel formation via automatic discovery of citrivity/sdwan peer in the datapath in a pure plug and play environment with zero networking configuration
US20220121545A1 (en) System and Method for Continuous Low-Overhead Monitoring of Distributed Applications Running on a Cluster of Data Processing Nodes
US10439916B2 (en) Client-side fault tolerance in a publish-subscribe system
US10706028B2 (en) Detecting outliers in server transaction time as a form of time series data
US8613085B2 (en) Method and system for traffic management via virtual machine migration
US8381026B2 (en) Systems and method for transaction stall detection and propagating the result in a multi-core architecture
US20240275724A1 (en) Offload of acknowledgements to a network device
US8910160B1 (en) Handling of virtual machine migration while performing clustering operations
TWI584131B (en) Server backup method and backup system thereof
US11843527B2 (en) Real-time scalable virtual session and network analytics
US20190273811A1 (en) Path selection using tcp handshake in a multipath environment
EP3283954B1 (en) Restoring service acceleration
US20210326177A1 (en) Queue scaling based, at least, in part, on processing load
US11418582B1 (en) Priority-based transport connection control
Ma et al. X-RDMA: Effective RDMA middleware in large-scale production environments
CN103927233A (en) Multi-node memory interconnection device and large-scale computer cluster
US9426022B2 (en) SEA failover mechanism with minimized packet losses
CN104270450A (en) Double-controller multilink heartbeat monitoring method using UDP
Miura et al. RI2N/DRV: Multi-link Ethernet for high-bandwidth and fault-tolerant network on PC clusters
US20130047024A1 (en) Virtual i/o server bandwidth via shared ethernet adapter (sea) load sharing in sea fail-over configuration
Popat et al. Experimental evaluation of multipath TCP with MPI
Behrens et al. Pushing Bytes: Cloud Scale Big-Data Replication with RDMC
Wang et al. SP-TCP: Scheduling Perceived TCP in Virtualized Datacenters
Behrens et al. Pushing Bytes: Cloud-Scale Data Replication with RDMC

Legal Events

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

Ref document number: 14887213

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase
122 Ep: pct application non-entry in european phase

Ref document number: 14887213

Country of ref document: EP

Kind code of ref document: A1