Computing task unloading method, device and product

By obtaining node device status information in the blockchain, optimizing resource allocation for data processing tasks and consensus computing tasks, the problem of insufficient computing power of node devices is solved, and low-cost and efficient computing task offloading is achieved.

CN120371467APending Publication Date: 2025-07-25KE COM (BEIJING) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510377130.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-27
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

In blockchain, due to limited computing power, node equipment is difficult to process data processing tasks and consensus computing tasks at the same time. The computing task offloading scheme in the existing technology fails to effectively solve the problem of resource optimization allocation, resulting in excessive delay and cost.

Method used

By obtaining the status information of the target node device, comprehensively considering the resource consumption and reward and punishment values of the data processing tasks and consensus calculation tasks, determining the calculation task offload decision, and offloading the task to the fog computing platform or cloud computing platform to optimize resource allocation.

Benefits of technology

It realizes that while meeting the needs of computing tasks, it reduces computing costs and delays, and improves computing efficiency and real-time performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371467A_ABST
    Figure CN120371467A_ABST
Patent Text Reader

Abstract

The invention provides a computing task unloading method, computing task unloading equipment and a computing task unloading product. The method disclosed by the invention comprises the following steps: in response to a calculation unloading request sent by any target node equipment in a block chain, obtaining state information of the target node equipment; wherein the calculation unloading request comprises a request for unloading a data processing task and a request for unloading a consensus calculation task; determining a first resource consumption and a resource reward and punishment value based on the state information, a first fog platform parameter allocated when the data processing task is unloaded to the fog computing platform, and a cloud platform parameter allocated when the data processing task is unloaded to the cloud computing platform; determining a second resource consumption based on the state information and a second fog platform parameter allocated when the consensus computing task is unloaded to the fog computing platform; determining a calculation task unloading decision based on the first resource consumption, the resource reward and punishment value and the second resource consumption; task offloading of the data processing task and / or the consensus computing task is performed based on the computing task offloading decision.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technologies, and particularly to a method, device, and product for computing task offloading. Background Art

[0002] With the development of Internet of Things (IoT) technologies, the structure of IoT systems has become increasingly complex. For example, a common structure is the structural relationship between end devices and cloud computing platforms. In some systems, there are node devices, fog computing platforms, and cloud computing platforms, which can meet the high-efficiency and real-time requirements of IoT computing tasks.

[0003] To improve network security, blockchain technology is introduced in some solutions. Each end device is used as a node device in the blockchain. In addition to handling conventional computing tasks (such as data processing tasks), the end device also needs to handle consensus computing tasks. However, due to the limited computing power of the node devices in the blockchain, it is difficult to handle data processing tasks and consensus computing tasks simultaneously. Although theoretically, data processing tasks and consensus computing tasks can be offloaded to the cloud computing platform, the offloading process also takes a certain amount of time, and sometimes unacceptable task delays will occur. Therefore, a solution that can achieve reasonable computing task offloading is needed. Summary of the Invention

[0004] The present disclosure provides a method, device, and product for computing task offloading.

[0005] According to a first aspect of the present disclosure, a method for computing task offloading is provided. The method specifically includes: in response to a computing offloading request sent by any target node device in the blockchain, obtaining the status information of the target node device; where the computing offloading request includes a request for offloading a data processing task and a request for offloading a consensus computing task. Based on the status information, the first fog platform parameters allocated when the data processing task is offloaded to the fog computing platform, and the cloud platform parameters allocated when the data processing task is offloaded to the cloud computing platform, determining the first resource consumption amount and the resource reward and punishment value for executing the data processing task. Where the first resource consumption amount is the energy consumption cost required to execute the data processing task, and the resource reward and punishment value is the reward and punishment coefficient of the energy consumption cost of the cloud computing platform and / or the fog computing platform. Based on the status information and the second fog platform parameters allocated when the consensus computing task is offloaded to the fog computing platform, determining the second resource consumption amount for executing the consensus computing task. Determining a computing task offloading decision based on the first resource consumption amount, the resource reward and punishment value, and the second resource consumption amount. Executing the task offloading of the data processing task and / or the consensus computing task based on the computing task offloading decision.

[0006] Based on the above, it can be known that there are many node devices in the blockchain. During the execution of computing tasks, it is necessary to comprehensively consider whether the node devices in the blockchain can execute the corresponding computing tasks. If not, reasonable offloading of computing tasks needs to be considered. The computing tasks responsible for each node device include consensus computing tasks and data processing tasks. The corresponding resource consumption costs are calculated separately for data processing tasks and consensus computing tasks. Specifically, the first resource consumption, resource reward and punishment value are comprehensively calculated according to different offloading situations of data processing tasks, and the second resource consumption is calculated according to different offloading situations of consensus computing tasks. Finally, a computing task offloading decision with the lowest comprehensive cost is determined by integrating the first resource consumption, resource reward and punishment value, and the second resource consumption, so as to meet the computing task processing requirements without incurring too much cost.

[0007] According to at least one embodiment of the present disclosure, determine the first sub-resource consumption of the target node device for executing the data processing task based on the status information; determine the second sub-resource consumption of the fog computing platform for executing the data processing task based on the status information and fog computing platform parameters; determine the third sub-resource consumption of the cloud computing platform for executing the data processing task based on the status information and cloud computing platform parameters. Sum the first sub-resource consumption, the second sub-resource consumption, and the third sub-resource consumption to obtain the first resource consumption.

[0008] According to at least one embodiment of the present disclosure, determine the first task cycle of the data processing task; determine the local computing power and energy consumption unit price of the target node device; determine the first computing power energy consumption, first idle energy consumption, and first queuing duration of the target node device for executing the data processing task; use the first task cycle, local computing power, first computing power energy consumption, first idle energy consumption, first queuing duration, and energy consumption unit price to determine the first sub-resource consumption of the target node device for executing the data processing task.

[0009] According to at least one embodiment of the present disclosure, determine the first request cost for the target node device to request computing power from the fog computing platform and the first computing power level requested; determine the first task offloading resource consumption for offloading the data processing task to the fog computing platform based on the status information; determine the first execution resource consumption of the fog computing platform for executing the data processing task based on the first computing power level; determine the second sub-resource consumption of the fog computing platform for executing the data processing task based on the first request cost, the first task offloading resource consumption, and the first execution resource consumption.

[0010] Determine the second request cost for the target node device to request computing power from the cloud computing platform and the second computing power level obtained in at least one embodiment of the present disclosure; determine the second task offloading resource consumption when the data processing task is offloaded to the fog computing platform based on the status information; and determine the third task offloading resource consumption when the data processing task is offloaded from the fog computing platform to the cloud computing platform; determine the second execution resource consumption for the fog computing platform to execute the data processing task based on the second computing power level; determine the third sub-resource consumption for the cloud computing platform to execute the data processing task based on the second request cost, the second task offloading resource consumption, the third task offloading resource consumption, and the second execution resource consumption.

[0011] Determine the first latency threshold and the first queue threshold corresponding to the target node device, the second latency threshold and the second queue threshold corresponding to the fog computing platform, and the third latency threshold and the third queue threshold corresponding to the cloud computing platform in at least one embodiment of the present disclosure; use the status information, the first latency threshold, and the first queue threshold to determine the first reward and punishment value corresponding to the target node device; use the status information, the first fog platform parameter, the second latency threshold, and the second queue threshold to determine the second reward and punishment value corresponding to the fog computing platform; use the status information, the cloud platform parameter, the third latency threshold, and the third queue threshold to determine the third reward and punishment value corresponding to the cloud computing platform; predict the resource reward and punishment value using the first reward and punishment value, the second reward and punishment value, and the third reward and punishment value.

[0012] Determine the third request cost for the target node device to request computing power from the fog computing platform and the third computing power level obtained in at least one embodiment of the present disclosure; determine the consensus probability of the target node device based on the third computing power level and the overall computing power of the blockchain; predict the consensus computing return using the consensus computing reward value and the consensus probability; calculate the second resource consumption using the third request cost and the consensus computing return.

[0013] Allocate virtual coins to each node device including the target node device in the blockchain according to at least one embodiment of the present disclosure; wherein, the virtual coins are used to request computing power from the cloud computing platform or the fog computing platform, and different amounts of virtual coins request different computing power levels. The computing task offloading decision includes: the data processing task is executed in the target node device; or, the data processing task is offloaded to the fog computing platform for execution; or, the data processing task is offloaded to the cloud computing platform for execution; the target node device abandons the consensus computing task, or requests computing power from the fog computing platform using virtual coins and offloads it to the fog computing platform for consensus computing task execution; the target node device offloads the data processing task to the fog computing platform or the cloud computing platform, and offloads the consensus computing task to the fog computing platform.

[0014] According to at least one embodiment of the present disclosure, the first resource consumption amount, the resource reward and punishment value, and the second resource consumption amount are input into the first policy model, and the first probabilities corresponding to each computing task offloading policy are predicted; according to the magnitudes of the first probabilities, the task offloading decision corresponding to the target node device is determined.

[0015] According to at least one embodiment of the present disclosure, the training method of the first policy model includes: obtaining a training sample including the state information at the first moment, the computing task offloading policy corresponding to the first moment, the score at the first moment, and the state information at the second moment; using the state information at the second moment, the score at the first moment, and the computing task offloading policy corresponding to the first moment to input into the value model to be trained to generate a first loss function; using the state information at the first moment to input into the first policy model and the policy model to be trained simultaneously, and then outputting a probability difference to generate a second loss function; comprehensively using the first loss function and the second loss function to obtain a feedback function; and using the feedback function to train the value model to be trained and the policy model to be trained to respectively obtain a value model and a second policy model; copying and updating the model parameters in the trained second policy model to the first policy model.

[0016] According to a second aspect of the present disclosure, there is provided an electronic device, including: a memory storing execution instructions; and a processor that executes the execution instructions stored in the memory, so that the processor executes the first aspect of any one of the embodiments of the present disclosure.

