CN111984376A - 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
CN111984376A
CN111984376A CN202011010006.9A CN202011010006A CN111984376A CN 111984376 A CN111984376 A CN 111984376A CN 202011010006 A CN202011010006 A CN 202011010006A CN 111984376 A CN111984376 A CN 111984376A
Authority
CN
China
Prior art keywords
virtual cpu
protocol
virtual
real
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.)
Granted
Application number
CN202011010006.9A
Other languages
Chinese (zh)
Other versions
CN111984376B (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

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)
  • Hardware Redundancy (AREA)

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, whether the work state of each first virtual CPU is abnormal is detected, if the first virtual CPU with the abnormal work state exists, 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 work task on the exclusive work queue of the target protocol is switched 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 queues of other second virtual CPUs, so that the abnormal work of the high-real-time protocol caused by the abnormal single virtual CPU is avoided, and the condition of network failure is avoided.

Description

Protocol processing method, device, equipment and computer readable storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a protocol processing method, apparatus, device, and computer readable storage medium.
Background
With the increasing scale of networks, the traffic in the networks is also more and more diverse, the processing requirements on network services are also more and more high, the performance requirements on network devices are more strict, in order to process complex tasks, the network devices all use multi-core processors, and each kernel thread in the multi-core processors executes tasks respectively allocated to the kernel threads, for example, some execute a plurality of management tasks, some execute a service packet receiving and sending task, some execute a channel communication task between devices, and the like.
Regarding the high real-time protocol, it relates to dynamic service processing, that is, dynamically receiving and sending packets, and making functional services corresponding to each protocol, often using 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 function is abnormal, so that the network device is seriously failed.
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 method is realized through the following technical scheme:
a protocol processing 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, an exclusive 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 or not;
if a first virtual CPU with an 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 a reserved work queue of the target protocol created on the second virtual CPU.
A protocol processing device 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, an exclusive 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 device comprises:
the detection unit is used for detecting whether the working state of each first virtual CPU is abnormal or not;
the determining unit is used for determining a high real-time protocol corresponding to a 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 a reserved work queue of the target protocol created on the second virtual cpu.
An electronic device, comprising: a processor, a memory;
the memory for storing a computer program;
the processor is used for executing the protocol processing method by calling the computer program.
A computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the protocol processing method described above.
According to the technical scheme provided by the application, each high-real-time protocol running on the network equipment corresponds to one first virtual cpu and at least one second virtual cpu, an exclusive 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, whether the work state of each first virtual CPU is abnormal is detected, if the first virtual CPU with the abnormal work state exists, 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 work task on the exclusive work queue of the target protocol is switched to the reserved work queue of the target protocol created on the second virtual CPU. Therefore, 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 queues of other second virtual CPUs, so that the abnormal work of the high-real-time protocol caused by the abnormal single virtual CPU is avoided, and the network fault is avoided.
Drawings
Fig. 1 is a schematic diagram of a protocol processing method according to the present application;
fig. 2 is a flowchart illustrating a protocol processing method according to the present application;
FIG. 3 is a functional diagram of a detection work queue initialization module shown in the present application;
FIG. 4 is a functional diagram 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 diagram of a vcpu work queue reservation module shown in this application;
fig. 7 is a functional schematic diagram 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 illustrating the components of a protocol processing apparatus according to 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 the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the 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 and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
Prior to describing the embodiments of the present application, technical terms related to the embodiments of the present application will be described first.
A multi-core processor: the multi-core processor is realized by using a multithreading 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 constituting each core corresponds to a virtual cpu, denoted vcpu.
A work queue: the work queue is a form of pushing and executing work, and the work queue can push and deliver the work to a vcpu for execution. The work queue is allowed to be rescheduled or even sleep, that is, when no work is added into the work queue, the work queue is in a sleep state, and does not occupy system resources, and when work is added into the work queue, the work queue is awakened to perform task processing.
High real-time protocol: a network protocol for dynamically interacting messages in real time and performing corresponding processing is required, and such a protocol often plays a crucial role in network devices.
The network device may run one or more high real-time protocols, which all play an important role and are closely connected to network services, and if these protocols fail, the network inevitably fails, the present application introduces Link Aggregation Control Protocol (LACP), Open Shortest Path First (OSPF), Intermediate System to Intermediate System (ISIS), Dynamic Host Configuration Protocol (DHCP), Dynamic heartbeat SHRP, monitored Loopback Detection, Spanning Tree Protocol (STP) as an example:
LACP is a dynamic aggregation protocol: the dynamic aggregation is used as a function for expanding bandwidth and increasing redundancy characteristics, and is often applied to a link which is butted with network equipment, when a vcpu where a kernel thread is located is abnormal in a dynamic aggregation protocol processing, the reception and the transmission of an LACP are overtime inevitably, the processing of the protocol is also abnormal, finally, the link between the equipment is interrupted, the network service is interrupted, and when the vcpu where the dynamic aggregation protocol is located is recovered to be normal, the dynamic aggregation is recovered to receive and transmit messages normally and the function processing is performed, and then the network service can be recovered.
OSPF/ISIS is a dynamic routing protocol: both OSPF and ISIS are 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 structure changes, the dynamic routing protocol can automatically update the routing table and is responsible for deciding the optimal path of data transmission. When the vcpu where the dynamic routing protocol kernel thread is located is abnormal, the routing function is abnormal, so that the network service lacks a route and the service is interrupted. And when the vcpu is recovered to be normal, the routing function plans the route again, and the network service is recovered.
DHCP is a dynamic host configuration protocol: the method is used for automatically distributing IP addresses by an intranet or a network service provider, and message interaction is carried out between a server and a client to finish the function of distributing IP to the client by the server, if the vcpu where the DHCP work kernel thread is located is abnormal, the service of the DHCP distributed IP is abnormal, so that the network of some clients which can not be distributed with IP is interrupted, and when the vcpu is recovered to be normal, the IP is redistributed through message interaction again, so that the network service is recovered.
SHRP refers to dynamic dual heartbeat: the dual-computer environment is a network device with backup redundancy commonly used in the ordinary network environment, the main device is responsible for processing network services, the standby device is used as the backup redundancy device, the main device and the standby device of the dual-computer rely on interaction of SHRP dual-computer heartbeat messages and negotiation processing of dual-computer kernel threads, when a vcpu where the SHRP working kernel threads are located is abnormal, the receiving and sending of the heartbeat messages are interrupted, dual-computer splitting is likely to be caused, the dual-computer environment is damaged, the network services are in failure, when the vcpu is recovered, the dual-computer messages are recovered to interact, the kernel threads perform renegotiation, the dual-computer is recovered, and the network services are recovered.
Loop back monitoring of loop back: and the port loopback monitoring function is used for monitoring whether each port loops outside or not, and if the loop appears, corresponding actions can be configured to eliminate the loop. When the vcpu where the loopback monitoring kernel thread is located is abnormal, the loopback monitoring function is abnormal, the loop cannot be detected, the network has serious faults, and the network service is recovered when the vcpu is recovered to be normal.
STP is a spanning tree protocol: the tree topology structure is established in the network, and the main function is to prevent redundant links in the network bridge from forming loops. When the vcpu where the kernel thread of the spanning tree is located fails, the spanning tree topology is vibrated inevitably, the spanning tree topology fails, the multi-device network service is abnormal, and the network service is recovered after the vcpu is recovered to be normal.
Regarding a high real-time protocol, it relates to dynamic service processing, that is, dynamically receiving and sending messages, and making functional services corresponding to each protocol, a kernel thread is often used to process the protocol, the kernel thread is specified 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 on the virtual cpu are necessarily affected by the virtual cpu, the dynamic receiving and sending packets of the high real-time protocol are affected by the virtual cpu, and the problem of network protocol interruption often occurs, and these high real-time protocols play a crucial role in the network, once a fault occurs, a serious network accident is necessarily caused.
Referring to a schematic diagram of a framework of a protocol processing method shown in fig. 1, in some embodiments, the method includes:
a high real-time protocol AGGRE is registered in a dedicated WORK queue AGGRE _ WORK of virtual cpu1 (i.e., vcpu1), initially in a sleep state, waiting for a task.
The high real-time protocol depends on the interaction of messages and can receive and send messages at regular time, the network equipment receives the protocol messages and analyzes the protocol messages to obtain the AGGRE messages, and then a task of receiving the protocol interaction messages and analyzing the messages is added to a WORK queue AGGRE _ WORK to execute the task.
When the high-real-time protocol needs to be processed by negotiation, a protocol negotiation processing task is added to a WORK queue AGGRE _ WORK to execute the task.
The high real-time protocol depends on the interaction of messages, and can receive and send messages at regular time, the network equipment sends protocol messages, and adds the tasks of 'splicing messages and sending protocol interaction messages' to a WORK queue AGGRE _ WORK for executing 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 kernel thread has strong coupling with the virtual cpu, and if the virtual cpu is abnormal, the important high real-time protocol is inevitably abnormal in operation, thereby affecting network services.
In order to solve the above problem, an embodiment of the present application provides a protocol processing method, which implements decoupling of a high real-time protocol and a certain virtual cpu, implements redundancy, and if an initially used virtual cpu is abnormal, can switch to other virtual cpus to perform message transceiving and function processing, thereby ensuring normal operation of the high real-time protocol.
A protocol processing method provided in the embodiments of the present application is specifically described below.
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; an exclusive work queue corresponding to a high real-time protocol is established on the first virtual CPU, and a reserved work queue corresponding to the high real-time protocol is established on the second virtual CPU; each of the first virtual cpus and each of the second virtual cpus are each a thread on the network device.
Specifically, the number of virtual cpus available for the network device includes a first number of first virtual cpus and a second number of second virtual cpus, and the network device runs a third number of high-real-time protocols, 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. For each high-real-time protocol, the high-real-time protocol corresponds to a first virtual cpu on the network device, and an exclusive work queue (i.e. an initial work queue) is created on the first virtual cpu for the high-real-time protocol, and related work tasks of the high-real-time protocol can preferentially run on the exclusive 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 for the high-real-time protocol on each second virtual cpu, which has the function that when the first virtual cpu of the high-real-time protocol is abnormal, the high-real-time protocol can be switched to the corresponding second virtual cpu to continue working, that is, the reserved work queue of the high-real-time protocol is used to continue to complete the work task on the exclusive work queue, so as to ensure the normal working of the high-real-time protocol.
In this 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 in one-to-one correspondence with different first virtual cpus.
For example, taking a network device with multiple virtual cpus as an example, it is assumed that the number of virtual cpus available for the network device is 10, i.e., virtual cpus 0 through 9. Assuming that the high-real-time protocol running on the network device includes LACP, OSPF, ISIS, DHCP, SHRP, Loopback Detection, STP, the virtual cpu 1-virtual cpu4 are first virtual cpus, respectively, where LACP and SHRP both belong to two-layer protocols and are link protocols for device docking, and may be allocated in virtual cpu 1; OSPF and ISIS belong to three-layer dynamic routing protocol, and can be distributed in a virtual cpu 2; DHCP belongs to a server and client type protocol and may be assigned in virtual cpu 3; both Loopback Detection and STP belong to anti-loop protocols and can be distributed in virtual cpu 4.
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, multiple reserved work queues may be bound on multiple 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 virtual cpu 0-virtual cpu9 on the network device as an example, after the first virtual cpu, i.e., virtual cpu 1-virtual cpu4, is allocated to each high-real-time protocol, all or part of the virtual cpus 5-virtual cpu9 may be used as the second virtual cpus of the high-real-time protocol, so as to create the reserved work queues of the high-real-time protocol on the second virtual cpus, respectively, to implement a queue redundancy mechanism.
A protocol processing method provided in the embodiment of the present application will be specifically described below, and it should be noted that, because the processing mechanisms of the high-real-time protocols are similar, the following contents will be described by taking the OSPF protocol and the STP protocol as examples.
Referring to fig. 2, a schematic flowchart of a protocol processing method provided in an embodiment of the present application, where an execution subject of the method is a network device, the method includes the following steps S201 to S203:
s201: and detecting whether the working state of each first virtual CPU is abnormal or not.
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 with this module, a WORK queue CHECK _ WORK may be created, and the WORK queue CHECK _ WORK is bound to a virtual cpu, where the virtual cpu is referred to as 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 serves as a runtime location of the device management process and the thread.
The third virtual cpu may be an independent virtual cpu other than the first virtual cpu and the second virtual cpu. Taking the virtual cpu 0-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 WORK is a management function, the detection WORK (e.g., detecting the current running states of other virtual cpus 1-9) may be placed on the WORK queue CHECK _ WORK of the virtual cpu0, and when the detection WORK is needed, the WORK task may be added to the WORK queue CHECK _ WORK.
In an implementation manner 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 a detection work queue established on the third virtual CPU.
In this implementation manner, a protocol work queue initialization module may be preset on the network device, and referring to fig. 4, this module is mainly responsible for setting the first virtual cpu where the exclusive work queue of the high real-time protocol is located. Taking the virtual cpus 0 to 9, the OSPF protocol and the STP protocol on the network device as examples, according to the multi-protocol planning, creating a dedicated WORK queue OSPF _ WORK2 for the OSPF protocol, binding the dedicated WORK queue OSPF _ WORK2 to the virtual cpu2 (i.e., vcpu2), and adding all OSPF protocol WORKs to the WORK queue OSPF _ WORK 2; a dedicated WORK queue created for the STP protocol, STP _ WORK4, is bound to cpu4 (i.e., vcpu4) and WORK in the STP protocol is added to the WORK queue STP _ WORK 4.
A vcpu protocol self-checking module may also be preset on the network device, and referring to fig. 5, the module is responsible for detecting the working state of the virtual cpu where the high-real-time protocol works, and placing the detection work on the detection work queue of the third virtual cpu, so as to detect whether the working state of each first virtual cpu is abnormal.
Taking the virtual cpus 0 to 9, the OSPF protocol and the STP protocol on the network device as examples, a vcpu protocol self-inspection module may be used to detect the virtual cpu2 (i.e., vcpu2) where the OSPF protocol is located, and place the detection WORK on the WORK queue CHECK _ WORK of the virtual cpu0 (i.e., vcpu 0); similarly, the virtual cpu4 (i.e. vcpu4) 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 (i.e. vcpu 0).
In an implementation manner of the embodiment of the present application, detecting whether the working state of each first virtual cpu is abnormal according to the following manner includes: detecting the utilization rate and/or the blocking state of each first virtual CPU; and determining whether the working state of each first virtual CPU is abnormal or not 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 and/or the duration of the blocking state of the first virtual cpu is greater than a preset duration, it may be determined that the operating state of the first virtual cpu is abnormal. The preset threshold and the preset time length may be manually set according to experience, for example, the preset threshold is 80%, and the preset time length is 3 seconds.
Referring to fig. 5, the virtual cpus 0 to 9 on the network device, the OSPF protocol and the STP protocol are taken as examples. A vcpu protocol self-checking module can be used for detecting vcpu2 where the OSPF protocol is located, and putting detection WORK on a WORK queue CHECK _ WORK of a vcpu0 to count whether the usage rate of the vcpu2 is too high, the threshold is set to be 80%, and if the usage rate exceeds 80%, the vcpu2 is considered to be abnormal; it is also possible to detect the current operating phase of vcpu2, check whether a certain function is blocked, set the threshold value for 3 seconds, and consider that vcpu2 is abnormal if vcpu2 lasts for more than 3 seconds and is in a single function. Similarly, a vcpu protocol self-checking module can be used to detect vcpu4 where the STP protocol is located, and place the detection WORK on a WORK queue CHECK _ WORK of vcpu0 to count whether the usage rate of vcpu4 is too high, where the threshold is set to 80%, and if the usage rate exceeds 80%, the vcpu4 is considered to be abnormal; it is also possible to detect the current operating phase of vcpu4, check whether a certain function is blocked, set the threshold value for 3 seconds, and consider that vcpu4 is abnormal if vcpu4 lasts for more than 3 seconds and is in a single function.
S202: and 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 an abnormal operating state is defined as a target protocol.
Taking the virtual cpus 0 to 9, the OSPF protocol and the 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 understood that for a first virtual cpu with a normal working state, the dedicated work queue of the high real-time protocol on the first virtual cpu still runs 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 a 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. This 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 cpu 0-virtual cpu9 on the network device, and the OSPF protocol and STP protocol. Reserved work queues may be created for the OSPF protocol on vcpu 5-vcpu 9, respectively: OSPF _ WORK5 (binding vcpu5), OSPF _ WORK6 (binding vcpu6), OSPF _ WORK7 (binding vcpu7), OSPF _ WORK8 (binding vcpu8), OSPF _ WORK9 (binding vcpu 9); similarly, reserved work queues may be created on vcpu 5-vcpu 9, respectively, for the STP protocol: STP _ WORK5 (binding vcpu5), STP _ WORK6 (binding vcpu6), STP _ WORK7 (binding vcpu7), STP _ WORK8 (binding vcpu8), STP _ WORK9 (binding vcpu 9). These reserved work queues are in a sleep state in an initial state.
In this embodiment of the present application, for the target protocol determined in S202, the target protocol corresponds to one or more second virtual cpus, and a reserved work queue of the target protocol is bound to each second virtual cpu. Because the first virtual cpu bound by 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 task is processed on the reserved work queue of the target protocol bound on the second virtual cpu, so as to ensure that the related task of the target protocol can normally run.
In addition, a vcpu selection module may also 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 needs to select one of the second virtual cpus corresponding to the target protocol to select one of the second virtual cpus for switching, and the vcpu selection module is responsible for this selection.
In an implementation manner of the embodiment of the present application, the "selecting one second virtual cpu corresponding to the target protocol" in S203 may include:
step A1: and if the target protocol only corresponds to one second virtual CPU, selecting the second virtual CPU.
If the target protocol only corresponds to one second virtual cpu, that is, 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: 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 rates of the at least two second virtual cpus.
If the target protocol corresponds to two or more second virtual cpus, that is, there are two or more reserved work queues bound to the target protocol on the second virtual cpus, one second virtual cpu can be selected from the two or more second virtual cpus based on the utilization rates of the 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 (the most idle) is selected to prepare for switching. Taking the virtual cpus 0 to 9 on the network device as examples, 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 (i.e., vcpu5 to vcpu9) to the WORK queue CHECK _ WORK shown in fig. 3, and screen out the vcpu with the lowest usage rate.
In S203, after one second virtual cpu corresponding to the target protocol is selected in the above manner, the work task on the exclusive 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 also be preset on the network device, and when the vcpu selecting module shown in fig. 7 selects the vcpu with the lowest utilization rate, the vcpu switching module is responsible for switching the work task of the target protocol to the vcpu with the lowest utilization rate.
For example, if the target protocol is the OSPF protocol and the second virtual cpu selected by the vcpu selection module shown in fig. 7 is vcpu5, adding the WORK task of the OSPF protocol to vcpu5, and continuing processing the WORK task by using the reserved WORK queue OSPF _ WORK5 (shown in fig. 6) bound to 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 WORK task of STP protocol is added to vcpu7, and the reserved WORK queue STP _ WORK7 (shown in fig. 6) bound to vcpu7 continues to process the task.
As can be seen from the protocol processing method provided in the above application, when each first virtual cpu executes a work task of each high-real-time protocol, it is detected whether the work state of each first virtual cpu is abnormal, if there is a first virtual cpu with an abnormal work state, a 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 a second virtual cpu corresponding to the target protocol is selected, and the work task on the exclusive work queue of the target protocol is switched to a reserved work queue of the target protocol created on the second virtual cpu. Therefore, 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 queues of other second virtual CPUs, so that the abnormal work of the high-real-time protocol caused by the abnormal single virtual CPU is avoided, and the network fault is avoided.
Referring to fig. 9, a schematic composition diagram of a protocol processing apparatus shown in this application is shown, where 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, an exclusive 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 device comprises:
a detecting unit 910, configured to detect whether a working state of each first virtual cpu is abnormal;
a determining unit 920, configured to determine, if there is a first virtual cpu with an abnormal working state, a high real-time protocol corresponding to the first virtual cpu, and use the determined high real-time protocol as a target protocol;
the switching unit 930 is configured to select a second virtual cpu corresponding to the target protocol, and switch the work task on the dedicated work queue of the target protocol to a 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 this 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 detecting unit 910 is specifically configured to: and detecting whether the working state of each first virtual CPU is abnormal or not by using the detection work queue established 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 this embodiment of the application, the detecting unit 910 is specifically configured to:
detecting the utilization rate and/or the blocking state of each first virtual CPU;
and determining whether the working state of each first virtual CPU is abnormal or not according to the utilization rate and/or the blocking state of each first virtual CPU.
In this embodiment of the application, the switching unit 930 is specifically configured to:
if the target protocol only corresponds to 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 rates of the at least two second virtual cpus.
In this embodiment of the application, the switching unit 930 is specifically configured to: and selecting a second virtual CPU with the lowest utilization rate from the at least two second virtual CPUs.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again. It should be noted that, if the functions and functions of the respective units in the above-mentioned apparatus overlap with the functions and functions of the respective modules in the above-mentioned method, each module in the above-mentioned method may belong to the unit having the same function, and may be regarded as one module of the unit.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the application. One of ordinary skill in the art can understand and implement it without inventive effort.
An embodiment of the present application further provides an electronic device, a schematic structural diagram of the electronic device is shown in fig. 10, the electronic device 1000 includes at least one processor 1001, a memory 1002, and a bus 1003, where the 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, thereby performing the steps of any one of the protocol processing methods as provided by any one of the embodiments or any one of the alternative embodiments of the present application.
Further, the processor 1001 may be an FPGA (Field-Programmable Gate Array) or other devices with logic processing capability, such as an MCU (micro controller Unit) and a CPU (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 queues of other second virtual CPUs, so that the abnormal work of the high-real-time protocol caused by the abnormal single virtual CPU is avoided, and the condition of network failure is avoided.
The embodiments of the present application further provide another computer-readable storage medium, which stores a computer program, where the computer program is used for implementing, when executed by a processor, the steps of any one of the protocol processing methods provided in any one of the embodiments or any one of the alternative embodiments of the present application.
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 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 queues of other second virtual CPUs, so that the abnormal work of the high-real-time protocol caused by the abnormal single virtual CPU is avoided, and the condition of network failure is avoided.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (10)

1. A protocol processing method 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, an exclusive 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 or not;
if a first virtual CPU with an 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 a reserved work queue of the target protocol created on the second virtual CPU.
2. The method according to 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, wherein the third virtual cpu is 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 established on the third virtual CPU.
4. The method of claim 3, wherein the third virtual cpu is an independent virtual cpu other than the first virtual cpu and the second virtual cpu.
5. The method according to claim 1, wherein the detecting whether the working state of each first virtual cpu is abnormal comprises:
detecting the utilization rate and/or the blocking state of each first virtual CPU;
and determining whether the working state of each first virtual CPU is abnormal or not according to the utilization rate and/or the blocking state of each first virtual CPU.
6. The method according to any of claims 1-5, wherein said selecting a second virtual cpu corresponding to the target protocol comprises:
if the target protocol only corresponds to 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 rates of the at least two second virtual cpus.
7. The method according to claim 6, wherein said selecting one second virtual cpu from the at least two second virtual cpus includes:
and selecting a second virtual CPU with the lowest utilization rate from the at least two second virtual CPUs.
8. A protocol processing device 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, an exclusive 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 device comprises:
the detection unit is used for detecting whether the working state of each first virtual CPU is abnormal or not;
the determining unit is used for determining a high real-time protocol corresponding to a 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 a reserved work queue of the target protocol created on the second virtual cpu.
9. An electronic device, comprising: a processor, a memory;
the memory for storing a computer program;
the processor for executing 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 executed by a processor, implements the protocol processing method of any one of claims 1 to 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 true CN111984376A (en) 2020-11-24
CN111984376B 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
NUNO SANTOS等: "Achieving High-Throughput State Machine Replication in Multi-core Systems", 《2013 IEEE 33RD INTERNATIONAL CONFERENCE ON DISTRIBUTED COMPUTING SYSTEMS》, pages 266 - 275 *
唐宏等: "网络功能虚拟化中的网络转发性能优化技术研究", 《电信科学》, vol. 30, no. 11, pages 135 - 139 *
李石峰: "基于嵌入式操作系统的物联网节点技术研究", 《中国优秀硕士学位论文全文数据库信息科技辑》, no. 12, pages 136 - 175 *

Also Published As

Publication number Publication date
CN111984376B (en) 2023-06-27

Similar Documents

Publication Publication Date Title
US10715411B1 (en) Altering networking switch priority responsive to compute node fitness
Yamato et al. Fast and reliable restoration method of virtual resources on OpenStack
US7925817B2 (en) Computer system and method for monitoring an access path
CN111698158B (en) Method and device for electing master equipment and machine-readable storage medium
CN104468181A (en) Detection and handling of virtual network appliance failures
US11398976B2 (en) Method, device, and system for implementing MUX machine
US9043636B2 (en) Method of fencing in a cluster system
US11886904B2 (en) Virtual network function VNF deployment method and apparatus
US11349706B2 (en) Two-channel-based high-availability
JP2008305070A (en) Information processor and information processor system
CN113709220B (en) High-availability implementation method and system of virtual load equalizer and electronic equipment
CN109032754B (en) Method and apparatus for improving reliability of communication path
US11409621B2 (en) High availability for a shared-memory-based firewall service virtual machine
EP3633931B1 (en) Method and system for implementing mux machine
US11418382B2 (en) Method of cooperative active-standby failover between logical routers based on health of attached services
US8036105B2 (en) Monitoring a problem condition in a communications system
CN117097604A (en) Management method, device and equipment of server cluster and readable storage medium
CN110138656B (en) Service processing method and device
CN111984376B (en) Protocol processing method, device, equipment and computer readable storage medium
CN112988335A (en) High-availability virtualization management system, method and related equipment
JP5389591B2 (en) Network control apparatus and method
CN115396385B (en) Method and device for quickly recovering service of stack switch and computing equipment
US10122588B2 (en) Ring network uplink designation
JP2000244526A (en) Multiplexed network connector system
CN104158681A (en) Method and device for processing region controller failure in SDN (software defined network)

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