Method, apparatus and medium for priority control of real-time container time synchronization
By monitoring and sorting the synchronization status data of PTP nodes in real time in a cloud-native environment, and dynamically scheduling real-time containers to high-precision nodes, the problem of low task efficiency caused by differences in node time synchronization accuracy is solved, and the running efficiency and stability of real-time tasks are improved.
Patent Information
- Application Number
- CN202511544992.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-28
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2045-10-28
AI Technical Summary
In cloud-native environments, differences in node time synchronization accuracy and the scheduler's lack of time accuracy judgment can cause time-sensitive real-time containers to be scheduled to nodes with low synchronization accuracy, affecting the running efficiency of real-time tasks.
By deploying monitors in the node cluster to monitor the synchronization status data of PTP nodes in real time, real-time status data is obtained, PTP accuracy data is determined, multi-dimensional characterization data is expanded, high-precision node scheduling real-time tasks are sorted and matched, synchronization service scheduling parameters are generated, and real-time containers are controlled to run on target nodes.
It enables dynamic scheduling of real-time tasks based on PTP precision, improving the running efficiency of real-time tasks, reducing delays and errors caused by insufficient synchronization precision, and ensuring that time-sensitive tasks run on high-precision nodes.
Smart Images

Figure CN121029425B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present disclosure relate to the technical field of computer, and in particular, to a priority control method, device, equipment and medium suitable for real-time container time synchronization. BACKGROUND
[0002] In real-time computing scenarios such as industrial automation, high-frequency trading in finance, distributed control system, etc., time synchronization accuracy directly affects the reliability and real-time performance of the system. PTP (Precision Time Protocol) as a high-precision time synchronization standard has been applied in many real-time systems.
[0003] However, in cloud-native environments such as Kubernetes / Kata Containers / Xenomai, due to the differences in node time synchronization accuracy, and the lack of time accuracy-based priority judgment when the scheduler allocates tasks, the time accuracy is uneven, which may schedule real-time containers sensitive to time to nodes with poor synchronization accuracy, affecting the efficiency of real-time task running. SUMMARY
[0004] Embodiments described herein provide a priority control method, device, equipment and medium for real-time container time synchronization, which overcomes the above problems.
[0005] In a first aspect, according to the content of the present disclosure, a priority control method for real-time container time synchronization is provided, comprising:
[0006] locating a plurality of candidate PTP nodes from a node cluster according to the node access state of the PTP device;
[0007] deploying a monitor in the candidate PTP node, and monitoring the synchronization state data corresponding to the candidate PTP node in real time through the monitor, the synchronization state data including: time deviation from the master clock, clock drift rate, jitter value and synchronization delay;
[0008] when a task scheduling event is detected, obtaining the real-time state data corresponding to each candidate PTP node through the monitor deployed in each candidate PTP node;
[0009] determining the PTP accuracy data corresponding to each candidate PTP node according to the real-time state data corresponding to each candidate PTP node;
[0010] data augmentation is performed on the PTP accuracy data corresponding to each candidate PTP node to obtain multi-dimensional representation data corresponding to each candidate PTP node;
[0011] sort the plurality of candidate PTP nodes according to the multi-dimensional characterization data corresponding to each of the candidate PTP nodes, to obtain a node accuracy list;
[0012] match a target PTP node corresponding to a target task in the task scheduling event from the node accuracy list, and forward the target task to a real-time container, and schedule the real-time container to the target PTP node; the target task is a real-time task with high time accuracy requirement in the task scheduling event;
[0013] generate a synchronization service scheduling parameter of the real-time container in the target PTP node according to a task priority corresponding to the real-time container, the synchronization service scheduling parameter being used to describe a PTP process scheduling strategy and a CPU occupation state followed by the real-time container when running the target task;
[0014] control the real-time container to run the target task using PTP resources in the target PTP node according to the synchronization service scheduling parameter.
[0015] In a second aspect, according to the content of the disclosure, a real-time container time synchronization priority control device is provided, comprising:
[0016] a positioning module configured to locate a plurality of candidate PTP nodes from a node cluster according to a node access state of a PTP device;
[0017] a monitoring module configured to deploy a monitor in the candidate PTP nodes, and monitor synchronization state data corresponding to the candidate PTP nodes in real time through the monitor, the synchronization state data including a time deviation from a master clock, a clock drift rate, a jitter value, and a synchronization delay;
[0018] an acquisition module configured to acquire real-time state data corresponding to each of the candidate PTP nodes through the monitor deployed in each of the candidate PTP nodes when a task scheduling event is detected to be triggered;
[0019] a determination module configured to determine PTP accuracy data corresponding to each of the candidate PTP nodes according to the real-time state data corresponding to each of the candidate PTP nodes;
[0020] an expansion module configured to perform data expansion on the PTP accuracy data corresponding to each of the candidate PTP nodes, to obtain multi-dimensional characterization data corresponding to each of the candidate PTP nodes;
[0021] a sorting module configured to sort the plurality of candidate PTP nodes according to the multi-dimensional characterization data corresponding to each of the candidate PTP nodes, to obtain a node accuracy list;
[0022] The scheduling module is configured to match a target PTP node corresponding to a target task in the task scheduling event from the node precision list, and forward the target task to a real-time container, and schedule the real-time container to the target PTP node; the target task is a real-time task with high time precision requirement in the task scheduling event;
[0023] The generating module is configured to generate a synchronization service scheduling parameter of the real-time container in the target PTP node according to a task priority corresponding to the real-time container, the synchronization service scheduling parameter being used to describe a PTP process scheduling strategy and a CPU occupation state followed by the real-time container when running the target task;
[0024] The control module is configured to control the real-time container to run the target task using PTP resources in the target PTP node according to the synchronization service scheduling parameter.
[0025] In a third aspect, a computer device is provided, including a memory and a processor, the memory storing a computer program, and the processor implementing steps of the priority control method for real-time container time synchronization in any one of the above embodiments when executing the computer program.
[0026] In a fourth aspect, a computer readable storage medium is provided, the computer readable storage medium storing a computer program, and the computer program implementing steps of the priority control method for real-time container time synchronization in any one of the above embodiments when executed by a processor.
[0027] The priority control method for real-time container time synchronization provided by the embodiments of the application comprises the following steps: locating a plurality of candidate PTP nodes from a node cluster according to a node access state of a PTP device; deploying a monitor in the candidate PTP nodes and monitoring the synchronization state data corresponding to the candidate PTP nodes in real time through the monitor, wherein the synchronization state data comprises a time deviation from a master clock, a clock drift rate, a jitter value and a synchronization delay; when a task scheduling event is detected to be triggered, obtaining the real-time state data corresponding to each candidate PTP node through the monitor deployed in each candidate PTP node; determining the PTP precision data corresponding to each candidate PTP node according to the real-time state data corresponding to each candidate PTP node; performing data augmentation on the PTP precision data corresponding to each candidate PTP node to obtain the multi-dimensional representation data corresponding to each candidate PTP node; sorting the plurality of candidate PTP nodes according to the multi-dimensional representation data corresponding to each candidate PTP node to obtain a node precision list; matching the target PTP node corresponding to a target task in the task scheduling event from the node precision list; and forwarding the target task to a real-time container and scheduling the real-time container to the target PTP node; the target task is a real-time task with a high time precision requirement in the task scheduling event; generating a synchronization service scheduling parameter of the real-time container in the target PTP node according to the task priority corresponding to the real-time container, wherein the synchronization service scheduling parameter is used to describe the PTP process scheduling strategy and the CPU occupation state according to which the real-time container runs the target task; and controlling the real-time container to run the target task using the PTP resources in the target PTP node according to the synchronization service scheduling parameter. In this way, the PTP time synchronization precision of each PTP node is perceived by monitoring the PTP precision data in real time, which facilitates the allocation of high-precision PTP nodes to real-time tasks with high time precision requirements, so as to accurately schedule real-time tasks sensitive to time to PTP nodes with high synchronization precision, thereby effectively improving the running efficiency of real-time tasks.
[0028] The above description is only a summary of the technical solutions of the embodiments of the application. In order to more clearly understand the technical means of the embodiments of the application, the embodiments of the application can be implemented according to the content of the description, and in order to make the above and other purposes, characteristics and advantages of the embodiments of the application more obvious and easy to understand, the specific embodiments of the application are described below. BRIEF DESCRIPTION OF DRAWINGS
[0029] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly described below. It should be noted that the drawings described below only relate to some embodiments of the present disclosure, but not limit the present disclosure, wherein:
[0030] Figure 1 is a flowchart of a priority control method for real-time container time synchronization provided by the present disclosure.
[0031] Figure 2 is a structural schematic diagram of a priority control device for real-time container time synchronization provided by the present disclosure.
[0032] Figure 3 is a structural schematic diagram of a computer device provided by the present disclosure.
[0033] It should be noted that the elements in the drawings are schematic and not drawn to scale. DETAILED DESCRIPTION
[0034] In order to make the purposes, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions of the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by a person of ordinary skill in the art without any inventive effort also belong to the scope of protection of the present disclosure.
[0035] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this present subject matter belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the specification and relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein. As used herein, the statement that two or more parts are "connected" or "coupled" together refer to an indirect or direct connection or coupling.
[0036] Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase "in an embodiment" in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive of one another. A person of ordinary skill in the art will readily recognize from the disclosure herein, given the total volume of this application that one or more passages that are described as an embodiment is / are also an embodiment of another embodiment.
[0037] The term "and / or", merely an associative relationship of the associated objects described herein, means that there can be three relationships, for example, A and / or B, which can represent: there is A, there is A and B, and there is B. In addition, the character " / " in this paper generally represents that the front and rear associated objects are a "or" relationship. Terms such as "first" and "second" are only used to distinguish one component (or part of a component) from another component (or another part of a component).
[0038] In the description of the present application, unless otherwise specified, the meaning of "a plurality of" is two or more (including two), and similarly, "a plurality of groups" means two or more groups (including two groups).
[0039] In order for those skilled in the art to better understand the scheme of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in combination with the drawings.
[0040] Figure 1 is a flowchart of a priority control method for real-time container time synchronization provided by an embodiment of the present disclosure, as Figure 1 indicated, the specific process of the priority control method for real-time container time synchronization includes:
[0041] S110, locating a plurality of candidate PTP nodes from a node cluster according to a node access state of a PTP device; deploying a monitor in the candidate PTP nodes, and monitoring the synchronization state data corresponding to the candidate PTP nodes in real time through the monitor.
[0042] The PTP device is a key component for realizing precise time synchronization, and the main function is to transmit time information through a network protocol. The candidate PTP node is a cluster node of a PTP resource with a PTP device. The node access state of the PTP device is used to describe the access relationship between the PTP device and each candidate PTP node, i.e., whether the PTP device has an access relationship with the PTP node. If the PTP device has an access relationship with the original PTP node, the PTP node is determined as a candidate PTP node, i.e., each node in the plurality of candidate PTP nodes has a node access relationship with the PTP device.
[0043] The synchronization state data includes: time offset from the master clock, clock drift rate, jitter value, and synchronization delay. The time offset from the master clock offset is the time offset of the host (i.e., the candidate PTP node) from the synchronized time source (i.e., the master clock) through the NTP clock synchronization; the closer the offset is to 0, the closer the time of the host and the ntp server is. The clock drift rate drift rate is the degree of deviation between the host clock frequency and the standard time, which is usually expressed in microseconds or milliseconds per second; the smaller the drift rate is, the higher the stability of the host clock is, and the more accurate the consistency with the master clock can be maintained. The jitter value jitter is the range of small fluctuations generated by the candidate PTP node in the time synchronization process, which is used to reflect the stability in the synchronization process; the lower the jitter value is, the higher the accuracy of time synchronization is, and the more reliable the overall time consistency of the system is. The synchronization delay delay is the time interval required for the candidate PTP node to synchronize with the master clock; the size of the synchronization delay directly affects the real-time and accuracy of time synchronization, and the shorter the delay is, the faster the candidate PTP node can complete the time alignment with the master clock.
[0044] S120, when detecting that the task scheduling event is triggered, obtaining real-time state data corresponding to each candidate PTP node through the monitor deployed in each candidate PTP node.
[0045] The offset, the drift rate, the delay, and the jitter data can be obtained through the Node PTP Monitor of each candidate PTP node through the clock_gettime() or pmc interface, and reported to the scheduling center / central scheduling controller, so as to obtain the real-time state data corresponding to each candidate PTP node.
[0046] In some embodiments, the real-time state data corresponding to each candidate PTP node is obtained through the monitor deployed in each candidate PTP node, including: obtaining timestamp information corresponding to the task scheduling event; based on the timestamp information corresponding to the task scheduling event, obtaining, through the monitor deployed in each candidate PTP node, a time deviation of each candidate PTP node relative to the master clock in real time; based on the timestamp information corresponding to the task scheduling event, obtaining, through the monitor deployed in each candidate PTP node, a clock drift rate of each candidate PTP node in real time; based on the timestamp information corresponding to the task scheduling event, obtaining, through the monitor deployed in each candidate PTP node, a jitter value of each candidate PTP node in real time; and based on the timestamp information corresponding to the task scheduling event, obtaining, through the monitor deployed in each candidate PTP node, a synchronization delay of each candidate PTP node in real time.
[0047] The timestamp information corresponding to the task scheduling event can be a trigger time point of the task scheduling event. By obtaining the time deviation, the clock drift rate, the jitter value, and the synchronization delay corresponding to the master clock from the PTP monitor deployed in each candidate PTP node at the time point of triggering the task scheduling event, the real-time performance of the state data acquisition can be ensured.
[0048] S130, determining PTP precision data corresponding to each candidate PTP node according to the real-time state data corresponding to each candidate PTP node; and performing data augmentation on the PTP precision data corresponding to each candidate PTP node to obtain multi-dimensional representation data corresponding to each candidate PTP node.
[0049] The smaller the time deviation relative to the master clock, the lower the clock drift rate, the smaller the jitter value, and the shorter the synchronization delay, the higher the PTP precision data; the larger the time deviation relative to the master clock, the higher the clock drift rate, the larger the jitter value, and the longer the synchronization delay, the lower the PTP precision data. The time deviation relative to the master clock, the clock drift rate, the jitter value, and the synchronization delay can be quantitatively processed respectively, and then the PTP precision data corresponding to each candidate PTP node can be determined.
[0050] In some embodiments, the PTP precision data corresponding to each candidate PTP node is data augmented to obtain multi-dimensional feature data corresponding to each candidate PTP node, including: performing attribute analysis on each user task in the task scheduling event, extracting a time precision related demand label as a time precision demand label corresponding to the user task; and adjusting the time precision demand label corresponding to the user task according to the container association state corresponding to the user task; determining a target task from the plurality of user tasks according to the time precision demand label corresponding to each user task; obtaining device running resources corresponding to each candidate PTP node; and determining multi-dimensional feature data corresponding to each candidate PTP node according to the device running resources corresponding to each candidate PTP node, the time precision demand label corresponding to the target task, and the PTP precision data corresponding to each candidate PTP node.
[0051] The time precision demand label is used to represent the specific requirements of each user task on time synchronization precision. By analyzing the attributes of each user task in the task scheduling event, feature information related to time precision can be identified, such as the execution period of the task, the maximum allowed time deviation, or specific time constraints. Specifically, the user can mark the time precision demand in the Pod Spec to facilitate the extraction of the time precision demand label, such as {time.precision.requirement: "<50ns"}. The device running resources corresponding to the candidate PTP node can be the CPU of the candidate PTP node. The multi-dimensional feature data corresponding to the candidate PTP node can include the device running resources corresponding to the candidate PTP node, the time precision demand label corresponding to the target task, and the PTP precision data corresponding to the candidate PTP node. Thus, the multi-dimensional feature data corresponding to each candidate PTP node is effectively augmented.
[0052] The time precision demand label corresponding to each user task is adjusted according to the container association state corresponding to each user task.
[0053] The container association state corresponding to each user task can be used to describe the job relationship between the user task and the historical execution container. For example, if the number of collaborative jobs between the user task and the historical execution container exceeds a preset threshold, the container association state corresponding to the user task is determined to describe that the user task and the historical execution container have strong correlation; if the number of collaborative jobs between the user task and the historical execution container does not exceed the preset threshold, the container association state corresponding to the user task is determined to describe that the user task and the historical execution container have weak correlation.
[0054] In some embodiments, the time precision of the time precision requirement label corresponding to the user task is adjusted according to the container association state corresponding to the user task, including: if the container association state corresponding to the user task is used to describe that the user task has strong correlation with the historical running container, the time precision of the time precision requirement label corresponding to the user task is optimized to shorten the time length requirement corresponding to the time precision requirement label; if the container association state corresponding to the user task is used to describe that the user task has no strong correlation with the historical running container, the time precision of the time precision requirement label corresponding to the user task is weakened to increase the time length requirement corresponding to the time precision requirement label.
[0055] For example, if the container association state corresponding to the user task is used to describe that the user task has strong correlation with the historical running container, the time precision requirement label corresponding to the user task can be optimized from "<50ns" to "<40ns"; if the container association state corresponding to the user task is used to describe that the user task has weak correlation with the historical running container, the time precision requirement label corresponding to the user task can be weakened from "<50ns" to "<60ns". Thus, by adjusting the time precision requirement label corresponding to the user task according to the correlation between the user task and the historical running container, the time precision can be dynamically adjusted according to the actual requirement, and resource waste or performance bottleneck can be avoided.
[0056] S140, sorting the plurality of candidate PTP nodes according to the multi-dimensional characterization data corresponding to each candidate PTP node to obtain a node precision list.
[0057] In the method, the plurality of candidate PTP nodes can be sorted according to the device running resources corresponding to each candidate PTP node to obtain a first sorting list; the plurality of candidate PTP nodes can be sorted according to the time precision requirement label corresponding to the target task to obtain a second sorting list; the plurality of candidate PTP nodes can be sorted according to the PTP precision data corresponding to each candidate PTP node to obtain a third sorting list; and the first sorting list, the second sorting list and the third sorting list are weightedly fused to obtain the node precision list.
[0058] S150, matching the target PTP node corresponding to the target task in the task scheduling event from the node precision list; and forwarding the target task to the real-time container and scheduling the real-time container to the target PTP node.
[0059] In the method, the target task is a real-time task with high time precision requirement in the task scheduling event. In the matching of the PTP node, the high-precision node in the node precision list can be matched as the target PTP node corresponding to the target task.
[0060] S160, generating a synchronization service scheduling parameter of the real-time container in the target PTP node according to the task priority corresponding to the real-time container; and controlling the real-time container to run the target task using the PTP resource in the target PTP node according to the synchronization service scheduling parameter.
[0061] The synchronization service scheduling parameter is used to describe a PTP process scheduling policy and a CPU occupation state on which the real-time container runs the target task. That is, the synchronization priority is dynamically adjusted in the node to ensure that the time accuracy of the critical real-time task is prioritized. The PTP process scheduling policy is, for example, SCHED_FIFO, SCHED_OTHER, or low-priority FIFO. SCHED_FIFO is a real-time scheduling policy, that is, a “first-in, first-out” scheduling policy. Under this policy, once a process obtains CPU resources, it will run until it voluntarily gives up the CPU (for example, the process ends or is blocked), or is preempted by a higher-priority process. SCHED_OTHER is a priority round-robin scheduling policy, which is used to balance the execution time between different threads to ensure fair allocation of system resources. The CPU occupation state includes exclusive state and shared state.
[0062] By dynamically adjusting the synchronization service scheduling parameter, accurate control of the real-time container executing tasks can be achieved. For example, in a high-load situation, the scheduling policy can be automatically switched according to the task priority to ensure that critical tasks always have sufficient resource support. At the same time, by optimizing the task allocation of the real-time container, resource competition between tasks can be effectively reduced, further improving the overall running efficiency of the system.
[0063] In some embodiments, generating a synchronization service scheduling parameter of the real-time container in the target PTP node according to the task priority corresponding to the real-time container includes: if the task priority corresponding to the real-time container meets a high-precision requirement, determining a first preset scheduling policy as the PTP process scheduling policy on which the real-time container runs the target task; and determining a first preset occupation state as the CPU occupation state corresponding to the real-time container running the target task; and if the task priority corresponding to the real-time container does not meet the high-precision requirement, determining a second preset scheduling policy as the PTP process scheduling policy on which the real-time container runs the target task; and determining a second preset occupation state as the CPU occupation state corresponding to the real-time container running the target task.
[0064] For high-precision tasks, the corresponding PTP process scheduling policy can be determined as SCHED_FIFO, and the CPU occupation state can be determined as exclusive state. For ordinary tasks, the corresponding PTP process scheduling policy can be determined as SCHED_OTHER or low-priority FIFO, and the CPU occupation state can be determined as shared state.
[0065] Thus, the high-precision task can avoid the interference of other threads when running in the exclusive state, ensure full occupation of CPU resources, and meet strict real-time requirements; and the ordinary task can run in the shared state, work with other tasks to fully utilize system resources, and effectively improve the processing efficiency of the system for different types of tasks.
[0066] In this embodiment, a plurality of candidate PTP nodes are located from the node cluster according to the node access state of the PTP device; a monitor is deployed in the candidate PTP nodes, and the synchronization state data corresponding to the candidate PTP nodes is monitored in real time through the monitor, the synchronization state data including: time deviation from the master clock, clock drift rate, jitter value and synchronization delay; when a task scheduling event is detected to be triggered, real-time state data corresponding to each candidate PTP node is obtained through the monitor deployed in each candidate PTP node; PTP precision data corresponding to each candidate PTP node is determined according to the real-time state data corresponding to each candidate PTP node; the PTP precision data corresponding to each candidate PTP node is data augmented to obtain multi-dimensional representation data corresponding to each candidate PTP node; the plurality of candidate PTP nodes are sorted according to the multi-dimensional representation data corresponding to each candidate PTP node to obtain a node precision list; a target PTP node corresponding to a target task in the task scheduling event is matched from the node precision list; and the target task is forwarded to a real-time container, and the real-time container is scheduled to the target PTP node; the target task is a real-time task with high time precision requirement in the task scheduling event; a synchronization service scheduling parameter of the real-time container in the target PTP node is generated according to the task priority corresponding to the real-time container, the synchronization service scheduling parameter being used to describe a PTP process scheduling strategy and a CPU occupation state according to which the real-time container runs the target task; the real-time container is controlled to run the target task using the PTP resources in the target PTP node according to the synchronization service scheduling parameter. In this way, the PTP time synchronization precision of each PTP node is perceived by monitoring the PTP precision data in real time, which facilitates the allocation of high-precision PTP nodes to real-time tasks with high time precision requirement, so as to accurately schedule the real-time tasks sensitive to time to PTP nodes with high synchronization precision, and effectively improve the running efficiency of the real-time tasks.
[0067] In some embodiments, the method further includes: in the process of controlling the real-time container to run the target task using the PTP resources in the target PTP node according to the synchronization service scheduling parameter, monitoring time precision information corresponding to the real-time container in real time; adjusting the synchronization service scheduling parameter of the real-time container in the target PTP node according to the time precision information corresponding to the real-time container; or, performing node migration on the target task according to the time precision information corresponding to the real-time container.
[0068] The time accuracy information can be determined according to the time deviation from the master clock, the clock drift rate, the jitter value and the synchronization time delay. By monitoring the time accuracy in real time during the task running, the scheduling optimization is triggered when the deviation of the time accuracy information is detected to exceed the threshold, and the task migration or the synchronization service scheduling parameter adjustment is performed. Therefore, by means of the flexible task migration strategy and the scheduling parameter adjustment mechanism, high stability and reliability can be maintained in a complex scene, thereby meeting the strict requirements of the time-sensitive task.
[0069] In some embodiments, the method further includes: if the task priority corresponding to the real-time container belongs to a high-priority task, and an interrupt instruction is received during the task running, identifying whether the interrupt source belongs to a storage resource area in the target PTP node; if the interrupt source belongs to the storage resource area in the target PTP node, controlling the real-time container to respond to the interrupt instruction; and if the interrupt source does not belong to the storage resource area in the target PTP node, shielding the interrupt instruction.
[0070] In some embodiments, the method further includes: if the task priority corresponding to the real-time container belongs to a high-priority task, and an interrupt instruction is received during the task running, identifying whether the interrupt source belongs to a storage resource area in the target PTP node; if the interrupt source belongs to the storage resource area in the target PTP node, controlling the real-time container to respond to the interrupt instruction; and if the interrupt source does not belong to the storage resource area in the target PTP node, shielding the interrupt instruction.
[0071] In summary, the embodiment can dynamically perceive the PTP time synchronization accuracy of each node, preferentially allocate the nodes with higher accuracy to the containers with strict time requirements during task scheduling, dynamically adjust the synchronization priority in the node, ensure the time accuracy of the key real-time task, and significantly reduce the scheduling delay, task timeout and control error caused by insufficient time synchronization accuracy. The real-time task sensitive to time can be run on the node with the optimal PTP accuracy; the jitter caused by the scheduling delay of the synchronization process can be reduced by dynamically adjusting the priority; the synchronization strategy can be dynamically adjusted according to the actual running condition of the task, so that better time stability is achieved; the scheduling system such as Kubernetes can be seamlessly combined, and can be used in multi-tenant and multi-cluster. In addition, the PTP accuracy perception and the node scheduling coupling are supported: the scheduler can directly sort based on the nanosecond-level accuracy data; the time deviation during the task running is adaptively optimized, such as deviation exceeding the threshold → dynamic priority / migration; the multi-level synchronization QoS strategy: different synchronization service scheduling parameters are allocated to different priority tasks; and the real-time container runtime (such as Kata+Xenomai) is deeply combined to ensure the end-to-end real-time performance.
[0072] Figure 2A structural schematic diagram of a priority control device for real-time container time synchronization is provided in the embodiment, and the priority control device for real-time container time synchronization can include:
[0073] The positioning module 210 is configured to locate a plurality of candidate PTP nodes from the node cluster according to a node access state of the PTP device.
[0074] The monitoring module 220 is configured to deploy a monitor in the candidate PTP node, and monitor the synchronization state data corresponding to the candidate PTP node in real time through the monitor, the synchronization state data including a time deviation from a master clock, a clock drift rate, a jitter value, and a synchronization delay.
[0075] The acquisition module 230 is configured to acquire the real-time state data corresponding to each candidate PTP node through the monitor deployed in each candidate PTP node when detecting that the task scheduling event is triggered.
[0076] The determination module 240 is configured to determine PTP precision data corresponding to each candidate PTP node according to the real-time state data corresponding to each candidate PTP node.
[0077] The expansion module 250 is configured to perform data expansion on the PTP precision data corresponding to each candidate PTP node to obtain multi-dimensional representation data corresponding to each candidate PTP node.
[0078] The sorting module 260 is configured to sort the plurality of candidate PTP nodes according to the multi-dimensional representation data corresponding to each candidate PTP node to obtain a node precision list.
[0079] The scheduling module 270 is configured to match a target PTP node corresponding to a target task in the task scheduling event from the node precision list, and forward the target task to a real-time container and schedule the real-time container to the target PTP node, the target task being a real-time task with a high time precision requirement in the task scheduling event.
[0080] The generation module 280 is configured to generate a synchronization service scheduling parameter of the real-time container in the target PTP node according to a task priority corresponding to the real-time container, the synchronization service scheduling parameter being used to describe a PTP process scheduling strategy and a CPU occupation state according to which the real-time container runs the target task.
[0081] The control module 290 is configured to control the real-time container to run the target task using PTP resources in the target PTP node according to the synchronization service scheduling parameter.
[0082] In the embodiment, the expansion module 250 is configured to:
[0083] The attribute analysis is performed on each user task in the task scheduling event, and a demand label related to time precision is extracted as a time precision demand label corresponding to the user task; and the time precision demand label corresponding to the user task is adjusted according to a container association state corresponding to the user task; the target task is determined from the plurality of user tasks according to the time precision demand label corresponding to each user task; the device running resource corresponding to each candidate PTP node is acquired; and the multi-dimensional representation data corresponding to each candidate PTP node is determined according to the device running resource corresponding to each candidate PTP node, the time precision demand label corresponding to the target task, and PTP precision data corresponding to each candidate PTP node.
[0084] In the embodiment, the generation module 280 is specifically configured to:
[0085] If the task priority corresponding to the real-time container meets the high-precision demand, the first preset scheduling strategy is determined as a PTP process scheduling strategy on which the real-time container runs the target task, and the first preset occupation state is determined as a CPU occupation state corresponding to the real-time container running the target task; if the task priority corresponding to the real-time container does not meet the high-precision demand, the second preset scheduling strategy is determined as a PTP process scheduling strategy on which the real-time container runs the target task, and the second preset occupation state is determined as a CPU occupation state corresponding to the real-time container running the target task.
[0086] In the embodiment, the acquisition module 230 is specifically configured to:
[0087] The timestamp information corresponding to the task scheduling event is acquired; the time deviation of each candidate PTP node relative to the master clock is acquired in real time by the monitor deployed in each candidate PTP node based on the timestamp information corresponding to the task scheduling event; the clock drift rate of each candidate PTP node is acquired in real time by the monitor deployed in each candidate PTP node based on the timestamp information corresponding to the task scheduling event; the jitter value of each candidate PTP node is acquired in real time by the monitor deployed in each candidate PTP node based on the timestamp information corresponding to the task scheduling event; and the synchronization delay of each candidate PTP node is acquired in real time by the monitor deployed in each candidate PTP node based on the timestamp information corresponding to the task scheduling event.
[0088] In the embodiment, the expansion module 250 is specifically configured to:
[0089] If the container association state corresponding to the user task is used to describe that the user task has strong correlation with the historical running container, the time precision requirement label corresponding to the user task is optimized in time precision, so as to shorten the time length requirement corresponding to the time precision requirement label; if the container association state corresponding to the user task is used to describe that the user task has no strong correlation with the historical running container, the time precision requirement label corresponding to the user task is weakened in time precision, so as to increase the time length requirement corresponding to the time precision requirement label.
[0090] In the embodiment, the first processing module is further included.
[0091] The first processing module is configured to monitor the time precision information corresponding to the real-time container in the process of controlling the real-time container to run the target task using the PTP resource in the target PTP node according to the synchronization service scheduling parameter; adjust the synchronization service scheduling parameter of the real-time container in the target PTP node according to the time precision information corresponding to the real-time container; or perform node migration on the target task according to the time precision information corresponding to the real-time container.
[0092] In the embodiment, the second processing module is further included.
[0093] The second processing module is configured to, if the task priority corresponding to the real-time container belongs to a high-priority task and an interrupt instruction is received in the process of task running, identify whether the interrupt source belongs to a storage resource area in the target PTP node; if the interrupt source belongs to the storage resource area in the target PTP node, control the real-time container to respond to the interrupt instruction; and if the interrupt source does not belong to the storage resource area in the target PTP node, shield the interrupt instruction.
[0094] The real-time container time synchronization priority control device provided by the present disclosure can execute the method embodiment, and the specific implementation principle and technical effects can be referred to the method embodiment, which will not be described here again.
[0095] The embodiment of the present disclosure further provides a computer device. For details, please refer to Figure 3 , Figure 3 The basic structure block diagram of the computer device of the embodiment is shown in the figure.
[0096] The computer device includes a memory 310 and a processor 320 which are communicatively connected through a system bus. It is noted that only the memory 310 and the processor 320 are shown in the figure, but it is understood that not all the shown components are required to be implemented, and more or less components can be alternatively implemented. Among them, the computer device herein is a device capable of automatically performing numerical calculation and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0097] The computer device can be a desktop computer, a notebook computer, a palm computer, a cloud server, etc. The computer device can interact with the user through a keyboard, a mouse, a remote controller, a touchpad, a voice control device, etc.
[0098] The memory 310 includes at least one type of readable storage medium, including non-volatile memory or volatile memory, for example, flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. The RAM can include static RAM or dynamic RAM. In some embodiments, the memory 310 can be an internal storage unit of the computer device, for example, a hard disk or a memory of the computer device. In other embodiments, the memory 310 can also be an external storage device of the computer device, for example, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, or a flash card, etc. equipped on the computer device. Of course, the memory 310 can include both an internal storage unit and an external storage device of the computer device. In the present embodiment, the memory 310 is generally used to store an operating system and various application software installed on the computer device, for example, program codes of the above-described method, etc. In addition, the memory 310 can also be used to temporarily store various data that has been output or will be output.
[0099] The processor 320 is generally used to perform the overall operation of the computer device. In the present embodiment, the memory 310 is used to store program codes or instructions, including computer operation instructions, and the processor 320 is used to execute the program codes or instructions stored in the memory 310 or process data, for example, run the program codes of the above-described method.
[0100] In this document, the bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, among others. The bus system can be a system of address, data, and control buses, for example. For the sake of presentation, the detailed wiring for bus transactions has been omitted, except for the interconnection of buses themselves. In practice, the number and arrangement of buses can be different from that shown in Figure 1, depending on the overall design constraints designed to meet the needs of the implemented applications.
[0101] Another embodiment of the present application further provides a computer readable medium, which can be a computer readable signal medium or a computer readable storage medium. A processor in a computer reads the computer readable program code stored in the computer readable medium, so that the processor can perform the function actions specified in each step or combination of steps in the above method; and generates a device implementing the function actions specified in each block or combination of blocks in the block diagram.
[0102] The computer readable medium includes, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or apparatus, or any suitable combination of the foregoing, for storing program codes or instructions, and the program codes include computer operation instructions. The processor is used to execute the program codes or instructions of the above method stored in the memory.
[0103] The definition of the memory and the processor can refer to the description of the foregoing computer device embodiment, which will not be repeated here.
[0104] In several embodiments provided in the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the device embodiment described above is only schematic, for example, the division of the module or unit is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed each other can be indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0105] The function units or modules in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of software function unit.
[0106] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0107] In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" as described in this application does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. This application can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims listing several means, several units of these means may be embodied by the same item of hardware. The use of "first," "second," and "third," etc., does not indicate any order and these words should be interpreted as names. Unless otherwise specified, the steps in the above embodiments should not be construed as limiting the order of execution.
[0108] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method of priority control for real-time container time synchronization, characterized by, The method comprises the following steps: locating a plurality of candidate PTP nodes from a node cluster according to a node access state of a PTP device; deploying a monitor in the candidate PTP nodes and monitoring in real time synchronization state data corresponding to the candidate PTP nodes through the monitor, wherein the synchronization state data comprises a time deviation from a master clock, a clock drift rate, a jitter value and a synchronization delay; when a task scheduling event is detected to be triggered, obtaining real-time state data corresponding to each of the candidate PTP nodes through the monitor deployed in each of the candidate PTP nodes; determining PTP precision data corresponding to each of the candidate PTP nodes according to the real-time state data corresponding to each of the candidate PTP nodes; performing data augmentation on the PTP precision data corresponding to each of the candidate PTP nodes to obtain multi-dimensional representation data corresponding to each of the candidate PTP nodes; sorting a plurality of the candidate PTP nodes according to the multi-dimensional representation data corresponding to each of the candidate PTP nodes to obtain a node precision list; matching a target PTP node corresponding to a target task in the task scheduling event from the node precision list, and forwarding the target task to a real-time container and scheduling the real-time container to the target PTP node, wherein the target task is a real-time task with high time precision requirement in the task scheduling event; generating a synchronization service scheduling parameter of the real-time container in the target PTP node according to a task priority corresponding to the real-time container, wherein the synchronization service scheduling parameter is used to describe a PTP process scheduling strategy and a CPU occupation state followed by the real-time container when running the target task; controlling the real-time container to run the target task using PTP resources in the target PTP node according to the synchronization service scheduling parameter.
2. The method of claim 1, wherein, The method further comprises the following steps: performing attribute analysis on each user task in the task scheduling event, extracting a time precision related demand label as a time precision demand label corresponding to the user task, and performing time precision adjustment on the time precision demand label corresponding to the user task according to a container association state corresponding to the user task; determining the target task from a plurality of the user tasks according to the time precision demand label corresponding to each of the user tasks; obtaining device running resources corresponding to each of the candidate PTP nodes; determining multi-dimensional representation data corresponding to each of the candidate PTP nodes according to the device running resources corresponding to each of the candidate PTP nodes, the time precision demand label corresponding to the target task, and the PTP precision data corresponding to each of the candidate PTP nodes.
3. The method of claim 1, wherein, The method further comprises the following steps: If the task priority corresponding to the real-time container meets the high-precision requirement, a first preset scheduling strategy is determined as a PTP process scheduling strategy relied on by the real-time container when running the target task, and a first preset occupation state is determined as a CPU occupation state corresponding to the real-time container when running the target task. If the task priority corresponding to the real-time container does not meet the high-precision requirement, a second preset scheduling strategy is determined as a PTP process scheduling strategy relied on by the real-time container when running the target task, and a second preset occupation state is determined as a CPU occupation state corresponding to the real-time container when running the target task.
4. The method of claim 1, wherein, The real-time state data corresponding to each candidate PTP node is obtained through the monitor deployed in each candidate PTP node, including: obtaining timestamp information corresponding to the task scheduling event; based on the timestamp information corresponding to the task scheduling event, the time deviation of each candidate PTP node relative to the master clock is obtained in real time through the monitor deployed in each candidate PTP node; based on the timestamp information corresponding to the task scheduling event, the clock drift rate of each candidate PTP node is obtained in real time through the monitor deployed in each candidate PTP node; based on the timestamp information corresponding to the task scheduling event, the jitter value of each candidate PTP node is obtained in real time through the monitor deployed in each candidate PTP node; based on the timestamp information corresponding to the task scheduling event, the synchronization delay of each candidate PTP node is obtained in real time through the monitor deployed in each candidate PTP node.
5. The method of claim 2, wherein, The time precision adjustment of the time precision requirement label corresponding to the user task according to the container association state corresponding to the user task, including: if the container association state corresponding to the user task is used to describe that the user task has strong correlation with the historical running container, the time precision requirement label corresponding to the user task is optimized for time precision to shorten the time length requirement corresponding to the time precision requirement label; if the container association state corresponding to the user task is used to describe that the user task has no strong correlation with the historical running container, the time precision requirement label corresponding to the user task is weakened for time precision to increase the time length requirement corresponding to the time precision requirement label.
6. The method of claim 1, wherein, Further comprising: in the process of controlling the real-time container to run the target task using the PTP resource in the target PTP node according to the synchronization service scheduling parameter, the time precision information corresponding to the real-time container is monitored in real time; according to the time precision information corresponding to the real-time container, the synchronization service scheduling parameter of the real-time container in the target PTP node is adjusted; or, according to the time precision information corresponding to the real-time container, the target task is migrated.
7. The method of claim 1, wherein, Further comprising: if the task priority corresponding to the real-time container belongs to a high-priority task, and an interrupt instruction is received during task running, it is identified whether the interrupt source belongs to the storage resource area in the target PTP node; If the interrupt source belongs to a storage resource area within the target PTP node, the real-time container is controlled to respond to the interrupt instruction; If the interrupt source does not belong to a storage resource area within the target PTP node, the interrupt instruction is shielded.
8. A priority control apparatus for real-time container time synchronization, characterized by, The method comprises the following steps: a positioning module is configured to locate a plurality of candidate PTP nodes from a node cluster according to a node access state of a PTP device; a monitoring module is configured to deploy a monitor in the candidate PTP nodes and monitor synchronization state data corresponding to the candidate PTP nodes in real time through the monitor, wherein the synchronization state data comprises a time deviation from a master clock, a clock drift rate, a jitter value and a synchronization delay; an acquisition module is configured to acquire real-time state data corresponding to each of the candidate PTP nodes through the monitor deployed in each of the candidate PTP nodes when a task scheduling event is triggered; a determination module is configured to determine PTP precision data corresponding to each of the candidate PTP nodes according to the real-time state data corresponding to each of the candidate PTP nodes; an expansion module is configured to perform data expansion on the PTP precision data corresponding to each of the candidate PTP nodes to obtain multi-dimensional representation data corresponding to each of the candidate PTP nodes; a sorting module is configured to sort a plurality of the candidate PTP nodes according to the multi-dimensional representation data corresponding to each of the candidate PTP nodes to obtain a node precision list; a scheduling module is configured to match a target PTP node corresponding to a target task in the task scheduling event from the node precision list, and forward the target task to a real-time container and schedule the real-time container to the target PTP node, wherein the target task is a real-time task with high time precision requirement in the task scheduling event; a generation module is configured to generate synchronization service scheduling parameters of the real-time container in the target PTP node according to a task priority corresponding to the real-time container, wherein the synchronization service scheduling parameters are used to describe a PTP process scheduling strategy and a CPU occupation state on which the real-time container runs the target task; a control module is configured to control the real-time container to run the target task using PTP resources in the target PTP node according to the synchronization service scheduling parameters.
9. A computer device, comprising: The computer program is executed by the processor to realize the priority control method for real-time container time synchronization according to any one of claims 1-7.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the priority control method for real-time container time synchronization according to any one of claims 1-7.
Citation Information
Patent Citations
Underlying resource scheduling method and device of real-time data synchronization platform and electronic equipment
CN114968555A
Task scheduling method and device, computer equipment and storage medium
CN118377593A