[0017] According to a third aspect of the present disclosure, there is provided a readable storage medium storing execution instructions, and when the execution instructions are executed by a processor, they are used to implement the first aspect of any one of the embodiments of the present disclosure.

[0018] According to a fourth aspect of the present disclosure, there is provided a computer program product including a computer program, and when the computer program is executed by a processor, it implements the first aspect of any one of the embodiments of the present disclosure. Description of the Drawings

[0019] The drawings illustrate exemplary embodiments of the present disclosure and, together with the description thereof, are used to explain the principles of the present disclosure. These drawings are included to provide a further understanding of the present disclosure and are included in this specification and form a part of this specification.

[0020] Figure 1 It is a schematic flowchart of the computing task offloading method proposed by the present disclosure.

[0021] Figure 2 It is a schematic flowchart of the first resource consumption amount calculation provided by the present disclosure.

[0022] Figure 3Flow chart of the first sub-resource consumption provided by the present disclosure.

[0023] Figure 4 Flow chart of the second sub-resource consumption provided by the present disclosure.

[0024] Figure 5 Flow chart of the third sub-resource consumption provided by the present disclosure.

[0025] Figure 6 Flow chart of the method for calculating the second resource consumption provided by the present disclosure.

[0026] Figure 7 Schematic diagram of a model training method provided by the present disclosure.

[0027] Figure 8 Provided by the present disclosure Function curve graph.

[0028] Figure 9 Structural schematic block diagram of a computing task offloading device according to an embodiment of the present disclosure.

[0029] Figure 10 Structural schematic block diagram of an electronic device according to an embodiment of the present disclosure. Detailed implementation manners

[0030] The present disclosure will be further described in detail below with reference to the accompanying drawings and examples. It can be understood that the specific examples described herein are only used to explain the relevant content and do not limit the present disclosure. Additionally, it should be noted that for the convenience of description, only the parts related to the present disclosure are shown in the drawings.

[0031] It should be noted that, without conflict, the embodiments in the present disclosure and the features in the embodiments can be combined with each other. The technical solutions of the present disclosure will be described in detail below with reference to the accompanying drawings and embodiments.

[0032] In an Internet of Things (IoT) system incorporating a blockchain, there are node devices, fog computing platforms, and cloud computing platforms. Among them, the node devices serve as nodes participating in consensus computing in the blockchain. The node devices can be smart terminals (such as mobile phones, computers, and tablets), communication terminals (such as routers), etc. Compared with fog computing platforms and cloud computing platforms, the computing power of node devices is very limited and it is difficult to undertake complex and large-scale computing tasks. Although sometimes the node devices can execute data processing tasks or consensus computing tasks, it often takes a long time and cannot meet real-time requirements. At this time, consideration will be given to offloading the computing tasks to different platforms in the IoT system. For example, offloading the data processing tasks to the cloud computing platform or offloading the consensus computing tasks to the fog computing platform. Apparently, the problem of insufficient computing power seems to be solved. However, offloading computing tasks also incurs certain costs. That is to say, in an IoT environment integrating a blockchain, the blockchain consensus computing tasks and the data processing tasks generated by the node devices (IoT devices) themselves consume the computing resources of the system simultaneously. Due to their different characteristics, the two types of computing tasks cannot be simply lumped together. However, in the existing technologies, some only consider offloading the consensus computing tasks and ignore the impact of data processing tasks on the optimal allocation of resources. Or, only offload the data processing tasks to the fog server, ignoring the problem that the resources in the fog server are still limited. Therefore, a solution capable of achieving reasonable offloading of computing tasks is needed.

[0033] Term Explanation.

[0034] For the convenience of description and to make the technical solutions of the specific embodiments of the present disclosure easier to understand, before describing the data processing method implemented in the present disclosure, the technical terms involved in the specific embodiments of the present disclosure are explained as follows.

[0035] The Internet of Things (IoT) is a network that enables all ordinary physical objects that can be independently addressed to achieve interconnection and interoperability based on information carriers such as the Internet and traditional telecommunications networks. It has three important characteristics: deviceization of ordinary objects, interconnection of autonomous terminals, and intelligence of pervasive services.

[0036] Blockchain: It is a block-chain storage, tamper-proof, secure and trustworthy decentralized distributed ledger that combines technologies such as distributed storage, peer-to-peer transmission, consensus mechanism, and cryptography. It records transactions and information through a continuously growing data block chain (Blocks) to ensure the security and transparency of data.

[0037] Blockchain consensus computing: It refers to the process of solving complex mathematical problems or algorithms through a dedicated computing platform, verifying and processing transactions, and adding them to the blockchain public ledger to obtain cryptocurrency rewards. This process is decentralized, meaning that there is no single central agency to manage and review transactions, but rather it is jointly completed by participating node devices distributed everywhere.

[0038] Cloud computing: It is a type of distributed computing. It means decomposing huge data computing programs into countless small programs through the "cloud" network, and then processing and analyzing these small programs through a system composed of multiple servers to obtain results and return them to users. In the early stage of cloud computing, simply put, it was simple distributed computing, solving task distribution and merging calculation results. Therefore, cloud computing is also called grid computing. Through this technology, it is possible to complete the processing of tens of thousands of data within a very short time (a few seconds), thus achieving powerful network services.

[0039] Fog computing: Fog Computing, in this mode, data, (data) processing, and applications are concentrated in devices at the network edge, rather than almost all being stored in the cloud. It is an extended concept of Cloud Computing. It supports real-time interaction, lower latency, and lower energy consumption. It has lower bandwidth requirements and alleviates congestion caused when a large number of devices connect to the cloud.

[0040] Figure 1 This is a schematic flowchart of the computing task offloading method proposed in this disclosure. As Figure 1 shown, the method includes steps 101 to 105. Among them, this method can be executed by any node device (such as an electronic device like a local computer, tablet, mobile phone, camera, router, etc.) in the blockchain.

[0041] Specifically, Figure 1 the shown method includes step 101: In response to a computing offloading request sent by any target node device in the blockchain, obtain the status information of the target node device; among them, the computing offloading request includes: a request for offloading a data processing task and a request for offloading a consensus computing task.

[0042] There are many node devices in the blockchain. Here, the node device that will perform computing task offloading this time is called the target node device. In practical applications, multiple node devices in the blockchain can perform computing task offloading simultaneously, that is, there will be multiple target node devices in the blockchain at the same time.

[0043] The computing offloading decision refers to the strategy of offloading some or all of the computing tasks (including data processing tasks and consensus computing tasks) on the node device to the cloud computing platform or fog computing platform for computing. The purpose of this computing offloading decision is to reduce the computing burden of the node devices in the blockchain, improve the computing efficiency, ensure the real-time computing effect and improve the user experience.

[0044] The computing offloading requests mentioned here include: data processing task offloading requests and consensus computing task offloading requests. The data processing tasks mentioned here refer to the tasks that the node device itself needs to execute, such as encoding and decoding tasks, data routing tasks, etc. The consensus computing task is the consensus computing task that the target node device needs to participate in as a node in the blockchain, so as to complete the consensus accounting and ensure the security and reliability of the blockchain data.

[0045] When performing computing task offloading, it can be to offload both the data processing task and the consensus computing task to the corresponding fog computing platform and cloud computing platform at the same time, or offload them to one of the computing platforms at the same time, or offload the data processing task or the consensus computing task to the fog computing platform and / or cloud computing platform. The final computing task offloading method is determined according to the computing offloading decision. For specific details, please refer to the following embodiments and will not be repeated here.

[0046] The status information of the node device includes the first computing power of the target node device, the first task cycle when locally executing data processing tasks, the amount of virtual currency allocated, the maximum allowed delay, etc. For specific details, please refer to the subsequent embodiments.

[0047] Step 102: Based on the status information, the first fog platform parameters for offloading the data processing task to the fog computing platform, and the cloud platform parameters for offloading the data processing task to the cloud computing platform, determine the first resource consumption and resource reward and punishment value for executing the data processing task.

[0048] Both the first resource consumption and the resource reward and punishment value mentioned here are predicted based on the status information of the target node device and the platform parameters, rather than the resource consumption or resource cost generated after actual execution.

[0049] During the process of executing data processing task offloading, the data processing task may remain locally executed, may be offloaded to the fog computing platform (such as a virtual machine) for execution, or may be offloaded to the cloud computing platform for execution. It is necessary to consider in advance the energy consumption costs (that is, resource consumption and resource reward and punishment value) generated by each possible computing task offloading situation.

[0050] The resource reward and punishment value mentioned here refers to that when a data processing task can be successfully executed within the agreed time range and the data processing task is not rejected, it means that the data processing task can be smoothly executed, and a certain reward needs to be given to the computing platform (fog computing platform or cloud computing platform). This reward value can be a coefficient with the same unit as the energy consumption cost or a suitable constant. If the data processing task times out or is rejected for various reasons and the data processing task is not successfully executed, a certain penalty needs to be given to the computing platform (fog computing platform or cloud computing platform). This penalty value can be a coefficient with the same unit as the energy consumption cost or a suitable constant. Here, the reward and penalty are collectively referred to as the resource reward and punishment value.

[0051] The first resource consumption mentioned here refers to the energy consumption cost of completing the data processing task, including the energy consumption costs required for various devices (local devices, fog computing platform devices, cloud computing platform devices) to execute the data processing task, wait for the data processing task, and perform data transmission to complete the data processing task. The energy consumption mentioned here can usually be understood as electric energy. By formulating the energy consumption cost, various different types of data and costs at different stages are converted into energy consumption costs with a unified unit, so as to conveniently and reasonably obtain the comprehensive cost required to complete the computing task. Of course, the time cost spent can also be used as the energy consumption cost (of course, it can also be called the time cost or computing resource cost), including the execution duration, waiting duration, and data transmission duration of the data processing task.

[0052] The first fog platform parameters mentioned here include: the first computing power of the fog computing platform allocated for this data processing task, as well as the data transmission speed, data transmission power, etc. when the data processing task is offloaded to the fog computing platform.

[0053] The cloud platform parameters mentioned here include: the third computing power of the cloud computing platform allocated for this data processing task, as well as the data transmission speed, data transmission power, etc. when the data processing task is offloaded from the fog computing platform to the cloud computing platform. It should be noted here that when the data computing task is offloaded to the cloud computing platform, the data processing task needs to be first offloaded from the node device to the fog computing platform and then from the fog computing platform to the cloud computing platform. During the offloading process, a certain time cost and energy consumption cost will be incurred.

[0054] Step 103: Determine the second resource consumption for executing the consensus computing task based on the status information and the second fog platform parameters when the consensus computing task is offloaded to the fog computing platform.

[0055] In practical applications, since consensus computing tasks usually require a large amount of computing and have a high demand for computing power, while the node devices themselves often have limited computing power and are unable to handle consensus computing tasks. Therefore, the consensus computing tasks will be offloaded to the fog computing platform. However, they are usually not offloaded to the cloud computing platform. This is because data processing tasks require a certain time cost during the transmission process. If they are transmitted to the cloud computing platform, the time cost will be higher and it will take more time. The real-time requirement of consensus computing tasks is also higher than that of data processing tasks. Obviously, it is not suitable to offload consensus computing tasks to the cloud computing platform.

[0056] It should be noted that although node devices can offload consensus computing tasks to the fog computing platform, the computing power in the fog computing platform is also limited. In other words, it is not suitable to offload all computing tasks (consensus computing tasks) to the fog computing platform. The offloading resource consumption needs to be considered comprehensively.

[0057] The second resource consumption mentioned here can be understood as the energy consumption cost required to complete the consensus computing task. It includes the energy consumption cost of executing the computing task, the energy consumption cost of offloading the computing task, the energy consumption cost of transmitting data, the energy consumption cost of waiting, etc.

[0058] Step 104: Determine the computing task offloading decision based on the first resource consumption, resource reward and punishment value, and the second resource consumption.

[0059] As mentioned above, after calculating the three costs of the first resource consumption, resource reward and punishment value, and the second resource consumption, further, these three costs can be comprehensively considered to predict which computing task offloading strategy should be selected.

[0060] The computing task offloading strategies mentioned here include: when the target node device does not accept the consensus computing task, the data processing task is executed locally on the target node device. Or, when the target node device does not accept the consensus computing task, the data processing task is offloaded to the fog computing platform for execution. Or, when the target node device does not accept the consensus computing task, the data processing task is offloaded to the cloud computing platform for execution. If the target node device accepts the consensus computing task, then the consensus computing task can only be offloaded to the fog computing platform for execution, and at the same time, the data processing task is executed locally on the target node device. Or, the consensus computing task is offloaded to the fog computing platform, and at the same time, the data processing task is also offloaded to the fog computing platform. Or, the consensus computing task is offloaded to the fog computing platform, and at the same time, the data processing task is offloaded to the cloud computing platform. There are a total of the above 6 computing task offloading strategies, and in practical applications, one of the computing task offloading strategies will be selected according to the level of computing task costs (resource consumption, resource reward and punishment value).

[0061] Step 105: Based on the computing task offloading decision, perform task offloading for the data processing task and / or the consensus computing task.

[0062] As described above, after determining which computing task offloading strategy the target power-saving device should choose using the above method, the computing tasks in the target node device can be further offloaded accordingly, and then the corresponding computing tasks can be executed. When executing according to the computing task offloading strategy, it is possible to meet the computing power requirements of the data processing task and the consensus computing task while satisfying the real-time requirements of the consensus computing task at a lower cost.

[0063] Based on the above, there are many node devices in the blockchain. During the execution of computing tasks, it is necessary to comprehensively consider whether the node devices in the blockchain can execute the corresponding computing tasks. If not, reasonable offloading of computing tasks needs to be considered. The computing tasks responsible for each node device include consensus computing tasks and data processing tasks. Calculate the corresponding costs separately for the data processing task and the consensus computing task. Specifically, calculate the first resource consumption cost, resource reward and punishment value according to different offloading situations of the data processing task, and calculate the second resource consumption cost according to different offloading situations of the consensus computing task. Finally, determine a computing task offloading decision with the lowest comprehensive cost by integrating the first resource consumption, resource reward and punishment value, and the second resource consumption, so as to meet the computing task processing requirements without incurring too much cost.

[0064] It should be noted that the resource consumption mentioned here (including the first resource energy consumption cost and the second resource energy consumption cost) can be understood as the total energy consumption cost required to complete the computing tasks (including data processing tasks and consensus computing tasks) (including computing task execution energy consumption, waiting energy consumption, data transmission consumption, etc.), as well as the energy consumption cost required to request computing power from the cloud computing platform and the fog computing platform.

[0065] Next, the resource calculation process required during the computing task offloading process will be elaborated. In the following solution, the resource consumption of the data processing task (i.e., the energy consumption cost required for data processing), the resource reward and punishment value, and the resource consumption of the consensus computing task (i.e., the energy consumption cost required for consensus computing) will be calculated separately.

[0066] As Figure 2 is the schematic diagram of the first resource consumption calculation process provided by the present disclosure. From Figure 2As can be seen, based on the status information, the first fog platform parameters for offloading the data processing task to the fog computing platform, and the cloud platform parameters for offloading the data processing task to the cloud computing platform, the first resource consumption for executing the data processing task is determined, specifically including: Step 201: Determine the first sub-resource consumption of the target node device for executing the data processing task based on the status information. Step 202: Determine the second sub-resource consumption of the fog computing platform for executing the data processing task based on the status information and the fog computing platform parameters. Step 203: Determine the third sub-resource consumption of the cloud computing platform for executing the data processing task based on the status information and the cloud computing platform parameters. Step 204: Sum up the first sub-resource consumption, the second sub-resource consumption, and the third sub-resource consumption to obtain the first resource consumption.

[0067] The calculation processes of the above first sub-resource consumption, second sub-resource consumption, and third sub-resource consumption will be described in detail below.

[0068] As Figure 3 is a schematic flowchart of the first sub-resource consumption provided by the present disclosure. As can be seen from Figure 3 the specific steps for determining the first sub-resource consumption of the target node device for executing the data processing task based on the status information as described in Step 201 are as follows: Step 2011: Determine the first task cycle of the data processing task. Step 2012: Determine the local computing power and energy consumption unit price of the target node device. Step 2013: Determine the first computing power energy consumption, the first idle energy consumption, and the first queuing duration of the target node device for executing the data processing task. Step 2014: Use the first task cycle, the first computing power, the first computing power energy consumption, the first idle energy consumption, the first queuing duration, and the energy consumption unit price to determine the first sub-resource consumption of the target node device for executing the data processing task.

[0069] The first task cycle mentioned here can be understood as the time required for the target node device to complete the data processing task. Since different node devices have different computing powers and different data processing tasks have different task amounts, the corresponding first task cycles are also different. In other words, the first task cycle is related to both the node device computing power and the data processing task.

[0070] The energy consumption unit price mentioned here can be simply understood as the unit price of the electric energy consumed by the node device during operation. It should be noted that in the blockchain, each node device may be distributed across the country or around the world, and the electricity prices in different regions are different. Moreover, even the unit price of the electric energy in the same region may be dynamically changing, such as the tiered electricity price.

[0071] The local computing power that the target node device can provide can be understood as the maximum computing power that the target node device can provide for data processing tasks. The size of the local computing power is related to the calculation result of the subsequent first sub-resource consumption.

[0072] The first computing power energy consumption mentioned here can be understood as the rate of electrical energy consumption of the node device during operation, usually measured in watts (W) or kilowatts (kW). In the computing power scenario, the energy consumption mainly includes the total energy consumption of the CPU, GPU, ASIC chips, and other electronic components during operation.

[0073] In the target device node, there may be many computing tasks to be processed. These computing tasks will be executed in sequence one after another. That is to say, the computing tasks executed later need to wait for the computing tasks executed earlier. During the waiting period, not only does it occupy the execution time of the data processing task, but the node device also consumes electrical energy. Therefore, it is also necessary to count the first computing power energy consumption, the first idle energy consumption (that is, the energy consumption generated when the data processing task is waiting to be executed), and the first queuing duration (that is, the waiting time generated when the data processing task is waiting to be executed) of the target node device. The above first task cycle, local computing power, energy consumption unit price, first computing power energy consumption, first idle energy consumption, and first queuing duration can all be regarded as the status information of the target node device for executing data processing tasks. However, the status information is not limited to the several types mentioned above. It can be various. The status information of different computing tasks is different, and the status information of node devices in different regions is also different.

[0074] The following will illustrate the process of the target node device locally executing data processing tasks through specific embodiments.

[0075] When the data processing task is executed locally on the target computing node, if there are many tasks, it needs to queue and wait. The delay of the data processing task that needs to be counted includes: the computing delay of the data processing task and the delay of queuing and waiting in the task queue of the target computing node locally. Assume that the first task cycle required for the execution of data processing task i is C i , and the local computing power of the IoT device (that is, the target node device) is f i . The queuing and waiting time of the data processing task in the task queue of the target node locally is ( is the sum of the expected execution delays of all data processing tasks in the task queue), in other words, the more tasks that need to be executed in the queue, the longer the waiting time. Then the total delay of the local execution of data processing task i is:

[0076]

[0077] where 1 {Ω}It is an indicator function, that is, when the Ω condition is satisfied, the function value is 1, otherwise the function value is 0.

[0078] The resource consumption of the data processing task executed locally is the energy consumption cost generated during the calculation and queuing of the task. Assume that the energy required for a unit CPU cycle of the IoT device is The idle power of the device is The unit price of the energy consumption cost is Then the cost of local execution of task i (that is, the resource consumption) can be expressed by formula (2):

[0079]

[0080] In the above way, by using the status information of the target node device, the resource consumption required when the data processing task is executed locally can be comprehensively evaluated. During the execution process, the data processing task is often a computing task that the local target node device can handle. Moreover, the real-time requirements of the data processing task are not as strict as those of the consensus computing task. Therefore, the data processing task can be determined where to execute the task after comprehensive consideration.

[0081] Such as Figure 4 It is a schematic flow diagram of the second sub-resource consumption provided by the present disclosure. From Figure 4 It can be seen that, as in step 202, the second sub-resource consumption of the fog computing platform for executing the data processing task is determined based on the status information and the fog computing platform parameters, specifically including the steps: Step 2021: Determine the first request cost for the target node device to request computing power from the fog computing platform and the first computing power level requested. Step 2022: Determine the first task offloading resource consumption for offloading the data processing task to the fog computing platform based on the status information. Step 2023: Determine the first execution resource consumption for the fog computing platform to execute the data processing task based on the first computing power level. Step 2024: Determine the second sub-resource consumption of the fog computing platform for executing the data processing task based on the first request cost, the first task offloading resource consumption, and the first execution resource consumption.

[0082] Specifically, when calculating the second sub-resource consumption, it is assumed the cost required for executing the data processing task in the fog computing platform. It is easy to understand that although the resource consumption cost is calculated for the same data processing task when calculating the resource consumption, however, due to the different computing power of the target node device and the fog computing platform, generally the computing power of the fog computing platform is higher than that of the target node device, which means that the same computing task is processed faster in the fog computing platform.

[0083] Although the fog computing platform has higher computing power and can simultaneously process the computing tasks offloaded from multiple different node devices. However, the computing power of the fog computing platform still has an upper limit, that is, the fog computing platform can accept a limited number of computing tasks. In the fog computing platform, different levels of computing power are allocated to different computing tasks, so as to avoid waste of computing power while meeting the computing task requirements.

[0084] Therefore, in the present disclosure solution, the target node device needs to request corresponding computing power from the fog computing platform according to its own needs and capabilities to execute data processing tasks. The request cost mentioned here can be understood as the total power consumption required during the execution of the data processing task.

[0085] The request mentioned here can be understood as the target node device using the allocated virtual currency to exchange for corresponding computing power from the fog computing platform. Generally speaking, the higher the virtual currency that the target node device can pay, the greater the computing power of the fog computing platform that can be exchanged.

[0086] It should be noted that the cost of the fog computing platform mainly includes: execution resource consumption and offloading resource consumption (that is, the transmission cost during the offloading process).

[0087] When calculating the first task offloading resource consumption, it is necessary to know the first data transmission speed, the first data transmission power, the data size of the data processing task, and the unit price of energy consumption when the data processing task is offloaded to the fog computing platform. Thus, the first task offloading resource consumption can be comprehensively calculated.

[0088] When calculating the first execution resource consumption, the first computing power level requested, the first task cycle of the data processing task, and the data size of the data processing task are comprehensively considered. Generally speaking, the higher the first computing power level requested, the shorter the time to execute the data processing task of the same size. In addition, if there are more computing tasks to be executed in the fog computing platform, the data processing task needs to queue up and wait. During the waiting process, not only will the data processing task be delayed, but also there will be an energy consumption cost due to the idle energy consumption loss during the waiting process. Therefore, it is necessary to consider the second idle energy consumption generated after the data processing task is offloaded to the fog computing platform and the energy consumption cost generated by the second queuing duration.

[0089] Furthermore, by comprehensively using the first computing power level, the first task cycle, the data size, the first data transmission speed, the first data transmission power, the unit price of energy consumption, the second idle energy consumption and the second queuing duration, and the first request cost, the second sub-resource consumption of the data processing task offloaded to the fog computing platform is determined.

[0090] The resource consumption cost of offloading data processing tasks to a fog server will be described in detail through specific embodiments below.

[0091] The latency of offloading a data processing task to a fog computing platform for execution includes the uplink transmission latency of the data processing task from the target node device to the fog computing platform, the queuing latency of the data processing task in the task queue of the fog computing platform, the computing latency generated during the execution of the computing task by the fog computing platform, and the downlink transmission latency of returning the computing result from the fog computing platform to the target node device.

[0092] In practical applications, since the amount of data for returning the computing result of the data processing task is much smaller than the amount of data during upload of the data processing task, therefore, the downlink transmission latency of the task is usually not considered in relevant research on computing offloading. Assume that the data size of data processing task i is D i , the computing power of the δ i th level (i.e., the first computing power level mentioned above) requested by the user from the fog server is The transmission rate of wireless transmission between the target node device and the fog computing platform is r i , and the queuing time of the data processing task in the computing task queue of the fog computing platform is Then the latency of offloading data processing task i to the fog computing platform for execution is:

[0093]

[0094] The cost of offloading a data processing task to the fog computing platform for execution includes the energy consumption cost generated during the transmission, queuing, and computing of the data processing task, as well as the cost of requesting computing resources (i.e., virtual currency) from the fog computing platform. Let the first transmission power of the IoT device (i.e., the target node device mentioned above) be The first idle power is Then the energy consumption cost generated during offloading (i.e., the first task offloading resource consumption) is:

[0095]

[0096] The cost of the computing power of the δ i th level requested by the target node device can be expressed as:

[0097] Therefore, the second sub-resource consumption of offloading data processing task i to the fog computing platform for execution is as shown in Equation (5):

[0098]

[0099] Through the above, when offloading a data processing task to a target task, the first task offloading resource consumption, the first execution resource consumption, and the first request cost are comprehensively calculated, and finally the second sub-resource consumption is estimated.

[0100] As Figure 5 is a schematic flowchart of the third sub-resource consumption provided by the present disclosure. As Figure 5 can be seen, as in step 203, the third sub-resource consumption of the cloud computing platform for executing the data processing task is determined based on the status information and the cloud computing platform parameters, which specifically includes the following steps: Step 2031: Determine the second request cost for the target node device to request computing power from the cloud computing platform and the second computing power level obtained. Step 2032: Determine the second task offloading resource consumption for offloading the data processing task to the fog computing platform based on the status information; and determine the third task offloading resource consumption for offloading the data processing task from the fog computing platform to the cloud computing platform. Step 2033: Determine the second execution resource consumption of the fog computing platform for executing the data processing task based on the second computing power level. Step 2034: Determine the third sub-resource consumption of the cloud computing platform for executing the data processing task based on the second request cost, the second task offloading resource consumption, the third task offloading resource consumption, and the second execution resource consumption.

[0101] It should be noted that in the data transmission relationship, the distance between the fog computing platform and the node device is closer than the distance between the cloud computing platform and the node device. This means that in the process of data transmission and data offloading, the time taken to transmit the data processing task to the cloud computing platform is longer and the latency is greater than that of transmitting it to the fog computing platform. Therefore, for some data processing tasks with high real-time requirements, it is more suitable to execute them locally on the node device or in the fog computing platform.

[0102] Specifically, when calculating the third sub-resource consumption, it is the cost assumed when executing the data processing task in the cloud computing platform. It is easy to understand that although the cost calculation is for the same data processing task, due to the different computing power of the target node device and the cloud computing platform, generally the computing power of the cloud computing platform is higher than that of the target node device, which means that the same computing task can be processed faster in the cloud computing platform.

[0103] Although the cloud computing platform has higher computing power than the node device and can simultaneously process the computing tasks offloaded from multiple different node devices. However, the computing power of the cloud computing platform still has an upper limit, that is, the cloud computing platform can accept a limited number of computing tasks. In the cloud computing platform, different levels of computing power are allocated to different computing tasks, so that the computing power can meet the computing task requirements while avoiding waste of computing power.

[0104] Therefore, in the present disclosure solution, the target node device needs to request corresponding computing power from the cloud computing platform according to its own needs and capabilities to execute data processing tasks. The request cost mentioned here can be understood as the total power consumption required during the execution of data processing tasks.

[0105] The request mentioned here can be understood as the target node device using the allocated virtual currency to exchange for corresponding computing power from the cloud computing platform. Generally speaking, the higher the virtual currency that the target node device can pay, the greater the computing power of the cloud computing platform that can be exchanged.

[0106] It should be noted that since direct data transmission between the node device and the cloud computing platform is not possible and needs to be offloaded in two steps through the fog computing platform. The costs of the cloud computing platform mainly include: execution resource consumption and offloading resource consumption (that is, the transmission cost during the offloading process). Among them, the offloading resource consumption of the data processing task to the cloud computing platform includes two parts, one part is the second task offloading resource consumption of the data processing task to the fog computing platform, and the other part is the third task offloading resource consumption of the data processing task from the fog computing platform to the cloud computing platform.

[0107] Specifically, when calculating the second task offloading resource consumption and the third task offloading resource consumption, it is necessary to know the first data transmission speed, the first data transmission power, the data size of the data processing task, and the unit energy consumption price when the data processing task is offloaded to the fog computing platform. Thus, the second task offloading resource consumption can be comprehensively calculated. And, the third task offloading resource consumption is comprehensively calculated from the second data transmission speed, the second data transmission power, and the second data size when the data processing task is offloaded from the fog computing platform to the cloud computing platform.

[0108] When calculating the second execution resource consumption, the second computing power level requested, the first task cycle of the data processing task, and the data size of the data processing task are comprehensively considered. Generally speaking, the higher the second computing power level requested, the shorter the time to execute the data processing task of the same size. In addition, if there are more computing tasks to be executed in the cloud computing platform, this data processing task also needs to queue and wait. During the waiting process, not only will the data processing task be delayed, but also idle energy consumption losses will occur during the waiting process. Therefore, it is necessary to consider the third idle energy consumption and the third queuing duration generated after the data processing task is offloaded to the cloud computing platform.

