CN111984376B - Protocol processing method, device, equipment and computer readable storage medium - Google Patents

Protocol processing method, device, equipment and computer readable storage medium Download PDF

Info

Publication number
CN111984376B
CN111984376B CN202011010006.9A CN202011010006A CN111984376B CN 111984376 B CN111984376 B CN 111984376B CN 202011010006 A CN202011010006 A CN 202011010006A CN 111984376 B CN111984376 B CN 111984376B
Authority
CN
China
Prior art keywords
virtual cpu
protocol
virtual
cpu
abnormal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011010006.9A
Other languages
Chinese (zh)
Other versions
CN111984376A (en
Inventor
郑磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou DPTech Technologies Co Ltd
Original Assignee
Hangzhou DPTech Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou DPTech Technologies Co Ltd filed Critical Hangzhou DPTech Technologies Co Ltd
Priority to CN202011010006.9A priority Critical patent/CN111984376B/en
Publication of CN111984376A publication Critical patent/CN111984376A/en
Application granted granted Critical
Publication of CN111984376B publication Critical patent/CN111984376B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • 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/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • 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/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application provides a protocol processing method, which comprises the following steps: when each first virtual cpu executes the work task of each high real-time protocol, detecting whether the work state of each first virtual cpu is abnormal, if the first virtual cpu with abnormal work state exists, determining the high real-time protocol corresponding to the first virtual cpu, taking the determined high real-time protocol as a target protocol, selecting one second virtual cpu corresponding to the target protocol, and switching the work task on the exclusive work queue of the target protocol to the reserved work queue of the target protocol created on the second virtual cpu. Through the embodiment of the application, when the first virtual CPU where the high-real-time protocol is located is abnormal, the work of the protocol can be switched to the reserved work queue of other second virtual CPUs, so that the work abnormality of the high-real-time protocol caused by the abnormality of the single virtual CPU is avoided, and the condition of network failure is further avoided.

Description

Protocol processing method, device, equipment and computer readable storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a protocol processing method, apparatus, device, and computer readable storage medium.
Background
As the scale of the network increases, the traffic in the network also increases and the processing requirements on network services increase and the performance requirements on network devices are more stringent, in order to process complex tasks, the network devices use multi-core processors, each kernel thread in the multi-core processor executes the tasks allocated to each kernel thread, for example, some management tasks are executed, some tasks for sending and receiving packets of services are executed, some tasks for executing channel communication tasks between devices are executed, and so on.
Regarding the high real-time protocol, it relates to dynamic service processing, i.e. dynamically receiving and sending messages, and doing the functional service corresponding to each protocol, and often uses kernel threads to process the protocol. However, the high real-time protocol depends on the normal function of a single kernel thread, and when the kernel thread on which the high real-time protocol depends is abnormal, the high real-time protocol functions are abnormal, so that serious faults of network equipment are caused.
Disclosure of Invention
In view of this, the present application provides a protocol processing method, apparatus, device, and computer readable storage medium, which can ensure normal operation of a high-real-time protocol.
Specifically, the application is realized by the following technical scheme:
a protocol processing method, the method is applied to a network device, each high-real-time protocol running on the network device corresponds to a first virtual cpu and at least one second virtual cpu, a dedicated work queue corresponding to the high-real-time protocol is created on the first virtual cpu, a reserved work queue corresponding to the high-real-time protocol is created on the second virtual cpu, and each first virtual cpu and each second virtual cpu are each a thread on the network device; the method comprises the following steps:
detecting whether the working state of each first virtual cpu is abnormal;
if a first virtual CPU with abnormal working state exists, determining a high real-time protocol corresponding to the first virtual CPU, and taking the determined high real-time protocol as a target protocol;
and selecting a second virtual CPU corresponding to the target protocol, and switching the work task on the exclusive work queue of the target protocol to the reserved work queue of the target protocol created on the second virtual CPU.
A protocol processing apparatus, the apparatus being applied to a network device, each high real-time protocol running on the network device corresponding to a first virtual cpu and at least a second virtual cpu, the first virtual cpu having created thereon a dedicated work queue corresponding to the high real-time protocol, the second virtual cpu having created thereon a reserved work queue corresponding to the high real-time protocol, each of the first virtual cpu and each of the second virtual cpus being a thread on the network device; the device comprises:
the detection unit is used for detecting whether the working state of each first virtual cpu is abnormal;
the determining unit is used for determining a high real-time protocol corresponding to the first virtual CPU if the first virtual CPU with abnormal working state exists, and taking the determined high real-time protocol as a target protocol;
and the switching unit is used for selecting a second virtual cpu corresponding to the target protocol and switching the work task on the exclusive work queue of the target protocol to the reserved work queue of the target protocol created on the second virtual cpu.
An electronic device, comprising: a processor, a memory;
the memory is used for storing a computer program;
the processor is configured to execute the protocol processing method by calling the computer program.
A computer readable storage medium having stored thereon a computer program which when executed by a processor implements the protocol processing method described above.
As can be seen from the technical solutions provided in the present application, each high real-time protocol running on the network device corresponds to a first virtual cpu and at least one second virtual cpu, a dedicated work queue corresponding to the high real-time protocol is created on each first virtual cpu, and a reserved work queue corresponding to the high real-time protocol is created on each second virtual cpu. When each first virtual cpu executes the work task of each high real-time protocol, detecting whether the work state of each first virtual cpu is abnormal, if the first virtual cpu with abnormal work state exists, determining the high real-time protocol corresponding to the first virtual cpu, taking the determined high real-time protocol as a target protocol, selecting one second virtual cpu corresponding to the target protocol, and switching the work task on the exclusive work queue of the target protocol to the reserved work queue of the target protocol created on the second virtual cpu. Therefore, when the first virtual cpu with the high real-time protocol is abnormal, the work of the protocol can be switched to the reserved work queue of the other second virtual cpus, so that the work abnormality of the high real-time protocol caused by the abnormality of the single virtual cpu is avoided, and the condition of network fault is further avoided.
Drawings
FIG. 1 is a schematic diagram of a protocol processing method according to the present application;
FIG. 2 is a flow chart of a protocol processing method shown in the present application;
FIG. 3 is a functional schematic of a detect work queue initialization module shown in the present application;
FIG. 4 is a functional schematic of a protocol work queue initialization module shown in the present application;
fig. 5 is a functional schematic diagram of a vcpu protocol self-checking module shown in the present application;
FIG. 6 is a functional schematic of a vcpu work queue reservation module shown in the present application;
FIG. 7 is a functional schematic of a vcpu selection module shown in the present application;
fig. 8 is a functional schematic diagram of a vcpu switching module shown in the present application;
FIG. 9 is a schematic diagram of a protocol processing apparatus shown in the present application;
fig. 10 is a schematic structural diagram of an electronic device shown in the present application.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present application as detailed in the accompanying claims.
The terminology used in the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any or all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first message may also be referred to as a second message, and similarly, a second message may also be referred to as a first message, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "at … …" or "responsive to a determination", depending on the context.
Before describing the embodiments of the present application, technical terms related to the embodiments of the present application will be described first.
The multi-core processor: the multi-core processor is realized by using a multi-thread mechanism, each thread is virtualized into a cpu, each thread can be isolated from each other and independently run, a plurality of threads form a core, and a processor can be formed by a plurality of cores.
Virtual cpu: each thread that makes up each core corresponds to a virtual cpu, denoted vcpu.
Work queue: work queue is a form of pushing work to execute, which can be pushed to execute by a vcpu. The work queue is allowed to be rescheduled or even sleep, that is, when no work is added to the work queue, the work queue is in a sleep state, does not occupy system resources, and when work is added to the work queue, the work queue is awakened to process tasks.
High real-time protocol: network protocols that require real-time dynamic interactions of messages and corresponding processing often play a critical role in network devices.
One or more high real-time protocols are run in the network device, these protocols all play important roles and are closely connected to the network service, if these protocols fail, the network must fail severely, and the present application is described by taking link aggregation control protocol (Link Aggregation Control Protocol, LACP), open shortest path first (Open Shortest Path First, OSPF), intermediate system-to-intermediate system (Intermediate System to Intermediate System, ISIS), dynamic host configuration protocol (Dynamic Host Configuration Protocol, DHCP), dynamic dual-hop SHRP, loop-back monitoring Loopback Detection, spanning tree protocol (Spanning Tree Protocol, STP) as examples:
LACP is a dynamic aggregation protocol: the dynamic aggregation is used as a function of expanding bandwidth and increasing redundancy characteristics, is often applied to a link where network equipment is in butt joint, when a dynamic aggregation protocol processes the abnormal vcpu where a kernel thread is located, the receiving and transmitting of LACP are overtime necessarily, the processing of the protocol is abnormal, the link between the equipment is finally interrupted, the network service is interrupted, and when the vcpu where the dynamic aggregation is located is recovered to be normal, the normal receiving and transmitting of the message and the functional processing are recovered, and at the moment, the network service can be recovered.
OSPF/ISIS is a dynamic routing protocol: OSPF and ISIS are both the most common dynamic routing protocols that generate and maintain routing tables required by forwarding engines through the exchange of routing information. When the network topology changes, the dynamic routing protocol can automatically update the routing table and is responsible for deciding the optimal path for data transmission. When the vcpu of the dynamic routing protocol kernel thread is abnormal, the routing function is abnormal, so that the network service lacks routing and the service is interrupted. And after the vcpu is recovered to be normal, the routing function re-programs the route and recovers the network service.
DHCP is a dynamic host configuration protocol: the method is used for automatically distributing IP addresses for an intranet or a network service provider, the server side and the client side are used for carrying out message interaction, the function of distributing the IP for the client side by the server side is completed, if the vcpu where the DHCP working kernel thread is located is abnormal, the IP distributing service of the DHCP is abnormal, so that the network of the client side which is not distributed to the IP is interrupted, and the network service is restored after the vcpu is restored to be normal through the repeated message interaction IP redistribution.
SHRP refers to dynamic dual-machine heartbeat: the dual-computer environment is a network device with backup redundancy commonly used in a normal network environment, the main device is responsible for network service processing, the standby device is used as the backup redundancy device, the main device and the standby device of the dual-computer rely on SHRP dual-computer heartbeat message interaction and dual-computer kernel thread negotiation processing, when the vcpu where the SHRP working kernel thread is located is abnormal, the sending and receiving of the heartbeat message are interrupted, the dual-computer environment is broken, the network service is broken, the restoration of the vcpu is waited, the dual-computer message restoration interaction is carried out, the kernel thread renegotiates, the dual-computer is restored, and the network service is restored.
Loopback Detection loop back monitoring: port loop-back monitoring functions to monitor whether each port is externally looped back, and if a loop occurs, corresponding actions can be configured to eliminate the loop. When the vcpu where the kernel thread for loop-back monitoring is located is abnormal, loop-back monitoring function is abnormal, a loop cannot be detected, a loop appears, a serious fault occurs in the network, and network service is restored after the vcpu is restored to be normal.
STP is a spanning tree protocol: the tree topology structure in the network is established, and the main function is to prevent redundant links in the bridge network from forming loops. When the vcpu where the kernel thread of the spanning tree is located fails, the spanning tree topology inevitably oscillates, the spanning tree topology fails, the multi-equipment network service is abnormal, and the network service is restored after the vcpu is restored to be normal.
Regarding the high real-time protocol, it relates to dynamic service processing, i.e. dynamically receiving and sending messages, and performing functional services corresponding to each protocol, often uses kernel threads to perform protocol processing, where kernel threads are designated to run on a certain virtual cpu, when the corresponding virtual cpu is abnormal, the receiving and sending packets and functional service processing of the high real-time protocol above the virtual cpu are affected by the abnormality, the dynamic receiving and sending packets of the high real-time protocol are affected, and often have a problem of network protocol interruption, and these high real-time protocols often have a critical role in the network, once the fault occurs, serious network accidents are caused.
Referring to a schematic frame diagram of the protocol processing method shown in fig. 1, in some technical solutions, the method includes:
a high real-time protocol AGGRE is registered in a dedicated WORK queue aggre_work of the virtual cpu1 (i.e. vcpu 1), and is initially in a sleep state, waiting for a task.
The high real-time protocol relies on the interaction of messages, the messages are received and sent regularly, the network equipment receives the protocol messages, analyzes the protocol messages to obtain AGGRE messages, and then adds the tasks of receiving the protocol interaction messages and analyzing the messages to a WORK queue AGGRE_WORK to execute the tasks.
When the high real-time protocol needs to do negotiation processing, the 'protocol negotiation processing' task is added to the WORK queue AGGRE_WORK to execute the task.
The high real-time protocol relies on the interaction of messages, and can receive and send messages regularly, the network equipment sends protocol messages, and the tasks of assembling the messages and sending the protocol interaction messages are added to a WORK queue AGGRE_WORK to execute the tasks.
Therefore, in the above technical solution, the kernel thread on which the high real-time protocol depends runs on a single virtual cpu, and the virtual cpu has strong coupling, if the virtual cpu is abnormal, the virtual cpu is likely to cause important abnormal operation of the high real-time protocol, thereby affecting network services.
In order to solve the above problems, the embodiment of the present application provides a protocol processing method, which implements decoupling of a high real-time protocol and a certain virtual cpu, and implements redundancy, and if an abnormality occurs in an initially used virtual cpu, the method may switch to another virtual cpu to perform transceiving and functional processing of a message, thereby ensuring normal operation of the high real-time protocol.
The following specifically describes a protocol processing method provided in the embodiments of the present application.
The embodiment of the application provides a protocol processing method, which is applied to a network device, wherein each high-real-time protocol running on the network device corresponds to a first virtual CPU and at least one second virtual CPU; a dedicated work queue corresponding to the high real-time protocol is created on the first virtual CPU, and a reserved work queue corresponding to the high real-time protocol is created on the second virtual CPU; each first virtual cpu and each second virtual cpu is a thread on the network device.
Specifically, the number of available virtual cpus of the network device includes a first number of first virtual cpus and a second number of second virtual cpus, and a third number of high-real-time protocols run on the network device, where the third number is greater than or equal to the first number, so that each first virtual cpu corresponds to at least one high-real-time property. For each high-real-time protocol, the high-real-time protocol corresponds to a first virtual cpu on the network device, and a dedicated work queue (i.e., initial work queue) is created on the first virtual cpu for the high-real-time protocol, and the related work tasks of the high-real-time protocol can be preferentially run on the dedicated work queue; in addition, for each high real-time protocol, the high real-time protocol also corresponds to at least one other second virtual cpu on the network device, and a reserved work queue is created on each second virtual cpu for the high real-time protocol, which has the effect that when the first virtual cpu of the high real-time protocol is abnormal, the first virtual cpu can be switched to one corresponding second virtual cpu to continue to work, that is, the reserved work queue of the high real-time protocol is used to continue to complete the work task on the dedicated work queue thereof, so as to ensure the normal work of the high real-time protocol.
In the embodiment of the present application, at least two high real-time protocols with similar characteristics may correspond to the same first virtual cpu, that is, the high real-time protocols with similar characteristics are divided into the same virtual cpu; of course, different high real-time protocols may be associated with different first virtual cpus one by one.
For example, taking a network device with multiple virtual cpus as an example, assume that the number of virtual cpus available for the network device is 10, i.e., virtual cpus 0 to 9. Assuming that the high real-time protocol running on the network device comprises LACP, OSPF, ISIS, DHCP, SHRP, loopback Detection and STP, wherein the virtual CPU 1-virtual CPU4 are respectively a first virtual CPU, and the LACP and the SHRP belong to two-layer protocols and are both link protocols for device docking and can be distributed to the virtual CPU1; OSPF and ISIS belong to three layers of dynamic routing protocols and can be distributed in virtual CPU2; DHCP belongs to a server and client type protocol and can be allocated in virtual cpu3; loopback Detection and STP both belong to the loop-protected protocol and may be distributed to virtual cpu4.
It should be noted that, based on the characteristic that the work queue consumes less resources, and the work queue is in a sleep state when there is no task, a plurality of reserved work queues may be bound on a plurality of virtual cpus for each high real-time protocol, that is, one or more second virtual cpus may be allocated for each high real-time protocol. For example, taking the above-mentioned virtual cpus 0 to 9 on the network device as an example, after each high-real-time protocol is allocated with a first virtual cpu, that is, virtual cpu1 to virtual cpu4, for each high-real-time protocol, all or part of virtual cpus 5 to 9 may be used as second virtual cpus of the high-real-time protocol, so as to create reserved work queues of the high-real-time protocol on the second virtual cpus, respectively, to implement a queue redundancy mechanism.
The following will specifically describe a protocol processing method provided in the embodiments of the present application, and it should be noted that, since the processing mechanism of each high real-time protocol is similar, the following description will take OSPF protocol and STP protocol as examples.
Referring to fig. 2, a flow chart of a protocol processing method provided in an embodiment of the present application is provided, and an execution subject of the method is a network device, and the method includes the following steps S201 to S203:
s201: and detecting whether the working state of each first virtual cpu is abnormal.
In this embodiment of the present application, a detection WORK queue initialization module may be preset on the network device, as shown in fig. 3, and by using this module, a WORK queue check_work may be created and bound to a virtual cpu, where the virtual cpu is called a third virtual cpu, that is, the network device may further include a third virtual cpu, where the third virtual cpu is a thread on the network device, and the third virtual cpu is used as an operation place of a device management process and a thread.
The third virtual cpu may be an independent virtual cpu other than the first virtual cpu and the second virtual cpu. Taking the above-mentioned virtual cpu0 to virtual cpu9 on the network device as an example, the virtual cpu0 (i.e. vcpu0 in fig. 3) may be used as the third virtual cpu, and since the detection task is a management function, the detection task (for example, detecting the current running states of other virtual cpu1 to virtual cpu 9) may be placed on the WORK queue check_work of the virtual cpu0, and when the detection task needs to be performed, a task may be added to the WORK queue check_work.
In one implementation of the embodiment of the present application, S201 may include: and detecting whether the working state of each first virtual CPU is abnormal or not by using the detection work queue created on the third virtual CPU.
In this implementation manner, a protocol work queue initialization module may be preset on the network device, referring to fig. 4, and the module is mainly responsible for setting the first virtual cpu where the dedicated work queue of the high real-time protocol is located. Taking the virtual cpu 0-9 and the OSPF protocol and STP protocol on the network device as examples, according to the multi-protocol planning, binding an exclusive working queue ospf_work2 created for the OSPF protocol to the virtual cpu2 (i.e. vcpu 2), and adding the OSPF protocol WORK to the working queue ospf_work2; the dedicated WORK queue stp_work4 created for STP protocol is bound to cpu4 (i.e., vcpu 4), and STP protocol WORK is added to the WORK queue stp_work4.
The network device may further be preset with a vcpu protocol self-checking module, see fig. 5, where the module is responsible for detecting a working state of a virtual cpu where the high real-time protocol works, and placing the detection work on a detection work queue of a third virtual cpu, where the detection work is used for detecting whether the working state of each first virtual cpu is abnormal.
Taking the above-mentioned virtual cpu 0-9 and OSPF protocol and STP protocol as examples, the vcpu protocol self-checking module may be used to detect the virtual cpu2 (i.e. vcpu 2) where the OSPF protocol is located, and put the detection WORK on the WORK queue check_work of the virtual cpu0 (i.e. vcpu 0); similarly, the virtual cpu4 (vcpu 4) in which the STP protocol is located is detected, and the detection WORK is put on the WORK queue check_work of the virtual cpu0 (vcpu 0).
In an implementation manner of the embodiment of the present application, whether the working state of each first virtual cpu is abnormal may be detected in the following manner, including: detecting the utilization rate and/or blocking state of each first virtual cpu; and determining whether the working state of each first virtual CPU is abnormal according to the utilization rate and/or the blocking state of each first virtual CPU.
In this implementation manner, for each first virtual cpu, the usage rate and/or the blocking state of the first virtual cpu may be detected, and if the usage rate of the first virtual cpu is greater than a preset threshold value and/or the duration time of the blocking state of the first virtual cpu is greater than a preset duration time, it may be determined that the working state of the first virtual cpu is abnormal. The preset threshold and the preset duration can be set manually according to experience, for example, the preset threshold is 80%, and the preset duration is 3 seconds.
Referring to fig. 5, the above-mentioned virtual cpus 0 to 9 on the network device, and the OSPF protocol and STP protocol are exemplified. The vcpu2 where the OSPF protocol is located can be detected by utilizing a vcpu protocol self-detection module, detection WORK is put on a WORK queue CHECK_WORK of the vcpu0 to count whether the use rate of the vcpu2 is too high, the threshold value is set to 80%, and if the use rate exceeds 80%, the vcpu2 is considered to be abnormal; the current operation stage of vcpu2 can also be detected to see whether the current operation stage is blocked in a certain function, the threshold is set for 3 seconds, and if vcpu2 lasts for more than 3 seconds and is in a single function, the vcpu2 is considered to be abnormal. Similarly, a vcpu protocol self-checking module can be utilized to detect vcpu4 where the STP protocol is located, and detection WORK is put on a WORK queue check_work of vcpu0 to count whether the use rate of the vcpu4 is too high, the threshold value is set to 80%, and if the use rate is over 80%, the vcpu4 is considered abnormal; the current operation stage of vcpu4 can also be detected to see whether the current operation stage is blocked in a certain function, the threshold is set for 3 seconds, and if vcpu4 lasts for more than 3 seconds and is in a single function, the vcpu4 is considered to be abnormal.
S202: if the first virtual CPU with abnormal working state exists, determining a high real-time protocol corresponding to the first virtual CPU, and taking the determined high real-time protocol as a target protocol.
For convenience of description, a high real-time protocol corresponding to the first virtual cpu with abnormal working state is defined as a target protocol.
Taking the virtual cpus 0 to 9 and the OSPF protocol and STP protocol on the network device as examples, if it is determined that vcpu2 is abnormal, the OSPF protocol is taken as a target protocol, and if it is determined that vcpu4 is abnormal, the STP protocol is taken as a target protocol.
It can be appreciated that for a first virtual cpu that is in a normal operating state, the dedicated work queue of the high real-time protocol on the first virtual cpu still operates normally.
S203: and selecting a second virtual CPU corresponding to the target protocol, and switching the work task on the exclusive work queue of the target protocol to the reserved work queue of the target protocol created on the second virtual CPU.
A vcpu work queue reservation module may also be preset on the network device, see fig. 6. The module is responsible for pre-allocating redundant backup work queues, i.e. allocating reserved work queues for each high real-time protocol.
Continuing with the example of virtual cpu0 through virtual cpu9 on the network device, and the OSPF protocol and STP protocol. Reserved work queues may be created on vcpu5 through vcpu9 for the OSPF protocol, respectively: OSPF_WORK5 (bound vcpu 5), OSPF_WORK6 (bound vcpu 6), OSPF_WORK7 (bound vcpu 7), OSPF_WORK8 (bound vcpu 8), OSPF_WORK9 (bound vcpu 9); similarly, reserved work queues may be created on vcpu 5-vcpu 9 for STP protocols, respectively: stp_work5 (bound vcpu 5), stp_work6 (bound vcpu 6), stp_work7 (bound vcpu 7), stp_work8 (bound vcpu 8), stp_work9 (bound vcpu 9). These reserved work queues are in a sleep state in the initial state.
In the embodiment of the present application, for the target protocol determined in S202, the target protocol corresponds to one or more second virtual cpus, where each second virtual cpu has a reserved work queue of the target protocol bound thereon. Because the first virtual cpu bound to the exclusive work queue of the target protocol is abnormal, one second virtual cpu can be selected from one or more second virtual cpus corresponding to the target protocol, and the work task of the target protocol on the abnormal first virtual cpu is switched to the selected second virtual cpu, and the processing task on the reserved work queue of the target protocol bound to the second virtual cpu is used for ensuring that the related task of the target protocol can normally run.
In addition, a vcpu selection module may be preset on the network device, see fig. 7. When the vcpu protocol self-checking module shown in fig. 5 detects that a first virtual cpu corresponding to a certain high real-time protocol (i.e., a target protocol) is abnormal, it is necessary to select between the second virtual cpus corresponding to the target protocol, so as to select one of the second virtual cpus for switching, and the vcpu selecting module is responsible for the selection.
In an implementation manner of the embodiment of the present application, the "selecting a second virtual cpu corresponding to the target protocol" in S203 may include:
step A1: if the target protocol corresponds to only one second virtual cpu, the second virtual cpu is selected.
If the target protocol corresponds to only one second virtual cpu, i.e. only the reserved work queue of the target protocol is bound to the second virtual cpu, the second virtual cpu can only be selected.
Step A2: if the target protocol corresponds to at least two second virtual cpus, selecting one second virtual cpu from the at least two second virtual cpus according to the usage rates of the at least two second virtual cpus.
If the target protocol corresponds to two or more second virtual cpus, i.e., there are two or more reserved work queues on which the target protocol is bound, one second virtual cpu may be selected from among the second virtual cpus based on the usage of these second virtual cpus.
Specifically, when one second virtual cpu is selected from the at least two second virtual cpus, one second virtual cpu with the lowest usage rate may be selected from the at least two second virtual cpus, that is, one second virtual cpu with the lowest usage rate (most idle) is selected to prepare for switching. Taking the above-mentioned virtual cpus 0 to 9 on the network device as an example, the vcpu selection module shown in fig. 7 may be used to add the WORK for detecting the usage rates of the virtual cpus 5 to 9 (that is, vcpu5 to vcpu 9) to the WORK queue CHECK shown in fig. 3, and screen the vcpu with the lowest usage rate.
In S203, after selecting a second virtual cpu corresponding to the target protocol in the above manner, the task on the dedicated work queue of the target protocol needs to be switched to the reserved work queue of the target protocol created on the second virtual cpu. The switching task may be implemented by the vcpu switching module shown in fig. 8, that is, a vcpu switching module may be preset on the network device, and after the vcpu selecting module shown in fig. 7 selects the vcpu with the lowest usage rate, the vcpu switching module is responsible for switching the task of the target protocol to the vcpu with the lowest usage rate.
For example, if the target protocol is an OSPF protocol and the second virtual cpu selected by the vcpu selection module shown in fig. 7 is vcpu5, the task of the OSPF protocol is added to vcpu5, and the task is continued to be processed by the reserved WORK queue ospf_work5 (shown in fig. 6) bound on vcpu 5; if the target protocol is STP protocol and the second virtual cpu selected by the vcpu selection module shown in fig. 7 is vcpu7, the task of STP protocol is added to vcpu7, and the task is continued to be processed by the reserved WORK queue stp_work7 (shown in fig. 6) bound on vcpu 7.
As can be seen from the above protocol processing method provided by the present application, when each first virtual cpu executes a task of each high real-time protocol, whether the working state of each first virtual cpu is abnormal is detected, if there is a first virtual cpu with abnormal working state, the high real-time protocol corresponding to the first virtual cpu is determined, the determined high real-time protocol is used as a target protocol, then, one second virtual cpu corresponding to the target protocol is selected, and the task on the dedicated working queue of the target protocol is switched to the reserved working queue of the target protocol created on the second virtual cpu. Therefore, when the first virtual cpu with the high real-time protocol is abnormal, the work of the protocol can be switched to the reserved work queue of the other second virtual cpus, so that the work abnormality of the high real-time protocol caused by the abnormality of the single virtual cpu is avoided, and the condition of network fault is further avoided.
Referring to fig. 9, a schematic composition diagram of a protocol processing apparatus shown in the present application is applied to a network device, where each high real-time protocol running on the network device corresponds to a first virtual cpu and at least one second virtual cpu, a dedicated work queue corresponding to the high real-time protocol is created on the first virtual cpu, a reserved work queue corresponding to the high real-time protocol is created on the second virtual cpu, and each first virtual cpu and each second virtual cpu are each a thread on the network device; the device comprises:
a detecting unit 910, configured to detect whether the operation state of each first virtual cpu is abnormal;
a determining unit 920, configured to determine a high real-time protocol corresponding to a first virtual cpu if the first virtual cpu has an abnormal working state, and take the determined high real-time protocol as a target protocol;
and a switching unit 930, configured to select a second virtual cpu corresponding to the target protocol, and switch the task on the dedicated work queue of the target protocol to the reserved work queue of the target protocol created on the second virtual cpu.
In this embodiment of the present application, at least two high real-time protocols with similar characteristics correspond to the same first virtual cpu.
In an embodiment of the present application, the network device further includes a third virtual cpu, where the third virtual cpu is a thread on the network device; the detection unit 910 specifically is configured to: and detecting whether the working state of each first virtual CPU is abnormal or not by using the detection work queue created on the third virtual CPU.
In this embodiment of the present application, the third virtual cpu is an independent virtual cpu other than the first virtual cpu and the second virtual cpu.
In the embodiment of the present application, the detection unit 910 is specifically configured to:
detecting the utilization rate and/or blocking state of each first virtual cpu;
and determining whether the working state of each first virtual CPU is abnormal according to the utilization rate and/or the blocking state of each first virtual CPU.
In the embodiment of the present application, the switching unit 930 is specifically configured to:
if the target protocol corresponds to only one second virtual cpu, selecting the second virtual cpu;
and if the target protocol corresponds to at least two second virtual cpus, selecting one second virtual cpu from the at least two second virtual cpus according to the utilization rate of the at least two second virtual cpus.
In the embodiment of the present application, the switching unit 930 is specifically configured to: and selecting one second virtual CPU with the lowest use rate from the at least two second virtual cpus.
The implementation process of the functions and roles of each unit in the above device is specifically shown in the implementation process of the corresponding steps in the above method, and will not be described herein again. The functions and actions of the respective units in the above-described apparatus may be the same as those of the respective units in the above-described method, if they overlap with those of the respective units in the above-described method, and each of the units in the above-described method may be one of the units.
For the device embodiments, reference is made to the description of the method embodiments for the relevant points, since they essentially correspond to the method embodiments. The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purposes of the present application. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
The embodiment of the application further provides an electronic device, the schematic structural diagram of which is shown in fig. 10, where the electronic device 1000 includes at least one processor 1001, a memory 1002 and a bus 1003, and at least one processor 1001 is electrically connected to the memory 1002; the memory 1002 is configured to store at least one computer executable instruction, and the processor 1001 is configured to execute the at least one computer executable instruction to perform steps of any one of the protocol processing methods as provided by any one of the embodiments or any one of the alternative implementations in the present application.
Further, the processor 1001 may be an FPGA (Field-Programmable Gate Array, field programmable gate array) or other device having logic processing capability, such as an MCU (Microcontroller Unit, micro control unit), a CPU (Central Process Unit, central processing unit).
By applying the embodiment of the application, when the first virtual CPU where the high-real-time protocol is located is abnormal, the work of the protocol can be switched to the reserved work queue of other second virtual CPUs, so that the work abnormality of the high-real-time protocol caused by the abnormality of the single virtual CPU is avoided, and the condition of network failure is further avoided.
The embodiments of the present application further provide another computer readable storage medium storing a computer program for implementing the steps of any one of the protocol processing methods provided in any one of the embodiments or any one of the optional embodiments of the present application when executed by a processor.
The computer readable storage medium provided by the embodiments of the present application includes, but is not limited to, any type of disk including floppy disks, hard disks, optical disks, CD-ROMs, and magneto-optical disks, ROMs (Read-Only memories), RAMs (Random Access Memory, random access memories), EPROMs (Erasable Programmable Read-Only memories), EEPROMs (Electrically Erasable Programmable Read-Only memories), flash memories, magnetic cards, or optical cards. That is, a readable storage medium includes any medium that stores or transmits information in a form readable by a device (e.g., a computer).
By applying the embodiment of the application, when the first virtual CPU where the high-real-time protocol is located is abnormal, the work of the protocol can be switched to the reserved work queue of other second virtual CPUs, so that the work abnormality of the high-real-time protocol caused by the abnormality of the single virtual CPU is avoided, and the condition of network failure is further avoided.
The foregoing description of the preferred embodiments of the present invention is not intended to limit the invention to the precise form disclosed, and any modifications, equivalents, improvements and alternatives falling within the spirit and principles of the present invention are intended to be included within the scope of the present invention.

Claims (10)

1. The protocol processing method is characterized in that the method is applied to a network device, each high-real-time protocol running on the network device corresponds to a first virtual cpu and at least one second virtual cpu, a dedicated work queue corresponding to the high-real-time protocol is created on the first virtual cpu, a reserved work queue corresponding to the high-real-time protocol is created on the second virtual cpu, and each first virtual cpu and each second virtual cpu are respectively a thread on the network device; the method comprises the following steps:
detecting whether the working state of each first virtual cpu is abnormal;
if a first virtual CPU with abnormal working state exists, determining a high real-time protocol corresponding to the first virtual CPU, and taking the determined high real-time protocol as a target protocol;
and selecting a second virtual CPU corresponding to the target protocol, and switching the work task on the exclusive work queue of the target protocol to the reserved work queue of the target protocol created on the second virtual CPU.
2. The method of claim 1, wherein at least two high real-time protocols with similar characteristics correspond to the same first virtual cpu.
3. The method of claim 1, wherein the network device further comprises a third virtual cpu, the third virtual cpu being a thread on the network device; the detecting whether the working state of each first virtual cpu is abnormal includes:
and detecting whether the working state of each first virtual CPU is abnormal or not by using the detection work queue created on the third virtual CPU.
4. The method of claim 3, wherein the third virtual cpu is a separate virtual cpu from the first virtual cpu and the second virtual cpu.
5. The method of claim 1, wherein detecting whether the operating state of each first virtual cpu is abnormal comprises:
detecting the utilization rate and/or blocking state of each first virtual cpu;
and determining whether the working state of each first virtual CPU is abnormal according to the utilization rate and/or the blocking state of each first virtual CPU.
6. The method according to any one of claims 1-5, wherein said selecting a second virtual cpu corresponding to the target protocol comprises:
if the target protocol corresponds to only one second virtual cpu, selecting the second virtual cpu;
and if the target protocol corresponds to at least two second virtual cpus, selecting one second virtual cpu from the at least two second virtual cpus according to the utilization rate of the at least two second virtual cpus.
7. The method of claim 6, wherein selecting one second virtual cpu from the at least two second virtual cpus comprises:
and selecting one second virtual CPU with the lowest use rate from the at least two second virtual cpus.
8. A protocol processing apparatus, wherein the apparatus is applied to a network device, each high real-time protocol running on the network device corresponds to a first virtual cpu and at least one second virtual cpu, a dedicated work queue corresponding to the high real-time protocol is created on the first virtual cpu, a reserved work queue corresponding to the high real-time protocol is created on the second virtual cpu, and each first virtual cpu and each second virtual cpu are each a thread on the network device; the device comprises:
the detection unit is used for detecting whether the working state of each first virtual cpu is abnormal;
the determining unit is used for determining a high real-time protocol corresponding to the first virtual CPU if the first virtual CPU with abnormal working state exists, and taking the determined high real-time protocol as a target protocol;
and the switching unit is used for selecting a second virtual cpu corresponding to the target protocol and switching the work task on the exclusive work queue of the target protocol to the reserved work queue of the target protocol created on the second virtual cpu.
9. An electronic device, comprising: a processor, a memory;
the memory is used for storing a computer program;
the processor is configured to execute the protocol processing method according to any one of claims 1 to 7 by calling the computer program.
10. A computer-readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the protocol processing method of any one of claims 1-7.
CN202011010006.9A 2020-09-23 2020-09-23 Protocol processing method, device, equipment and computer readable storage medium Active CN111984376B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011010006.9A CN111984376B (en) 2020-09-23 2020-09-23 Protocol processing method, device, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011010006.9A CN111984376B (en) 2020-09-23 2020-09-23 Protocol processing method, device, equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN111984376A CN111984376A (en) 2020-11-24
CN111984376B true CN111984376B (en) 2023-06-27

Family

ID=73450143

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011010006.9A Active CN111984376B (en) 2020-09-23 2020-09-23 Protocol processing method, device, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN111984376B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7675920B1 (en) * 2005-04-22 2010-03-09 Sun Microsystems, Inc. Method and apparatus for processing network traffic associated with specific protocols
CN101799776A (en) * 2010-02-25 2010-08-11 上海华为技术有限公司 Fault processing method of multi-core processor, multi-core processor and communication device
JP2011182269A (en) * 2010-03-03 2011-09-15 Meidensha Corp Network security system and method
CN103491190A (en) * 2013-09-30 2014-01-01 国家电网公司 Processing method for large-scale real-time concurrent charger monitoring data
CN106406976A (en) * 2016-07-21 2017-02-15 柏科数据技术(深圳)股份有限公司 Method and apparatus for identifying IO intensive application in cloud computing environment
CN107733742A (en) * 2017-11-01 2018-02-23 北京天创凯睿科技有限公司 A kind of business datum interrupted transmission method and apparatus
CN109257235A (en) * 2018-11-12 2019-01-22 深信服科技股份有限公司 Network Abnormal restoration methods, device, equipment and computer readable storage medium
CN111447101A (en) * 2020-02-27 2020-07-24 平安科技(深圳)有限公司 Link detection method and device, computer equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7675920B1 (en) * 2005-04-22 2010-03-09 Sun Microsystems, Inc. Method and apparatus for processing network traffic associated with specific protocols
CN101799776A (en) * 2010-02-25 2010-08-11 上海华为技术有限公司 Fault processing method of multi-core processor, multi-core processor and communication device
JP2011182269A (en) * 2010-03-03 2011-09-15 Meidensha Corp Network security system and method
CN103491190A (en) * 2013-09-30 2014-01-01 国家电网公司 Processing method for large-scale real-time concurrent charger monitoring data
CN106406976A (en) * 2016-07-21 2017-02-15 柏科数据技术(深圳)股份有限公司 Method and apparatus for identifying IO intensive application in cloud computing environment
CN107733742A (en) * 2017-11-01 2018-02-23 北京天创凯睿科技有限公司 A kind of business datum interrupted transmission method and apparatus
CN109257235A (en) * 2018-11-12 2019-01-22 深信服科技股份有限公司 Network Abnormal restoration methods, device, equipment and computer readable storage medium
CN111447101A (en) * 2020-02-27 2020-07-24 平安科技(深圳)有限公司 Link detection method and device, computer equipment and storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Achieving High-Throughput State Machine Replication in Multi-core Systems;Nuno Santos等;《2013 IEEE 33rd International Conference on Distributed Computing Systems》;266-275 *
基于嵌入式操作系统的物联网节点技术研究;李石峰;《中国优秀硕士学位论文全文数据库信息科技辑》(第12期);I136-175 *
网络功能虚拟化中的网络转发性能优化技术研究;唐宏等;《电信科学》;第30卷(第11期);135-139,172 *

Also Published As

Publication number Publication date
CN111984376A (en) 2020-11-24

Similar Documents

Publication Publication Date Title
US7925817B2 (en) Computer system and method for monitoring an access path
US6934880B2 (en) Functional fail-over apparatus and method of operation thereof
Bailis et al. The network is reliable: An informal survey of real-world communications failures
US7370223B2 (en) System and method for managing clusters containing multiple nodes
US7278055B2 (en) System and method for virtual router failover in a network routing system
US7619965B2 (en) Storage network management server, storage network managing method, storage network managing program, and storage network management system
US7787388B2 (en) Method of and a system for autonomously identifying which node in a two-node system has failed
JP2005209201A (en) Node management in high-availability cluster
US8984266B2 (en) Techniques for stopping rolling reboots
US20180295192A1 (en) Keep-alive technique in a network device
US9043636B2 (en) Method of fencing in a cluster system
CN109286529A (en) A kind of method and system for restoring RabbitMQ network partition
CN112087375A (en) WAN port switching method of WAN port standby router, storage medium and router
JP4964666B2 (en) Computer, program and method for switching redundant communication paths
US8036105B2 (en) Monitoring a problem condition in a communications system
US11418382B2 (en) Method of cooperative active-standby failover between logical routers based on health of attached services
CN111984376B (en) Protocol processing method, device, equipment and computer readable storage medium
JP2012014674A (en) Failure recovery method, server, and program in virtual environment
JP5285044B2 (en) Cluster system recovery method, server, and program
CN113760459A (en) Virtual machine fault detection method, storage medium and virtualization cluster
CN112988335A (en) High-availability virtualization management system, method and related equipment
JP2000244526A (en) Multiplexed network connector system
US11947431B1 (en) Replication data facility failure detection and failover automation
KR101883251B1 (en) Apparatus and method for determining failover in virtual system
CN112328375B (en) Correlation method and device for tracking data segments of distributed system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant