CN109697117B - Terminal control method, terminal control device and computer-readable storage medium - Google Patents

Terminal control method, terminal control device and computer-readable storage medium Download PDF

Info

Publication number
CN109697117B
CN109697117B CN201710981418.9A CN201710981418A CN109697117B CN 109697117 B CN109697117 B CN 109697117B CN 201710981418 A CN201710981418 A CN 201710981418A CN 109697117 B CN109697117 B CN 109697117B
Authority
CN
China
Prior art keywords
heartbeat
terminal
terminals
threshold value
task
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710981418.9A
Other languages
Chinese (zh)
Other versions
CN109697117A (en
Inventor
王智
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Telecom Corp Ltd
Original Assignee
China Telecom Corp 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 China Telecom Corp Ltd filed Critical China Telecom Corp Ltd
Priority to CN201710981418.9A priority Critical patent/CN109697117B/en
Publication of CN109697117A publication Critical patent/CN109697117A/en
Application granted granted Critical
Publication of CN109697117B publication Critical patent/CN109697117B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system

Abstract

The disclosure discloses a terminal control method, a terminal control device and a computer readable storage medium, and relates to the technical field of computers. The method of the present disclosure comprises: responding to the establishment of batch tasks for the plurality of terminals, and starting a heartbeat counting function for the plurality of terminals; respectively carrying out heartbeat counting on a plurality of terminals according to received heartbeat packets of the plurality of terminals by utilizing a heartbeat counting function; under the condition that the heartbeat count of the terminal reaches the corresponding heartbeat threshold value, a corresponding task is issued to the terminal; wherein the plurality of terminals are divided into at least one heartbeat threshold set, different heartbeat threshold sets corresponding to different heartbeat threshold values. The scheme of the system can realize gray control of a large number of terminals based on a heartbeat mechanism, can greatly reduce the occurrence probability of a tidal surge phenomenon, reduces the load pressure of a server side, and improves the overall management and control efficiency.

Description

Terminal control method, terminal control device and computer-readable storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a terminal control method and apparatus, and a computer-readable storage medium.
Background
With the development of internet and communication technology, intelligent terminals become indispensable tools in people's lives. The intelligent terminal is more and more various, and quantity is bigger and bigger, also is bigger and bigger to a large amount of intelligent terminal's the management and control degree of difficulty.
The management platform has various commands for managing the intelligent terminal, such as restarting the device, upgrading the firmware, upgrading the installation and uninstallation plug-ins, switching the service platform, modifying the parameter configuration, and the like. When a large number of intelligent terminals need to execute tasks, the management platform generally issues commands to the terminals at the same time.
Disclosure of Invention
The inventor finds that: the management platform issues commands to a large number of terminals simultaneously, so that a surge phenomenon is likely to occur, the load of the server is too large, even the server is broken down, and the overall management and control efficiency is reduced.
One technical problem to be solved by the present disclosure is: how to reduce the emergence of tidal surge phenomenon when managing and controlling a large amount of terminals, improve whole management and control efficiency.
According to some embodiments of the present disclosure, there is provided a terminal control method including: responding to the establishment of batch tasks for the plurality of terminals, and starting a heartbeat counting function for the plurality of terminals; respectively carrying out heartbeat counting on a plurality of terminals according to received heartbeat packets of the plurality of terminals by utilizing a heartbeat counting function; under the condition that the heartbeat count of the terminal reaches the corresponding heartbeat threshold value, a corresponding task is issued to the terminal; wherein the plurality of terminals are divided into at least one heartbeat threshold set, different heartbeat threshold sets corresponding to different heartbeat threshold values.
In some embodiments, turning on the heartbeat counting function for a plurality of terminals includes: for a terminal which does not establish the heartbeat counting function, marking as a terminal to start the heartbeat counting function, when receiving a heartbeat packet of the terminal, inquiring the terminal marked as the terminal to start the heartbeat counting function according to the identification of the terminal in the heartbeat packet, and establishing and starting the heartbeat counting function for the terminal, wherein the heartbeat counting function comprises: the identification of the terminal, the heartbeat counting starting zone bit, the heartbeat counter and the heartbeat threshold value.
In some embodiments, the following method is used to partition the terminals into different sets of heartbeat thresholds: determining the number of terminals which can be loaded by the current server according to the load condition of the server when the historical terminals execute tasks, the load condition of the current server and the types of the current batch tasks; and dividing the terminals of the task to be issued corresponding to the server into different heartbeat threshold value groups according to the number of the terminals which can be loaded by the current server and the number of the terminals of the task to be issued corresponding to the server.
In some embodiments, the following method is used to partition the terminals into different sets of heartbeat thresholds: selecting a preset number of terminals as terminals of a heartbeat threshold value group with the lowest heartbeat threshold value; selecting terminals of the next heartbeat threshold value set within a preset heartbeat interval after the terminals of the current heartbeat threshold value set reach a heartbeat threshold value, and setting the heartbeat interval as a difference value of heartbeat threshold values between preset terminals of all heartbeat threshold value sets until the terminals are completely divided; the method comprises the steps that when a terminal of a current heartbeat threshold value set executes a task, corresponding server load does not reach a preset load threshold value, the number of terminals of a next heartbeat threshold value set is equal to the sum of the number of terminals of a previous heartbeat threshold value set and a preset addition value, and when the corresponding server load reaches the preset load threshold value when the terminal of the current heartbeat threshold value set executes the task, the number of terminals of the next heartbeat threshold value set is equal to the number of terminals of the previous heartbeat threshold value set.
In some embodiments, in the case that the terminal is not online, counting the time that the terminal is not online; and when the offline time of the terminal reaches a time threshold, reducing the heartbeat threshold of the terminal according to a preset step length.
In some embodiments, issuing the corresponding task to the terminal includes: sending a task query instruction to a database according to the identifier of the terminal; and receiving a task query result returned by the database, and issuing a corresponding task to the terminal.
In some embodiments, the terminal control method further includes: and under the condition of successful issuing, closing the heartbeat counting function corresponding to the terminal, under the condition of failed issuing, re-issuing the task, under the condition that the number of times of failed issuing reaches a threshold value, judging the reason of failed issuing, and determining to close the heartbeat counting function or reset the heartbeat counting function according to the reason of failure.
According to some embodiments of the present disclosure, there is provided a terminal control apparatus including: the heartbeat counting starting module is used for responding to the establishment of batch tasks for the plurality of terminals and starting a heartbeat counting function for the plurality of terminals; the heartbeat counting module is used for respectively counting the heartbeats of the terminals according to the received heartbeat packets of the terminals by utilizing a heartbeat counting function; the task issuing module is used for issuing a corresponding task to the terminal under the condition that the heartbeat count of the terminal reaches a corresponding heartbeat threshold value; wherein the plurality of terminals are divided into at least one heartbeat threshold set, different heartbeat threshold sets corresponding to different heartbeat threshold values.
In some embodiments, the heartbeat counting start module is configured to mark, as a terminal to be started with the heartbeat counting function, a terminal of the terminal marked as the terminal to be started with the heartbeat counting function, when the heartbeat packet of the terminal is received, query, according to an identifier of the terminal in the heartbeat packet, the terminal of the terminal marked as the terminal to be started with the heartbeat counting function, and set and start the heartbeat counting function for the terminal, where the heartbeat counting function includes: the terminal comprises a terminal identification, a heartbeat counting starting zone bit, a heartbeat counter and a heartbeat threshold value.
In some embodiments, the terminal control apparatus further includes: the first terminal dividing module is used for determining the number of terminals which can be loaded by the current service end according to the load condition of the service end when the historical terminals execute the tasks, the load condition of the current service end and the types of the tasks in batches, and dividing the terminals of the tasks to be issued corresponding to the service end into different heartbeat threshold value groups according to the number of the terminals which can be loaded by the current service end and the number of the terminals of the tasks to be issued corresponding to the service end.
In some embodiments, the terminal control apparatus further includes: the second terminal dividing module is used for selecting a preset number of terminals as the terminals of the heartbeat threshold value group with the lowest heartbeat threshold values, selecting the terminals of the next heartbeat threshold value group within a preset heartbeat interval after the terminals of the current heartbeat threshold value group reach the heartbeat threshold values, and setting the preset heartbeat interval as the difference value of the heartbeat threshold values between the preset heartbeat threshold value group terminals until the terminals are divided; the method comprises the steps that when a terminal of a current heartbeat threshold value set executes a task, corresponding server load does not reach a preset load threshold value, the number of terminals of a next heartbeat threshold value set is equal to the sum of the number of terminals of a previous heartbeat threshold value set and a preset addition value, and when the corresponding server load reaches the preset load threshold value when the terminal of the current heartbeat threshold value set executes the task, the number of terminals of the next heartbeat threshold value set is equal to the number of terminals of the previous heartbeat threshold value set.
In some embodiments, the terminal control apparatus further includes: and the heartbeat adjusting module is used for counting the offline time of the terminal under the condition that the terminal is offline, and reducing the heartbeat threshold of the terminal according to the preset step length when the offline time of the terminal reaches the time threshold.
In some embodiments, the task issuing module is configured to send a task query instruction to the database according to the identifier of the terminal, receive a task query result returned by the database, and issue the corresponding task to the terminal.
In some embodiments, the terminal control apparatus further comprises: and the heartbeat counting function adjusting module is used for judging whether the task is successfully issued to the terminal, closing the heartbeat counting function corresponding to the terminal under the condition that the issuing is successful, re-issuing the task under the condition that the issuing is failed, judging the reason of the issuing failure under the condition that the issuing failure frequency reaches a threshold value, and determining to close the heartbeat counting function or reset the heartbeat counting function according to the failure reason.
According to some embodiments of the present disclosure, there is provided a terminal control apparatus including: a memory; and a processor coupled to the memory, the processor configured to execute the terminal control method as in any of the preceding embodiments based on instructions stored in the memory device.
According to some embodiments of the present disclosure, there is provided a computer-readable storage medium having a computer program stored thereon, wherein the program, when executed by a processor, implements the terminal control method in any of the foregoing embodiments.
According to the method and the device, the terminals needing to execute the task are divided into at least one heartbeat threshold value set, different heartbeat threshold value sets correspond to different heartbeat threshold values, each terminal is subjected to heartbeat counting according to the heartbeat packet of each terminal, and the corresponding task is issued to the terminal when the counting reaches the heartbeat threshold value. The scheme of the system can realize gray control of a large number of terminals based on a heartbeat mechanism, can greatly reduce the occurrence probability of a tidal surge phenomenon, reduces the load pressure of a server side, and improves the overall management and control efficiency.
Other features of the present disclosure and advantages thereof will become apparent from the following detailed description of exemplary embodiments thereof, which proceeds with reference to the accompanying drawings.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 shows a flow diagram of a terminal control method of some embodiments of the present disclosure.
Fig. 2 shows a flow diagram of a terminal control method of further embodiments of the present disclosure.
Fig. 3 shows a schematic structural diagram of a terminal control device of some embodiments of the present disclosure.
Fig. 4 shows a schematic structural diagram of a terminal control device according to another embodiment of the present disclosure.
Fig. 5 shows a schematic structural diagram of a terminal control device according to further embodiments of the present disclosure.
Fig. 6 shows a schematic structural diagram of a terminal control device according to still further embodiments of the present disclosure.
Detailed Description
The technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, and not all of the embodiments. The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the disclosure, its application, or uses. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
Aiming at the problem that the management platform issues commands to a large number of terminals at the same time, the problem that the surge phenomenon is likely to occur, the load of the server is too large, the server is even collapsed, and the overall management and control efficiency is reduced is solved.
The terminal control method of the present disclosure is described below in conjunction with some embodiments of the present disclosure.
Fig. 1 is a flow chart of some embodiments of a terminal control method of the present disclosure. As shown in fig. 1, the method of this embodiment includes: steps S102 to S106.
And step S102, responding to the establishment of batch tasks for the plurality of terminals, and starting a heartbeat counting function for the plurality of terminals.
An administrator or a management system can establish batch tasks for a plurality of terminals according to actual requirements, and the tasks corresponding to the terminals can be stored in a database. The method can firstly judge whether the number of the terminals needing to execute the task reaches the threshold value of the gray control, and if the number of the terminals reaches the threshold value of the gray control, the heartbeat counting function is started for each terminal.
A heartbeat counting module may be provided in the terminal control device (management platform) for performing heartbeat counting for each terminal. Can set up heartbeat counting function respectively to each terminal in the heartbeat counting module, heartbeat counting function includes: the terminal comprises a terminal identification, a heartbeat counting starting zone bit, a heartbeat counter and a heartbeat threshold value. The identifier of the terminal is, for example, a Media Access Control (MAC) address of the terminal. Since each terminal is not necessarily capable of sending heartbeat packets on time (e.g., a terminal failure), it is more accurate to set a heartbeat counter for each terminal separately.
For a terminal with a heartbeat counting function established, the heartbeat counting function is directly started, for example, the position of the heartbeat counting start flag is set to 1. For the terminal without the heartbeat counting function, marking as the terminal to be started, when receiving the heartbeat packet of the terminal, inquiring the terminal marked as the terminal to be started according to the identification of the terminal in the heartbeat packet, establishing and starting the heartbeat counting function for the terminal,
and step S104, respectively carrying out heartbeat counting on the plurality of terminals according to the received heartbeat packets of the plurality of terminals by using a heartbeat counting function.
In some embodiments, a corresponding heartbeat counting function is searched according to a terminal identifier carried in a received heartbeat packet, and under the condition that the heartbeat counting function is established for the terminal and started, a heartbeat counter corresponding to the terminal is incremented by one according to the terminal identifier; and under the condition that the heartbeat counting function is not established for the terminal, establishing the heartbeat counting function for the terminal, starting the heartbeat counting function, and adding one to a heartbeat counter corresponding to the terminal.
And step S106, under the condition that the heartbeat count of the terminal reaches the corresponding heartbeat threshold value, issuing a corresponding task to the terminal.
In some embodiments, a task query instruction is sent to the database according to the identifier of the terminal, a task of the terminal returned by the database is received, and the task is issued to the terminal. The database stores tasks to be issued corresponding to the terminals, one terminal may correspond to a plurality of tasks, and the plurality of tasks correspond to different execution sequences. The condition that the heartbeat count reaches the heartbeat threshold value triggers a terminal control device (a management platform) to inquire the behavior of the terminal task to the database, and further the task can be issued to the terminal according to the sequence of the terminal task in the database.
The plurality of terminals may be partitioned into at least one set of heartbeat thresholds, with different sets of heartbeat thresholds corresponding to different heartbeat thresholds. The terminal control device (management platform) can display a management and control interface to an administrator, information of each terminal, such as task content, terminal model, geographic position and the like, is displayed in the management and control interface, the administrator divides the terminals according to actual requirements, and different heartbeat threshold values are set for each heartbeat threshold value set. For example, the administrator may divide the terminals into different heartbeat threshold value sets according to the geographical locations, set a lower heartbeat threshold value for the terminals in the beijing area, and preferentially trigger the task issuing.
The terminal control device (management platform) can also be internally provided with a division rule of the terminal in advance, automatically divide different heartbeat threshold value groups for the terminal according to the information of each terminal according to the division rule, and set different heartbeat threshold values. Some embodiments are described below.
In some embodiments, the number of terminals which can be loaded by the current service end is determined according to the load condition of the service end when the historical terminals execute the tasks, the load condition of the current service end and the type of the current batch tasks; and dividing the terminals of the task to be issued corresponding to the server into different heartbeat threshold value groups according to the number of the terminals which can be loaded by the current server and the number of the terminals of the task to be issued corresponding to the server.
Different terminals may correspond to different tasks to be executed, and different tasks may correspond to different servers. For example, some terminals need to upgrade firmware, and some terminals need to modify configuration parameters, which correspond to different servers respectively.
The terminal control device (management platform) can acquire historical load conditions of each server when the terminal executes tasks. The terminal control device (management platform) can determine the corresponding service end according to the type of the current batch task, and determine the number of terminals which can be loaded by the current corresponding service end according to the resource amount occupied by the historical terminals when the tasks of the type are executed, and the residual resource amount of the current corresponding service end. Further, the number of the terminal to which the task is to be issued is divided by the number of the terminal which can be loaded at the corresponding server to obtain the number of the heartbeat threshold value groups divided by the terminal, and the number of the terminals in each heartbeat threshold value group is obtained. And if the quotient is a non-integer, rounding up.
If the terminals to be executed correspond to a plurality of different service terminals respectively, after the terminals are divided into different heartbeat threshold value sets for each service terminal, the number of the terminals in the same heartbeat threshold value set of each service terminal can be combined, and the number of the terminals in each heartbeat threshold value set is determined.
When the number of terminals that can be loaded by the server is determined, if the server corresponds to multiple tasks of the terminal, the load condition when multiple terminals simultaneously and respectively execute multiple tasks needs to be considered when the load of the server is considered. For example, a terminal needs to occupy resources of a certain service end for upgrading firmware and modifying configuration parameters, and a task to be issued currently includes upgrading firmware and modifying configuration parameters, so that when the historical load condition of the service end is referred, the resource amount occupied by multiple terminals when executing two tasks of upgrading firmware and modifying configuration parameters respectively at the same time needs to be referred, and the number of terminals which can be loaded by the service end is further determined.
In some embodiments, different servers arranged in the terminal control device (management platform) may correspond to different tasks. According to the method, different heartbeat threshold value groups are divided for the terminals according to the whole resource occupation condition of the terminal control device (management platform) when the historical terminals execute the same task and the historical whole resource occupation condition, the resource use condition of the current terminal control device (management platform) and the number of the terminals of the task to be issued.
The foregoing embodiments may be used in combination with each other, that is, the heartbeat threshold value set of the terminal is determined by referring to the load condition of each server and also referring to the overall load condition of the terminal control device (management platform).
Under the condition that the historical load condition or the current load condition is inconvenient to estimate, the balance between the load of the server and the task issuing rate of the terminal can be gradually achieved by adopting a mode of gradually increasing the number of the terminals of each heartbeat threshold value set. Specific implementations can be found in the following examples.
In some embodiments, a preset number of terminals are selected as the terminals of the heartbeat threshold value set with the lowest heartbeat threshold value; selecting terminals of the next heartbeat threshold value set within a preset heartbeat interval after the terminals of the current heartbeat threshold value set reach a heartbeat threshold value, and setting the heartbeat interval as a difference value of heartbeat threshold values between preset terminals of all heartbeat threshold value sets until the terminals are completely divided; the method comprises the steps that when a terminal of a current heartbeat threshold value set executes a task, corresponding server load does not reach a preset load threshold value, the number of terminals of a next heartbeat threshold value set is equal to the sum of the number of terminals of a previous heartbeat threshold value set and a preset addition value, and when the corresponding server load reaches the preset load threshold value when the terminal of the current heartbeat threshold value set executes the task, the number of terminals of the next heartbeat threshold value set is equal to the number of terminals of the previous heartbeat threshold value set.
For example, the terminal of the heartbeat threshold value group with the lowest heartbeat threshold value is set to be 1000 first, the preset heartbeat interval is 5 heartbeats, and the preset increment value is 500. And when 5 heartbeats of the heartbeat threshold values of the first heartbeat threshold value set with the lowest heartbeat threshold value are reached, issuing a task to the terminal of the first heartbeat threshold value set, and monitoring the load of the server corresponding to the terminal of the first heartbeat threshold value set in the following 5 heartbeats. And if the preset load threshold value is not reached, setting the number of the terminals in the second heartbeat threshold value group to be 1500, correspondingly setting the heartbeat threshold value corresponding to the terminals in the second heartbeat threshold value group to be 10 heartbeats, and repeating the steps to monitor the load of the service end when the terminals in each heartbeat threshold value group execute the task, and if the preset load threshold value is reached, not increasing the number of the terminals in the subsequent heartbeat threshold value groups.
The method of the embodiment can also be used as an evaluation of the load capacity of the server in the test stage, and when the method is actually used, the number of terminals when the server reaches the preset load threshold value, the load condition of the current server and the number of terminals of the task to be issued are divided into different heartbeat threshold value groups.
The method of each embodiment is mainly used for determining the number of the terminals in each heartbeat threshold value group, the terminals in each heartbeat threshold value group can be randomly selected, or the terminals in each heartbeat threshold value group can be determined by referring to various information (such as regions, manufacturers, equipment models and user information) of the terminals, and the heartbeat threshold value group of the terminals is determined, that is, the sequence of tasks issued to the terminals is determined, that is, the height of the heartbeat threshold value of the terminals is determined. Some embodiments are described below.
In some embodiments, the heartbeat threshold of each terminal is determined according to the priority of the task corresponding to each terminal, and the higher the priority of the corresponding task is, the lower the heartbeat threshold of the terminal is. The priority of the task can be set according to actual requirements, such as the emergency degree of the task, the priority of a user corresponding to the task, and the like.
Optionally, the terminal is first divided into different task groups, and each task group is sorted according to the priority of the tasks. Starting from the task group with the highest priority, the terminals in the task group can be divided into different heartbeat threshold value groups by using the method in the foregoing embodiment, and the tasks issued to the terminals in the task group are completed according to the heartbeat threshold value of each heartbeat threshold value group (i.e., steps S102 to S104). After the terminal tasks in one task group are completely issued, the working process of the next task group is entered, and the task issuing process is executed for the terminals in each task group in sequence. The heartbeat threshold of the terminal in the task group in the front is lower than that of the terminal in the task group in the back, that is, the heartbeat threshold of the terminal with the higher task priority is lower.
The task group division can be performed according to the actual requirements according to the information of various terminals such as regions, manufacturers, equipment models, user information and the like besides the priority of the tasks, and the sequence of each task group can also be determined according to the actual requirements by referring to the information of various terminals.
Optionally, when multiple tasks to be issued can be processed simultaneously, a terminal with a high task priority is preferably selected as much as possible in the heartbeat threshold value set with a low heartbeat threshold value according to the load capacity of the server corresponding to the tasks. For example, the first heartbeat threshold value group is the heartbeat threshold value group with the lowest heartbeat threshold value, the number of terminals in each heartbeat threshold value group is 1000, and assuming that the server can process two tasks with different priorities, under the condition that the load of the server allows, terminals with high priorities of corresponding tasks are preferentially selected from the first heartbeat threshold value group and the previous heartbeat threshold value groups.
Optionally, the intervals of the heartbeat threshold values of different heartbeat threshold value sets are adjusted according to the priority of the task. For example, task priority is high and the interval of heartbeat thresholds from different sets of heartbeat thresholds is short.
In the method of the embodiment, the terminals of the task to be issued are divided into at least one heartbeat threshold value group, different heartbeat threshold value groups correspond to different heartbeat threshold values, each terminal is subjected to heartbeat counting according to the heartbeat packet of each terminal, and the corresponding task is issued to the terminal when the counting reaches the heartbeat threshold value. The method of the embodiment can realize gray control of a large number of terminals based on a heartbeat mechanism, greatly reduce the occurrence probability of a tidal surge phenomenon, reduce the load pressure of a server side, and improve the overall management and control efficiency. In addition, the method of the embodiment does not affect the running of the historical batch tasks when the batch tasks are issued to the terminal, and further improves the overall management and control effect compared with a scheme of continuously closing the historical batch tasks to avoid overlarge load of the server.
According to the condition of the heartbeat packet of the receiving terminal, whether the terminal is on line or not can be judged, and the heartbeat threshold value of the terminal which is not on line for a long time can be adjusted. In some embodiments, in the case that the terminal is not online, counting the time that the terminal is not online; and when the offline time of the terminal reaches a time threshold, reducing the heartbeat threshold of the terminal according to a preset step length.
For example, if the original heartbeat threshold of a terminal is 10 heartbeats, but the terminal is not online for three consecutive days, the heartbeat threshold is reset to 3. Because the device is not on-line again for a long time, the on-line behavior is usually random and no surge generally occurs.
According to the method, the heartbeat mechanism is adopted to issue the tasks to the terminal, the offline state of the terminal can be found, the polling process of the terminal is reduced, signaling resources are saved, and the overall management and control efficiency is improved.
Further embodiments of the terminal control method of the present disclosure are described below with reference to fig. 2.
Fig. 2 is a flow chart of some embodiments of a terminal control method of the present disclosure. As shown in fig. 2, the method of this embodiment includes: steps S202 to S220.
Step S202, responding to the establishment of batch tasks for the terminal, and starting a heartbeat counting function for the terminal.
There are a plurality of terminals for establishing the batch tasks, and steps S202 to S220 are steps that need to be executed for each terminal to which a task is to be issued.
And step S204, carrying out heartbeat counting on the terminal according to the received heartbeat packet of the terminal by using the heartbeat counting function.
The plurality of terminals are divided into at least one set of heartbeat thresholds, with different sets of heartbeat thresholds corresponding to different heartbeat thresholds.
And step S206, judging whether the heartbeat count of the terminal reaches a corresponding heartbeat threshold value, if so, executing step S208, otherwise, repeating step S204 and executing repeatedly.
And step S208, sending a task query instruction to the database according to the identifier of the terminal.
And step S210, receiving a task query result returned by the database, and issuing a corresponding task to the terminal.
Step S212, judging whether the task is successfully issued, if so, executing step S214, otherwise, executing step S216.
And step S214, closing the heartbeat counting function of the terminal.
Step S216, determine whether the number of failed delivery times reaches a threshold value. If so, step S218 is performed, otherwise, step S220 is performed.
Step S218, the reason of the delivery failure is judged, and the heartbeat counting function is determined to be closed or reset according to the failure reason.
For example, when the terminal is abnormal (for example, a failure code is returned), the abnormal condition of the terminal is recorded, and the heartbeat counting function is turned off to wait for the subsequent processing. And under the condition that the terminal is not on line (off line in the heartbeat counting process) or has no response, resetting the heartbeat counter of the terminal to be 0, restarting counting, and when waiting for reaching the heartbeat threshold value next time, issuing the task failed to be issued to the terminal again, or modifying the heartbeat threshold value of the terminal which is not on line or has no response according to actual requirements, for example, reducing the heartbeat threshold value.
And step S220, the task is issued again. The process returns to step S212 to resume the execution.
The present disclosure also provides a terminal control apparatus, which is described below with reference to fig. 3.
Fig. 3 is a block diagram of some embodiments of the terminal control device of the present disclosure. As shown in fig. 3, the terminal control device 30 includes: a heartbeat count start module 302, a heartbeat count module 304 and a task issue module 306.
A heartbeat counting starting module 302, configured to start a heartbeat counting function for a plurality of terminals in response to establishing a batch task for the plurality of terminals. The heartbeat count start module 302 may, for example, execute step S102 of the above-described embodiment.
In some embodiments, the heartbeat counting start module 302 is configured to mark, as a terminal that does not establish a heartbeat counting function, a terminal that is marked as a terminal that waits to start the heartbeat counting function, and when receiving a heartbeat packet of the terminal, query, according to an identifier of the terminal in the heartbeat packet, the terminal that is marked as the terminal that waits to start the heartbeat counting function, and establish and start the heartbeat counting function for the terminal, where the heartbeat counting function includes: the terminal comprises a terminal identification, a heartbeat counting starting zone bit, a heartbeat counter and a heartbeat threshold value.
And the heartbeat counting module 304 is configured to perform heartbeat counting on the multiple terminals according to the received heartbeat packets of the multiple terminals by using the heartbeat counting function. The heartbeat counting module 304 may, for example, perform step S104 of the above-described embodiment.
And the task issuing module 306 is configured to issue the corresponding task to the terminal when the heartbeat count of the terminal reaches the corresponding heartbeat threshold value. The task issuing module 306 may execute step S106 of the above embodiment, for example.
The plurality of terminals are divided into at least one set of heartbeat thresholds, with different sets of heartbeat thresholds corresponding to different heartbeat thresholds.
In some embodiments, the task issuing module 306 is configured to send a task query instruction to the database according to the identifier of the terminal, receive a task query result returned by the database, and issue a corresponding task to the terminal.
Further embodiments of the terminal control device of the present disclosure are described below in conjunction with figure 4,
fig. 4 is a block diagram of another embodiment of a terminal control device according to the present disclosure. As shown in fig. 4, the terminal control device 40 includes: a heartbeat counting starting module 402, a heartbeat counting module 404, a task issuing module 406 and a first terminal dividing module 408.
The heartbeat count enable module 402, the heartbeat count module 404, and the task issue module 406 are similar in function to the heartbeat count enable module 302, the heartbeat count module 304, and the task issue module 306, respectively, of fig. 3.
The first terminal dividing module 408 is configured to determine the number of terminals that can be loaded by the current server according to the load condition of the server when the historical terminals execute the tasks, the load condition of the current server, and the type of the current batch tasks, and divide the terminals of the task to be issued corresponding to the server into different heartbeat threshold value sets according to the number of terminals that can be loaded by the current server and the number of terminals of the task to be issued corresponding to the server.
In some embodiments, the first terminal partitioning module 408 may be replaced with a second terminal partitioning module 410.
The second terminal dividing module 410 is configured to select a preset number of terminals as terminals of a heartbeat threshold value set with the lowest heartbeat threshold values, and select terminals of a next heartbeat threshold value set within a preset heartbeat interval after terminals of a current heartbeat threshold value set reach the heartbeat threshold value, until the terminals are divided, where the preset heartbeat interval is a difference value of the heartbeat threshold values between the preset heartbeat threshold value set terminals.
And under the condition that the corresponding server load does not reach the preset load threshold when the terminals of the current heartbeat threshold group execute the tasks, the number of the terminals of the next heartbeat threshold group is equal to the sum of the number of the terminals of the last heartbeat threshold group and the preset incremental value, and under the condition that the corresponding server load reaches the preset load threshold when the terminals of the current heartbeat threshold group execute the tasks, the number of the terminals of the next heartbeat threshold group is equal to the number of the terminals of the last heartbeat threshold group.
In some embodiments, the terminal control device 40 may further include: and the heartbeat adjusting module 412 is configured to count the offline time of the terminal when the terminal is offline, and reduce the heartbeat threshold of the terminal according to a preset step length when the offline time of the terminal reaches the time threshold.
In some embodiments, the terminal control device 40 may further include: and the heartbeat counting function adjusting module 414 is configured to determine whether the task is successfully issued to the terminal, close the heartbeat counting function corresponding to the terminal if the issuing is successful, re-issue the task if the issuing is failed, determine a reason of the issuing failure if the issuing failure frequency reaches a threshold value, and determine to close the heartbeat counting function or reset the heartbeat counting function according to the failure reason.
The terminal control apparatuses in the embodiments of the present disclosure may each be implemented by various computing devices or computer systems, which are described below with reference to fig. 5 and 6.
Fig. 5 is a block diagram of some embodiments of the terminal control device of the present disclosure. As shown in fig. 5, the apparatus 50 of this embodiment includes: a memory 510 and a processor 520 coupled to the memory 510, the processor 520 configured to perform the terminal control apparatus method in any of the embodiments of the present disclosure based on instructions stored in the memory 510.
Memory 510 may include, for example, system memory, fixed non-volatile storage media, and the like. The system memory stores, for example, an operating system, an application program, a Boot Loader (Boot Loader), a database, and other programs.
Fig. 6 is a block diagram of another embodiment of a terminal control device according to the present disclosure. As shown in fig. 6, the apparatus 60 of this embodiment includes: memory 610 and processor 620 are similar to memory 510 and processor 520, respectively. An input output interface 630, a network interface 640, a storage interface 650, and the like may also be included. These interfaces 630, 640, 650 and the connections between the memory 610 and the processor 620 may be, for example, via a bus 660. The input/output interface 630 provides a connection interface for input/output devices such as a display, a mouse, a keyboard, and a touch screen. The network interface 640 provides a connection interface for various networking devices, such as a database server or a cloud storage server. The storage interface 650 provides a connection interface for external storage devices such as an SD card and a usb disk.
The present disclosure also provides a computer-readable storage medium on which a computer program is stored, wherein the program, when executed by a processor, implements the terminal control method in any of the foregoing embodiments.
As will be appreciated by one skilled in the art, embodiments of the present disclosure may be provided as a method, system, or computer program product. Accordingly, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable non-transitory storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present disclosure is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the disclosure. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only exemplary of the present disclosure and is not intended to limit the present disclosure, so that any modification, equivalent replacement, or improvement made within the spirit and principle of the present disclosure should be included in the scope of the present disclosure.

Claims (16)

1. A terminal control method includes:
responding to the establishment of batch tasks for a plurality of terminals, and starting a heartbeat counting function for the plurality of terminals;
respectively carrying out heartbeat counting on the plurality of terminals according to the received heartbeat packets of the plurality of terminals by utilizing the heartbeat counting function;
under the condition that the heartbeat count of the terminal reaches the corresponding heartbeat threshold value, a corresponding task is issued to the terminal;
the plurality of terminals are divided into at least one heartbeat threshold value set, and different heartbeat threshold value sets correspond to different heartbeat threshold values;
wherein, in response to establishing a batch task for a plurality of terminals, starting a heartbeat counting function for the plurality of terminals includes:
judging whether the number of terminals needing to execute the task reaches a threshold value of gray control, and if so, starting a heartbeat counting function for each terminal; when a heartbeat packet of the terminal is received, the terminal marked as the terminal to be started with the heartbeat counting function is inquired according to the identifier of the terminal in the heartbeat packet, and the heartbeat counting function is established and started for the terminal.
2. The terminal control method according to claim 1, wherein the heartbeat counting function includes: the identification of the terminal, the heartbeat counting starting zone bit, the heartbeat counter and the heartbeat threshold value.
3. The terminal control method according to claim 1,
the following method is adopted to divide the terminals into different heartbeat threshold value groups:
determining the number of terminals which can be loaded by the current server according to the load condition of the server when the historical terminals execute tasks, the load condition of the current server and the types of the current batch tasks;
and dividing the terminals of the task to be issued corresponding to the server into different heartbeat threshold value groups according to the number of the terminals which can be loaded by the current server and the number of the terminals of the task to be issued corresponding to the server.
4. The terminal control method according to claim 1,
the following method is adopted to divide the terminals into different heartbeat threshold value groups:
selecting a preset number of terminals as terminals of a heartbeat threshold value group with the lowest heartbeat threshold value;
selecting terminals of a next heartbeat threshold value set within a preset heartbeat interval after the terminals of the current heartbeat threshold value set reach a heartbeat threshold value until the terminals are completely divided, wherein the preset heartbeat interval is the difference value of the heartbeat threshold values between the preset heartbeat threshold value set terminals;
the method comprises the steps that when a server load corresponding to a terminal of a current heartbeat threshold value set does not reach a preset load threshold value when a task is executed, the number of terminals of a next heartbeat threshold value set is equal to the sum of the number of terminals of a previous heartbeat threshold value set and the preset increasing value, and when the server load corresponding to the terminal of the current heartbeat threshold value set reaches the preset load threshold value when the task is executed, the number of terminals of the next heartbeat threshold value set is equal to the number of terminals of the previous heartbeat threshold value set.
5. The terminal control method according to any one of claims 1 to 4,
under the condition that the terminal is not on line, counting the time that the terminal is not on line;
and when the offline time of the terminal reaches a time threshold, reducing the heartbeat threshold of the terminal according to a preset step length.
6. The terminal control method according to any one of claims 1 to 4,
the issuing of the corresponding task to the terminal includes:
sending a task query instruction to a database according to the identifier of the terminal;
and receiving a task query result returned by the database, and issuing a corresponding task to the terminal.
7. The terminal control method according to any one of claims 1 to 4, further comprising:
judging whether the task is successfully issued to the terminal;
under the condition of successful issuing, closing the heartbeat counting function corresponding to the terminal;
and re-issuing the task under the condition of failure in issuing, judging the reason of failure in issuing under the condition that the number of times of failure in issuing reaches a threshold value, and determining to close the heartbeat counting function or reset the heartbeat counting function according to the reason of failure.
8. A terminal control device comprising:
the heartbeat counting starting module is used for responding to the establishment of batch tasks for the plurality of terminals and starting a heartbeat counting function for the plurality of terminals;
the heartbeat counting module is used for respectively counting the heartbeats of the terminals according to the received heartbeat packets of the terminals by utilizing the heartbeat counting function;
the task issuing module is used for issuing a corresponding task to the terminal under the condition that the heartbeat count of the terminal reaches a corresponding heartbeat threshold value;
the plurality of terminals are divided into at least one heartbeat threshold value set, and different heartbeat threshold value sets correspond to different heartbeat threshold values;
the heartbeat counting starting module is used for judging whether the number of terminals needing to execute tasks reaches a threshold value of gray control or not, and if the number of terminals reaches the threshold value of gray control, starting a heartbeat counting function for each terminal; when a heartbeat packet of the terminal is received, the terminal marked as the terminal to be started with the heartbeat counting function is inquired according to the identifier of the terminal in the heartbeat packet, and the heartbeat counting function is established and started for the terminal.
9. The terminal control device according to claim 8,
the heartbeat counting function includes: the identification of the terminal, the heartbeat counting starting zone bit, the heartbeat counter and the heartbeat threshold value.
10. The terminal control device of claim 8, further comprising:
the first terminal dividing module is used for determining the number of terminals which can be loaded by the current service end according to the load condition of the service end when the historical terminals execute the tasks, the load condition of the current service end and the types of the tasks in batches, and dividing the terminals of the tasks to be issued corresponding to the service end into different heartbeat threshold value groups according to the number of the terminals which can be loaded by the current service end and the number of the terminals of the tasks to be issued corresponding to the service end.
11. The terminal control device of claim 8, further comprising:
the second terminal dividing module is used for selecting a preset number of terminals as the terminals of the heartbeat threshold value group with the lowest heartbeat threshold value, selecting the terminals of the next heartbeat threshold value group within a preset heartbeat interval after the terminals of the current heartbeat threshold value group reach the heartbeat threshold value until the terminals are divided, wherein the preset heartbeat interval is the difference value of the heartbeat threshold values between the preset heartbeat threshold value group terminals;
the method comprises the steps that when a terminal of a current heartbeat threshold value set executes a task, corresponding server load does not reach a preset load threshold value, the number of terminals of a next heartbeat threshold value set is equal to the sum of the number of terminals of a previous heartbeat threshold value set and a preset addition value, and when the corresponding server load reaches the preset load threshold value when the terminal of the current heartbeat threshold value set executes the task, the number of terminals of the next heartbeat threshold value set is equal to the number of terminals of the previous heartbeat threshold value set.
12. The terminal control device according to any one of claims 8-11, further comprising:
and the heartbeat adjusting module is used for counting the offline time of the terminal under the condition that the terminal is offline, and reducing the heartbeat threshold of the terminal according to a preset step length when the offline time of the terminal reaches the time threshold.
13. The terminal control device according to any one of claims 8 to 11,
the task issuing module is used for sending a task query instruction to the database according to the identifier of the terminal, receiving a task query result returned by the database and issuing a corresponding task to the terminal.
14. The terminal control device according to any one of claims 8-11, further comprising:
and the heartbeat counting function adjusting module is used for judging whether the task is successfully issued to the terminal, closing the heartbeat counting function corresponding to the terminal under the condition that the issuing is successful, re-issuing the task under the condition that the issuing is failed, judging the reason of the issuing failure under the condition that the issuing failure frequency reaches a threshold value, and determining to close the heartbeat counting function or reset the heartbeat counting function according to the failure reason.
15. A terminal control device comprising:
a memory; and
a processor coupled to the memory, the processor configured to execute the terminal control method of any of claims 1-7 based on instructions stored in the memory device.
16. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN201710981418.9A 2017-10-20 2017-10-20 Terminal control method, terminal control device and computer-readable storage medium Active CN109697117B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710981418.9A CN109697117B (en) 2017-10-20 2017-10-20 Terminal control method, terminal control device and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710981418.9A CN109697117B (en) 2017-10-20 2017-10-20 Terminal control method, terminal control device and computer-readable storage medium

Publications (2)

Publication Number Publication Date
CN109697117A CN109697117A (en) 2019-04-30
CN109697117B true CN109697117B (en) 2021-03-09

Family

ID=66225157

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710981418.9A Active CN109697117B (en) 2017-10-20 2017-10-20 Terminal control method, terminal control device and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN109697117B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110572292B (en) * 2019-10-30 2022-04-15 北京永亚普信科技有限责任公司 High availability system and method based on unidirectional transmission link
CN113612624B (en) * 2021-06-29 2023-01-06 济南浪潮数据技术有限公司 Method and device for processing heartbeat between nodes
CN116800301A (en) * 2022-03-14 2023-09-22 华为技术有限公司 Power line communication system, method and equipment for detecting network state

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105808334A (en) * 2016-03-04 2016-07-27 山东大学 MapReduce short job optimization system and method based on resource reuse
CN106874487A (en) * 2017-02-21 2017-06-20 国信优易数据有限公司 A kind of distributed reptile management system and its method
US9766942B2 (en) * 2013-11-01 2017-09-19 Sony Corporation Control device, processing device, and information processing method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170032300A1 (en) * 2015-07-31 2017-02-02 International Business Machines Corporation Dynamic selection of resources on which an action is performed

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9766942B2 (en) * 2013-11-01 2017-09-19 Sony Corporation Control device, processing device, and information processing method
CN105808334A (en) * 2016-03-04 2016-07-27 山东大学 MapReduce short job optimization system and method based on resource reuse
CN106874487A (en) * 2017-02-21 2017-06-20 国信优易数据有限公司 A kind of distributed reptile management system and its method

Also Published As

Publication number Publication date
CN109697117A (en) 2019-04-30

Similar Documents

Publication Publication Date Title
CN108322345B (en) Method for issuing fault repair data packet and server
CN109144559B (en) Update data packet pushing method and server
CN109697117B (en) Terminal control method, terminal control device and computer-readable storage medium
CN105049268A (en) Distributed computing resource allocation system and task processing method
CN109962856B (en) Resource allocation method, device and computer readable storage medium
CN111008075A (en) Load balancing system, method, device, equipment and medium
CN111262726B (en) Configuration information updating method and device and computer readable storage medium
CN105245567B (en) A kind of processing updates the method and server system of request
CN108306717A (en) Data transmission method, server and storage medium
CN103501391A (en) Method and system for managing updating behavior of user
CN114661462A (en) Resource allocation method, system, computer readable storage medium and electronic device
CN104793982A (en) Method and device for establishing virtual machine
CN112367345A (en) Data processing method, server device and computer readable storage medium
CN110933178B (en) Method for adjusting node configuration in cluster system and server
CN111400039A (en) Control method and device of cloud platform, cloud platform system and electronic equipment
CN113132267B (en) Distributed system, data aggregation method and computer readable storage medium
CN111400041A (en) Server configuration file management method and device and computer readable storage medium
CN109104334B (en) Management method and device for nodes in monitoring system
CN109962941B (en) Communication method, device and server
CN109194703B (en) Processing method of communication load between cloud platform hosts, electronic device and medium
CN107707395B (en) Data transmission method, device and system
CN112130984A (en) Resource processing method, device and computer readable storage medium
CN113242302A (en) Data access request processing method and device, computer equipment and medium
CN113535402A (en) Load balancing processing method and device based on 5G MEC and electronic equipment
CN108021407B (en) Service processing method and device based on network equipment

Legal Events

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