[0109] Furthermore, comprehensively utilize the second computing power level, the first task cycle, the data size, the first data transmission speed, the first data transmission power, the second data transmission speed, the second data transmission power, the unit price of energy consumption, the third idle energy consumption, the third queuing duration, and the second request cost to determine the third sub-resource consumption of the data processing task unloaded to the cloud computing platform.

[0110] Next, the third sub-resource consumption of the data processing task unloaded to the cloud computing platform will be calculated through specific embodiments.

[0111] The latency for the data processing task to be unloaded to the cloud computing platform for execution includes: the transmission latency for the data processing task to be unloaded (i.e., transmitted) from the target node device to the fog computing platform and then to the cloud computing platform, and the latency generated during the execution of the computing task in the cloud computing platform. Let the computing power of the cloud computing platform (i.e., the second computing power level) be f c , and the transmission rate of wired fiber optic transmission be R. Then the latency for data processing task i to be unloaded to the cloud computing platform for execution is:

[0112]

[0113] The cost for the data processing task to be unloaded to the cloud computing platform for execution includes the energy consumption cost generated during the transmission and calculation of the data processing task, and the cost for requesting computing resources from the cloud computing platform. Among them, the energy consumption cost generated during unloading (i.e., the sum of the second task unloading resource consumption and the third task unloading resource consumption) is:

[0114]

[0115] The cost for the target node device to request computing resources from the cloud computing platform (i.e., the second request cost) is:

[0116]

[0117] Therefore, the third sub-resource consumption of data processing task i unloaded to the cloud computing platform for execution is shown in Equation (8):

[0118]

[0119] In practical applications, when it is necessary to unload the data processing task to the cloud computing platform, it is necessary to estimate the third sub-resource consumption. During the estimation process, fully consider the second task unloading resource consumption, the third task unloading resource consumption, and the second task execution resource consumption. Thus, a reasonable and comprehensive cost evaluation result can be obtained.

[0120] After calculating the first sub-resource consumption respectively through the above method the second sub-resource consumption and the consumption of the third sub-resource After that, the sum can be used to obtain the consumption of the first resource.

[0121] In one or more embodiments of the present application, based on the status information, the first fog platform parameters for offloading the data processing task to the fog computing platform, and the cloud platform parameters for offloading the data processing task to the cloud computing platform, determining the resource reward and punishment value for executing the data processing task includes: determining the first delay threshold and the first queue threshold corresponding to the target node device, the second delay threshold and the second queue threshold corresponding to the fog computing platform, and the third delay threshold and the third queue threshold corresponding to the cloud computing platform. Using the status information, the first delay threshold, and the first queue threshold to determine the first reward and punishment value corresponding to the target node device. Using the status information, the first fog platform parameters, the second delay threshold, and the second queue threshold to determine the second reward and punishment value corresponding to the fog computing platform. Using the status information, the cloud platform parameters, the third delay threshold, and the third queue threshold to determine the third reward and punishment value corresponding to the cloud computing platform. Predicting the resource reward and punishment value using the first reward and punishment value, the second reward and punishment value, and the third reward and punishment value.

[0122] In practical applications, in addition to considering the offloading resource consumption and execution resource consumption of the data processing task, it is also necessary to consider the impact caused by the untimely processing of the data processing task. Specifically, although the data processing task can meet the computing requirements through offloading, the fog computing platform and the cloud computing platform also need to process many computing tasks simultaneously. In this case, it may lead to serious delays in the data processing task and even fail to meet the timeliness requirements of the data processing task. For example, the maximum allowable time for a data processing task is 2 seconds, but after being offloaded to the cloud computing platform, due to the long queuing time, the calculation result is not feedback until 10 seconds later. Then this way of processing the data processing task is not desirable. Therefore, in order to effectively constrain the rationality of offloading the data processing task, a method of setting the resource reward and punishment value is adopted here. That is to say, when the delay of the data processing task exceeds the reasonable requirement, a penalty will be imposed on the executor of this task. On the contrary, if the delay is within the reasonable range, a reward will be given to the executor of this task. By reasonably setting the resource reward and punishment value, a suitable calculation task offloading decision is comprehensively calculated.

[0123] Specifically, to encourage more data processing tasks to be successfully executed, the present disclosure illustrates a reward and punishment mechanism by way of example. If the data processing task is successfully executed, the target node device will receive corresponding rewards; if the task fails to execute (that is, the delay seriously exceeds the time limit), the target node device will receive corresponding penalties.

[0124] For data processing tasks executed locally (i.e., in the target node device) and in the fog computing platform, they are queued in a task queue of finite length according to the first-in-first-out rule. If the task queue is full, newly incoming data processing tasks will be directly rejected, which is regarded as the failure of the execution of the data processing task. In addition, each data processing task is assigned a different maximum allowable processing delay. If the total processing delay of the data processing task exceeds the maximum allowable processing delay of the data processing task, the data processing task is also regarded as a failed execution. Denote the penalty for the failure of executing the data processing task locally as Denote the penalty for the failure of offloading and executing on the fog computing platform as Denote the penalty for the failure of offloading and executing on the cloud server as Then the penalty for the failure of task i execution is shown in Equation (9):

[0125]

[0126] where p is the penalty size for task execution failure, τ i is the maximum allowable processing delay of task i, q i is the length of the current local task queue, is the maximum length of the local task queue, q f is the length of the task queue in the current fog computing platform, is the maximum length of the task queue in the fog computing platform.

[0127] If the data processing task is executed successfully, the user will get corresponding rewards. In this paper, different reward values v i are set for different tasks. Then the reward for the successful execution of task i is shown in Equation (10):

[0128]

[0129] Based on the above calculation methods of penalty costs and reward values, they are comprehensively called resource reward and penalty values.

[0130] Through the various embodiments in the foregoing, the processing costs (i.e., resource consumption amounts) of computing tasks under various offloading decisions of data processing tasks are described in detail. In the following embodiments, a cost prediction scheme related to consensus computing tasks will be described in detail.

[0131] As Figure 6 is a schematic flowchart of the second resource consumption amount calculation method provided by the present disclosure. From Figure 6As can be seen, based on the status information and the second fog platform parameters for offloading the consensus computing task to the fog computing platform, the second resource consumption for executing the consensus computing task is determined. Specifically, it includes the following steps: Step 601: Determine the third request cost for the target node device to request computing power from the fog computing platform and the third computing power level obtained. Step 602: Based on the third computing power level and the overall computing power of the blockchain, determine the consensus probability of the target node device. Step 603: Use the consensus computing reward value and the consensus probability to predict the consensus computing return. Step 604: Calculate the second resource consumption using the third request cost and the consensus computing return.

[0132] It should be noted here that when executing the consensus computing task, since each node device needs to calculate very complex mathematical problems, it means that a large amount of computing power is required to successfully obtain the accounting right. And the node devices generally do not have very strong computing power. Therefore, the consensus computing task cannot be executed by the node devices in the blockchain. The cloud computing platform, although having better computing power than the node devices, however, due to the long distance between the cloud computing platform and the node devices, more computing task offloading time is required when performing computing task offloading, and it is difficult to meet the real-time requirements of the consensus computing task. Therefore, only the fog computing platform can meet the computing power and timeliness requirements of the computing task at the same time. Of course, the node device can also choose to abandon this consensus computing task.

[0133] Next, the implementation method of the consensus computing task will be described in detail through specific embodiments.

[0134] As a user of the blockchain node device, there is the right to choose whether to participate in the consensus computing. If the user decides to participate in the consensus computing, the node device needs to pay virtual currency for requesting hash computing power to the fog computing platform. When the balance of the target node device is insufficient, it cannot request computing power and thus cannot participate in the consensus computing task. At the same time, when the blockchain network reaches a consensus, the node devices participating in the consensus computing will obtain corresponding consensus computing returns.

[0135] The method for predicting the consensus computing return is as follows: If the user decides to execute the consensus computing task, the target node device needs to perform a large number of hash calculations to compete for the accounting right. Assume that the hash computing power of the m i th level requested by the target node device i is ( which determines how many hash calculations are performed per second), and the total sum of the hash computing power of the entire blockchain network is H. Then, the relative hash computing power λi of the target node device i in the blockchain network can be expressed by formula (11). Generally, it is considered that the greater the λi, the greater the probability of reaching a consensus, which means that the target node device has a higher probability of competing for the accounting right and obtaining the corresponding consensus computing return.

[0136]

[0137] The blockchain system adopts the "principle of following the longest chain". That is, when a fork occurs in the blockchain, only the longest chain will be retained as the main chain, and the blocks not on the main chain will be discarded and become "orphan blocks". The reasons for the generation of orphan blocks may be that the block is discovered relatively late or the propagation time in the network is relatively long. Although orphan blocks are also legitimate, the node device that packages the block will not receive a reward (i.e., the consensus computing reward). According to the literature, the probability that a block becomes an orphan block during propagation is where α is a constant, s i represents the size of the block packaged by the user, and φ(s i ) represents a function of the block size. Assuming that the reward given by the blockchain network to the node device after reaching a consensus is Y, the consensus computing reward of node device i can be expressed by formula (12):

[0138]

[0139] The calculation method of the second resource consumption is as follows: Since the node devices in the blockchain network are IoT devices with relatively low computing power, they can only request computing resources (i.e., the computing power of the third computing power level for consensus computing) from the fog computing platform to participate in the execution of the consensus computing task. When the target node device i requests the m i -th level of hash computing power, the cost to be paid is:

[0140]

[0141] In summary, considering the consensus computing reward and the third request cost, the profit of the target node i for executing the consensus computing task can be obtained as:

[0142]

[0143] When predicting the cost of the consensus computing task, the rewards brought by the consensus computing and the request costs paid therefor will be fully considered, and then the consensus computing profit will be comprehensively calculated. In this way, the node device can decide whether to strive for this consensus computing task according to its actual virtual currency balance. Generally speaking, when the virtual currency balance of the node device is insufficient, it cannot request enough computing power, and even if it participates in the consensus computing, it cannot obtain the bookkeeping right and the consensus computing reward. In this case, it will not continue to compete for the consensus computing task. On the contrary, if the balance is sufficient and enough computing power can be requested, it will participate in the consensus computing task. However, it needs to be considered that if the request cost for requesting computing power is much greater than the consensus computing reward, the node device will consider giving up this consensus computing task.

[0144] In one or more embodiments of the present application, before obtaining the status information of the target node device, it further includes: allocating virtual coins to each node device including the target node device in the blockchain; wherein, the virtual coins are used to request computing power from the cloud computing platform or the fog computing platform, and different amounts of virtual coins request different levels of computing power.

[0145] The following will illustrate the related solutions for virtual coin allocation and using virtual coins to request computing power through specific embodiments.

[0146] The computing resource request scheme for data processing tasks is as follows: Here, it is assumed that the local computing power of IoT devices cannot meet the requirements of data processing tasks. A solution is proposed to request computing resources (i.e., computing power) from the fog computing platform or the cloud computing platform to offload the data processing tasks of node devices. To meet different computing task requirements, the present disclosure designs to divide the virtual machines used to execute data processing tasks in the fog computing platform into k levels, and the size of the computing power level is expressed as The prices corresponding to each computing power level are expressed as At the same time, it is assumed that the computing resources of the cloud computing platform are unlimited, and the computing power allocated to each data processing task is f c , and the price is p c .

[0147] To facilitate subsequent mathematical modeling, the definition of the offloading decision for data processing tasks is given here.

[0148] Assume that the offloading decision Δ for data processing tasks: The present disclosure represents the offloading decision vector of all node device data processing tasks as Δ = {δ1, δ2,..., δ I}}. Among them, the offloading decision for data processing task i (i ∈ I) is δ i ∈ {-1, 0, 1, 2,..., k}. When δ i = 0, it means that the task only needs to be calculated locally; when δ i ∈ {1, 2,..., k}, it means that the task needs to be offloaded to the fog server for execution and requests the computing resources of level δ i ; when δ i = -1, it means that the task needs to be offloaded to the cloud server for execution.

[0149] The computing resource request plan for the consensus computing task is as follows: The consensus computing process requires a huge amount of hash calculations, and the local computing resources of IoT devices are very limited, so this process cannot be completed locally. In addition, since the consensus computing task is a process for blockchain nodes to compete for the right to record accounts, only the first node device to obtain the calculation result will receive the consensus computing reward. Therefore, this task has high requirements for latency, and the cloud computing platform is far from the node device and cannot meet the latency requirements. Therefore, if a user considers participating in the execution of the consensus computing task, they can only choose to offload the consensus computing task to the fog computing platform. To meet the needs of users with different account balances, this disclosure designs to divide the virtual machines used to execute the consensus computing task in the fog computing platform into j levels, and its computing power is expressed as The corresponding price is expressed as

[0150] To facilitate subsequent mathematical modeling, the offloading decision definition of the consensus computing task is given here.

[0151] The offloading decision M of the consensus computing task: In the solution of this disclosure, the offloading decision vector of all users executing the consensus computing task is expressed as M = {m1, m2,..., m I}. Among them, the offloading decision of the target node device i (i ∈ I) is m i ∈ {0, 1, 2,..., j}. When m i = 0, it means that this target computing node does not need to execute the consensus computing task in this round; when m i ∈ {1, 2,..., j}, it means that this target computing node will participate in the consensus computing task as a node device and request the computing resources of the m i th level from the fog computing platform.

[0152] The computing task offloading decisions mentioned above include three types: First, the data processing task is executed in the target node device; or, the data processing task is offloaded to the fog computing platform for execution; or, the data processing task is offloaded to the cloud computing platform for execution.

[0153] Second, the target node device abandons the consensus computing task, or requests computing power from the fog computing platform using virtual currency and offloads it to the fog computing platform to execute the consensus computing task.

[0154] Third, the target node device offloads the data processing task to the fog computing platform or the cloud computing platform, and moreover, offloads the consensus computing task to the fog computing platform.

[0155] In this solution, the total cost of resource consumption for user i to perform computing offloading consists of two parts: the cost of executing the data processing task and the revenue of executing the consensus computing task. Among them, the cost for executing the data processing task includes the cost of the task being executed locally (That is, the first sub-resource consumption), the cost of offloading the task to the fog server for execution (The second sub-resource consumption), the cost of offloading the task to the cloud server for execution (The third sub-resource consumption), the reward V for successful task execution i And the penalty P for failed task execution i (The reward and penalty, that is, the resource reward and penalty value); the revenue for participating in the consensus calculation task is expressed as (The second resource consumption). Therefore, the total resource consumption cost for user i to perform the two types of task calculations and offloading in the current time slot can be obtained:

[0156]

[0157] Then the total resource consumption cost for all users to perform calculation offloading can be expressed as:

[0158]

[0159] The optimization goal of this disclosure is to minimize the total resource consumption cost C for all node devices to perform calculation offloading within a period of time all . In the current time slot, the problem of minimizing the total resource consumption cost of users with the offloading decisions Δ of data processing tasks and the offloading decisions M of consensus calculation tasks as variables can be formulated as Equation (17):

[0160]

[0161] In the above formula, Δ = {δ1, δ2,..., δ I} represents the offloading decision vector for all node devices to perform data processing tasks, and M = {m1, m2,..., m I} represents the offloading decision vector for all node devices to perform consensus calculation tasks. The constraint condition C1 restricts that the data processing task can only be selected to be executed locally on the node device (δ i = 0), or offloaded to the fog computing platform for execution (δ i ∈ {1, 2,..., k}) and request the computing resources of the δ i -th level, or offloaded to the cloud computing platform for execution (δ i = -1).

[0162] The constraint condition C2 restricts that the node device can choose not to participate in the consensus calculation task (m i = 0), or participate in the consensus calculation task (m i ∈ {1, 2,..., j}) and request the computing resources of the m i -th level.

[0163] The constraint condition C3 indicates that the cost paid by the node device i for executing two types of computing offloading tasks is less than the current account balance b i 。

[0164] In summary, the above optimization problem (formula (17)) can be solved by solving the optimal values of the offloading decision vector Δ of the data processing tasks and the offloading decision vector M of the consensus computing tasks executed by all node devices. Obviously, since the offloading decision vector is an integer variable within a certain range, the above optimization problem is a non-convex optimization problem and can be solved using traditional algorithms.

[0165] Of course, in order to improve the solution speed, the deep reinforcement learning PPO algorithm (that is, the first policy model mentioned below) can also be selected to solve the above optimization problem.

[0166] Specifically, determining the computing task offloading decision based on the first resource consumption, resource reward and punishment value, and the second resource consumption includes: inputting the first resource consumption, resource reward and punishment value, and the second resource consumption into the first policy model to predict the first probability corresponding to each computing task offloading strategy; determining the task offloading decision corresponding to the target node device according to the magnitude of the first probability.

[0167] The reward in reinforcement learning represents the feedback given by the environment to the Agent at a certain time slot t according to the state S t after taking the action A t The ultimate goal of reinforcement learning is to maximize the cumulative reward obtained by the Agent. Therefore, the reward function generally needs to be related to the optimization goal. The optimization goal of this solution is to minimize the total resource consumption cost C of all users for executing data processing tasks and consensus computing task offloading all 。Therefore, the designed reward function should be negatively correlated with the optimization objective function. Therefore, the reward function of the deep reinforcement learning provided in this disclosure is defined as formula (18):

[0168]

[0169] Among them, the state S in the above formula (18) t includes the first resource consumption, resource reward and punishment value, and the second resource consumption. The action A t is the executed computing offloading decision. The calculation result R of formula (18) t represents the first probability.

[0170] The first policy model PPO is a deep reinforcement learning algorithm based on the Actor-Critic framework. Since the traditional Actor-Critic algorithm is an on-policy algorithm, that is, the policy network (Actor network) to be learned and the policy network (Actor network) interacting with the environment are the same, it is impossible to utilize the experience obtained from interacting with the environment at other times, making the training process very time-consuming. Therefore, in this disclosure solution, the importance sampling theorem is borrowed in the PPO algorithm, enabling the policy network (Actor network) to reuse the sampled data, thus greatly improving the learning efficiency of the model.

[0171] Such as Figure 7 It is a schematic diagram of a model training method provided by this disclosure. In the training process diagram of the PPO-based computing offloading algorithm designed by this disclosure, the policy network (Actor network) is used to enable the Agent to make offloading decisions for data processing tasks and consensus computing tasks. Its input is the state variables in the current IoT system deploying the blockchain, and the output is a probability density function, which represents the probability of the Agent executing different offloading decisions. The value network (Critic network, that is, the value model mentioned above) is used to reflect the quality of the current time slot system state. Its input is still the state variables in the current IoT system deploying the blockchain, and the output is a score for the current system state (a definite value), which can also be said to be an estimate of the cumulative reward that may be obtained in the future.

[0172] Theoretically, since the Actor network and the Critic network have different functions, the Actor network is used to guide the Agent to take actions, and the Critic network is used to evaluate the quality of the current state. Therefore, two different neural networks should be set up. However, since the two networks in the solution proposed in this disclosure input the same data, that is, the current environmental state and system variables. Therefore, this disclosure adopts the idea of "parameter sharing" and uses a deep neural network to construct the Actor network and the Critic network, thereby improving the convergence speed of the neural network and the performance of the system. In the output layer of the neural network, the Actor network outputs the probability distribution of two task offloading decisions, so the Softmax activation function is set; the Critic network outputs the evaluation of the current state, which is a definite value, so the Tanh activation function is set.

[0173] The training method of the first policy model specifically includes the following steps: Obtain training samples including the state information at the first moment, the computing task offloading policy corresponding to the first moment, the score at the first moment, and the state information at the second moment. Input the state information at the second moment, the score at the first moment, and the computing task offloading policy corresponding to the first moment into the value model to be trained to generate the first loss function. Input the state information at the first moment into both the first policy model and the policy model to be trained, and then output the probability difference to generate the second loss function. Synthesize the first loss function and the second loss function to obtain the feedback function. Use the feedback function to train the value model to be trained and the policy model to be trained, and obtain the value model and the second policy model respectively. Copy and update the model parameters in the trained second policy model to the first policy model.

