CN117785403A - Heartbeat task execution device for equipment, electronic equipment and storage medium - Google Patents

Heartbeat task execution device for equipment, electronic equipment and storage medium Download PDF

Info

Publication number
CN117785403A
CN117785403A CN202311659960.4A CN202311659960A CN117785403A CN 117785403 A CN117785403 A CN 117785403A CN 202311659960 A CN202311659960 A CN 202311659960A CN 117785403 A CN117785403 A CN 117785403A
Authority
CN
China
Prior art keywords
heartbeat
task
equipment
target
scheduler
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.)
Pending
Application number
CN202311659960.4A
Other languages
Chinese (zh)
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.)
Jiangsu Tc Smart Systems Group Co ltd
Original Assignee
Jiangsu Tc Smart Systems Group 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 Jiangsu Tc Smart Systems Group Co ltd filed Critical Jiangsu Tc Smart Systems Group Co ltd
Priority to CN202311659960.4A priority Critical patent/CN117785403A/en
Publication of CN117785403A publication Critical patent/CN117785403A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a heartbeat task execution method and device of equipment, electronic equipment and a storage medium. The heartbeat task execution method of the equipment comprises the following steps: starting a target scheduler and polling a plurality of time slots in the target scheduler, wherein the target scheduler is a time wheel scheduler determined based on a plurality of equipment heartbeat tasks, each time slot corresponds to a task list, and one task list comprises at least one equipment heartbeat task; and determining target equipment corresponding to the equipment heartbeat task aiming at each equipment heartbeat task in the task list corresponding to the polled time slot, and controlling the target equipment to execute the equipment heartbeat task. According to the technical scheme of the embodiment of the invention, the operation entrance of the heartbeat task execution, namely the target dispatcher, can be unified, the complexity of the heartbeat task execution of multiple devices is simplified, the burden of a server is reduced, and the stability of the task execution is improved.

Description

