CN112968923A - Block chain task scheduling method and mini node - Google Patents

Block chain task scheduling method and mini node Download PDF

Info

Publication number
CN112968923A
CN112968923A CN202110080581.4A CN202110080581A CN112968923A CN 112968923 A CN112968923 A CN 112968923A CN 202110080581 A CN202110080581 A CN 202110080581A CN 112968923 A CN112968923 A CN 112968923A
Authority
CN
China
Prior art keywords
target block
block
worker node
node
address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110080581.4A
Other languages
Chinese (zh)
Other versions
CN112968923B (en
Inventor
杨高赟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Guangpu Internet Technology Co ltd
Original Assignee
Hebei Fengzhichao Internet Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hebei Fengzhichao Internet Technology Co ltd filed Critical Hebei Fengzhichao Internet Technology Co ltd
Priority to CN202110080581.4A priority Critical patent/CN112968923B/en
Publication of CN112968923A publication Critical patent/CN112968923A/en
Application granted granted Critical
Publication of CN112968923B publication Critical patent/CN112968923B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1023Server selection for load balancing based on a hash applied to IP addresses or costs
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1008Server selection for load balancing based on parameters of servers, e.g. available memory or workload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the application discloses a block chain task scheduling method and a mini node, which are used for improving the efficiency of block allocation. The method in the embodiment of the application comprises the following steps: acquiring a block number of a target block from a task queue, wherein the block number comprises an identification bit, an address bit and a stage bit, the identification bit stores a unique identification of the target block, the address bit stores an Internet Protocol (IP) address of a worker node associated with the miner node, and the stage bit stores stage information of the target block; analyzing the block number to obtain a first IP address; determining a first worker node according to the first IP address; judging whether the first worker node meets a preset condition for processing the target block; and if so, allocating the target block to the first worker node for processing.

Description

Block chain task scheduling method and mini node
Technical Field
The embodiment of the application relates to the technical field of block chains, in particular to a block chain task scheduling method and a mini node.
Background
The InterPlanetary File System (IPFS) is a network transport protocol aimed at creating persistent and distributed storage and sharing files. The advent of IPFS provides a solution to reduce the maintenance cost of data. And IPFS-based blockchain items such as filejoin, filecast, and filestar are generated at the same time. In a block chain project based on IPFS, a scheme that a miner node and a plurality of worker nodes are matched to form a mining cluster is generally adopted to provide data storage services for a demand side.
In the prior art, when a miner node acquires a block from a task queue, task conditions of all worker nodes associated with the miner node are often acquired first, then worker nodes meeting conditions are screened out, and then the miner node is randomly allocated to any one of the worker nodes meeting the conditions according to a certain rule, or is allocated to the worker node with the least number of tasks to be executed in the worker nodes meeting the conditions, or is allocated to the task in other manners.
However, the process from acquiring the block to completing the allocation of the miner node is too cumbersome, and the efficiency of allocating the block is low.
Disclosure of Invention
The embodiment of the application provides a block chain task scheduling method and a terminal node, which can simplify the process of allocating blocks by the terminal node and improve the efficiency of allocating the blocks.
The first aspect of the embodiments of the present application provides a method for block chain task scheduling, which is applied to a miner node, and the method includes:
acquiring a block number of a target block from a task queue, wherein the block number comprises an identification bit, an address bit and a stage bit, the identification bit stores a unique identification of the target block, the address bit stores an Internet Protocol (IP) address of a worker node associated with the miner node, and the stage bit stores stage information of the target block;
analyzing the block number to obtain a first IP address;
determining a first worker node according to the first IP address;
judging whether the first worker node meets a preset condition for processing the target block;
and if so, allocating the target block to the first worker node for processing.
Optionally, the determining whether the first worker node meets a preset condition for processing the target block includes:
judging whether the number of tasks to be completed of the first worker node is smaller than a task number threshold value;
and if so, determining that the first worker node meets a preset condition for processing the target block.
Optionally, after determining whether the number of tasks to be completed of the first worker node is less than a task number threshold, the method further includes:
if not, acquiring all worker nodes with the task number to be completed lower than the task number threshold value as preselected worker nodes;
randomly selecting one from the preselected worker nodes as a second worker node;
and allocating the target block to the second worker node for processing.
Optionally, after randomly selecting one of the preselected worker nodes as a second worker node, before allocating the target block to the second worker node for processing, the method further includes:
and changing the address bit of the block number into a second IP address, wherein the second IP address is the IP address of the second worker node.
Optionally, after the target block is allocated to the second worker node for processing, the method further includes:
and when a stage change notice which is sent by the second worker node and corresponds to the target block is received, updating the stage bit of the block number.
Optionally, before obtaining the block number of the target block from the task queue, the method further includes:
generating a block number of a target block according to a preset naming rule;
and adding the block number into a task queue.
Optionally, the generating the block number of the target block according to the preset naming rule includes:
acquiring an IP address of a worker node with the highest weight according to the historical task allocation record;
generating a unique identifier of a target block according to the unique identifier of the last block of the target block;
and generating the block number of the target block according to the IP address and the unique identifier of the target block.
A second aspect of the embodiments of the present application provides a mini node, including:
the system comprises an acquisition unit, a task queue and a processing unit, wherein the acquisition unit is used for acquiring a block number of a target block from the task queue, the block number comprises an identification bit, an address bit and a stage bit, the identification bit stores a unique identification of the target block, the address bit stores an Internet Protocol (IP) address of a worker node associated with a miner node, and the stage bit stores stage information of the target block;
the analysis unit is used for analyzing the block number to obtain a first IP address;
the determining unit is used for determining a first worker node according to the first IP address;
the judging unit is used for judging whether the first worker node meets the preset condition for processing the target block;
and the first allocation unit is used for allocating the target block to the first worker node for processing when the judgment unit determines that the first worker node meets the preset condition for processing the target block.
Optionally, the determining unit is specifically configured to:
judging whether the number of tasks to be completed of the first worker node is smaller than a task number threshold value;
and if so, determining that the first worker node meets a preset condition for processing the target block.
Optionally, the miner node further includes a second allocating unit, and the second allocating unit is configured to:
when the judging unit determines that the first worker node does not meet the preset condition for processing the target block, all worker nodes with the task number to be completed being lower than the task number threshold are obtained to serve as pre-selected worker nodes;
randomly selecting one from the preselected worker nodes as a second worker node;
and allocating the target block to the second worker node for processing.
Optionally, the second allocating unit is specifically configured to:
when the judging unit determines that the first worker node does not meet the preset condition for processing the target block, all worker nodes with the task number to be completed being lower than the task number threshold are obtained to serve as pre-selected worker nodes;
randomly selecting one from the preselected worker nodes as a second worker node;
and changing the address bit of the block number into a second IP address, wherein the second IP address is the IP address of the second worker node.
And allocating the target block to the second worker node for processing.
Optionally, the miner node further includes a second updating unit, where the second updating unit is specifically configured to:
and when a stage change notice which is sent by the second worker node and corresponds to the target block is received, updating the stage bit of the block number.
Optionally, the miner node further includes a naming unit, and the naming unit is configured to:
generating a block number of a target block according to a preset naming rule;
and adding the block number into a task queue.
Optionally, the naming unit is specifically configured to:
acquiring an IP address of a worker node with the highest weight according to the historical task allocation record;
generating a unique identifier of a target block according to the unique identifier of the last block of the target block;
generating a block number of the target block according to the IP address and the unique identifier of the target block;
and adding the block number into a task queue.
A third aspect of the embodiments of the present application provides a mini node, including:
the device comprises a processor, a memory, an input and output unit and a bus;
the processor is connected with the memory, the input and output unit and the bus;
the processor specifically performs the following operations:
acquiring a block number of a target block from a task queue, wherein the block number comprises an identification bit, an address bit and a stage bit, the identification bit stores a unique identification of the target block, the address bit stores an Internet Protocol (IP) address of a worker node associated with the miner node, and the stage bit stores stage information of the target block;
analyzing the block number to obtain a first IP address;
determining a first worker node according to the first IP address;
judging whether the first worker node meets a preset condition for processing the target block;
and if so, allocating the target block to the first worker node for processing.
A fourth aspect of the embodiments of the present application provides a computer-readable storage medium, where a program is stored, and when the program is executed on a computer, the computer is caused to execute the method according to the first aspect and any one of the possible implementation manners of the first aspect.
According to the technical scheme, the embodiment of the application has the following advantages:
in the embodiment of the application, after a miner node acquires a target block from a task queue, a block number of the target block is firstly analyzed, so that a first Internet Protocol (IP) address carried in the target block is obtained, then a first worker node is determined according to the first IP address, and if the first worker node meets a preset condition for processing the target block, the target block is directly allocated to the first worker node for processing. The method and the device improve the block number, and add the IP address of the worker node associated with the miner node while considering the uniqueness of the block number, so that when the miner node allocates a task to the target block, the target block is directly allocated to the first worker node for processing as long as the first worker node corresponding to the first IP address carried in the block number of the target block is determined to meet the preset condition for processing the target block, the process of allocating the block is simplified, and the efficiency of allocating the block is improved.
Drawings
Fig. 1 is a flowchart illustrating an embodiment of a method for scheduling a blockchain task according to the present invention;
fig. 2 is a flowchart illustrating a method for scheduling a blockchain task according to another embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of an embodiment of a miner node provided in the present application;
FIG. 4 is a schematic structural diagram of another embodiment of a miner node provided in the present application;
fig. 5 is a schematic structural diagram of another embodiment of a miner node provided in the embodiment of the present application.
Detailed Description
The embodiment of the application provides a block chain task scheduling method and a terminal node, which are used for simplifying the process of allocating blocks by the terminal node and improving the efficiency of allocating the blocks.
The method for scheduling the blockchain task in the embodiment of the present application is described in detail below.
Referring to fig. 1, an embodiment of a method for scheduling a blockchain task in an embodiment of the present application includes:
101. the miner node acquires the block number of the target block from the task queue;
in a mine digging cluster consisting of a miner node and a plurality of worker nodes, the miner node can acquire a block number of a target block from a task queue, wherein the block number comprises an identification bit, an address bit and a stage bit, and the identification bit stores a unique identification of the target block so as to ensure the uniqueness of the block number; the address bit stores the Internet protocol IP address of the worker node associated with the miner node; the stage bit stores stage information of the target block, which indicates the execution stage of the target block.
It should be noted that, the IP address stored in the address bit only needs to ensure that a unique worker node can be determined, and the IP address may be a complete IP address, or may only include a part of the IP address, such as a tail, and the specific details are not limited herein.
102. The miner node analyzes the block number to obtain a first IP address;
because the address bit of the block number stores the internet protocol IP address of the worker node associated with the miner node, the miner node can obtain the first IP address according to the address bit by analyzing the block number.
103. The miner node determines a first worker node according to the first IP address;
the first IP address is the IP address of a worker node in the mining cluster and has uniqueness, so that the miner node can determine the first worker node corresponding to the first IP address in the mining cluster according to the first IP address.
104. The miner node judges whether the first worker node meets a preset condition for processing the target block, if so, the step 105 is executed;
after determining the first worker node, the miner node may determine the first worker node, and if the first worker node meets a preset condition for processing the target block, step 105 may be executed.
105. And the miner node allocates the target block to the first worker node for processing.
When the first worker node meets the preset condition for processing the target block, the miner node can directly allocate the target block to the first worker node, and the target block is processed by the first worker node.
In the embodiment of the application, after a miner node acquires a target block from a task queue, the block number of the target block is firstly analyzed, so that a first IP address carried in the target block is obtained, then a first worker node is determined according to the first IP address, and if the first worker node meets a preset condition for processing the target block, the target block is directly allocated to the first worker node for processing. The method and the device improve the block number, and add the IP address of the worker node associated with the miner node while considering the uniqueness of the block number, so that when the miner node allocates a task to the target block, the target block is directly allocated to the first worker node for processing as long as the first worker node corresponding to the first IP address carried in the block number of the target block is determined to meet the preset condition for processing the target block, the process of allocating the block is simplified, and the efficiency of allocating the block is improved.
Referring to fig. 2, another embodiment of the method for scheduling blockchain tasks in the embodiment of the present application includes:
201. the miner node acquires the IP address of the worker node with the highest weight according to the historical task allocation record;
in practical application, a weight of each worker node under a miner node is dynamically calculated according to a historical task allocation record, namely a previous block allocation record, the weight refers to the finite degree of an allocation block, after the miner node calculates the weight of each worker node, the weight of each worker node can be compared, then the worker node with the highest weight is determined, and then the IP address of the worker node is obtained.
It should be noted that the miner node may calculate the weight of the worker node according to a latest part of the distribution records in the historical task distribution records, such as the latest 100 block task distributions; and calculating the weight of the worker node according to all historical task records, wherein the calculation is not limited here.
In this embodiment, the principle of the weight of the worker node may be that the higher the number of times the historical task allocation record is allocated to the block is, the higher the weight is, for example, the number of times the historical task allocation record is 100, the 9-time block task is allocated to the worker node a in the mining cluster, the 7-time block task is allocated to the worker node B, the 22-time block task is allocated to the worker node C, and the weights of the three worker nodes are as high as the worker node C > the worker node a > the worker node B; other principles are also possible and are not specifically limited herein.
202. The miner node generates a unique identifier of the target block according to the unique identifier of the last block of the target block;
the miner node may generate the unique identifier of the target block according to the unique identifier of the previous block of the target block, for example, the unique identifier of the previous block of the target block is 10783672, and the rule generated by the unique identifier is 1 increment each time, the miner node may obtain the unique identifier 10783673 of the target block, and similarly, the unique identifier of the next block of the target block is 10783674.
203. The miner node generates a block number of the target block according to the IP address and the unique identifier of the target block;
the miner node can generate the block number of the target block according to the acquired IP address of the worker node with the highest weight and the unique identifier of the target block, and it should be noted that the phase bit values of the newly generated block number are all default values.
204. The miner node adds the block number into a task queue;
the miner node may add the block number of the target block to the task queue after generating the block number.
205. The miner node acquires the block number of the target block from the task queue;
206. the miner node analyzes the block number to obtain a first IP address;
207. the miner node determines a first worker node according to the first IP address;
in this embodiment, steps 205 to 207 are similar to steps 101 to 103 in the previous embodiment, and are not described again here.
208. The miner node judges whether the number of tasks to be completed of the first worker node is smaller than a task number threshold value, if so, the step 209 is executed; if not, go to step 212.
The miner node can judge whether the target task is allocated to the first worker node or not according to the number of tasks to be completed of the first worker node. If the number of tasks to be completed of the first worker node is smaller than the task number threshold, it indicates that the first worker node meets the preset condition of the processing target block, and at this time, the miner node may execute step 209; otherwise, the miner node performs step 212.
209. The miner node determines that the first worker node meets a preset condition for processing the target block;
when the number of tasks to be completed of the first worker node is smaller than the task number threshold, the miner node can determine that the first worker node meets the preset condition of the processing target block.
210. The miner node allocates the target block to the first worker node for processing;
in this embodiment, step 210 is similar to step 105 in the previous embodiment, and is not described herein again.
211. When the miner node receives a stage change notification which is sent by the first worker node and corresponds to the target block, updating the stage bit of the block number;
after the miner node allocates the target block to the first worker node, if the first worker node finishes processing the corresponding task of the target block, a stage change notification is sent to the miner node, and after the miner node receives the stage change notification sent by the first worker node, the stage bit in the block number of the target block can be updated.
In this embodiment, when the stage information of the target block changes, the miner node may receive a stage change notification sent by the first worker node, and then correspondingly update the stage bit in the block number.
In this embodiment, when the stage of the target block changes, the miner node may perform corresponding update on the stage bit in the block number of the target block, may track the stage of the target block, and may acquire the stage where the target block is abnormal through the stage bit in the block number if the target block is abnormal.
212. The miner node acquires all worker nodes with the task number to be completed being lower than the task number threshold value as preselected worker nodes;
and when the miner node determines that the first worker node does not meet the preset condition of the processing target block, screening the worker nodes with the number of tasks to be completed lower than the threshold value of the number of tasks from the mining cluster as the preselected worker nodes of the processing target block.
213. The miner node randomly selects one from the preselected worker nodes as a second worker node;
after the miner node acquires the preselected worker nodes, a second worker node serving as a processing target block can be randomly selected from the preselected worker nodes.
214. The miner node changes the address bit of the block number into a second IP address;
after the miner node determines the second worker node, the address bit in the block number of the target block may be changed to a second IP address, where the second IP address bit is the IP address of the second worker node.
215. The miner node allocates the target block to the second worker node for processing;
after the address bit in the block number is changed by the miner node, the target block can be allocated to a second worker node, and the target block is processed by the first worker node.
In the embodiment, when the first worker node does not meet the preset condition, the miner node can dynamically allocate the target block to a second worker node meeting the preset condition in the mining cluster for processing, so that the robustness is improved.
In this embodiment, before the miner node allocates the target block to the second worker node, the address bit in the block number of the target block is changed to the second IP address corresponding to the second worker node, so that the miner node can track the worker node which is processing the target block through querying the IP address corresponding to the address bit in the block number without querying a log file, and efficiency is improved.
216. And when the miner node receives a stage change notification which is sent by the second worker node and corresponds to the target block, updating the stage bit of the block number.
After the miner node allocates the target block to the second worker node, if the second worker node finishes processing the corresponding task of the target block, a stage change notification is sent to the miner node, and after the miner node receives the stage change notification sent by the second worker node, the stage bit in the block number of the target block can be updated.
The method for scheduling the block chain task in the embodiment of the present application is described in detail above, and the mini node in the embodiment of the present application is described in detail below.
Referring to fig. 3, an embodiment of a miner node in the embodiment of the present application includes:
an obtaining unit 301, configured to obtain a block number of a target block from a task queue, where the block number includes an identification bit, an address bit, and a stage bit, the identification bit stores a unique identification of the target block, the address bit stores an internet protocol IP address of a worker node associated with a miner node, and the stage bit stores stage information of the target block;
an analyzing unit 302, configured to analyze the block number to obtain a first IP address;
a determining unit 303, configured to determine a first worker node according to the first IP address;
a determining unit 304, configured to determine whether the first worker node meets a preset condition of the processing target block;
the first allocating unit 305 is configured to, when the determining unit 304 determines that the first worker node meets the preset condition for processing the target block, allocate the target block to the first worker node for processing.
In this embodiment of the application, after the obtaining unit 301 obtains the target block from the task queue, the analyzing unit 302 first analyzes the block number of the target block to obtain a first IP address carried in the target block, then the determining unit 303 determines a first worker node according to the first IP address, and if the first worker node meets a preset condition for processing the target block, the first allocating unit 305 directly allocates the target block to the first worker node for processing. The block number is improved, the IP address of the worker node associated with the miner node is added while the uniqueness of the block number is considered, so that when the miner node allocates a task to the target block, as long as the judging unit 304 determines that the first worker node corresponding to the first IP address carried in the block number of the target block meets the preset condition for processing the target block, the first allocating unit 305 can directly allocate the target block to the first worker node for processing, the process of allocating the block is simplified, and the efficiency of allocating the block is improved.
Referring to fig. 4, a detailed description will be given below of a mini node in an embodiment of the present application, where another embodiment of the mini node in the embodiment of the present application includes:
an obtaining unit 301, configured to obtain a block number of a target block from a task queue, where the block number includes an identification bit, an address bit, and a stage bit, the identification bit stores a unique identification of the target block, the address bit stores an internet protocol IP address of a worker node associated with a miner node, and the stage bit stores stage information of the target block;
an analyzing unit 302, configured to analyze the block number to obtain a first IP address;
a determining unit 303, configured to determine a first worker node according to the first IP address;
a determining unit 304, configured to determine whether the first worker node meets a preset condition of the processing target block;
the first allocating unit 305 is configured to, when the determining unit 304 determines that the first worker node meets the preset condition for processing the target block, allocate the target block to the first worker node for processing.
In this embodiment, the determining unit is specifically configured to:
judging whether the number of tasks to be completed of the first worker node is smaller than a task number threshold value or not;
if so, determining that the first worker node meets the preset condition of the processing target block.
In this embodiment, the miner node may further include a first updating unit 406, a second allocating unit 407, a second updating unit 408, and a naming unit 409.
The first updating unit 406 is specifically configured to:
and updating the stage bit of the block number when receiving a stage change notification which is sent by the first worker node and corresponds to the target block.
The second allocating unit 407 is specifically configured to:
when the judging unit 404 determines that the first worker node does not meet the preset condition of the processing target block, all worker nodes with the number of tasks to be completed being lower than the threshold value of the number of tasks are obtained as preselected worker nodes;
randomly selecting one from the preselected worker nodes as a second worker node;
changing the address bit of the block number into a second IP address, wherein the second IP address is the IP address of a second worker node;
and allocating the target block to a second worker node for processing.
The second updating unit 408 is specifically configured to:
and updating the stage bit of the block number when receiving a stage change notification which is sent by the second worker node and corresponds to the target block.
The naming unit 409 is specifically configured to:
acquiring an IP address of a worker node with the highest weight according to the historical task allocation record;
generating a unique identifier of the target block according to the unique identifier of the last block of the target block;
generating a block number of the target block according to the IP address and the unique identifier of the target block;
the block number is added to the task queue.
In this embodiment, the functions of each unit correspond to the steps in the embodiment shown in fig. 2, and are not described herein again.
Referring to fig. 5, a detailed description is given below of a mini node in an embodiment of the present application, where another embodiment of the mini node in the embodiment of the present application includes:
a processor 501, a memory 502, an input/output unit 503, and a bus 504;
the processor 501 is connected with the memory 502, the input/output unit 503 and the bus 504;
the processor 501 specifically performs the following operations:
acquiring a block number of a target block from a task queue, wherein the block number comprises an identification bit, an address bit and a stage bit, the identification bit stores a unique identification of the target block, the address bit stores an Internet Protocol (IP) address of a worker node associated with a miner node, and the stage bit stores stage information of the target block;
analyzing the block number to obtain a first IP address;
determining a first worker node according to the first IP address;
judging whether the first worker node meets a preset condition for processing the target block;
and if so, allocating the target block to a first worker node for processing.
In this embodiment, the functions of the processor 501 correspond to the steps in the embodiments shown in fig. 1 to fig. 2, and are not described herein again.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and the like.

Claims (10)

1. A method for block chain task scheduling is applied to a miner node, and is characterized by comprising the following steps:
acquiring a block number of a target block from a task queue, wherein the block number comprises an identification bit, an address bit and a stage bit, the identification bit stores a unique identification of the target block, the address bit stores an Internet Protocol (IP) address of a worker node associated with the miner node, and the stage bit stores stage information of the target block;
analyzing the block number to obtain a first IP address;
determining a first worker node according to the first IP address;
judging whether the first worker node meets a preset condition for processing the target block;
and if so, allocating the target block to the first worker node for processing.
2. The method of claim 1, wherein the determining whether the first worker node meets a preset condition for processing the target block comprises:
judging whether the number of tasks to be completed of the first worker node is smaller than a task number threshold value;
and if so, determining that the first worker node meets a preset condition for processing the target block.
3. The method according to claim 2, wherein after determining whether the number of tasks to be completed of the first worker node is less than a task number threshold, the method further comprises:
if not, acquiring all worker nodes with the task number to be completed lower than the task number threshold value as preselected worker nodes;
randomly selecting one from the preselected worker nodes as a second worker node;
and allocating the target block to the second worker node for processing.
4. The method of claim 3, wherein after randomly selecting one of the preselected worker nodes as a second worker node, and before assigning the target block to the second worker node for processing, the method further comprises:
and changing the address bit of the block number into a second IP address, wherein the second IP address is the IP address of the second worker node.
5. The method of claim 3, wherein after the allocating the target block to the second worker node for processing, the method further comprises:
and when a stage change notice which is sent by the second worker node and corresponds to the target block is received, updating the stage bit of the block number.
6. The method according to any of claims 1 to 5, wherein before obtaining the block number of the target block from the task queue, the method further comprises:
generating a block number of a target block according to a preset naming rule;
and adding the block number into a task queue.
7. The method of claim 6, wherein the generating the block number of the target block according to the preset naming rule comprises:
acquiring an IP address of a worker node with the highest weight according to the historical task allocation record;
generating a unique identifier of a target block according to the unique identifier of the last block of the target block;
and generating the block number of the target block according to the IP address and the unique identifier of the target block.
8. A mini node, comprising:
the system comprises an acquisition unit, a task queue and a processing unit, wherein the acquisition unit is used for acquiring a block number of a target block from the task queue, the block number comprises an identification bit, an address bit and a stage bit, the identification bit stores a unique identification of the target block, the address bit stores an Internet Protocol (IP) address of a worker node associated with a miner node, and the stage bit stores stage information of the target block;
the analysis unit is used for analyzing the block number to obtain a first IP address;
the determining unit is used for determining a first worker node according to the first IP address;
the judging unit is used for judging whether the first worker node meets the preset condition for processing the target block;
and the first allocation unit is used for allocating the target block to the first worker node for processing when the judgment unit determines that the first worker node meets the preset condition for processing the target block.
9. The miner node of claim 7, wherein the determining unit is specifically configured to:
judging whether the number of tasks to be completed of the first worker node is smaller than a task number threshold value;
and if so, determining that the first worker node meets a preset condition for processing the target block.
10. The miner node of claim 8, further comprising a second assigning unit, the second assigning unit being specifically configured to:
when the judging unit determines that the first worker node does not meet the preset condition for processing the target block, all worker nodes with the task number to be completed being lower than the task number threshold are obtained to serve as pre-selected worker nodes;
randomly selecting one from the preselected worker nodes as a second worker node;
and allocating the target block to the second worker node for processing.
CN202110080581.4A 2021-01-21 2021-01-21 Block chain task scheduling method and miner node Active CN112968923B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110080581.4A CN112968923B (en) 2021-01-21 2021-01-21 Block chain task scheduling method and miner node

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110080581.4A CN112968923B (en) 2021-01-21 2021-01-21 Block chain task scheduling method and miner node

Publications (2)

Publication Number Publication Date
CN112968923A true CN112968923A (en) 2021-06-15
CN112968923B CN112968923B (en) 2023-05-05

Family

ID=76271487

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110080581.4A Active CN112968923B (en) 2021-01-21 2021-01-21 Block chain task scheduling method and miner node

Country Status (1)

Country Link
CN (1) CN112968923B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109076344A (en) * 2016-05-03 2018-12-21 诺基亚美国公司 Affairs using the protection of block chain for Internet resources distribution
CN109951482A (en) * 2019-03-19 2019-06-28 全链通有限公司 User terminal and its block chain domain name analytic method
CN110233802A (en) * 2019-05-14 2019-09-13 天津大学 A method of the block chain framework of the building more side chains of one main chain
CN110531924A (en) * 2019-05-31 2019-12-03 杭州复杂美科技有限公司 For extending the method and apparatus, storage medium and system of block chain memory capacity
US20200021446A1 (en) * 2017-03-06 2020-01-16 Nokia Technologies Oy Secure de-centralized domain name system
WO2020143196A1 (en) * 2019-01-11 2020-07-16 平安科技(深圳)有限公司 Communication method and device between blockchain nodes, storage medium and electronic apparatus
WO2020215247A1 (en) * 2019-04-24 2020-10-29 Nokia Technologies Oy Method and apparatus for supporting blockchain-based data storage in vehicular network

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109076344A (en) * 2016-05-03 2018-12-21 诺基亚美国公司 Affairs using the protection of block chain for Internet resources distribution
US20200021446A1 (en) * 2017-03-06 2020-01-16 Nokia Technologies Oy Secure de-centralized domain name system
WO2020143196A1 (en) * 2019-01-11 2020-07-16 平安科技(深圳)有限公司 Communication method and device between blockchain nodes, storage medium and electronic apparatus
CN109951482A (en) * 2019-03-19 2019-06-28 全链通有限公司 User terminal and its block chain domain name analytic method
WO2020215247A1 (en) * 2019-04-24 2020-10-29 Nokia Technologies Oy Method and apparatus for supporting blockchain-based data storage in vehicular network
CN110233802A (en) * 2019-05-14 2019-09-13 天津大学 A method of the block chain framework of the building more side chains of one main chain
CN110531924A (en) * 2019-05-31 2019-12-03 杭州复杂美科技有限公司 For extending the method and apparatus, storage medium and system of block chain memory capacity

Also Published As

Publication number Publication date
CN112968923B (en) 2023-05-05

Similar Documents

Publication Publication Date Title
CN110351375B (en) Data processing method and device, computer device and readable storage medium
CN110852882B (en) Packet consensus method, apparatus, device, and medium for blockchain networks
CN107682417B (en) Task allocation method and device for data nodes
CN110866167B (en) Task allocation method, device, server and storage medium
CN111083013B (en) Test method and device based on flow playback, electronic equipment and storage medium
US8572621B2 (en) Selection of server for relocation of application program based on largest number of algorithms with identical output using selected server resource criteria
CN103401947A (en) Method and device for allocating tasks to multiple servers
CN108512672B (en) Service arranging method, service management method and device
CN112487091A (en) Method and device for determining block chain consensus node
CN112968923A (en) Block chain task scheduling method and mini node
CN111078560B (en) Test method and device based on flow pruning, electronic equipment and storage medium
CN109842665B (en) Task processing method and device for task allocation server
CN111062634A (en) Approval task allocation method and device, computer equipment and storage medium
CN111935100B (en) Flowspec rule issuing method, device, equipment and medium
CN113312359B (en) Distributed job progress calculation method and device and storage medium
CN110636072A (en) Target domain name scheduling method, device, equipment and storage medium
CN113746942B (en) Information transceiving method, device, equipment and medium based on cluster message synchronization
JP2017016478A (en) Process allocation method, process allocation device, and process allocation program
CN104579793B (en) The dispatching method and system of Internet resources
CN114172910A (en) Load dynamic allocation method, device, equipment and medium based on memory management
CN109344119B (en) File merging processing method and device, computing equipment and computer storage medium
CN109547552B (en) API request processing method and device, storage medium and electronic equipment
CN109344131B (en) Data storage method and device and management server
CN112732451A (en) Load balancing system in cloud environment
CN109962963B (en) Message processing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20210831

Address after: 518000 1303a, satellite building, No. 61, Gaoxin South ninth Road, high tech Zone community, Yuehai street, Nanshan District, Shenzhen, Guangdong

Applicant after: Shenzhen Guangpu Internet Technology Co.,Ltd.

Address before: A01, 11th floor, Jinyuan business building, Haigang District, Qinhuangdao City, Hebei Province 066000

Applicant before: Hebei fengzhichao Internet Technology Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant