CN114785714A - Message transmission delay detection method, storage medium and equipment - Google Patents

Message transmission delay detection method, storage medium and equipment Download PDF

Info

Publication number
CN114785714A
CN114785714A CN202210195643.0A CN202210195643A CN114785714A CN 114785714 A CN114785714 A CN 114785714A CN 202210195643 A CN202210195643 A CN 202210195643A CN 114785714 A CN114785714 A CN 114785714A
Authority
CN
China
Prior art keywords
time period
virtual machine
message processing
processing state
transmission delay
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
CN202210195643.0A
Other languages
Chinese (zh)
Other versions
CN114785714B (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.)
Alibaba China Co Ltd
Original Assignee
Alibaba China 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 Alibaba China Co Ltd filed Critical Alibaba China Co Ltd
Priority to CN202210195643.0A priority Critical patent/CN114785714B/en
Publication of CN114785714A publication Critical patent/CN114785714A/en
Application granted granted Critical
Publication of CN114785714B publication Critical patent/CN114785714B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0852Delays
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements

Abstract

The present specification provides a method, a storage medium, and a device for detecting a packet transmission delay, in which Vring is detected in a virtual machine, whether a new packet arrives at a host is determined based on a head pointer and a tail pointer of a used descriptor region, whether the virtual machine starts to process a packet is determined by combining control information of the usable descriptor region, so as to determine a packet processing state, and whether a packet transmission delay occurs is determined based on the packet processing state in a preset time period and update information of the tail pointer of the used descriptor in the preset time period. By the scheme, the message transmission delay can be conveniently detected, a tool does not need to be deployed in the host machine, the tool deployment cost is reduced, the resource consumption of the host machine is reduced, and the method is safer and more efficient.

Description

