CN115328645A - Computing task scheduling method, computing task scheduling device and electronic equipment - Google Patents
Computing task scheduling method, computing task scheduling device and electronic equipment Download PDFInfo
- Publication number
- CN115328645A CN115328645A CN202210743382.1A CN202210743382A CN115328645A CN 115328645 A CN115328645 A CN 115328645A CN 202210743382 A CN202210743382 A CN 202210743382A CN 115328645 A CN115328645 A CN 115328645A
- Authority
- CN
- China
- Prior art keywords
- task
- computing
- node
- data
- computed
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/606—Protecting data by securing the transmission between two devices or processes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45562—Creating, deleting, cloning virtual machine instances
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45587—Isolation or security of virtual machine instances
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- General Health & Medical Sciences (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Health & Medical Sciences (AREA)
- Bioethics (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
- Multi Processors (AREA)
Abstract
The invention provides a computing task scheduling method, a computing task scheduling device and electronic equipment, wherein the method comprises the following steps: determining a computing node and a data node for executing a task to be computed based on an intelligent contract in a block chain network, wherein the computing node is used for providing computing resources needed for executing the task to be computed, and the data resource is used for providing data resources needed for executing the task to be computed; sending the task mirror image corresponding to the task to be calculated and the data resource to the calculation node; and executing the task to be calculated in the calculation node to obtain a calculation result. The method for scheduling the computing task can realize reasonable resource allocation and node selection of the task to be computed.
Description
Technical Field
The present invention relates to the field of block chain technologies, and in particular, to a method, an apparatus and an electronic device for scheduling a computation task.
Background
With the development of technologies such as big data and internet of things, the number and the types of devices accessed to a network are increasing day by day, and massive data are generated. However, the terminal device lacks computing power, a large amount of data cannot be processed locally, and in order to deal with the problems of insufficient processing power, limited resources and the like of the terminal device, technologies such as cloud computing, edge computing and the like are generated, and these technologies offload computing tasks to other servers for execution, acquire computing resources of other servers, and make up for the deficiencies of the terminal in data storage, computing performance and the like.
The process of computing task scheduling needs to realize resource scheduling, data transmission and result sharing among computers, and in order to ensure the safety and the credibility of the process, an application mode combining computing task scheduling and a block chain technology appears. The block chain is a distributed book essentially, and has the advantages of decentralization, tamper resistance, traceability, anonymity, transparency and the like. The block chain is used for user identity authentication, resource management and the like, the defects that a traditional centralized server is easy to attack and low in fault tolerance are overcome, nodes are prevented from modifying task information maliciously, and credible supervision on a computing task scheduling process is achieved.
And the block chain enables calculation task scheduling, so that the safety and the reliability of the task scheduling process are greatly improved. However, the block chain lacks computing power, the throughput is low, and a large amount of data and instruction interaction in the process of computing task scheduling is difficult to meet.
Disclosure of Invention
The invention provides a computing task scheduling method, a computing task scheduling device and electronic equipment, which are used for solving the technical problem that a block chain network in the prior art cannot meet the requirement of massive data and instruction interaction in the computing task scheduling process.
The invention provides a computing task scheduling method, which comprises the following steps:
determining a computing node and a data node for executing a task to be computed based on an intelligent contract in a block chain network, wherein the computing node is used for providing computing resources needed for executing the task to be computed, and the data resource is used for providing data resources needed for executing the task to be computed;
sending the task mirror image corresponding to the task to be calculated and the data resource to the calculation node;
and executing the task to be calculated in the calculation node to obtain a calculation result.
In some embodiments, the determining, based on the intelligent contract in the blockchain network, a compute node and a data node that execute a task to be computed includes:
selecting the computing resources and the data resources in a resource pool based on the intelligent contract and the requirements corresponding to the tasks to be computed, wherein the resource pool is constructed based on the resources to be scheduled registered on the blockchain network;
determining the compute node and the data node based on the compute resources and the data resources.
In some embodiments, the sending the task image and the data resource corresponding to the task to be computed to the compute node includes:
based on a first state channel, sending the task image to the computing node;
and sending the data resource to the computing node based on a second state channel.
In some embodiments, before sending the task image and the data resource corresponding to the task to be computed to the compute node, the method includes:
and encrypting and signing the data resource based on a digital signature mechanism.
In some embodiments, the executing the task to be computed in the compute node to obtain a computation result includes:
constructing a computing container based on the task mirror image;
executing the task to be calculated based on the calculation container, the calculation resources and the data resources to obtain the calculation result;
and under the condition that the task to be calculated is executed completely, deleting the task mirror image and the calculation container.
In some embodiments, the intelligent contract comprises at least one of:
node management contracts, computing resource management contracts, data resource management contracts, status channel contracts, and task management contracts.
The invention also provides a device for scheduling the computation tasks, which comprises:
the system comprises a first determination module, a second determination module and a third determination module, wherein the first determination module is used for determining a computing node and a data node for executing a task to be computed based on an intelligent contract in a block chain network, the computing node is used for providing computing resources needed by executing the task to be computed, and the data resource is used for providing data resources needed by executing the task to be computed;
the sending module is used for sending the task mirror image corresponding to the task to be calculated and the data resource to the calculation node;
and the execution module is used for executing the task to be calculated in the calculation node to obtain a calculation result.
The invention further provides an electronic device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor executes the program to realize the computing task scheduling method.
The present invention also provides a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method of computing task scheduling as described in any of the above.
The present invention also provides a computer program product comprising a computer program which, when executed by a processor, implements a method of computing task scheduling as described in any of the above.
According to the computing task scheduling method, the computing task scheduling device and the electronic equipment, computing resources and data resources required by the tasks are abstracted through intelligent contracts on the blockchain network, entities participating in the tasks, namely computing nodes and data nodes, are abstracted, and reasonable resource allocation and node selection of the tasks to be computed can be achieved.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
FIG. 1 is a flow chart illustrating a method for scheduling computing tasks according to the present invention;
FIG. 2 is a schematic diagram of data encryption using the method for scheduling computing tasks according to the present invention;
FIG. 3 is a functional diagram of a node agent to which the method for scheduling a computing task according to the present invention is applied;
FIG. 4 is a schematic diagram of a contract invocation relationship for applying the method for scheduling computing tasks provided by the present invention;
FIG. 5 is a flow chart illustrating a method for scheduling computing tasks according to the present invention;
FIG. 6 is a schematic structural diagram of a computing task scheduling device provided in the present invention;
fig. 7 is a schematic physical structure diagram of an electronic device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without inventive step based on the embodiments of the present invention, are within the scope of protection of the present invention.
Fig. 1 is a schematic flow chart of a computing task scheduling method provided by the present invention. Referring to fig. 1, the method for scheduling a computing task provided by the present invention includes: step 110, step 120 and step 130.
and step 130, executing the task to be calculated in the calculation node to obtain a calculation result.
The execution main body of the calculation task scheduling method provided by the invention can be electronic equipment, a component in the electronic equipment, an integrated circuit or a chip. The electronic device may be a mobile electronic device or a non-mobile electronic device. By way of example, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm top computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), and the like, and the non-mobile electronic device may be a server, a Network Attached Storage (NAS), a Personal Computer (PC), and the like, which is not limited in the present disclosure.
The following describes the technical solution of the present invention in detail by taking an example in which an electronic device executes the method for scheduling a computation task provided by the present invention.
In step 110, the blockchain network is a network of blockchains. A block chain is a chain of blocks one after the other. Each block holds certain information, which are linked in a chain according to a respective generated time sequence. This chain is maintained in all servers, and as long as one server can work in the entire system, the entire blockchain is secure. These servers, referred to as nodes in the blockchain system, provide storage space and computational support for the entire blockchain system.
An intelligent contract is a piece of code written on a blockchain that executes automatically once an event triggers a term in the contract. An intelligent contract is a computer protocol intended to propagate, validate or execute contracts in an informational manner. Smart contracts allow trusted transactions, which are traceable and irreversible, to be conducted without a third party.
It can be understood that the computing task scheduling method provided by the invention can be applied to a computing task scheduling system. Electronic devices in a computing task scheduling system may be abstracted into four types of entities: task initiators, data nodes, compute nodes, and blockchain networks.
The task initiator submits the calculation tasks to the scheduling system, provides the mirror images required by the tasks, specifies the data resources required by the calculation, and receives the calculation results.
A compute node is a node that holds a compute resource and needs to register the compute resource in the system. After being assigned to perform a task, it is necessary to acquire the image from the task originator and perform the computing task.
The data node is a node holding a data resource, and the data resource needs to be registered in the system. In a computing task, specified data is transmitted to a computing node.
The blockchain network is used for storing records of data resources and computing resources on a chain in a certain form, and information and task records of each node are also stored on the chain. When the scheduling system allocates resources for the tasks, the resource records on the chain can be inquired, and the tasks are scheduled according to the node information.
The computing task scheduling system needs to respond to the task request, allocate computing resources and data resources to the task to be computed, and control and complete task scheduling and task execution.
Because the task initiator does not have sufficient computing power, it needs to request the system to schedule computing resources to perform computing tasks on other devices. Therefore, the system needs to complete registration management of the computing resources, respond to the task request, reasonably allocate the computing resources for the task, and select the computing nodes for executing the task.
Data resources required by tasks to be computed may not be held by the device initiating the task or performing the task, but stored on other devices in the blockchain network, and thus, the data resources and corresponding data nodes need to be determined.
In step 120, the data resources required by the task to be computed may not be held by the device initiating the task or executing the task, but stored on other devices in the blockchain network, and in order to complete the task to be computed, the data resources need to be transmitted to the device providing the computing resources, i.e., the data resources are sent to the computing node. Therefore, the system needs to complete registration and management of data resources, respond to task requests, allocate data resources to tasks, and control transmission of data resources.
In order to simplify the task loading process, the computing task is executed in a relatively isolated environment, and a system environment required by the computing task is provided on the premise of minimizing consumption and starting time.
The computer scheduling system can send the task image corresponding to the task to be calculated to the calculation node. The task image is actually the file system that is used to provide the isolated execution environment for the container process.
A task image can be understood as a base file system containing applications and their associated dependencies, which are used in a read-only manner to create a container's runtime environment during the startup of a computing container.
In step 130, after receiving the task image and the data resource, the computing node executes a computing task based on the task image, the computing resource, and the data resource, and obtains a computing result. The compute node may send the computed result to the task originator.
According to the computing task scheduling method, computing resources and data resources required by the task are abstracted through the intelligent contract on the block chain network, entities participating in the task, namely computing nodes and data nodes are abstracted, and reasonable resource allocation and node selection of the task to be computed can be achieved.
In some embodiments, determining compute nodes and data nodes to perform a task to be computed based on an intelligent contract in a blockchain network includes:
selecting computing resources and data resources from a resource pool based on the intelligent contract and the corresponding requirements of the tasks to be computed, wherein the resource pool is constructed based on the resources to be scheduled registered on the block chain network;
based on the computing resources and the data resources, computing nodes and data nodes are determined.
In actual execution, the computing task scheduling system may centralize the distributed hardware resources to form a resource pool on the blockchain network for distribution by the scheduling center. During the task loading, data acquisition and task execution processes, data transmission is completed under the supervision of the block chain, so that the credibility of the task execution process is ensured.
In order to participate in performing the task to be computed, the hardware device needs to register its own resources in the blockchain network. Registration of resources is accomplished through proxies.
All resources, including data resources, computing resources and the like, are registered on the block chain network, and are stored on the chain in a record form to form a resource pool; after receiving the demand of the task to be calculated, the scheduling system inquires a resource pool on a chain based on an intelligent contract, allocates calculation resources and data resources for the task, and then determines the calculation nodes and the data nodes.
When a plurality of computing nodes exist in the computing task scheduling system, the scheduling center needs to select the computing node most suitable for the task according to the computing capability of the computing node, the computing resource required for executing the task to be computed, the position of the data resource and other factors, so that the task execution efficiency is improved as much as possible. The computing node needs to provide the memory size as a measure of the computing power when registering. When a task to be computed is submitted by a device initiated by a task, the requirement of the task on the memory size of a computing node needs to be indicated. When the dispatching center selects the computing node, the following three points need to be measured:
(1) Whether the compute node is performing a task: one computing node can only execute one task at the same time, and the next task is not executed before the execution of the previous computing task is finished.
(2) Memory of the computing node: more than the minimum requirement of the task on memory is required.
(3) Location of data resource: if the node holding the data resources required by the task has enough computing power, the node is prioritized to avoid the delay consumption of the data transmission process.
The method for scheduling the computing task completes resource registration and node registration on a chain by designing a computing resource, a data resource management mechanism and a user identity management mechanism based on a block chain, and performs resource allocation and node selection for the task.
In some embodiments, sending a task image and a data resource corresponding to a task to be computed to a compute node includes:
based on the first state channel, sending the task mirror image to a computing node;
and sending the data resource to the computing node based on the second state channel.
In actual execution, the computing task scheduling system is responsible for completing scheduling and execution of computing tasks. The scheduling system may be divided into two parts, up-chain and down-chain. Under the chain, each node needs to run an agent, and the agent is an interface for interaction between all devices and the blockchain and also an interface for interaction between the devices. And on the chain, the intelligent contract is responsible for user identity authentication, resource pool management and task scheduling and resource allocation. Due to the limited computing power and throughput of the blockchain, the deployment of the containers and the interaction of the data are not completed through the blockchain but are completed by the blockchain control state channel.
Because the throughput of the block chain is low, the requirement on data interaction in task scheduling cannot be met, and therefore the capacity of the block chain is expanded by using the state channel between the nodes, and large-scale data transmission is completed. This process can be divided into three phases:
establishing a state channel: the establishment of the channel is controlled by the dispatching center, and when the channel is established, the current state of the node is checked and part of states are locked.
In the embodiment of the invention, the task initiating node needs to establish a first state channel with the selected computing node, and the computing node needs to establish a second state channel with the data node.
In actual execution, a task initiator transmits a task image of a computing task to a computing node through a first state channel, and the computing node acquires data resources required by computing from a data node.
And after the computing node executes the computing task, transmitting the computing result to the task initiator through the first state channel.
The state channel is introduced as a chain expansion scheme, so that the processing capacity of the block chain can be improved while the data security and the calculation credibility are guaranteed.
(2) Data interaction under the link: and the nodes transmit data and deploy containers through the state channels. This process needs to ensure the trustworthiness of the data source and that the transmission process is not stolen. As shown in fig. 2, for encryption and signature, a digital signature mechanism is used to sign the original data with the public key of the receiving party; for decryption and verification, an asymmetric encryption mechanism is adopted, and data is encrypted by a private key of a sender.
(3) Closing the state channel: after the data transmission is completed and the check is correct, the status channel is closed and the status is updated on the chain. The closing of the status channel must be agreed by both parties, and the updated status can only be validated by the signatures of both parties.
In some embodiments, before the task image and the data resource corresponding to the task to be computed are sent to the compute node, the data resource is encrypted and signed based on a digital signature mechanism.
All devices in the computing task scheduling system may participate in the computing task and perform point-to-point connection, and in order to ensure security and credibility in task unloading, data transmission and task execution processes and avoid data leakage or device attack, the system needs to verify the identity of each participant and maintain the security of the scheduling system and the participants.
In practical implementation, the present invention can design the following state channel mechanism:
(a) Two ends of the state channel are respectively a node 1 and a node 2, public keys of the two ends of the state channel are respectively pubKey1 and pubKey2, and private keys of the two ends of the state channel are respectively priKey1 and priKey2.
(b) When the node 1 transmits data to the node 2, the data is hashed, and then the hash is encrypted by using a private key of the node 1 to obtain a public key, namely signature = priKey1 (sha 3 (data)).
(c) Node 1 encrypts the data using the public key of node 2 to obtain the ciphertext, i.e., cipaertext = pubKey2 (data).
(d) And the node 1 sends the ciphertext and the signature to the node 2 through a state channel.
(e) And the node 2 receives the ciphertext and the signature, and decrypts the ciphertext by using the private key of the node 2 to obtain data' = privey 2 (ciphertext).
(f) And the node 2 decrypts the signature by using the public key of the node 1, hashes the data ', and compares whether the signature and the data are equal first, namely sha3 (data') = = pubKey1 (signature), and if the signature and the data are equal, the data are correct in the transmission process.
According to the calculation task scheduling method provided by the invention, the transmission of original data, task mirror images, calculation results and other control information is carried out under a chain by designing a calculation task scheduling process based on a state channel, so that the data uploading pressure of a block chain is reduced; and an encryption and signature mechanism of the data transmission under the link is designed, so that the credibility of the task scheduling process is realized.
In some embodiments, executing a task to be computed in a compute node to obtain a computation result includes:
constructing a computing container based on the task mirror image;
executing the task to be calculated based on the calculation container, the calculation resource and the data resource to obtain a calculation result;
and under the condition that the execution of the task to be calculated is completed, deleting the task mirror image and the calculation container.
In order to simplify the task loading process, the task to be calculated is executed in a relatively isolated environment, a system environment required by the calculation task is provided on the premise of reducing consumption and starting time as much as possible, a docker container is built on equipment for providing calculation resources according to a mirror image provided by a task initiator, and a task program is executed in the container.
In actual execution, before a task to be calculated is executed, a task initiator sends a task mirror image to a calculation node through a first state channel, and a data node sends a data resource to the calculation node through a second state channel.
After receiving the task mirror image, the computing node needs to use a docker to complete instantiation of the container and deploy the container to build an execution environment of the computing task.
After the deployment of the container is finished and the data resources required by the task are obtained, the system executes the task to be calculated based on the calculation container, the calculation resources and the data resources to obtain a calculation result.
And after the calculation result is obtained, the calculation node sends the calculation result to the task initiator through the first state channel.
After the task execution is finished, the computing task scheduling system deletes the mirror image and destroys the container.
According to the computing task scheduling method provided by the invention, by designing the container-based computing environment deployment, the server uses the docker to build the lightweight computing container for different computing tasks, so that the computing tasks can be executed in the isolated computing container, the task loading process is simplified, and the consumption and the starting time are reduced.
In some embodiments, the smart contract comprises at least one of:
a node management contract, a computing resource management contract, a data resource management contract, a status channel contract, and a task management contract.
In actual execution, the computing task scheduling system adopts an intelligent contract to manage the nodes and the resources registered on the chain, allocate the resources for the computing tasks, and select the computing nodes and the data nodes participating in executing the tasks to be computed. As shown in fig. 4, an embodiment of the present invention may provide five intelligent contracts to accomplish these functions.
1. Node management contract
And the system is responsible for the registration and the logout of the nodes and the management and the query of the node information. All requests initiated by the nodes to the intelligent contracts, including resource registration and logout, and initiation and revocation of tasks, need to be subjected to identity verification through the node management contracts; when the task is scheduled, the position information of the nodes is acquired through the contract, so that the nodes participating in the task can establish connection, and the task is loaded and the data is transmitted.
The node administration contract maintains a node registry.
As shown in table 1, each entry represents a node, the node uses an account with a 40-bit 16-ary number as a unique identifier, and the registration information includes a location and an access interface of the node in the network, a public key, and the like, which is convenient for other nodes to access. The registered nodes can initiate or participate in the computing task.
Table 1 node registry
Parameter(s) | Type (B) | Means of |
account | address | Node account |
ip:port | string | Network address of a node |
balance | uint | Balance of the node |
pubKey | string | Public key |
timestamp | uint | Time stamp |
2. Computing resource management contracts
Responsible for registration, deregistration, and querying of computing resources. The computing nodes need to register attributes such as computing capacity and the like on the chain through the contract to form a computing resource pool, and when a system needs to allocate computing resources for a certain task, the computing resource pool can be obtained and searched through the contract to select the computing nodes. Before and after a computing node performs a task, a computing resource management contract is responsible for modifying the state of the node.
A computing resource management contract maintains a computing resource registry.
As shown in table 2, each entry represents a share of computing resources, and the node account of the holder is used as a unique identifier, and further includes attributes such as a memory. Before registering computing resources, it is guaranteed that the computing nodes have registered.
Table 2 computing resource registry
Parameter(s) | Type (B) | Means of |
owner | address | Node account with the data |
memory | uint | Memory size of computing device |
price | uint | Price for performing a computational task |
isBusy | bool | Whether a node is performing a task |
timestamp | uint | Time stamp |
3. Data resource management contracts
And is responsible for registration, deregistration and query of data resources. The data nodes need to complete the registration of data resources on the chain through the local contract to form a data resource pool. When the system needs to distribute data resources for a certain task, the data resource pool can be obtained and searched through the contract, and the scheduling of the data resources is completed.
A data resource management contract maintains a registry of data resources.
As shown in Table 3, each entry represents a copy of the data. The data resource takes the data ID as a unique identifier, and the main information comprises a data abstract with 256 bits, an account of a data holder, data description information and the like, and can be used for searching the data resource or verifying the data integrity.
Table 3 data resource registry
Parameter(s) | Types of | Means of |
id | uint | Data id, unique identification |
description | string | Description of data |
owner | address | Node account with the data |
dataAbscract | bytes | Data digests, i.e. data after hash encryption |
timestamp | uint | Time stamp |
3. Status channel contracts
The loading, execution and transmission of data and results of tasks are performed through a status channel. The first type is established between the computing node and the task initiator, the task initiator transmits the mirror image to the computing node, and the computing node transmits the computing result to the task initiator after locally completing task execution; the second is established between a compute node and a data node, which transmits raw data to the compute node. When the nodes at the two ends of the channel finish the transaction or the transaction cannot be finished due to the inequality, the channel is closed. The closing of the channel requires the taking of signatures from both parties. The contract is responsible for establishing and canceling the state channel and maintaining the consistency of data on the chain.
The status channel contract maintains a status channel table.
As shown in table 4, each entry is a channel, and the main attributes include nodes at both ends of the channel and the channel status.
TABLE 4 status channel Table
Parameter(s) | Type (B) | Means of |
id | uint | Id of status channel |
peer1 | address | The side of the initiator |
peer2 | address | The other party of the initiator |
status | bool | Status of passage, i.e. whether it has been closed |
4. Task management contracts
And the system is responsible for managing the complete life cycle of the task from creation to revocation and saving the task record on the chain. After receiving the task request, the task management contract calls other contracts to complete the processes of resource allocation and task scheduling, and the detailed steps are as follows:
(1) After receiving a task request sent by a certain node agent, the task management contract calls the node management contract and verifies the identity of an initiator; if the task originator is not registered, the contract will reject the task.
(2) After the identity of the task initiator is checked, the task management contract sends a request to the data resource management contract, the data resources needed by the task are searched in the data resource pool, and the data resources are returned to the account of the data node with the resources.
(3) The task management contract sends a request to the computing resource management contract, searches the computing resource pool, and screens out the computing resources meeting the task requirement.
(4) According to the resource search result, the task management contract can select the computing node by combining the attribute of the computing resource and the position of the data resource.
(5) After determining the computing nodes and data nodes which participate in the task, the task management contract calls a state channel management contract, establishes state channels between a task initiator and the computing nodes and between the computing nodes and the data nodes, triggers a channel establishment event, and issues an instruction to the node agents which participate in the task.
The task management contract maintains a task record table.
As shown in Table 5, each entry is a record of one time task with the task id as the unique identifier.
TABLE 5 task log sheet
Parameter(s) | Type (B) | Means of |
id | uint | Task id, unique identification |
sponser | address | Node account of task initiator |
dataList | uint[] | Required data list |
channelList | uint[] | List of status channels established for the task |
computer | address | Computing node for executing computing task |
status | bool | Task state |
success | bool | Whether the task was successfully executed |
resultAbstract | bytes | Summarization of computed results |
timestamp | uint | Time stamp |
The node agents are deployed on a server local to a user, each node needs to run one agent, and the agents are interfaces for interaction between all devices and the blockchain and are also interfaces for interaction between the devices. As shown in fig. 3, the node agent mainly performs the following five functions:
1. user interface
The node agent provides an interface for user access downwards, including node registration and deregistration, registration and deregistration of data resources, registration and deregistration of computing resources, initiation of tasks and search of data resources. The user inputs instructions and parameters through the command line, and the node agent analyzes the input of the user, reads the parameters or the configuration file and executes corresponding operation.
2. Contract interface
The node agent provides an interface for accessing the intelligent contract upwards, and interacts with the contract through the web3 library and the JSON RPC interface. On one hand, the node agent actively calls a function in the contract to initiate a transaction or inquire data on the chain; on the other hand, since contracts cannot actively send information to a certain node or application, the node agent can listen to contract events, mainly status channel establishment events and status channel closing events, through the web 3. By monitoring the event, the node agent obtains the instruction of the intelligent contract and completes the corresponding operation.
3. Communication interface
In order to conduct transactions down the chain, connections need to be established between nodes down the chain. Before the task is executed, the task initiator sends the task mirror image to the computing node, and the data node sends the data resource to the computing node; and after the task is completed, the computing node sends the result to the task initiator. In addition, necessary control messages are transmitted between the nodes. The transmission of these data is not via a block chain, but is sent directly between the nodes.
In order to establish point-to-point network connection between nodes, a user agent opens a certain port for connection of other nodes, and monitors network data of the port. Each connection corresponds to a status channel, and when the channels are closed, the connections are also disconnected.
4. Data processing
Data transmitted in a status channel under a chain needs to be encrypted and signed to ensure the safety of a transmission process and the credibility of a data source, and similarly, a receiver needs to decrypt and verify the data.
5. Container deployment and task execution
After receiving the task mirror image, the computing node needs to use docker to complete instantiation of the container and deploy the container to build an execution environment of the computing task. After the container is deployed and the data resources required by the task are obtained, the system calls the task program in the container according to the program entrance provided by the task initiator to execute the calculation task. After the task is completed, the system deletes the mirror image and destroys the container.
The method for dispatching the computing tasks provided by the invention completes the functions of the task dispatching system by designing the intelligent contract and the node agent program based on the block chain, and verifies the feasibility of design.
In some embodiments, the compute task scheduler may aggregate the distributed hardware resources to form a resource pool on a chain for allocation by the scheduler hub. In the processes of task loading, data acquisition and task execution, state channels need to be established among all devices participating in a task, and data transmission is completed under supervision of a block chain, so that the credibility of the task execution process is ensured. Based on this, the embodiment of the present invention can design a three-layer architecture, which is a resource layer, a block chain network layer and a scheduling system layer from bottom to top.
The resource layer comprises hardware providers of all resources, all data are stored in the resource layer, and all computing tasks are completed through servers of the resource layer. To participate in a computing task, a hardware device needs to register its own held resources in a blockchain network. Registration of resources is accomplished through proxies.
All resources, including data resources, computing resources and the like, are registered on the block chain network, and are stored on the chain in a record form to form a resource pool; after receiving a request for a computing task, the scheduling system queries a resource pool on the chain to allocate computing resources and data resources to the task.
And the computing task scheduling system layer is responsible for completing scheduling and execution of computing tasks. The computing task scheduling system may be divided into an up-chain and a down-chain. Under the chain, each node needs to run an agent, and the agent is an interface for interaction between all devices and the blockchain and also an interface for interaction between the devices. And on the chain, the intelligent contract is responsible for user identity authentication, resource pool management and task scheduling and resource allocation. Due to the limited computing power and throughput of the blockchain, the deployment of the containers and the interaction of the data are not completed through the blockchain but are completed by the blockchain control state channel.
In some embodiments, fig. 5 is a flowchart illustrating a method for scheduling a computing task according to the present invention. Referring to fig. 5, the method for scheduling a computing task according to the present invention may include the following steps.
(1) The task initiator initiates a calculation task, provides a mirror image of a container required by the task, and initiates a request to the task scheduling system.
(2) And searching a resource pool by the intelligent contract on the chain according to the task requirement, selecting the computing resource and the data resource, and determining the computing node and the data node participating in the task.
(3) The intelligent contract links the task record.
(4) The computing node and the task initiator establish a state channel, and the task initiator transmits the mirror image of the computing task to the computing node.
(5) And the computing node inquires the task record on the chain and acquires the entry of the task program.
(6) The computing nodes instantiate the container locally, deploying the computing environment.
(7) If the computing node does not hold the data resources required by the task, the computing node and the data node are required to establish a state channel to request the data required by the computation.
(8) And the data node receives the data resource request, sends the encrypted and signed data to the computing node, and closes the state channel after verifying and decrypting the signature.
(9) And after receiving the data, the computing node executes a computing task, and transmits the encrypted and signed computing result to a task initiator through a state channel after completing the computation.
(10) The task initiator checks the signature of the result and decrypts, after confirming that the signature is received, the multiple signatures and the abstract of the calculation result are submitted to the chain, the state channel is closed, and the task is ended.
(11) And the computing node destroys local data resources, task containers and mirror images.
The invention provides an application mode combining computing task scheduling and block chain technology, which registers computing resources and data resources on a chain and corresponds the resources to nodes holding the resources. A system architecture of an intelligent contract-node agent under a chain is designed, and user identity authentication, data resource management, computing resource management, resource allocation and node selection are carried out through the intelligent contract. In addition, in order to solve the problem of insufficient throughput of the block chain, the invention designs a calculation task scheduling process based on a state channel, and realizes the credible supervision of task loading, data transmission and result sharing in the calculation task scheduling process; in order to meet the difference requirements of different tasks on computing environments, the invention designs task deployment based on a docker container. The intelligent contract and the node agent are completed through encoding, and the feasibility of design is verified.
The following describes the computing task scheduling apparatus provided by the present invention, and the computing task scheduling apparatus described below and the computing task scheduling method described above may be referred to in correspondence with each other.
Fig. 6 is a schematic structural diagram of a computing task scheduling device provided in the present invention. Referring to fig. 6, the apparatus for scheduling a computing task according to the present invention may include: a first determination module 610, a sending module 620, and an execution module 630.
A first determining module 610, configured to determine, based on an intelligent contract in a block chain network, a computing node and a data node for executing a task to be computed, where the computing node is configured to provide computing resources required for executing the task to be computed, and the data resource is configured to provide data resources required for executing the task to be computed;
a sending module 620, configured to send the task mirror image and the data resource corresponding to the task to be computed to the computing node;
the executing module 630 is configured to execute the task to be calculated in the computing node to obtain a calculation result.
The computing task scheduling device provided by the invention abstracts computing resources and data resources required by the task and also abstracts entities participating in the task, namely computing nodes and data nodes, through an intelligent contract on a block chain network, and can realize reasonable resource allocation and node selection of the task to be computed.
In some embodiments, the first determining module 610 is further configured to:
selecting the computing resources and the data resources in a resource pool based on the intelligent contract and the requirements corresponding to the tasks to be computed, wherein the resource pool is constructed based on the resources to be scheduled registered on the blockchain network;
determining the compute node and the data node based on the compute resources and the data resources.
In some embodiments, the sending module 620 is further configured to:
based on a first state channel, sending the task mirror image to the computing node;
and sending the data resource to the computing node based on the second state channel.
In some embodiments, the apparatus further comprises:
and the encryption module is used for encrypting and signing the data resource based on a digital signature mechanism.
In some embodiments, the executing module 630 is further configured to:
building a computing container based on the task mirror image;
executing the task to be calculated based on the calculation container, the calculation resources and the data resources to obtain the calculation result;
and deleting the task mirror image and the computing container under the condition that the task to be computed is completely executed.
In some embodiments, the smart contract comprises at least one of:
a node management contract, a computing resource management contract, a data resource management contract, a status channel contract, and a task management contract.
Fig. 7 illustrates a physical structure diagram of an electronic device, which may include, as shown in fig. 7: a processor (processor) 710, a communication Interface (Communications Interface) 720, a memory (memory) 730, and a communication bus 740, wherein the processor 710, the communication Interface 720, and the memory 730 communicate with each other via the communication bus 740. Processor 710 may call logic instructions in memory 730 to perform a method of computing task scheduling, the method comprising:
determining a computing node and a data node for executing a task to be computed based on an intelligent contract in a block chain network, wherein the computing node is used for providing computing resources needed for executing the task to be computed, and the data resource is used for providing data resources needed for executing the task to be computed;
sending the task mirror image corresponding to the task to be calculated and the data resource to the calculation node;
and executing the task to be calculated in the calculation node to obtain a calculation result.
In addition, the logic instructions in the memory 730 can be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, the computer program product including a computer program, the computer program being storable on a non-transitory computer-readable storage medium, the computer program being capable of executing the method for scheduling a computing task provided by the above methods when executed by a processor, the method comprising:
determining a computing node and a data node for executing a task to be computed based on an intelligent contract in a block chain network, wherein the computing node is used for providing computing resources needed for executing the task to be computed, and the data resource is used for providing data resources needed for executing the task to be computed;
sending the task mirror image corresponding to the task to be calculated and the data resource to the calculation node;
and executing the task to be calculated in the calculation node to obtain a calculation result.
In still another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, the computer program, when being executed by a processor, is implemented to perform the method for scheduling computing tasks provided by the above methods, the method including:
determining a computing node and a data node for executing a task to be computed based on an intelligent contract in a block chain network, wherein the computing node is used for providing computing resources needed for executing the task to be computed, and the data resource is used for providing data resources needed for executing the task to be computed;
sending the task mirror image corresponding to the task to be calculated and the data resource to the calculation node;
and executing the task to be calculated in the calculation node to obtain a calculation result.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. Based on the understanding, the above technical solutions substantially or otherwise contributing to the prior art may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the various embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, and not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (10)
1. A method for scheduling a computing task, comprising:
determining a computing node and a data node for executing a task to be computed based on an intelligent contract in a block chain network, wherein the computing node is used for providing computing resources needed for executing the task to be computed, and the data resource is used for providing data resources needed for executing the task to be computed;
sending the task mirror image corresponding to the task to be calculated and the data resource to the calculation node;
and executing the task to be calculated in the calculation node to obtain a calculation result.
2. The method according to claim 1, wherein the determining the compute nodes and data nodes executing the tasks to be computed based on the intelligent contracts in the blockchain network comprises:
selecting the computing resources and the data resources in a resource pool based on the intelligent contract and the requirements corresponding to the tasks to be computed, wherein the resource pool is constructed based on the resources to be scheduled registered on the blockchain network;
determining the compute node and the data node based on the compute resources and the data resources.
3. The method according to claim 1, wherein the sending the task image and the data resource corresponding to the task to be computed to the computing node comprises:
based on a first state channel, sending the task image to the computing node;
and sending the data resource to the computing node based on the second state channel.
4. The method for scheduling the computing task according to claim 1, wherein before sending the task image and the data resource corresponding to the task to be computed to the computing node, the method comprises:
and encrypting and signing the data resource based on a digital signature mechanism.
5. The method according to claim 1, wherein the executing the task to be computed in the compute node to obtain a computation result comprises:
building a computing container based on the task mirror image;
executing the task to be calculated based on the calculation container, the calculation resources and the data resources to obtain the calculation result;
and deleting the task mirror image and the computing container under the condition that the task to be computed is completely executed.
6. The computing task scheduling method of any of claims 1-5, wherein the intelligent contract comprises at least one of:
a node management contract, a computing resource management contract, a data resource management contract, a status channel contract, and a task management contract.
7. A computing task scheduler, comprising:
the system comprises a first determination module, a second determination module and a third determination module, wherein the first determination module is used for determining a computing node and a data node for executing a task to be computed based on an intelligent contract in a block chain network, the computing node is used for providing computing resources needed by executing the task to be computed, and the data resource is used for providing data resources needed by executing the task to be computed;
the sending module is used for sending the task mirror image corresponding to the task to be calculated and the data resource to the calculation node;
and the execution module is used for executing the task to be calculated in the calculation node to obtain a calculation result.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method for computing task scheduling according to any of claims 1 to 6 when executing the program.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method for scheduling computing tasks according to any one of claims 1 to 6.
10. A computer program product comprising a computer program, wherein the computer program, when executed by a processor, implements a method for scheduling computing tasks according to any of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210743382.1A CN115328645A (en) | 2022-06-27 | 2022-06-27 | Computing task scheduling method, computing task scheduling device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210743382.1A CN115328645A (en) | 2022-06-27 | 2022-06-27 | Computing task scheduling method, computing task scheduling device and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115328645A true CN115328645A (en) | 2022-11-11 |
Family
ID=83917958
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210743382.1A Pending CN115328645A (en) | 2022-06-27 | 2022-06-27 | Computing task scheduling method, computing task scheduling device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115328645A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115495223A (en) * | 2022-11-18 | 2022-12-20 | 安徽华云安科技有限公司 | Task safety scheduling method, device, equipment and storage medium |
CN116132420A (en) * | 2022-12-28 | 2023-05-16 | 中国互联网络信息中心 | Cluster password acceleration method and device for universal Internet platform |
CN117348999A (en) * | 2023-12-06 | 2024-01-05 | 之江实验室 | Service execution system and service execution method |
CN117851023A (en) * | 2023-03-29 | 2024-04-09 | 广州纳指数据智能科技有限公司 | Conversion method and system for computing power of high-performance computer group and local resources |
-
2022
- 2022-06-27 CN CN202210743382.1A patent/CN115328645A/en active Pending
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115495223A (en) * | 2022-11-18 | 2022-12-20 | 安徽华云安科技有限公司 | Task safety scheduling method, device, equipment and storage medium |
CN116132420A (en) * | 2022-12-28 | 2023-05-16 | 中国互联网络信息中心 | Cluster password acceleration method and device for universal Internet platform |
CN116132420B (en) * | 2022-12-28 | 2024-07-12 | 中国互联网络信息中心 | Cluster password acceleration method and device for universal Internet platform |
CN117851023A (en) * | 2023-03-29 | 2024-04-09 | 广州纳指数据智能科技有限公司 | Conversion method and system for computing power of high-performance computer group and local resources |
CN117348999A (en) * | 2023-12-06 | 2024-01-05 | 之江实验室 | Service execution system and service execution method |
CN117348999B (en) * | 2023-12-06 | 2024-02-23 | 之江实验室 | Service execution system and service execution method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110537182B (en) | System and method for providing representational state transfer proxy service for blockchain cloud service | |
CN115328645A (en) | Computing task scheduling method, computing task scheduling device and electronic equipment | |
KR102566892B1 (en) | Blockchain consensus method, device and system | |
Dai et al. | Research and implementation of cross-chain transaction model based on improved hash-locking | |
CN112005264A (en) | Blockchain implementing cross-chain transactions | |
KR102569409B1 (en) | Systems and methods for virtual distributed ledger networks | |
US11632247B2 (en) | User security token invalidation | |
US12126734B2 (en) | Cross-chain data transmission method and apparatus, computer device, storage medium, and computer program product | |
CN112702402A (en) | System, method, device, processor and storage medium for realizing government affair information resource sharing and exchange based on block chain technology | |
CN112835977B (en) | Database management method and system based on block chain | |
CN111950019A (en) | Block chain-based Internet of things access control system and method | |
CN111338906B (en) | Terminal equipment, edge node and block chain-based application supervision method and system | |
EP3598333B1 (en) | Electronic device update management | |
WO2023040502A1 (en) | User service registration | |
CN114296922A (en) | Multi-party data processing method, system, electronic device and storage medium | |
WO2023005500A1 (en) | Cross-chain transaction processing method and apparatus, electronic device, and storage medium | |
CN111932239A (en) | Service processing method, device, node equipment and storage medium | |
CN115145702A (en) | Information processing method and device based on secure multi-party computing | |
CN114553440B (en) | Cross-data center identity authentication method and system based on block chain and attribute signature | |
US10673827B1 (en) | Secure access to user data | |
CN114327827A (en) | Task processing method and device and storage medium | |
WO2022141024A1 (en) | Blockchain technology-based business transaction method and system, and storage medium | |
WO2024092929A1 (en) | Cross-domain data authorization method and apparatus, and electronic device | |
CN111478776A (en) | Trusted hybrid cloud system with digital identity and construction method thereof | |
CN113612732B (en) | Resource calling method and device and multiparty secure computing system |
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 |