[0174] According to the relevant knowledge of probability theory, if the probability distribution of the random variable x is represented as p1(x), then the expected value of x~p1(x) can be approximately calculated by sampling the probability distribution at N points, as shown in the following formula:

[0175]

[0176] The importance sampling theorem states that when it is very difficult to directly sample the probability distribution that x follows, it is possible to consider sampling another probability distribution p2(x) at N points, and then indirectly calculate the expected value of x~p1(x) through the importance sampling parameter p1(x) / p2(x), as shown in formula (20):

[0177]

[0178] The present disclosure scheme draws on the above idea and designs two Actor networks for training on the basis of the Actor-Critic framework, as Figure 7 shown. One is the Actor new network (the second policy model with parameters θ), and the other is the Actor old network (the first policy model with parameters θ old . Let the old network (the first policy model) be used to interact with the environment, and let the new network (the second policy model) be used for training and learning. The advantage of doing this is that the data collected by the old network can also be used to update the parameters of the Actor new network, without having to collect new data for training every time the network parameters are updated, thus improving the data utilization rate and learning efficiency.

[0179] The present disclosure defines the state of the system at time slot t as S t , the action as A t (offloading policy), and the reward value as R t .

[0180] Both the Actor new network and the Actor old network use deep neural networks to approximate the policy function, helping the Agent obtain the optimal offloading decision action. Their policy functions are respectively expressed as:

[0181] π θ = P[A t |S t ; θ] (21)

[0182]

[0183] Among them, P[...] represents the probability density function of the input system state S t , with the output action being A t . θ represents the parameters of the Actor new network, and θ old represents the parameters of the Actor old network.

[0184] The value function in the Critic network (i.e., the value model) is used to evaluate the quality of the policy and can be approximately represented by a deep neural network as:

[0185]

[0186] Since the importance sampling idea borrowed in the design of the Actor network has the problem of unequal expected values of the probability distribution when the number of samples is small, a clip function is introduced in the algorithm to limit the change amplitude of the policy function. In addition, to enable the value network and the policy network to share a deep neural network model for training, an entropy gain S(π θ ,S t ) is added in the design of the loss function. Therefore, the loss function of the PPO algorithm can be expressed as the following formula:

[0187]

[0188] In formula (24), E t [...] represents the average experience obtained from several samplings, and β1 and β2 represent weight parameters. The mathematical representations of each part in the above formula are as follows:

[0189] represents the loss function of the value network and can be specifically expressed as:

[0190]

[0191] represents the loss function of the policy network and can be specifically expressed as:

[0192]

[0193] In the above formula, gt $(θ)$ represents the importance sampling parameter, which determines the importance of the new action by the ratio of the probability distributions of the old and new action policies. Specifically, it can be expressed as:

[0194]

[0195] A t represents the Advantage function. In this paper, the expression of its generalized advantage estimation is selected, and it can be specifically expressed as:

[0196]

[0197] The above expression adopts the Temporal-Difference (TD) idea. Among them, δ t = R t + γV θ (S t+1 ) - V θ (S t ) is the TD error, and λ is the weight parameter for modifying the bias and variance.

[0198] clip represents the truncation function, whose role is to limit the amplitude of the new policy update. ε represents the truncation hyperparameter. clip(g t (θ), 1 - ε, 1 + ε) means that when the independent variable g t (θ) is less than 1 + ε or greater than 1 - ε, the function value is g t (θ); when g t (θ) is greater than 1 + ε, the function value is 1 + ε; when g t (θ) is less than 1 - ε, the function value is 1 - ε. It can be divided into two cases where the Advantage value is positive and negative. For example, Figure 8 is the function curve graph provided by this disclosure.

[0199] S(π θ , S t ) represents the entropy gain of the action policy. To prevent the probability distribution of the action from being too dispersed, it is required that the value of the entropy gain cannot be too large; at the same time, to make the action policy have a certain degree of exploration, it is required that the value of the entropy gain cannot be too small to avoid falling into local optima.

[0200] After calculating the loss function , this paper selects the Gradient Ascent method mentioned in the first chapter to update the neural network parameter θ. By continuously optimizing the neural network, the optimal offloading decisions for the two tasks are finally obtained.

[0201] Based on any of the above embodiments, the present disclosure also provides a computing task offloading device.

[0202] Figure 9 It is a structural schematic block diagram of a computing task offloading device according to an embodiment of the present disclosure. As Figure 9 shown, the computing task offloading device includes: an acquisition module 91, configured to acquire the status information of the target node device in response to a computing offloading request sent by any target node device in the blockchain; wherein, the computing offloading request includes: a request for offloading a data processing task and a request for offloading a consensus computing task.

[0203] A prediction module 92, configured to determine a first resource consumption amount and a resource reward and punishment value for executing the data processing task based on the status information, first fog platform parameters allocated when the data processing task is offloaded to the fog computing platform, and cloud platform parameters allocated when the data processing task is offloaded to the cloud computing platform.

[0204] The prediction module 92 is further configured to determine a second resource consumption amount for executing the consensus computing task based on the status information and second fog platform parameters allocated when the consensus computing task is offloaded to the fog computing platform.

[0205] A determination module 93, configured to determine a computing task offloading decision based on the first resource consumption amount, the resource reward and punishment value, and the second resource consumption amount.

[0206] An execution module 94, configured to execute the task offloading of the data processing task and / or the consensus computing task based on the computing task offloading decision.

[0207] The prediction module 92 is further configured to determine a first sub-resource consumption amount of the target node device for executing the data processing task based on the status information; determine a second sub-resource consumption amount of the fog computing platform for executing the data processing task based on the status information and the fog computing platform parameters; determine a third sub-resource consumption amount of the cloud computing platform for executing the data processing task based on the status information and the cloud computing platform parameters. The first resource consumption amount is obtained by summing the first sub-resource consumption amount, the second sub-resource consumption amount, and the third sub-resource consumption amount.

[0208] The prediction module 92 is further configured to determine a first task cycle of the data processing task; determine the local computing power and energy consumption unit price of the target node device; determine the first computing power energy consumption, the first idle energy consumption, and the first queuing duration of the target node device for executing the data processing task; and use the first task cycle, the local computing power, the first computing power energy consumption, the first idle energy consumption, the first queuing duration, and the energy consumption unit price to determine the first sub-resource consumption amount of the target node device for executing the data processing task.

[0209] The prediction module 92 is further configured to determine a first request cost for the target node device to request computing power from the fog computing platform and a first computing power level requested; determine a first task offloading resource consumption for offloading the data processing task to the fog computing platform based on the status information; determine a first execution resource consumption for the fog computing platform to execute the data processing task based on the first computing power level; and determine a second sub-resource consumption for the fog computing platform to execute the data processing task based on the first request cost, the first task offloading resource consumption, and the first execution resource consumption.

[0210] The prediction module 92 is further configured to determine a second request cost for the target node device to request computing power from the cloud computing platform and a second computing power level requested; determine a second task offloading resource consumption for offloading the data processing task to the fog computing platform based on the status information; and determine a third task offloading resource consumption for offloading the data processing task from the fog computing platform to the cloud computing platform; determine a second execution resource consumption for the fog computing platform to execute the data processing task based on the second computing power level; and determine a third sub-resource consumption for the cloud computing platform to execute the data processing task based on the second request cost, the second task offloading resource consumption, the third task offloading resource consumption, and the second execution resource consumption.

[0211] The prediction module 92 is further configured to determine a first delay threshold and a first queue threshold corresponding to the target node device, a second delay threshold and a second queue threshold corresponding to the fog computing platform, and a third delay threshold and a third queue threshold corresponding to the cloud computing platform; determine a first reward and punishment value corresponding to the target node device by using the status information, the first delay threshold, and the first queue threshold; determine a second reward and punishment value corresponding to the fog computing platform by using the status information, the first fog platform parameter, the second delay threshold, and the second queue threshold; determine a third reward and punishment value corresponding to the cloud computing platform by using the status information, the cloud platform parameter, the third delay threshold, and the third queue threshold; and predict a resource reward and punishment value by using the first reward and punishment value, the second reward and punishment value, and the third reward and punishment value.

[0212] The prediction module 92 is further configured to determine a third request cost for the target node device to request computing power from the fog computing platform and a third computing power level requested; determine the consensus probability of the target node device based on the third computing power level and the overall computing power of the blockchain; predict the consensus computing return by using the consensus computing reward value and the consensus probability; and calculate a second resource consumption by using the third request cost and the consensus computing return.

[0213] Optionally, it further includes an allocation module 95 for allocating virtual coins to each node device including the target node device in the blockchain; wherein, the virtual coins are used to request computing power from a cloud computing platform or a fog computing platform, and different amounts of virtual coins can request different levels of computing power. Among them, the computing task offloading decision includes: the data processing task is executed in the target node device; or, the data processing task is offloaded to the fog computing platform for execution; or, the data processing task is offloaded to the cloud computing platform for execution; the target node device abandons the consensus computing task, or requests computing power from the fog computing platform using virtual coins and offloads the consensus computing task to the fog computing platform for execution; the target node device offloads the data processing task to the fog computing platform or the cloud computing platform, and moreover, offloads the consensus computing task to the fog computing platform.

[0214] A prediction module 92 is configured to input the first resource consumption, the resource reward and punishment value, and the second resource consumption into a first policy model, and predict the first probability corresponding to each computing task offloading strategy; according to the magnitude of the first probability, determine the task offloading decision corresponding to the target node device.

[0215] Optionally, it further includes a model training module 96 for training the first policy model, specifically including: obtaining a training sample including the state information at the first moment, the computing task offloading strategy corresponding to the first moment and the score at the first moment, and the state information at the second moment. Using the state information at the second moment, the score at the first moment, and the computing task offloading strategy corresponding to the first moment to input into the value model to be trained, generate a first loss function. Using the state information at the first moment to input into the first policy model and the policy model to be trained simultaneously, and generate a second loss function based on the probability difference output. Synthesize the first loss function and the second loss function to obtain a feedback function. And use the feedback function to train the value model to be trained and the policy model to be trained, respectively obtain the value model and the second policy model. Copy and update the model parameters in the trained second policy model to the first policy model.

[0216] The implementation processes of the functions and roles of each module in the above device are specifically detailed in the implementation processes of the corresponding steps in the above method, and will not be elaborated here.

[0217] The execution subject of the data processing method in the specific implementation manner of the present disclosure may be an electronic device such as a server (including a local server or a cloud computing platform).

[0218] Therefore, based on any one of the above embodiments, the present disclosure further provides an electronic device, and this electronic device can execute the data processing method of any one of the above embodiments described in the present disclosure.

[0219] Figure 10 It is a structural schematic diagram of an electronic device according to an embodiment of the present disclosure.

[0220] The hardware structure of the electronic device 1000 can be implemented using a bus architecture. The bus architecture can include any number of interconnecting buses and bridges, depending on the specific application of the hardware and the overall design constraints. The bus 1100 connects various circuits including one or more processors 1200, a memory 1300, and / or hardware modules together. The bus 1100 can also connect various other circuits 1400 such as peripheral devices, voltage regulators, power management circuits, external antennas, etc.

[0221] The bus 1100 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Component (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, only one connecting line is shown in this figure, but it does not mean that there is only one bus or one type of bus.

[0222] The present disclosure also provides a readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, it is used to implement the above method. The "readable storage medium" can be any device that can contain, store, communicate, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. More specific examples of the readable storage medium include the following: an electrical connection part with one or more wirings (electronic device), a portable computer disk cartridge (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable read-only memory (CDROM), etc.

[0223] The present disclosure also provides a computer program product. The method of the present disclosure can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed, the processes or functions of the present disclosure are executed in whole or in part.

[0224] Computer programs or instructions can be stored in a readable storage medium or transmitted from one readable storage medium to another. For example, the computer programs or instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center in a wired or wireless manner. The readable storage medium can be any available medium that can be accessed or a data storage device such as a server or data center integrating one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; it can also be an optical medium, such as a digital video disc; or it can be a semiconductor medium, such as a solid-state drive. The computer-readable storage medium can be a volatile or non-volatile storage medium, or can include both volatile and non-volatile types of storage media.

[0225] Those skilled in the art should understand that the embodiments of the present disclosure can be provided as a method, system, or computer program product. Therefore, the present disclosure can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present disclosure can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0226] The present disclosure is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to the present disclosure. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing device generate means for implementing the functions specified in Figure 1 one or more of the flows Figure 1 or blocks or combinations of blocks.

[0227] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the functions specified in Figure 1 one or more of the flows Figure 1 or blocks or combinations of blocks.

[0228] These computer program instructions can also be loaded onto a computer or other programmable data processing apparatus, so that a series of operation steps are performed on the computer or other programmable apparatus to produce a computer-implemented process, and thus the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions specified in one process or a plurality of processes and / or boxes. Figure 1 one process or a plurality of processes and / or boxes Figure 1 steps for implementing the functions specified in one box or a plurality of boxes.

[0229] In the description of this specification, the descriptions with reference to the terms "one embodiment / way", "some embodiments / ways", "example", "specific example", or "some examples", etc. mean that the specific features, structures, or characteristics described in connection with the embodiment / way or example are included in at least one embodiment / way or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment / way or example. Moreover, the specific features, structures, or characteristics described can be combined in any one or more embodiments / ways or examples in a suitable manner. In addition, without conflict, those skilled in the art can combine and combine the different embodiments / ways or examples described in this specification and the features of different embodiments / ways or examples.

[0230] In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, "a plurality of" means at least two, such as two, three, etc., unless otherwise specifically and clearly defined.

[0231] Those skilled in the art should understand that the above embodiments are only for clearly explaining the present disclosure and are not intended to limit the scope of the present disclosure. For those skilled in the art, other changes or variations can be made on the basis of the above disclosure, and these changes or variations are still within the scope of the present disclosure.

Claims

1. A computing task offloading method, characterized in that, The method includes: In response to a computing offloading request sent by any target node device in the blockchain, obtaining the status information of the target node device; wherein, the computing offloading request includes: a request for offloading a data processing task and a request for offloading a consensus computing task; Based on the status information, the first fog platform parameters allocated when the data processing task is offloaded to the fog computing platform, and the cloud platform parameters allocated when the data processing task is offloaded to the cloud computing platform, determining the first resource consumption and the resource reward and punishment value for executing the data processing task; wherein, the first resource consumption is the energy consumption cost required to execute the data processing task, and the resource reward and punishment value is the reward and punishment coefficient of the energy consumption cost of the cloud computing platform and / or the fog computing platform; Based on the status information and the second fog platform parameters allocated when the consensus computing task is offloaded to the fog computing platform, determining the second resource consumption for executing the consensus computing task; Determining a computing task offloading decision based on the first resource consumption, the resource reward and punishment value, and the second resource consumption; Performing task offloading of the data processing task and / or the consensus computing task based on the computing task offloading decision.

2. The method according to claim 1, wherein Based on the status information, the first fog platform parameters when the data processing task is offloaded to the fog computing platform, and the cloud platform parameters when the data processing task is offloaded to the cloud computing platform, determining the first resource consumption for executing the data processing task includes: Determining the first sub-resource consumption of the target node device for executing the data processing task based on the status information; Determining the second sub-resource consumption of the fog computing platform for executing the data processing task based on the status information and the fog platform parameters; Determining the third sub-resource consumption of the cloud computing platform for executing the data processing task based on the status information and the cloud platform parameters; Summing up the first sub-resource consumption, the second sub-resource consumption, and the third sub-resource consumption to obtain the first resource consumption.

3. The method according to claim 2, wherein The determining the first sub-resource consumption of the target node device for executing the data processing task based on the status information includes: Determining the first task period of the data processing task; Determining the local computing power and the unit energy consumption price of the target node device; Determining the first computing power energy consumption, the first idle energy consumption, and the first queuing duration of the target node device for executing the data processing task; Using the first task period, the local computing power, the first computing power energy consumption, the first idle energy consumption, the first queuing duration, and the unit energy consumption price to determine the first sub-resource consumption of the target node device for executing the data processing task.

4. The method according to claim 2, wherein The determining the second sub-resource consumption of the fog computing platform for executing the data processing task based on the status information and the fog platform parameters includes: Determining the first request cost for the target node device to request computing power from the fog computing platform and the first computing power level requested; Determining the first task offloading resource consumption of the data processing task offloaded to the fog computing platform based on the status information; Determine a first execution resource consumption of the fog computing platform for executing the data processing task based on the first computing power level; Determine a second sub-resource consumption of the fog computing platform for executing the data processing task based on the first request cost, the first task offloading resource consumption, and the first execution resource consumption.

5. The method according to claim 2, characterized in that The determining a third sub-resource consumption of the cloud computing platform for executing the data processing task based on the status information and the cloud computing platform parameters includes: Determine a second request cost for the target node device to request computing power from the cloud computing platform and a second computing power level requested; Determine a second task offloading resource consumption of the data processing task offloaded to the fog computing platform based on the status information; and determine a third task offloading resource consumption of the data processing task offloaded from the fog computing platform to the cloud computing platform; Determine a second execution resource consumption of the fog computing platform for executing the data processing task based on the second computing power level; Determine a third sub-resource consumption of the cloud computing platform for executing the data processing task based on the second request cost, the second task offloading resource consumption, the third task offloading resource consumption, and the second execution resource consumption.

6. The method according to claim 1, wherein Based on the status information, a first fog platform parameter of the data processing task offloaded to the fog computing platform, and a cloud platform parameter of the data processing task offloaded to the cloud computing platform, determine a resource reward and punishment value for executing the data processing task, including: Determine a first delay threshold and a first queue threshold corresponding to the target node device, a second delay threshold and a second queue threshold corresponding to the fog computing platform, and a third delay threshold and a third queue threshold corresponding to the cloud computing platform; Determine a first reward and punishment value corresponding to the target node device by using the status information, the first delay threshold, and the first queue threshold; Determine a second reward and punishment value corresponding to the fog computing platform by using the status information, the first fog platform parameter, the second delay threshold, and the second queue threshold; Determine a third reward and punishment value corresponding to the cloud computing platform by using the status information, the cloud platform parameter, the third delay threshold, and the third queue threshold; Predict the resource reward and punishment value by using the first reward and punishment value, the second reward and punishment value, and the third reward and punishment value.

7. The method according to claim 4, characterized in that, The determining a second resource consumption for executing the consensus computing task based on the status information and a second fog platform parameter of the consensus computing task offloaded to the fog computing platform includes: Determine a third request cost for the target node device to request computing power from the fog computing platform and a third computing power level requested; Determine a consensus probability of the target node device based on the third computing power level and the overall computing power of the blockchain; Determine a consensus computing return by using a consensus computing reward value and the consensus probability; Calculate the second resource consumption by using the third request cost and the consensus computing return.

8. The method according to claim 1, characterized in that Before obtaining the status information of the target node device, further include: Allocate virtual coins to each node device in the blockchain, including the target node device; wherein, the virtual coins are used to request computing power from the cloud computing platform or the fog computing platform, and different amounts of virtual coins request different levels of computing power.

9. An electronic device, characterized in that, Comprising: A memory that stores execution instructions; And A processor that executes the execution instructions stored in the memory, so that the processor executes the method according to any one of claims 1 to 8.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, the method according to any one of claims 1 to 8 is implemented.