Message transmission delay detection method, storage medium and equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, a storage medium, and a device for detecting a message transmission delay.
Background
In a virtualized scene, a message needs to be transmitted to a back-end virtual machine through the transmission of a front-end host, and a delay problem sometimes exists in the process of transmitting front-end and back-end data, so that network jitter is caused. In the related art, tcpdump (a network data acquisition and analysis tool) is generally deployed in a host and a virtual machine at the same time, and packets are captured at the same time by using tcpdump, and whether a delay exists in the front-end and back-end data transmission process is judged according to timestamp information of the messages. However, this solution is cumbersome, costly to deploy, and time consuming to analyze the data.
Disclosure of Invention
According to a first aspect of the embodiments of the present specification, there is provided a method for detecting a packet transmission delay, which is applied to a virtual machine, where the virtual machine and a host communicate with each other through Vring, and the method includes: detecting a head pointer and a tail pointer of a used descriptor region in the Vring; the head pointer of the used descriptor area indicates the number of messages received by the host machine, and the tail pointer indicates the number of messages processed by the virtual machine; determining a message processing state based on the head and tail pointers and control information of available descriptor areas; and determining whether the message transmission delay occurs or not based on the message processing state in the preset time period and the updating information of the tail pointer of the used descriptor region in the preset time period.
In some embodiments, the determining the message processing state based on the head pointer and the tail pointer and the control information of the available descriptor region includes: and if the head pointer and the tail pointer are different and the control information of the available descriptor area in the Vring does not indicate to stop sending and interrupting, determining that the message processing state is abnormal.
In some embodiments, the determining whether the packet transmission delay occurs based on the packet processing status in the preset time period and the update information of the tail pointer of the used descriptor region in the time period includes: and if the message processing states in the preset time period are all abnormal and the tail pointer of the used descriptor region is not updated in the preset time period, determining that the message transmission delay occurs.
In some embodiments, the detecting the head and tail pointers of the used descriptor region in Vring comprises: polling head and tail pointers of used descriptor regions in said Vring for a period of time; the duration corresponding to the preset time period is set based on the total duration corresponding to the time period of N times of polling, wherein N is an integer greater than or equal to 1.
In some embodiments, the above method further comprises: when the abnormal message processing state is determined, accumulating the time period of the polling to the delay time of the message transmission delay; and if the delay time length is greater than or equal to the time length corresponding to the preset time period, determining that the message processing states in the preset time period are all abnormal.
In some embodiments, the above method further comprises: in any polling, when the message processing state is determined to be normal, the delay time length is cleared.
In some embodiments, after determining the message processing state, the method further comprises: if the message processing state is determined to be normal, updating preset marking time by using the current time, wherein the marking time is used for recording the latest time for determining the normal message processing state; if the message processing state is determined to be abnormal, judging whether the time difference between the current time and the preset marking time is greater than or equal to the duration corresponding to the preset time period, and if so, determining that the message processing states in the preset time period are all abnormal.
In some embodiments, the above method further comprises: and if the message transmission delay is determined to occur, recording the information stored in the Vring and the system time information of the virtual machine to a specified storage position.
According to a second aspect of embodiments herein, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs any of the methods herein.
According to a third aspect of embodiments herein, there is provided a computer apparatus comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements any one of the methods in the embodiments herein when executing the program.
The technical scheme provided by the embodiment of the specification can have the following beneficial effects:
in the method, Vring is detected in a virtual machine, whether a new message reaches a host is determined based on a head pointer and a tail pointer of a used descriptor region, whether the virtual machine starts to process a packet is determined by combining control information of the usable descriptor region, a message processing state is determined, and whether message transmission delay occurs is determined based on the message processing state in a preset time period and update information of the tail pointer of the used descriptor in the preset time period. By the scheme, the message transmission delay can be conveniently detected, a tool does not need to be deployed in the host machine, the tool deployment cost is reduced, the resource consumption of the host machine is reduced, and the method is safer and more efficient.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the specification.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with this specification and, together with the description, serve to explain the principles of the specification.
Fig. 1 is a flowchart illustrating a message transmission delay detection method according to an exemplary embodiment;
FIG. 2 is a schematic diagram of one back-end communication interaction scenario illustrated in accordance with an exemplary embodiment;
fig. 3 is a schematic diagram illustrating a flow of detecting a message transmission delay by a virtual machine according to an exemplary embodiment of the present specification;
fig. 4 is a block diagram of a message transmission delay detection apparatus according to an exemplary embodiment;
FIG. 5 is a more specific computing device hardware architecture diagram that is illustrated in accordance with an exemplary embodiment.
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 implementations described in the following exemplary examples do not represent all implementations consistent with this description. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the specification, as detailed in the claims that follow.
The terminology used in the description herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the description. As used in this specification 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 should 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, the first information may also be referred to as second information, and similarly, the second information may also be referred to as first information, without departing from the scope of the present specification. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
Virtualization technology, also called virtualization technology, is a resource management technology for abstracting and displaying various physical resources of a host, such as a Central Processing Unit (CPU), a memory, a disk space, a network adapter, and the like. By means of virtualization technology, a plurality of Virtual Machines (VMs) can be deployed on one physical Machine, and the VMs are isolated from each other and can run simultaneously and independently from each other. The physical machine on which the virtual machine is installed is also referred to as a host machine, and accordingly, the virtual machine is also referred to as a client machine.
In a virtualization scene, message data usually needs to be transmitted to a virtual machine for processing through host machine transmission, and sometimes there is a delay problem in the transmission process, which causes network jitter. In the related technology, tcpdump (a network data acquisition and analysis tool) is generally deployed in a host machine and a virtual machine at the same time, and packets are captured at the same time by using tcpdump, and then whether the packet has time delay in the transmission process is judged according to the timestamp information of the packet. However, this solution is cumbersome to operate, costly to deploy, and time consuming to analyze the data.
Based on this, embodiments of the present specification provide a scheme for detecting a message transmission delay, so as to solve the above problem. The following provides a detailed description of examples of the present specification.
As shown in fig. 1, fig. 1 is a flowchart of a message transmission delay detection method according to an exemplary embodiment, where the method is applied to a virtual machine, and the virtual machine and a host communicate through Vring.
A virtual machine is a complete computer system with certain hardware system functionality, which is emulated by software, running in a relatively isolated environment. When creating a virtual machine, the hardware resources of the host machine are used as the virtual resources of the virtual machine, where the virtual resources may include computing resources, storage resources, and the like. In this embodiment, the host where the virtual machine is located is a hardware system with an entity, and the hardware system may be a personal computer, a server, an intelligent tablet, and the like. That is, the scheme of the present embodiment can be applied to various computer apparatuses.
Virtio is a general I/O virtualization framework, the core mechanism of which is to transmit data between a front-end host and a back-end virtual machine through a shared memory, and Vring is the shared memory. Vring introduces ring buffers (ring buffers) to hold information for front-end and back-end execution. Vring mainly includes three parts, respectively, Descriptor Table (Descriptor Table), Used Descriptor region (Used Ring), and Available Descriptor region (Available Ring). The descriptor table is used for storing associated descriptors, each descriptor is a description of a buffer and mainly comprises address (physical address of the buffer) and length (length of the buffer) and other information; the used descriptor area is used for informing the used descriptor of the virtual machine; the available descriptor area is used to inform the host that there are new descriptors available. The nature of these three parts is an array.
In normal operation, the mechanism for front-end and back-end data interaction may include: when message data reach a host machine, the host machine stores the message data into Vring, adds 1 to update used _ idx (a head pointer of a used descriptor region), and simultaneously sends an interrupt to the virtual machine to inform the virtual machine of starting to receive packets; the virtual machine receives the interrupt, informs the host computer to stop sending the interrupt through the available _ flags _ shadow (the control information of the available descriptor area) when starting to process packet receiving, adds 1 to the last _ used _ idx (the tail pointer of the used descriptor area) after message processing and updates until the used _ idx is equal to the last _ used _ idx, ends the packet receiving process, and finally restores the available _ flags _ shadow.
In this specification, an embodiment provides a scheme for detecting a message transmission delay in combination with the above interaction mechanism, where the scheme is suitable for a scenario in which front-end and back-end communication is performed by means of Vring, and the scenario includes a scenario in which a virtual machine is deployed by using Virtio _ net technology, a scenario in which a virtual machine is deployed by using Virtio _ blk technology, and the like.
The method comprises the following steps:
step 101, detecting a head pointer and a tail pointer of a used descriptor area in Vring; the head pointer of the used descriptor area indicates the number of messages received by the host machine, and the tail pointer indicates the number of messages processed by the virtual machine;
in the communication process of the front end and the back end of Vring, when a host stores a message into Vring, the head pointer of the used descriptor area is updated by adding 1, so that the head pointer of the used descriptor area can be used for determining the number of the messages received by the host; accordingly, when the virtual machine finishes processing one message, the tail pointer of the used descriptor region is updated by adding 1, so that the tail pointer of the used descriptor region can be used for determining the number of the messages processed by the virtual machine. In this step, by detecting the head pointer and the tail pointer, it can be determined whether a new packet arrives at the host, and the new packet is not processed by the virtual machine. For example, in one detection, if the number of messages indicated by the head pointer of the descriptor region is 5 and the number of messages indicated by the tail pointer is 5, the number of messages received by the host is consistent with the number of messages processed by the virtual machine, which indicates that all the message data received by the host is processed by the virtual machine; in the next detection, if the number of packets indicated by the head pointer in the descriptor area is 7 and the number of packets indicated by the tail pointer is 6, it indicates that the host receives two new packets, but one of the two new packets is not processed by the virtual machine in the two detection processes because the number of packets received by the host is inconsistent with the number of packets processed by the virtual machine.
In some examples, the detection in this step may be a detection performed at a certain time period, i.e., polling. Specifically, a timer may be established in the virtual machine, which triggers the detection of Vring according to a preset time period. The preset time period may be set to 2 seconds, i.e., the virtual machine performs detection of Vring every 2 seconds. Of course, in practical applications, 2 seconds is only an example, and the preset time period can be adjusted according to practical experience summary and different business requirements.
Step 102, determining a message processing state based on the head pointer, the tail pointer and control information of an available descriptor area;
the message processing state mentioned in this step may refer to a state of a transfer process of a message from a host to a virtual machine. In some examples, this step may include: and if the head pointer and the tail pointer are different and the control information of the available descriptor area in the Vring does not indicate to stop sending interruption, determining that the message processing state is abnormal. The control information of the available descriptor area indicates to stop sending the INTERRUPT, which may be to set AVAIL _ flags _ shadow in Vring as Vring _ AVAIL _ F _ NO _ INTERRUPT, and may be considered as a switch, when the control information does not indicate to stop sending the INTERRUPT, the host sends an INTERRUPT to the virtual machine every time a message is stored in Vring to notify the virtual machine to receive the packet, and when the control information indicates to stop sending the INTERRUPT, the virtual machine does not want to receive the notification, during which the host does not send the INTERRUPT to the virtual machine when the message is stored in Vring. When the message processing state is normal, if a message which is not processed by the virtual machine exists in Vring and the virtual machine is in the process of processing the message, the control information of the available descriptor region indicates to stop sending and interrupting, therefore, when the head pointer and the tail pointer are different and the control information of the available descriptor region in Vring does not indicate to stop sending and interrupting, it is indicated that the message arrives at the host, but the virtual machine does not receive an interrupt notice of the host to receive the packet, and in this case, it can be determined that an abnormality occurs in the transmission process of the message from the host to the virtual machine, namely, the message processing state is abnormal.
In addition, correspondingly, if the head pointer and the tail pointer are not the same, and the control information in the available descriptor area in Vring indicates that the sending of the interrupt is stopped, it indicates that a packet reaches the host, and the virtual machine starts to receive the packet according to the interrupt sent by the host, in this case, it may be determined that the packet processing state is normal; and if the head pointer and the tail pointer of the used descriptor area are the same, the message data received by the host machine is completely processed by the virtual machine, and in this case, the message processing state can be determined to be normal. It should be noted that, the virtual machine may detect whether the control information of the available descriptor region in Vring indicates the timing to stop sending the interrupt, while detecting the head pointer and the tail pointer of the used descriptor region in each polling process, or may detect that the head pointer and the tail pointer of the used descriptor region are different, which is not limited in this embodiment.
Step 103, determining whether a message transmission delay occurs based on a message processing state in a preset time period and update information of a tail pointer of a used descriptor region in the preset time period.
The concept of packet transmission delay referred in this embodiment may mean that the virtual machine delays the start of processing a packet received by a host, which may be expressed as that the time of each packet transmitted from the host to the virtual machine exceeds the tolerance time, taking the tolerance time as 3 seconds as an example, two packets arrive at the host at a certain time, where the two packets are a packet a and a packet B, respectively, and assuming that the virtual machine starts to process the packet a stored in Vring after 2 seconds of the time, and starts to process the packet B after 4 seconds of the time, since the time of the packet a transmitted from the host to the virtual machine is 2 seconds and is less than the tolerance time of 3 seconds, it may be considered that no packet transmission delay occurs; on the contrary, if the virtual machine does not start to process any of the two messages after 3 seconds of the time, it may be considered that a message transmission delay occurs. The preset time period mentioned in this step may be set according to the tolerant duration, and the virtual machine performs detection on Vring at least once in the preset time period.
When the message processing states in the preset time period are all abnormal states, the virtual machine may not receive the interrupt notification of the host machine to receive the packet in the preset time period, but the virtual machine may have already processed the message in the preset time period and the host machine may have received a new message after the virtual machine has processed the message. In the two possible cases, the former may determine that the message transmission delay occurs, and the latter may determine that the message transmission delay does not occur. Therefore, in the solution of this embodiment, it is further determined, in combination with the update information of the tail pointer of the used descriptor region in the preset time period, whether the virtual machine has a processing completion message in the preset time period, so as to determine whether a message transmission delay occurs.
Specifically, in some examples, this step may include: and if the message processing states in the preset time period are all abnormal and the tail pointer of the used descriptor region is not updated in the preset time period, determining that the message transmission delay occurs. For example, the virtual machine performs two detections in a preset time period, and when the detection is performed for the first time, the number of messages indicated by the head pointer of the used descriptor is 6, the number of messages indicated by the tail pointer of the used descriptor is 4, and the control information of the available descriptor does not indicate that the sending interruption is stopped, so that it is determined that the message processing state is abnormal; at the time of the second detection, the number of packets indicated by the head pointer of the used descriptor is 7, the number of packets indicated by the tail pointer of the used descriptor is 4, and the control information of the available descriptor does not indicate that the transmission interruption is stopped, so that it is determined that the packet processing state is abnormal. In the two detections, because the tail pointer of the used descriptor is not updated, it is indicated that the virtual machine does not start packet receiving processing all the time within the preset time period, and in this situation, it can be determined that the time of the process of transmitting two new packets from the host to the virtual machine during the first detection exceeds the time duration corresponding to the preset time period, so that the occurrence of packet transmission delay can be determined. On the contrary, if the message processing states in the preset time period are all abnormal, but the tail pointer of the descriptor region is updated in the preset time period, it is indicated that the virtual machine performs packet receiving processing in the preset time period, and in this case, it can be determined that the time of the process of transmitting two new messages from the host to the virtual machine during the first detection does not exceed the time duration corresponding to the preset time period, so that it can be determined that no message transmission delay occurs.
According to the scheme of the embodiment, Vring is detected in the virtual machine, whether a new message arrives at a host machine is determined based on a head pointer and a tail pointer of a used descriptor area, whether the virtual machine starts to process a packet is determined by combining control information of the usable descriptor area, so that the message processing state is determined, and whether message transmission delay occurs is determined based on the message processing state in a preset time period and updating information of the tail pointer of the used descriptor in the preset time period. By the scheme, the message transmission delay can be conveniently detected, a tool does not need to be deployed in the host machine, the tool deployment cost is reduced, the resource consumption of the host machine is reduced, and the method is safer and more efficient.
In an alternative embodiment, when the virtual machine polls Vring at a certain time period, the duration corresponding to the aforementioned preset time period may be set based on the total duration corresponding to the time period of N polls, where N is an integer greater than or equal to 1. The value of N may be 1, that is, after performing polling once, the virtual machine may directly determine whether a packet transmission delay occurs according to the result of the polling this time and the update information of the last polling when the tail pointer of the used descriptor region is compared with the update information of the last polling; the value of N may also be an integer greater than 1, for example, a time period set by the timer is 1 second, if N is 3, a duration corresponding to the preset time period may be 3 seconds, that is, the virtual machine may perform 3 times of polling on Vring within the preset time period, if in the 3 times of polling, a message processing state is abnormal, and a tail pointer of the used descriptor region is not updated all the time, it may be determined that a message transmission delay occurs. In addition, the value of N may be set according to the requirements of a specific scenario, which is not limited in this specification.
Further, for statistics of a message processing state in a preset time period, the present specification further provides the following two schemes:
the first scheme is that when the abnormal message processing state is determined, the time period of the polling is accumulated to the delay time of the message transmission delay; and if the delay time length is greater than or equal to the time length corresponding to the preset time period, determining that the message processing states in the preset time period are all abnormal. That is, a module for counting the delay time of the message transmission delay may be set in the virtual machine, where the initial value of the delay time is 0, when the message processing state is determined to be abnormal, the time period of one polling is added to the delay time, it is assumed that the time period corresponding to the preset time period is 3 seconds, which is the total time period of the time periods of 2 polling, if the virtual machine determines that the message processing state is normal in the first polling, the delay time is still 0, when the message processing state is determined to be abnormal in the second polling, the module adds the time period of one polling, that is, 1.5 seconds, to the delay time period, which is 1.5 seconds, the delay time period is determined to be abnormal in the third polling, the module adds the time period of one polling to the delay time period again, which is 3 seconds, and at this time, the delay time period is equal to the time period corresponding to the preset time period, therefore, it can be determined that the message processing states in the preset time period are all abnormal. In addition, it should be noted that, in any polling, when it is determined that the message processing state is normal, the virtual machine may clear the delay duration to zero, so that it may be avoided to merge discontinuous polling results, thereby reducing misjudgment.
The second scheme is that after the message processing state is determined, if the message processing state is determined to be normal, the preset marking time is updated by using the current time; if the message processing state is determined to be abnormal, judging whether the time difference between the current time and the preset marking time is greater than or equal to the duration corresponding to the preset time period, and if so, determining that the message processing states in the preset time period are all abnormal. Correspondingly, the scheme means that a module is arranged in the virtual machine and used for recording and determining the latest time when the message processing state is determined to be normal, so that when the message processing state is determined to be abnormal for the first time, the time difference between the current time and the latest time recorded in the module is the time period of one polling, and when the message processing state is determined to be normal in the next polling after the message processing state is determined to be abnormal for the first time, the latest time recorded in the module is updated to the current time, namely, the time difference between the current time and the latest time recorded in the module is 0, so that if the time difference between the current time and the latest time recorded in the module is greater than or equal to the duration corresponding to the preset time period, the message processing states in the preset time period can be determined to be abnormal.
Of course, in other embodiments, the message processing state in the preset time period may also be counted in other manners, which is not limited in this specification.
Also, in order to improve the reason for the message transmission delay for operation and maintenance personnel, in some examples, when it is determined that the message transmission delay occurs, the virtual machine may record the information stored in Vring and the system time information of the virtual machine to a specified storage location. That is to say, when determining that the message transmission delay occurs, the virtual machine may print Vring and time information of an operating system of the virtual machine, and store the time information in a specified storage location, so that operation and maintenance staff may obtain the information from the specified storage location and analyze a root cause of the message transmission delay according to the information.
To explain the message transmission delay scheme in more detail, a specific embodiment is described as follows:
as shown in fig. 2, fig. 2 is a schematic diagram of a front-end and back-end communication interaction scenario shown in this embodiment. In the scenario of this embodiment, the virtual machine 21 at the guest end is installed on the host machine 22 at the host end, data transmission is performed between the host machine 22 and the virtual machine 21 through Vring23, the host machine 22 is responsible for receiving and sending messages and storing the received messages into Vring23, the virtual machine 21 obtains the messages from Vring23 to process the messages, in addition, used _ idx in the Vring23 indicates the number of the messages received by the host machine 22, and the host machine 22 performs updating; last _ used _ idx in Vring23 indicates the number of packets that virtual machine 21 has finished processing, and is updated by virtual machine 21.
In this embodiment, a timer24 is established in the virtual machine 21 to trigger the timing polling Vring23, and the process shown in fig. 3 is executed to detect whether there is a message transmission delay. Fig. 3 is a schematic diagram of a flow of detecting a message transmission delay by a virtual machine shown in this embodiment, where the flow includes:
s301, after the period of the timer and the delay time threshold value are set, polling detection is started;
s302, waiting for triggering of a timer, wherein the timer triggers polling detection once every other set period;
s303, triggering polling detection by a timer, judging whether used _ idx and last _ used _ idx are different and whether the AVAIL _ flags _ shadow is not VRING _ AVAIL _ F _ NO _ INTERRUPT, if so, executing S304, otherwise, executing S305;
s304, judging whether last _ used _ idx is updated, if yes, executing S305, otherwise executing S306;
s305, updating t1 to be the current time, returning to S302, and waiting for the timer to trigger the next detection polling;
s306, calculating a target time length delta, wherein the value of the delta is the difference value obtained by subtracting t1 from the current time;
s307, judging whether the delta exceeds a set delay time threshold, if so, executing S308, otherwise, returning to S302, and waiting for the next detection polling triggered by a timer;
s308, printing Vring information and system time information.
In the above flow, the virtual machine regularly polls whether used _ idx and last _ used _ idx in Vring are different, and whether available _ flags _ shadow is not Vring _ AVAIL _ F _ NO _ INTERRUPT, if the polling result is yes, it indicates that a data packet arrives at the host, but the virtual machine does not receive the INTERRUPT notification of the host to receive the packet, after the polling passes through a plurality of cycles, if the above condition is still satisfied and last _ used _ idx at the guest end is not updated, then the time can be compared with the set delay time threshold, if the above condition is still satisfied, it is determined that the packet transmission delay occurs, at this time, Vring information and system time information are printed, so as to facilitate the subsequent operation and maintenance processing.
By the scheme of the embodiment, at least the following effects can be obtained: the front-end and back-end time delay information of the message is directly detected in the virtual machine, a detection tool does not need to be deployed in the host machine, the tool deployment cost is reduced, no resource is consumed by the host machine, and the method is safe and efficient; meanwhile, the time delay information is more visual, and the timestamp of the message does not need to be analyzed.
Corresponding to the foregoing method embodiments, the present specification further provides embodiments of a message transmission delay detection apparatus and a terminal applied thereto.
As shown in fig. 4, fig. 4 is a block diagram of a packet transmission delay detection apparatus shown in this specification according to an exemplary embodiment, where the apparatus is applied to a virtual machine, and the virtual machine and a host communicate through Vring, and the apparatus includes:
a message detection module 41, configured to detect a head pointer and a tail pointer of a used descriptor area in the Vring; the head pointer of the used descriptor area indicates the number of messages received by the host machine, and the tail pointer indicates the number of messages processed by the virtual machine;
a state determining module 42, configured to determine a message processing state based on the head pointer and the tail pointer and control information of the available descriptor area;
a delay determining module 43, configured to determine whether a packet transmission delay occurs based on a packet processing state in a preset time period and update information of a tail pointer of a used descriptor region in the preset time period.
For the device embodiment, since it basically corresponds to the method embodiment, reference may be made to the partial description of the method embodiment for relevant points. The above-described embodiments of the apparatus are merely illustrative, wherein the modules described as separate parts may or may not be physically separate, and the parts displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution in the present specification. One of ordinary skill in the art can understand and implement it without inventive effort.
Embodiments of the present specification also provide a computer device, which at least includes a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the method according to any of the foregoing embodiments when executing the program.
Fig. 5 is a schematic diagram illustrating a more specific hardware structure of a computing device according to an embodiment of the present disclosure, where the computing device may include: a processor 501, a memory 502, an input/output interface 503, a communication interface 504, and a bus 505. Wherein the processor 501, the memory 502, the input/output interface 503 and the communication interface 504 are communicatively connected to each other within the device via a bus 505.
The processor 501 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present specification. The processor 501 may further include a graphics card, which may be an Nvidia titan X graphics card or a 1080Ti graphics card, etc.
The Memory 502 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, or the like. The memory 502 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present specification is implemented by software or firmware, the relevant program codes are stored in the memory 502 and called to be executed by the processor 501.
The input/output interface 503 is used for connecting an input/output module to realize information input and output. The i/o module may be configured as a component in a device (not shown) or may be external to the device to provide a corresponding function. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.
The communication interface 504 is used to connect a communication module (not shown in the figure) to implement communication interaction between the present device and other devices. The communication module can realize communication in a wired mode (such as USB, network cable and the like) and also can realize communication in a wireless mode (such as mobile network, WIFI, Bluetooth and the like).
Bus 505 comprises a path that transfers information between the various components of the device, such as processor 501, memory 502, input/output interface 503, and communication interface 504.
It should be noted that although the above-mentioned device only shows the processor 501, the memory 502, the input/output interface 503, the communication interface 504 and the bus 505, in a specific implementation, the device may also include other components necessary for normal operation. In addition, those skilled in the art will appreciate that the above-described apparatus may also include only those components necessary to implement the embodiments of the present description, and not necessarily all of the components shown in the figures.
The embodiments of the present disclosure further provide a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the method of any one of the foregoing embodiments.
Computer-readable media, including both permanent and non-permanent, removable and non-removable media, may implement the information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
From the above description of the embodiments, it is clear to those skilled in the art that the embodiments of the present disclosure can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the embodiments of the present specification may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments of the present specification.
The systems, apparatuses, modules or units described in the above embodiments may be specifically implemented by a computer chip or an entity, or implemented by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
The foregoing description of specific embodiments has been presented for purposes of illustration and description. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
Other embodiments of the present description will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This specification is intended to cover any variations, uses, or adaptations of the specification following the general principles of the specification and including such departures from the present disclosure as come within known or customary practice in the art to which the specification pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the specification being indicated by the following claims.
It will be understood that the present description is not limited to the precise arrangements that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present description is limited only by the appended claims.
The above description is only a preferred embodiment of the present disclosure, and should not be taken as limiting the present disclosure, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present disclosure should be included in the protection scope of the present disclosure.

Claims (10)

1. A message transmission delay detection method is applied to a virtual machine, the virtual machine and a host machine communicate through Vring, and the method comprises the following steps:
detecting a head pointer and a tail pointer of a used descriptor region in the Vring; the head pointer of the used descriptor region indicates the number of messages received by the host machine, and the tail pointer indicates the number of messages processed by the virtual machine;
determining a message processing state based on the head and tail pointers and control information of available descriptor areas;
and determining whether message transmission delay occurs or not based on the message processing state in the preset time period and the update information of the tail pointer of the used descriptor region in the preset time period.
2. The method of claim 1, wherein determining a message processing state based on the head and tail pointers and control information for available descriptor regions comprises:
and if the head pointer and the tail pointer are different and the control information of the available descriptor area in the Vring does not indicate to stop sending and interrupting, determining that the message processing state is abnormal.
3. The method of claim 1, wherein the determining whether a packet transmission delay occurs based on the packet processing status in the preset time period and the updated information of the tail pointer of the used descriptor area in the time period comprises:
and if the message processing states in the preset time period are all abnormal and the tail pointer of the used descriptor region is not updated in the preset time period, determining that the message transmission delay occurs.
4. The method of claim 1, said detecting a head pointer and a tail pointer for used descriptor regions in said Vring comprising: polling head and tail pointers of used descriptor regions in said Vring for a period of time;
the duration corresponding to the preset time period is set based on the total duration corresponding to the time period of N times of polling, wherein N is an integer greater than or equal to 1.
5. The method of claim 4, further comprising:
when the abnormal message processing state is determined, accumulating the time period of the polling to the delay time of the message transmission delay;
and if the delay time length is greater than or equal to the time length corresponding to the preset time period, determining that the message processing states in the preset time period are all abnormal.
6. The method of claim 5, further comprising:
and in any polling, clearing the delay time length when the message processing state is determined to be normal.
7. The method of claim 1, after determining a message processing state, the method further comprising:
if the message processing state is determined to be normal, updating preset marking time by using the current time, wherein the marking time is used for recording the latest time for determining the normal message processing state;
if the message processing state is determined to be abnormal, judging whether the time difference between the current time and the preset marking time is greater than or equal to the time length corresponding to the preset time period, and if so, determining that the message processing states in the preset time period are all abnormal.
8. The method of claim 1, further comprising:
and if the message transmission delay is determined, recording the information stored in the Vring and the system time information of the virtual machine to a specified storage position.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor when executing the program implements the method of any one of claims 1 to 8.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method of any one of claims 1 to 8.
CN202210195643.0A 2022-03-01 2022-03-01 Message transmission delay detection method, storage medium and equipment Active CN114785714B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210195643.0A CN114785714B (en) 2022-03-01 2022-03-01 Message transmission delay detection method, storage medium and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210195643.0A CN114785714B (en) 2022-03-01 2022-03-01 Message transmission delay detection method, storage medium and equipment

Publications (2)

Publication Number Publication Date
CN114785714A true CN114785714A (en) 2022-07-22
CN114785714B CN114785714B (en) 2023-08-22

Family

ID=82424144

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210195643.0A Active CN114785714B (en) 2022-03-01 2022-03-01 Message transmission delay detection method, storage medium and equipment

Country Status (1)

Country Link
CN (1) CN114785714B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116634469A (en) * 2023-07-21 2023-08-22 南京源兴智达信息科技有限公司 Data transmission management system and method based on multiple LoRa nodes

Citations (24)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060039371A1 (en) * 2004-08-19 2006-02-23 Microsoft Corporation Network routing
US20120124249A1 (en) * 2010-11-16 2012-05-17 International Business Machines Corporation Method Of Data Communications With Reduced Latency
CN103514261A (en) * 2013-08-13 2014-01-15 江苏华大天益电力科技有限公司 Data asynchronization storage and access mechanism applied to industrial control system
CN105516023A (en) * 2014-09-24 2016-04-20 华为技术有限公司 Message forwarding method and apparatus
CN106302238A (en) * 2015-05-13 2017-01-04 深圳市中兴微电子技术有限公司 A kind of queue management method and device
CN106406997A (en) * 2016-09-20 2017-02-15 杭州华三通信技术有限公司 A timer scheduling method and device
CN107342954A (en) * 2017-06-29 2017-11-10 北京东土军悦科技有限公司 The dispatching method and device of a kind of message
US20180027074A1 (en) * 2016-07-22 2018-01-25 6Wind System and method for storage access input/output operations in a virtualized environment
CN108509156A (en) * 2018-04-04 2018-09-07 腾讯科技(深圳)有限公司 Method for reading data, device, equipment and system
CN108958884A (en) * 2018-06-22 2018-12-07 郑州云海信息技术有限公司 A kind of method and relevant apparatus of Virtual Machine Manager
CN208424653U (en) * 2018-05-17 2019-01-22 上海欣诺通信技术股份有限公司 A kind of Ethernet loop network system based on XPON access net
CN109656515A (en) * 2018-11-16 2019-04-19 深圳证券交易所 Operating method, device and the storage medium of queue message
CN110442573A (en) * 2019-06-29 2019-11-12 苏州浪潮智能科技有限公司 A kind of method and device of distributed fault-tolerance key assignments storage
US20190377593A1 (en) * 2018-06-12 2019-12-12 Beijing Baidu Netcom Science And Technology Co., Ltd. Communication method, apparatus and system for virtual machine and host machine
CN110750367A (en) * 2019-09-30 2020-02-04 华为技术有限公司 Method, system and related equipment for queue communication
CN110851371A (en) * 2018-08-20 2020-02-28 华为技术有限公司 Message processing method and related equipment
CN110995680A (en) * 2019-11-22 2020-04-10 北京浪潮数据技术有限公司 Virtual machine message receiving method, system, device and computer readable storage medium
CN111221476A (en) * 2020-01-08 2020-06-02 深圳忆联信息系统有限公司 Front-end command processing method and device for improving SSD performance, computer equipment and storage medium
CN111654447A (en) * 2018-01-16 2020-09-11 华为技术有限公司 Message transmission method and device
CN111831389A (en) * 2019-04-23 2020-10-27 上海华为技术有限公司 Data processing method and device and storage medium
CN112804115A (en) * 2019-11-14 2021-05-14 北京华为数字技术有限公司 Method, device and equipment for detecting abnormity of virtual network function
CN112866410A (en) * 2021-02-10 2021-05-28 北京字节跳动网络技术有限公司 Forwarding control method, forwarding control device, forwarding control medium and electronic equipment of data message
CN113609055A (en) * 2021-06-25 2021-11-05 山东云海国创云计算装备产业创新中心有限公司 Method, device, equipment and readable medium for obtaining descriptor by back-end equipment
CN113746749A (en) * 2020-05-29 2021-12-03 阿里巴巴集团控股有限公司 Network connection device

