Disclosure of Invention
The disclosure provides a task scheduling method, a task scheduling device, a task scheduling equipment and a task scheduling storage medium based on edge computing.
According to a first aspect of the present disclosure, there is provided a task scheduling method based on edge computing, including:
acquiring a current task to be calculated and parameter information corresponding to the task to be calculated;
determining a first integer value corresponding to the task to be calculated according to the parameter information;
determining a target virtual node corresponding to the first integer value according to the corresponding relation between each integer value and a virtual node on a preset integer ring;
and sending the task to be calculated to the edge node to which the target virtual node belongs.
According to a second aspect of the present disclosure, there is provided an edge-computation-based task scheduling apparatus, including:
the system comprises an acquisition module, a calculation module and a calculation module, wherein the acquisition module is used for acquiring a current task to be calculated and parameter information corresponding to the task to be calculated;
a first determining module, configured to determine, according to the parameter information, a first integer value corresponding to the task to be calculated;
a second determining module, configured to determine, according to a correspondence between each integer value on a preset integer ring and a virtual node, a target virtual node corresponding to the first integer value;
and the sending module is used for sending the task to be calculated to the edge node to which the target virtual node belongs.
Optionally, the second determining module includes:
a first determining unit, configured to determine each current virtual node according to a current available edge node;
and a second determining unit, configured to map the virtual nodes uniformly into a preset integer ring, so as to determine a corresponding relationship between each integer value and a virtual node.
Optionally, the second determining unit includes:
the first determining subunit is configured to uniformly divide a preset integer ring according to the number of the virtual nodes, so as to determine an integer value corresponding to each division point;
and the second determining subunit is configured to associate the number corresponding to each virtual node with each integer value one by one, so as to determine a corresponding relationship between each integer value and a virtual node.
Optionally, the second determining subunit is further configured to:
and determining the number of each virtual node according to the preset number of the available edge nodes and the number of the virtual nodes corresponding to each available edge node, wherein the numbers of the available edge nodes corresponding to the virtual nodes with adjacent numbers are different.
Optionally, the first determining module is specifically configured to:
and performing hash operation on the corresponding end device address parameter, the port parameter, the request timestamp parameter and the task data parameter to determine the first integer value.
Optionally, the second determining module is specifically configured to:
traversing the integer ring by taking the first integer value as a starting point along a preset sequence to determine a second integer value with the minimum distance from the starting point;
and determining a target virtual node corresponding to the second integer value according to the corresponding relation between each integer value and the virtual node.
An embodiment of a third aspect of the present disclosure provides a computer device, including: the present invention relates to a computer program product, and a computer program stored on a memory and executable on a processor, which when executed by the processor performs a method as set forth in an embodiment of the first aspect of the present disclosure.
A fourth aspect of the present disclosure is directed to a non-transitory computer-readable storage medium storing a computer program, which when executed by a processor implements the method as set forth in the first aspect of the present disclosure.
A fifth aspect of the present disclosure provides a computer program product, which when executed by an instruction processor performs the method provided in the first aspect of the present disclosure.
In the embodiment of the disclosure, a task to be currently calculated and parameter information corresponding to the task to be calculated are first obtained, then a first integer value corresponding to the task to be calculated is determined according to the parameter information, then a target virtual node corresponding to the first integer value is determined according to a corresponding relationship between each integer value and a virtual node on a preset integer ring, and finally the task to be calculated is sent to an edge node to which the target virtual node belongs. Therefore, the virtual nodes are uniformly distributed on the preset integer ring, so that the load of each node is relatively balanced, the corresponding hash value is calculated according to the parameters of the current task, the task can correspond to the integer value in the integer ring, and then the node for processing the task is found out.
The task scheduling method, device and equipment based on edge computing provided by the disclosure have at least the following beneficial effects:
it should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
The method for task scheduling based on edge computing provided by the present disclosure may be executed by the task scheduling apparatus based on edge computing provided by the present disclosure, and may also be executed by an electronic device provided by the present disclosure, where the electronic device may include but is not limited to a desktop computer, a tablet computer, and other terminal devices, and the following is to execute the method for task scheduling based on edge computing provided by the present disclosure with the electronic device provided by the present disclosure, without limiting the present disclosure.
A task scheduling method based on edge computing according to the present disclosure is described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic flowchart of a task scheduling method based on edge computing according to an embodiment of the present disclosure.
As shown in fig. 1, the task scheduling method based on edge calculation may include the following steps:
step 101, acquiring a current task to be calculated and parameter information corresponding to the task to be calculated.
Optionally, the parameter information may include an address parameter, a port parameter, a request timestamp parameter, a task data parameter, and the like of a corresponding end device of the task to be currently calculated, which is not limited herein.
Specifically, the task to be calculated may be an application instance for generating data for the device at the sensing layer side, and is not limited herein.
And step 102, determining a first integer value corresponding to the task to be calculated according to the parameter information.
The first integer value may be a hash value corresponding to the task to be calculated.
Optionally, any hash operation may be performed on the device address parameter, the port parameter, the request timestamp parameter, and the task data parameter corresponding to the task, for example, an SHA256 algorithm is used to perform an encryption operation, so as to determine the first integer value, which is not limited herein.
And 103, determining a target virtual node corresponding to the first integer value according to the corresponding relation between each integer value on the preset integer ring and the virtual node.
The integer ring can be a pre-constructed integer ring, for example, the hash value space is 0-264-1 integer ring. It is understood that an integer ring may be a virtual circular ring organized by hash values, and the integer ring may have an integer value of 0 as the head of the integer ring and 264-1 as the tail of the integer ring.
It should be noted that the virtual node may be a node uniquely associated with a real node, that is, an edge node, and in the present disclosure, the number of edge nodes in a current edge node cluster may be determined first, and then a corresponding virtual node is created through an edge node server corresponding to each edge node. Each edge node may correspond to a plurality of virtual nodes and may be the same in number. Or, a corresponding number of nodes may be generated according to the load condition of the edge node, that is, the edge node with strong computing capability and small load may correspond to a plurality of virtual nodes, so that the load of each edge node is relatively balanced.
For example, if the number of the current edge nodes is m, n virtual nodes may be created for each edge node. Further, the method can be used for 0-2 pre-constructed64The integer ring of-1 is divided, i.e. m × n division points are divided into m × n +1 arc segments as equally as possible, so that each division point corresponds to a unique integer value on the integer ring. Since the number of the current edge nodes is m, the number of the virtual nodes corresponding to all the current edge nodes is m × n, that is, the number is the same as the number of the segmentation points. It should be noted that this example is only a schematic illustration of the present disclosure, and does not limit the present disclosure.
In order to distribute the tasks to be calculated to different virtual nodes of the current integer ring relatively uniformly, namely to make the load of each edge node relatively balanced. In the present disclosure, it is necessary to distribute the tasks to be calculated to all buffers as much as possible, that is, all buffer spaces are utilized. As a possible implementation manner, virtual nodes corresponding to each edge node may be arranged in a cross manner, for example, numbers of each edge node, such as P1, P2, and P3, may be determined first, numbers of virtual nodes corresponding to each edge node, such as virtual nodes P1Q1, P1Q2, and P1Q3 corresponding to the edge node 1, are then determined, and then virtual nodes corresponding to each edge node may be arranged in a cross manner, that is, the virtual nodes corresponding to each edge node may be arranged in the following order, i.e., P1Q1, P2Q1, P3Q1, P1Q2, P2Q2, P3Q2, P3Q1, P3Q2, and P3Q3, so that edge nodes corresponding to adjacent virtual nodes may be different, and thus load balance and overall utilization rate may be improved.
It should be noted that the above example is only an illustrative example, and the disclosure is not limited, that is, the number and the arrangement order of each edge node and each virtual node are not limited.
Thus, after the order of each virtual node is determined, the present disclosure may determine its correspondence to each division point since the integer value corresponding to each division point is from 0 to 264-1, so that each virtual node can be associated with an integer value corresponding to each partitioning point. For example, after the first integer value is determined, the position of the first integer value in the integer ring may be determined, and then the integer ring may be traversed in a clockwise order starting from the first integer value to determine an integer value corresponding to a partition point with a minimum distance between the starting points, so that a node corresponding to the integer value may be determined as the target virtual node.
And 104, sending the task to be calculated to the edge node to which the target virtual node belongs.
It should be noted that a certain mapping relationship exists between the virtual node and the edge node, and therefore after the target edge node is determined, the present disclosure may determine the edge node to which the target virtual node belongs according to the mapping relationship, and further may deliver the task to be calculated to the edge node for processing. In addition, under the condition that any edge node is in fault, the corresponding mapping relation and the virtual node can be deleted from the integer ring in time, so that a new task can find a next adjacent available node for processing, the task accumulation and the response failure caused by the fault node are avoided, the operation of a non-fault node is basically not influenced, certain expandability is realized, smooth horizontal expansion can be supported, and the edge node can be added and deleted.
In the embodiment of the disclosure, a task to be currently calculated and parameter information corresponding to the task to be calculated are first obtained, then a first integer value corresponding to the task to be calculated is determined according to the parameter information, then a target virtual node corresponding to the first integer value is determined according to a corresponding relationship between each integer value and a virtual node on a preset integer ring, and finally the task to be calculated is sent to an edge node to which the target virtual node belongs. Therefore, the virtual nodes are uniformly distributed on the preset integer ring, so that the load of each node is relatively balanced, the corresponding hash value is calculated according to the parameters of the current task, the task can correspond to the integer value in the integer ring, and then the node for processing the task is found out.
Fig. 2 is a flowchart illustrating a task scheduling method based on edge computing according to another embodiment of the present disclosure.
As shown in fig. 2, the task scheduling method based on edge calculation may include the following steps:
step 201, acquiring a current task to be calculated and parameter information corresponding to the task to be calculated.
Step 202, according to the parameter information, determining a first integer value corresponding to the task to be calculated.
It should be noted that, the specific implementation manner of steps 201 and 202 may refer to the above embodiments, and is not described herein again.
Step 203, determining each current virtual node according to the current available edge node.
The edge node can be a service platform constructed near the network edge of the user, can provide resources such as storage, calculation, network and the like, and sinks part of key service application to the edge of the access network so as to reduce the width and delay loss caused by network transmission and multistage forwarding.
It should be noted that, the edge node corresponds to the edge node server, and the number of virtual nodes corresponding to the currently available edge node can be determined according to the computational power and the operating state of the edge node, so that the process is more flexible.
Step 204, mapping each virtual node uniformly into a preset integer ring to determine the corresponding relationship between each integer value and the virtual node.
As a possible implementation manner, a preset integer ring may be uniformly divided according to the number of virtual nodes to determine an integer value corresponding to each division point, and then numbers corresponding to each virtual node are associated with each integer value one by one to determine a corresponding relationship between each integer value and a virtual node.
Optionally, the number of each virtual node may be determined according to a preset number of available edge nodes and the number of virtual nodes corresponding to each available edge node, where the numbers of available edge nodes corresponding to virtual nodes with adjacent numbers are different.
In the present disclosure, the correspondence between each integer value and a virtual node may be determined as needed. In order to map each virtual node to a preset integer ring, the preset integer ring may be first divided uniformly to determine each division point and an integer value corresponding to each division point, and then each integer value may be associated with the preset virtual node in a sequence from small to large one by one, so that one virtual node corresponds to one division point and one integer value.
It should be noted that the preset number of the edge node may be determined according to the number of the edge nodes, such as 1,2, 3. And then, determining the number of virtual nodes according to the number of the edge nodes, and determining the number of each virtual node, where the virtual nodes may be randomly arranged, or alternately and randomly arranged according to the order of the edge nodes, and this is not limited herein. Wherein the numbers of available edge nodes corresponding to adjacent numbered virtual nodes may be different.
Step 205, taking the first integer value as a starting point, traversing the integer ring along a preset sequence to determine a second integer value with the smallest distance from the starting point.
It should be noted that the preset sequence may be the same as the sequence of the integer ring, for example, if the integer ring is organized clockwise, traversal may be performed along the integer ring with the first integer value as a starting point, and the integer value corresponding to the virtual node with the smallest distance from the starting point is taken as the second integer value.
Wherein the second integer value may be an integer value corresponding to the target virtual node.
Step 206, determining a target virtual node corresponding to the second integer value according to the corresponding relationship between each integer value and the virtual node.
After the correspondence relationship between each integer value and the virtual node is determined, the virtual node corresponding to the second integer value may be set as the target virtual node.
And step 207, sending the task to be calculated to the edge node to which the target virtual node belongs.
It should be noted that, reference may be made to the foregoing embodiments for specific implementation of step 207, which is not described herein again.
In the embodiment of the disclosure, a task to be currently calculated and parameter information corresponding to the task to be calculated are first obtained, then a first integer value corresponding to the task to be calculated is determined according to the parameter information, then current virtual nodes are determined according to current available edge nodes, then the virtual nodes are uniformly mapped into a preset integer ring to determine a corresponding relationship between each integer value and each virtual node, then the integer ring is traversed along a preset sequence with the first integer value as a starting point to determine a second integer value with the smallest distance from the starting point, then a target virtual node corresponding to the second integer value is determined according to the corresponding relationship between each integer value and each virtual node, and finally the task to be calculated is sent to the edge node to which the target virtual node belongs. Therefore, after the integer value corresponding to the task to be calculated is determined, the corresponding position of the integer value and the integer ring can be determined, and the corresponding target virtual node can be further determined. Because the integer ring can be divided by a plurality of virtual nodes corresponding to the current available edge nodes, tasks can be relatively and uniformly distributed to different nodes, and the load of each node is relatively balanced, so that the overall performance utilization rate of the edge node cluster is ensured.
In order to implement the above embodiments, the present disclosure further provides a task scheduling device based on edge computation.
Fig. 3 is a schematic structural diagram of a task scheduling device based on edge computation according to an embodiment of the present disclosure.
As shown in fig. 3, the task scheduler 300 based on edge calculation includes: an obtaining module 310, a first determining module 320, a second determining module 330, and a sending module 340.
An obtaining module 310, configured to obtain a current task to be computed and parameter information corresponding to the task to be computed;
a first determining module 320, configured to determine, according to the parameter information, a first integer value corresponding to the task to be calculated;
a second determining module 330, configured to determine, according to a correspondence between each integer value on a preset integer ring and a virtual node, a target virtual node corresponding to the first integer value;
a sending module 340, configured to send the task to be computed to the edge node to which the target virtual node belongs.
Optionally, the second determining module includes:
a first determining unit, configured to determine each current virtual node according to a current available edge node;
and a second determining unit, configured to map the virtual nodes uniformly into a preset integer ring, so as to determine a corresponding relationship between each integer value and a virtual node.
Optionally, the second determining unit includes:
the first determining subunit is configured to uniformly divide a preset integer ring according to the number of the virtual nodes, so as to determine an integer value corresponding to each division point;
and the second determining subunit is configured to associate the number corresponding to each virtual node with each integer value one by one, so as to determine a corresponding relationship between each integer value and a virtual node.
Optionally, the second determining subunit is further configured to:
and determining the number of each virtual node according to the preset number of the available edge nodes and the number of the virtual nodes corresponding to each available edge node, wherein the numbers of the available edge nodes corresponding to the virtual nodes with adjacent numbers are different.
Optionally, the first determining module is specifically configured to:
and performing hash operation on the corresponding end device address parameter, the port parameter, the request timestamp parameter and the task data parameter to determine the first integer value.
Optionally, the second determining module is specifically configured to:
traversing the integer ring by taking the first integer value as a starting point along a preset sequence to determine a second integer value with the minimum distance from the starting point;
and determining a target virtual node corresponding to the second integer value according to the corresponding relation between each integer value and the virtual node.
In the embodiment of the disclosure, a task to be currently calculated and parameter information corresponding to the task to be calculated are first obtained, then a first integer value corresponding to the task to be calculated is determined according to the parameter information, then a target virtual node corresponding to the first integer value is determined according to a corresponding relationship between each integer value and a virtual node on a preset integer ring, and finally the task to be calculated is sent to an edge node to which the target virtual node belongs. Therefore, the virtual nodes are uniformly distributed on the preset integer ring, so that the load of each node is relatively balanced, the corresponding hash value is calculated according to the parameters of the current task, the task can correspond to the integer value in the integer ring, and then the node for processing the task is found out.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
FIG. 4 shows a schematic block diagram of an example electronic device 400 that may be used to implement embodiments of the present disclosure. 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. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 4, the apparatus 400 includes a computing unit 401 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM)402 or a computer program loaded from a storage unit 408 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, ROM 402, and RAM 403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
A number of components in device 400 are connected to I/O interface 405, including: an input unit 406 such as a keyboard, a mouse, or the like; an output unit 407 such as various types of displays, speakers, and the like; a storage unit 408 such as a magnetic disk, optical disk, or the like; and a communication unit 409 such as a network card, modem, wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
Computing unit 401 may be a variety of general and/or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and so forth. The calculation unit 401 executes the respective methods and processes described above, such as a task scheduling method based on edge calculation. For example, in some embodiments, the edge-computing-based task scheduling method may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 408. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 400 via the ROM 402 and/or the communication unit 409. When the computer program is loaded into RAM 403 and executed by computing unit 401, one or more steps of the above described edge computing based task scheduling method may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to perform the edge-computation-based task scheduling method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a 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 that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code 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 this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable 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. 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 a computer 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) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can 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, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end 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 back-end, 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), the internet, and blockchain networks.
The computer system may include clients and servers. A client and server are generally 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 as to solve the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service ("Virtual Private Server", or simply "VPS"). The server may also be a server of a distributed system, or a server incorporating a blockchain.
In the embodiment of the disclosure, a task to be currently calculated and parameter information corresponding to the task to be calculated are first obtained, then a first integer value corresponding to the task to be calculated is determined according to the parameter information, then a target virtual node corresponding to the first integer value is determined according to a corresponding relationship between each integer value and a virtual node on a preset integer ring, and finally the task to be calculated is sent to an edge node to which the target virtual node belongs. Therefore, the virtual nodes are uniformly distributed on the preset integer ring, so that the load of each node is relatively balanced, the corresponding hash value is calculated according to the parameters of the current task, the task can correspond to the integer value in the integer ring, and then the node for processing the task is found out.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, and the present disclosure is not limited herein.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.