Heartbeat task execution device for equipment, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer application technologies, and in particular, to a method and apparatus for executing a heartbeat task of a device, an electronic device, and a storage medium.
Background
A heartbeat mechanism is a mechanism in which one party (typically a client or an active party) periodically sends a heartbeat signal or heartbeat packet to another party (typically a server or a passive party). The receiving party periodically checks whether a heartbeat signal is received. If no heartbeat signal is received, this indicates that the connection may be broken or that there is a fault.
In the related art, the heartbeat data is usually sent by timing or delay tasks, but each timing task needs to create a scheduling manager which only belongs to the timing task and is responsible for the life cycle and the periodic task execution. If there are a large number of timing tasks in the service logic, the resources of the cpu are generally consumed excessively, which increases the burden of the server and results in poor stability of task execution.
Disclosure of Invention
The invention provides a heartbeat task execution method and device of equipment, electronic equipment and a storage medium, and aims to solve the technical problems that when a large number of timing tasks exist, a server is heavy in burden and task execution is unstable.
According to an aspect of the present invention, there is provided a heartbeat task execution method of a device, wherein the method includes:
starting a target scheduler and polling a plurality of time slots in the target scheduler, wherein the target scheduler is a time wheel scheduler determined based on a plurality of equipment heartbeat tasks, each time slot corresponds to a task list, and one task list comprises at least one equipment heartbeat task;
and determining target equipment corresponding to the equipment heartbeat task aiming at each equipment heartbeat task in the task list corresponding to the polled time slot, and controlling the target equipment to execute the equipment heartbeat task.
According to another aspect of the present invention, there is provided a heartbeat task performing apparatus of a device, wherein the apparatus includes:
the device comprises a slot polling module, a target scheduler and a processing module, wherein the slot polling module is used for starting the target scheduler and polling a plurality of time slots in the target scheduler, the target scheduler is a time wheel scheduler determined based on a plurality of equipment heartbeat tasks, each time slot corresponds to a task list, and one task list comprises at least one equipment heartbeat task;
the task execution module is used for determining target equipment corresponding to the equipment heartbeat task according to each equipment heartbeat task in the task list corresponding to the polled time slot, and controlling the target equipment to execute the equipment heartbeat task.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the heartbeat task performing method of the apparatus according to any of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to execute a heartbeat task performing method of an apparatus according to any embodiment of the present invention.
According to the technical scheme, a target scheduler is started and polls a plurality of time slots in the target scheduler, wherein the target scheduler is a time wheel scheduler determined based on a plurality of equipment heartbeat tasks, each time slot corresponds to a task list, and one task list comprises at least one equipment heartbeat task; and determining target equipment corresponding to the equipment heartbeat task aiming at each equipment heartbeat task in the task list corresponding to the polled time slot, and controlling the target equipment to execute the equipment heartbeat task. The operation entrance of heartbeat task execution, namely the target dispatcher, is unified, the complexity of heartbeat task execution of multiple devices is simplified, the burden of a server is reduced, and the stability of task execution is improved.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the invention or to delineate the scope of the invention. Other features of the present invention will become apparent from the description that follows.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method for performing a heartbeat task for a device in accordance with a first embodiment of the present invention;
FIG. 2 is a block diagram of a time wheel scheduler provided in accordance with an embodiment of the present invention;
fig. 3 is a flowchart of a heartbeat task execution method of a device according to a second embodiment of the present invention;
FIG. 4 is an overall flowchart of a method for performing a heartbeat task for a device provided in accordance with an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a heartbeat task execution device of an apparatus according to a third embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device implementing a heartbeat task execution method of the device according to an embodiment of the present invention.
Detailed Description
In order that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example 1
Fig. 1 is a flowchart of a heartbeat task execution method of a device according to an embodiment of the present invention, where the method may be executed by a heartbeat task execution apparatus of the device, the heartbeat task execution apparatus of the device may be implemented in hardware and/or software, and the heartbeat task execution apparatus of the device may be configured in a computer. As shown in fig. 1, the method includes:
s110, starting a target scheduler, and polling a plurality of time slots in the target scheduler, wherein the target scheduler is a time wheel scheduler determined based on a plurality of equipment heartbeat tasks, each time slot corresponds to a task list, and one task list comprises at least one equipment heartbeat task.
Wherein the target scheduler may be understood as a time wheel scheduler. The time wheel scheduler can be understood as a scheduler which can bind a huge number of heartbeat tasks of the equipment and perform unified management. The device heartbeat task may be understood as a task that causes the target device to send heartbeat signals at regular intervals.
The target scheduler may comprise a plurality of time slots, which may be understood as slots in the target scheduler that characterize the heartbeat interval of the device heartbeat task. Each time slot may represent a heartbeat interval, and each time slot corresponds to a task list, where the task list may be understood as a list carrying heartbeat tasks of the device. At least one of the device heartbeat tasks may be included in each of the task lists (see fig. 2).
Fig. 2 is a block diagram of a time wheel scheduler according to an embodiment of the present invention. The current time wheel scheduler includes 10 time slots, where 1 may represent a time slot with a heartbeat interval of 1 second, 2 may represent a time slot with a heartbeat interval of 2 seconds, and similarly, the time slots represented by 3-8 are not described herein, and 0 may represent a time slot with a heartbeat interval of 10 seconds. Task_list may be understood as the Task list, and Task1 and Task2 may be understood as the device heartbeat Task.
S120, determining target equipment corresponding to the equipment heartbeat task according to each equipment heartbeat task in the task list corresponding to the time slot position, and controlling the target equipment to execute the equipment heartbeat task.
The target device may be understood as a device that needs to perform the heartbeat task of the device. Alternatively, the target device may be a device that needs to transmit the heartbeat signal at a timing. In an embodiment of the present invention, one of the device heartbeat tasks may correspond to one or more of the target devices.
Optionally, the controlling the target device to perform the device heartbeat task includes:
determining the time slot position of the equipment heartbeat task corresponding to each target equipment according to each target equipment, and determining a target heartbeat interval based on the current time slot position; and controlling the target equipment to send a heartbeat signal based on the target heartbeat interval.
Wherein the target heartbeat interval may be understood as a heartbeat interval of the target device. Alternatively, the target heartbeat interval may be a time interval for controlling the target device to transmit the heartbeat signal.
The heartbeat signal may be understood as a signal that characterizes the normal operation of the target device. In the embodiment of the present invention, the heartbeat signal may be preset according to a scene requirement, which is not specifically limited herein. Alternatively, the heartbeat signal may be a data packet, a probe message, or a specific message.
Optionally, the heartbeat task execution method of the device further includes:
determining a monitoring time threshold of each equipment heartbeat task;
determining the current target equipment corresponding to the equipment heartbeat task as normal operation equipment under the condition that the heartbeat signal is received in the monitoring time threshold value for each target equipment;
otherwise, the current target device is determined to be the abnormal operation device.
The monitoring time threshold may be understood as a threshold for monitoring whether the heartbeat task of the device is normally executed. Alternatively, the monitoring time threshold may be a time period threshold. In the embodiment of the present invention, the monitoring time threshold may be preset according to the scene requirement, which is not specifically limited herein. By way of example, the monitoring time threshold may be 1 second, 5 seconds, 10 seconds, or the like. It is understood that the monitoring time thresholds corresponding to different device heartbeat tasks may be the same or different.
The normal operation device may be understood as the target device that is operating normally. Alternatively, the normal operation device may be understood as the target device that normally transmits the heartbeat signal.
The abnormally operated device may be understood as the target device that is abnormally operated. Alternatively, the normal operation device may be understood as the target device that does not normally transmit the heartbeat signal.
According to the technical scheme, the monitoring time threshold value of each equipment heartbeat task is determined; determining the current target equipment corresponding to the equipment heartbeat task as normal operation equipment under the condition that the heartbeat signal is received in the monitoring time threshold value for each target equipment; otherwise, the current target device is determined to be the abnormal operation device. The method can detect the target equipment efficiently and accurately, and timely detect and determine the target equipment with interrupted connection or faults.
According to the technical scheme, a target scheduler is started and polls a plurality of time slots in the target scheduler, wherein the target scheduler is a time wheel scheduler determined based on a plurality of equipment heartbeat tasks, each time slot corresponds to a task list, and one task list comprises at least one equipment heartbeat task; and determining target equipment corresponding to the equipment heartbeat task aiming at each equipment heartbeat task in the task list corresponding to the polled time slot, and controlling the target equipment to execute the equipment heartbeat task. The operation entrance of heartbeat task execution, namely the target dispatcher, is unified, the complexity of heartbeat task execution of multiple devices is simplified, the burden of a server is reduced, and the stability of task execution is improved.
Example two
Fig. 3 is a flowchart of a heartbeat task execution method of a device according to a second embodiment of the present invention, where the method is performed with respect to the start target scheduler in the foregoing embodiment. As shown in fig. 3, the method includes:
s210, acquiring a plurality of equipment heartbeat tasks, determining equipment heartbeat intervals of each equipment heartbeat task, and determining the largest equipment heartbeat interval in the equipment heartbeat intervals as a first heartbeat interval.
The device heartbeat interval can be understood as an executable heartbeat interval corresponding to each device heartbeat task. In the embodiment of the present invention, the device heartbeat interval corresponding to each device heartbeat task may be one or more. For example, for the current device heartbeat task, the time interval for transmitting the heartbeat signal may be 1 second, 2 seconds, 3 seconds, or the like.
The first heartbeat interval is understood to be the largest heartbeat interval of the plurality of device heartbeat intervals.
S220, determining the number of slots of the target scheduler based on the first heartbeat interval, determining the time interval, and creating a preliminary scheduler based on the number of slots and the time interval.
Wherein the slot number may be understood as the number of time slots of the target scheduler. Specifically, in the case where the first heartbeat interval is 10 seconds, the slot number is determined to be 10.
The time interval may be understood as a time interval between each of the time slots. Optionally, the time interval may characterize a minimum granularity of the target scheduler. In the embodiment of the present invention, the time interval may be preset according to the scene requirement, which is not specifically limited herein. Alternatively, the time interval may be 1 second, 2 seconds, 3 seconds, or the like.
The preliminary scheduler may be understood as a preliminary time wheel scheduler. I.e. the scheduler has already clarified the number of slots and the time interval.
S230, placing the equipment heartbeat task in the preliminary scheduler to obtain the target scheduler.
Optionally, the placing the heartbeat task of the device in the preliminary scheduler, to obtain the target scheduler, includes:
determining a second heartbeat interval and a candidate heartbeat interval of each equipment heartbeat task;
and placing the equipment heartbeat task in the preliminary scheduler based on the second heartbeat interval and the candidate heartbeat interval to obtain the target scheduler.
The second heartbeat interval may be understood as an optimal time interval corresponding to the heartbeat task of the device.
The candidate heartbeat interval may be understood as other device heartbeat intervals than the second heartbeat interval among the device heartbeat intervals. In an embodiment of the present invention, the candidate heartbeat interval may be one or more.
Optionally, the placing the device heartbeat task in the preliminary scheduler based on the second heartbeat interval and the candidate heartbeat interval to obtain the target scheduler includes:
placing each equipment heartbeat task in the time slot position corresponding to the second heartbeat interval to obtain a reference scheduler, wherein each second heartbeat interval corresponds to one time slot position;
and adjusting the reference scheduler based on the candidate heartbeat interval corresponding to each equipment heartbeat task, and determining the adjusted reference scheduler as the target scheduler under the condition that the reference scheduler meets a list condition.
The reference scheduler may be understood as a time scheduler obtained by placing each device heartbeat task in the time slot corresponding to the optimal heartbeat interval.
It can be appreciated that the optimal heartbeat interval corresponding to each device heartbeat task may be the same or different. Therefore, there may be a case where the device heartbeat task placed in a part of the time slots is too many and the device heartbeat task is not placed in a part of the time slots, and thus, the time slots in which the device heartbeat task is placed in a part of the time slots need to be adjusted.
The adjusting the reference scheduler based on the candidate heartbeat interval corresponding to each equipment heartbeat task includes:
determining the task number of the heartbeat tasks of the equipment in each time slot, determining the time slots with the task number exceeding a first number threshold, and determining the current time slot as a slot to be adjusted;
and determining a task to be adjusted in the slot to be adjusted, wherein the task to be adjusted is the equipment heartbeat task which is not placed in the time slot corresponding to the candidate heartbeat interval or is not placed in the time slot and is the equipment heartbeat task which does not exceed a second number threshold.
And adjusting the task to be adjusted to the time slot position corresponding to the candidate heartbeat interval to obtain the adjusted reference scheduler.
The list condition may be understood that the number of the standby heartbeat tasks in the task list corresponding to each time slot exceeds a preset threshold. The preset threshold may be understood as a threshold for verifying whether the adjusted reference scheduler may be the target scheduler. In the embodiment of the present invention, the preset threshold may be preset according to a scene requirement, which is not specifically limited herein.
Alternatively, the preset threshold may be 1, 2, 3, or the like. In the case where the preset threshold may be 1, the currently adjusted reference scheduler may be determined as the target scheduler in the case where the number of tasks of the device heartbeat task in each of the time slots in the adjusted reference scheduler exceeds 1.
According to the technical scheme of the embodiment of the invention, the reference scheduler is obtained by placing each equipment heartbeat task in the time slot corresponding to the second heartbeat interval, wherein each second heartbeat interval corresponds to one time slot; and adjusting the reference scheduler based on the candidate heartbeat interval corresponding to each equipment heartbeat task, and determining the adjusted reference scheduler as the target scheduler under the condition that the reference scheduler meets a list condition. The heartbeat tasks of the equipment can be uniformly placed in the time slots of the target scheduler, the performance of the created target scheduler is improved, and the smoothness and stability of the execution of the heartbeat tasks of the equipment are ensured.
S240, starting a target scheduler, and polling a plurality of time slots in the target scheduler.
S250, determining target equipment corresponding to the equipment heartbeat task according to each equipment heartbeat task in the task list corresponding to the time slot position which is polled, and controlling the target equipment to execute the equipment heartbeat task.
According to the technical scheme, equipment heartbeat intervals of each equipment heartbeat task are determined by acquiring a plurality of equipment heartbeat tasks, and the largest equipment heartbeat interval in the equipment heartbeat intervals is determined to be a first heartbeat interval; determining the number of slots of the target scheduler based on the first heartbeat interval, determining the time interval, and creating a preliminary scheduler based on the number of slots and the time interval; and placing the equipment heartbeat task in the preliminary scheduler to obtain the target scheduler. The task scheduling performance of the determined target scheduler may be improved.
Fig. 4 is an overall flowchart of a heartbeat task execution method of a device according to an embodiment of the present invention. As shown in fig. 4, optionally, the overall flow of the heartbeat task execution method of the device may be:
1. a target scheduler is created.
And allocating the slot number and determining the time interval according to the actual situation. The slot number is used for standardizing the time range, and the time interval confirms the minimum granularity of the time. For example, if the maximum time of all tasks to be performed with heartbeat data transmission is 10 seconds once, ten slot numbers can be created, and the time interval is 1 second.
2. A device heartbeat task is determined.
Corresponding task codes of different device heartbeat mechanisms are written.
3. And adding the heartbeat task of the equipment into the target scheduler.
The equipment heartbeat task is put into a task list of the time wheel scheduler, for example, the optimal heartbeat requirement of the equipment A is 1 second once, and then the task code can be put into a slot number 1 of the time wheel scheduler; the optimal heartbeat requirement of the equipment B is once 5 seconds, and the equipment B can be placed in a slot number 5. In addition, if the number of the heartbeat tasks of the equipment in part of the slots is too large or too small, the slots where the heartbeat tasks of the equipment are located can be adjusted so that the tasks are evenly placed in each slot, and therefore a target scheduler with better performance can be obtained. For example, the number of tasks in slot number 4 is significantly less than the other slots, and the tasks in other slots can be shifted into slot number 4 without affecting the performance of the heartbeat task.
4. And polling the target scheduler to judge whether the target slot has a device heartbeat task.
5. And starting and asynchronously executing the device heartbeat task under the condition that the device heartbeat task exists.
According to the method and the device, the device heartbeat tasks can be conveniently executed, and the plurality of device heartbeat tasks can be managed in a unified mode. One scheduler can manage the heartbeat tasks of a plurality of devices, so that the system is more visual; the heartbeat strategy of each task can be intuitively seen without searching the setting of the task in the code, so that the heartbeat task of each device is convenient to modify; and the task optimization can be more specifically and conveniently performed while the new task is added in the later stage.
Example III
Fig. 5 is a schematic structural diagram of a heartbeat task execution device of a device according to a third embodiment of the present invention. As shown in fig. 5, the apparatus includes: a slot poll module 310 and a task execution module 320.
Wherein,
a slot polling module 310, configured to start a target scheduler and poll a plurality of time slots in the target scheduler, where the target scheduler is a time wheel scheduler determined based on a plurality of device heartbeat tasks, each time slot corresponds to a task list, and one task list includes at least one device heartbeat task; the task execution module 320 is configured to determine, for each device heartbeat task in the task list corresponding to the polled time slot, a target device corresponding to the device heartbeat task, and control the target device to execute the device heartbeat task.
According to the technical scheme, a target scheduler is started and polls a plurality of time slots in the target scheduler, wherein the target scheduler is a time wheel scheduler determined based on a plurality of equipment heartbeat tasks, each time slot corresponds to a task list, and one task list comprises at least one equipment heartbeat task; and determining target equipment corresponding to the equipment heartbeat task aiming at each equipment heartbeat task in the task list corresponding to the polled time slot, and controlling the target equipment to execute the equipment heartbeat task. The operation entrance of heartbeat task execution, namely the target dispatcher, is unified, the complexity of heartbeat task execution of multiple devices is simplified, the burden of a server is reduced, and the stability of task execution is improved.
Optionally, the target scheduler includes a slot number and/or a time interval, and the heartbeat task execution device of the device further includes: the system comprises a task acquisition module, a scheduling data determination module and a task placement module; wherein,
the task acquisition module is used for acquiring a plurality of equipment heartbeat tasks before starting the target scheduler, determining equipment heartbeat intervals of each equipment heartbeat task, and determining the largest equipment heartbeat interval in the equipment heartbeat intervals as a first heartbeat interval;
the scheduling data determining module is used for determining the slot number of the target scheduler based on the first heartbeat interval, determining the time interval and creating a preliminary scheduler based on the slot number and the time interval;
and the task placement module is used for placing the equipment heartbeat task in the preliminary scheduler to obtain the target scheduler.
Optionally, the task placement module includes: a heartbeat interval determining unit and a task placing unit; wherein,
the heartbeat interval determining unit is used for determining a second heartbeat interval and a candidate heartbeat interval of each equipment heartbeat task;
the task placement unit is configured to place the device heartbeat task in the preliminary scheduler based on the second heartbeat interval and the candidate heartbeat interval, and obtain the target scheduler.
Optionally, the task placement unit is configured to:
placing each equipment heartbeat task in the time slot position corresponding to the second heartbeat interval to obtain a reference scheduler, wherein each second heartbeat interval corresponds to one time slot position;
and adjusting the reference scheduler based on the candidate heartbeat interval corresponding to each equipment heartbeat task, and determining the adjusted reference scheduler as the target scheduler under the condition that the reference scheduler meets a list condition.
Optionally, the list condition is that the number of the standby heartbeat tasks in the task list corresponding to each time slot exceeds a preset threshold.
Optionally, the task execution module 320 is configured to:
determining the time slot position of the equipment heartbeat task corresponding to each target equipment according to each target equipment, and determining a target heartbeat interval based on the current time slot position;
and controlling the target equipment to send a heartbeat signal based on the target heartbeat interval.
Optionally, the task execution module 320 is further configured to:
determining a monitoring time threshold of each equipment heartbeat task;
determining the current target equipment corresponding to the equipment heartbeat task as normal operation equipment under the condition that the heartbeat signal is received in the monitoring time threshold value for each target equipment;
otherwise, the current target device is determined to be the abnormal operation device.
The heartbeat task execution device of the equipment provided by the embodiment of the invention can execute the heartbeat task execution method of the equipment provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example IV
Fig. 6 shows a schematic diagram of the structure of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. Electronic equipment may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 6, the electronic device 10 includes at least one processor 11, and a memory, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, etc., communicatively connected to the at least one processor 11, in which the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various appropriate actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 may also be stored. The processor 11, the ROM 12 and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, etc.; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, digital Signal Processors (DSPs), and any suitable processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as the heartbeat task execution method of the device.
In some embodiments, the heartbeat task performing method of the device may be implemented as a computer program, which is tangibly embodied on a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the heartbeat task performing method of the device described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the heartbeat task performing method of the device in any other suitable way (e.g. by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for carrying out methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be implemented. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical hosts and VPS service are overcome.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps described in the present invention may be performed in parallel, sequentially, or in a different order, so long as the desired results of the technical solution of the present invention are achieved, and the present invention is not limited herein.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method for performing a heartbeat task for a device, comprising:
starting a target scheduler and polling a plurality of time slots in the target scheduler, wherein the target scheduler is a time wheel scheduler determined based on a plurality of equipment heartbeat tasks, each time slot corresponds to a task list, and one task list comprises at least one equipment heartbeat task;
and determining target equipment corresponding to the equipment heartbeat task aiming at each equipment heartbeat task in the task list corresponding to the polled time slot, and controlling the target equipment to execute the equipment heartbeat task.
2. The method of claim 1, wherein the target scheduler comprises a slot number and/or a time interval, and wherein prior to starting the target scheduler, further comprising:
acquiring a plurality of equipment heartbeat tasks, determining equipment heartbeat intervals of each equipment heartbeat task, and determining the largest equipment heartbeat interval in the equipment heartbeat intervals as a first heartbeat interval;
determining the number of slots of the target scheduler based on the first heartbeat interval, determining the time interval, and creating a preliminary scheduler based on the number of slots and the time interval;
and placing the equipment heartbeat task in the preliminary scheduler to obtain the target scheduler.
3. The method of claim 2, wherein the placing the device heartbeat task in the preliminary scheduler results in the target scheduler, comprising:
determining a second heartbeat interval and a candidate heartbeat interval of each equipment heartbeat task;
and placing the equipment heartbeat task in the preliminary scheduler based on the second heartbeat interval and the candidate heartbeat interval to obtain the target scheduler.
4. The method of claim 3, wherein the placing the device heartbeat task in the preliminary scheduler based on the second heartbeat interval and the candidate heartbeat interval results in the target scheduler, comprising:
placing each equipment heartbeat task in the time slot position corresponding to the second heartbeat interval to obtain a reference scheduler, wherein each second heartbeat interval corresponds to one time slot position;
and adjusting the reference scheduler based on the candidate heartbeat interval corresponding to each equipment heartbeat task, and determining the adjusted reference scheduler as the target scheduler under the condition that the reference scheduler meets a list condition.
5. The method of claim 4, wherein the list condition is that the number of standby heartbeat tasks in the task list corresponding to each time slot exceeds a preset threshold.
6. The method of claim 1, wherein the controlling the target device to perform the device heartbeat task comprises:
determining the time slot position of the equipment heartbeat task corresponding to each target equipment according to each target equipment, and determining a target heartbeat interval based on the current time slot position;
and controlling the target equipment to send a heartbeat signal based on the target heartbeat interval.
7. The method as recited in claim 6, further comprising:
determining a monitoring time threshold of each equipment heartbeat task;
determining the current target equipment corresponding to the equipment heartbeat task as normal operation equipment under the condition that the heartbeat signal is received in the monitoring time threshold value for each target equipment;
otherwise, the current target device is determined to be the abnormal operation device.
8. A heartbeat task performing device of an apparatus, comprising:
the device comprises a slot polling module, a target scheduler and a processing module, wherein the slot polling module is used for starting the target scheduler and polling a plurality of time slots in the target scheduler, the target scheduler is a time wheel scheduler determined based on a plurality of equipment heartbeat tasks, each time slot corresponds to a task list, and one task list comprises at least one equipment heartbeat task;
the task execution module is used for determining target equipment corresponding to the equipment heartbeat task according to each equipment heartbeat task in the task list corresponding to the polled time slot, and controlling the target equipment to execute the equipment heartbeat task.
9. An electronic device, the electronic device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the heartbeat task performing method of the device of any one of claims 1-7.
10. A computer readable storage medium storing computer instructions for causing a processor to perform the heartbeat task performing method of the device of any one of claims 1-7 when executed.
CN202311659960.4A 2023-12-05 2023-12-05 Heartbeat task execution device for equipment, electronic equipment and storage medium Pending CN117785403A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311659960.4A CN117785403A (en) 2023-12-05 2023-12-05 Heartbeat task execution device for equipment, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311659960.4A CN117785403A (en) 2023-12-05 2023-12-05 Heartbeat task execution device for equipment, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117785403A true CN117785403A (en) 2024-03-29

Family

ID=90385913

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311659960.4A Pending CN117785403A (en) 2023-12-05 2023-12-05 Heartbeat task execution device for equipment, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117785403A (en)

Similar Documents

Publication Publication Date Title
CN116150051A (en) Command processing method, device and system
CN115904656A (en) State control method, device and equipment applied to chip and storage medium
CN116594563A (en) Distributed storage capacity expansion method and device, electronic equipment and storage medium
CN116431313A (en) Scheduling method, device, equipment and medium for polling task
CN115629903A (en) Task delay monitoring method, device, equipment and storage medium
CN115543416A (en) Configuration updating method and device, electronic equipment and storage medium
CN117785403A (en) Heartbeat task execution device for equipment, electronic equipment and storage medium
CN115421859A (en) Dynamic loading method and device of configuration file, computer equipment and storage medium
CN114691781A (en) Data synchronization method, system, device, equipment and medium
CN113656239A (en) Monitoring method and device for middleware and computer program product
CN114003367B (en) Risk monitoring method, device, equipment and storage medium
CN115174447B (en) Network communication method, device, system, equipment and storage medium
CN116661960A (en) Batch task processing method, device, equipment and storage medium
CN116048791B (en) Regulation and control method and device of test node, electronic equipment and storage medium
CN114422638B (en) Cloud mobile phone control method, device, equipment, medium and program product
CN115484668A (en) Node synchronization system, method, device, equipment and storage medium
CN115470476A (en) Authentication renewal method and device, electronic equipment and storage medium
CN116450915A (en) Application degradation method, device, electronic equipment and storage medium
CN117421140A (en) Data processing method, device, equipment and medium
CN116521739A (en) Data processing method and device and electronic equipment
CN115203139A (en) Log query method and device, electronic equipment and storage medium
CN116909204A (en) Equipment operation control method and device, electronic equipment and storage medium
CN117851045A (en) Resource scheduling method, device and medium for message data processing
CN115630253A (en) Page idle detection method and device, electronic equipment and storage medium
CN118018405A (en) Upgrading method and device of Internet of things equipment, server and 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