Patent Citations (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060039371A1 (en) * 2004-08-19 2006-02-23 Microsoft Corporation Network routing
US20120124249A1 (en) * 2010-11-16 2012-05-17 International Business Machines Corporation Method Of Data Communications With Reduced Latency
CN103514261A (en) * 2013-08-13 2014-01-15 江苏华大天益电力科技有限公司 Data asynchronization storage and access mechanism applied to industrial control system
CN105516023A (en) * 2014-09-24 2016-04-20 华为技术有限公司 Message forwarding method and apparatus
CN106302238A (en) * 2015-05-13 2017-01-04 深圳市中兴微电子技术有限公司 A kind of queue management method and device
US20180027074A1 (en) * 2016-07-22 2018-01-25 6Wind System and method for storage access input/output operations in a virtualized environment
CN106406997A (en) * 2016-09-20 2017-02-15 杭州华三通信技术有限公司 A timer scheduling method and device
CN107342954A (en) * 2017-06-29 2017-11-10 北京东土军悦科技有限公司 The dispatching method and device of a kind of message
CN111654447A (en) * 2018-01-16 2020-09-11 华为技术有限公司 Message transmission method and device
CN108509156A (en) * 2018-04-04 2018-09-07 腾讯科技(深圳)有限公司 Method for reading data, device, equipment and system
CN208424653U (en) * 2018-05-17 2019-01-22 上海欣诺通信技术股份有限公司 A kind of Ethernet loop network system based on XPON access net
US20190377593A1 (en) * 2018-06-12 2019-12-12 Beijing Baidu Netcom Science And Technology Co., Ltd. Communication method, apparatus and system for virtual machine and host machine
CN108958884A (en) * 2018-06-22 2018-12-07 郑州云海信息技术有限公司 A kind of method and relevant apparatus of Virtual Machine Manager
CN110851371A (en) * 2018-08-20 2020-02-28 华为技术有限公司 Message processing method and related equipment
US20210051118A1 (en) * 2018-08-20 2021-02-18 Huawei Technologies Co., Ltd. Packet processing method and related device
CN109656515A (en) * 2018-11-16 2019-04-19 深圳证券交易所 Operating method, device and the storage medium of queue message
CN111831389A (en) * 2019-04-23 2020-10-27 上海华为技术有限公司 Data processing method and device and storage medium
CN110442573A (en) * 2019-06-29 2019-11-12 苏州浪潮智能科技有限公司 A kind of method and device of distributed fault-tolerance key assignments storage
CN110750367A (en) * 2019-09-30 2020-02-04 华为技术有限公司 Method, system and related equipment for queue communication
CN112804115A (en) * 2019-11-14 2021-05-14 北京华为数字技术有限公司 Method, device and equipment for detecting abnormity of virtual network function
CN110995680A (en) * 2019-11-22 2020-04-10 北京浪潮数据技术有限公司 Virtual machine message receiving method, system, device and computer readable storage medium
CN111221476A (en) * 2020-01-08 2020-06-02 深圳忆联信息系统有限公司 Front-end command processing method and device for improving SSD performance, computer equipment and storage medium
CN113746749A (en) * 2020-05-29 2021-12-03 阿里巴巴集团控股有限公司 Network connection device
CN112866410A (en) * 2021-02-10 2021-05-28 北京字节跳动网络技术有限公司 Forwarding control method, forwarding control device, forwarding control medium and electronic equipment of data message
CN113609055A (en) * 2021-06-25 2021-11-05 山东云海国创云计算装备产业创新中心有限公司 Method, device, equipment and readable medium for obtaining descriptor by back-end equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116634469A (en) * 2023-07-21 2023-08-22 南京源兴智达信息科技有限公司 Data transmission management system and method based on multiple LoRa nodes
CN116634469B (en) * 2023-07-21 2023-09-19 南京源兴智达信息科技有限公司 Data transmission management system and method based on multiple LoRa nodes

Also Published As

Publication number Publication date
CN114785714B (en) 2023-08-22

Similar Documents

Publication Publication Date Title
CN100365994C (en) Method and system for regulating ethernet
EP2819015B1 (en) Method, terminal, and server for synchronizing terminal mirror
EP3617889B1 (en) Stutter detection method and device
CN112311617A (en) Configured data monitoring and alarming method and system
CN109783345B (en) Method and system for testing small program performance
CN107517110A (en) Veneer configuration self-recovery method and device in a kind of distributed system
CN107025145B (en) Error code analysis method and device
CN109101371B (en) Disaster recovery switching method and device
CN114785714B (en) Message transmission delay detection method, storage medium and equipment
CN111949511A (en) Application program pause processing method and device, terminal and storage medium
CN104809054A (en) Method and system for realizing program testing
EP2975524B1 (en) Information processing device
CN113190427A (en) Caton monitoring method and device, electronic equipment and storage medium
CN112685247A (en) Alarm suppression method based on Zabbix monitoring system and monitoring system
CN110784337A (en) Cloud service quality monitoring method and related product
CN112989323B (en) Process detection method, device, terminal and storage medium
US11336714B1 (en) Queue-based distributed timer
CN114113855A (en) Electrostatic discharge detection processing method and device and terminal equipment
CN112804115B (en) Method, device and equipment for detecting abnormity of virtual network function
CN112953723B (en) Vehicle-mounted intrusion detection method and device
CN114666390A (en) Page monitoring method and device of application program, electronic equipment and storage medium
CN114265669A (en) Destroyed container instance identification method and device
CN113010222A (en) File processing method and server
CN113346973A (en) Event prompting method and device, electronic equipment and computer readable storage medium
CN110209548B (en) Service control method, system, electronic device and computer readable storage medium

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