CN116974764A - Block chain-based data processing method, device, equipment and readable storage medium - Google Patents

Block chain-based data processing method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN116974764A
CN116974764A CN202310955133.3A CN202310955133A CN116974764A CN 116974764 A CN116974764 A CN 116974764A CN 202310955133 A CN202310955133 A CN 202310955133A CN 116974764 A CN116974764 A CN 116974764A
Authority
CN
China
Prior art keywords
contract
computing power
power resource
container unit
process container
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310955133.3A
Other languages
Chinese (zh)
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202310955133.3A priority Critical patent/CN116974764A/en
Publication of CN116974764A publication Critical patent/CN116974764A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5072Grid computing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45575Starting, stopping, suspending or resuming virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5011Pool
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5013Request control
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/505Clust

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a data processing method, a device, equipment and a readable storage medium based on a blockchain, wherein the method comprises the following steps: acquiring computing power resource occupation information corresponding to the contract process container unit through the vertical expansion and contraction component; according to the computing power resource occupation information and the vertical expansion and contraction parameters, computing power resource quota adjustment processing is carried out on the contract process container unit, and an adjusted contract process container unit is obtained; acquiring an adjusted computing power resource limit through the adjusted contract process container unit, determining the adjusted coroutine quantity corresponding to the coroutine pool according to the coroutine configuration file and the adjusted computing power resource limit, and carrying out coroutine quantity adjustment processing on the coroutine pool according to the adjusted coroutine quantity; and adjusting the computing power resource limit to be the computing power resource limit of the adjusted contract process container unit. By adopting the application, the computational power resource is dynamically allocated, thereby improving the operation efficiency of the block chain network.

Description

Block chain-based data processing method, device, equipment and readable storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a data processing method, apparatus, device, and readable storage medium.
Background
The block chain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like, and is mainly used for sorting data according to time sequence, encrypting the data into an account book, preventing the account book from being tampered and forged, and simultaneously verifying, storing and updating the data. There is also increasing use for blockchains because of their non-tamperability and authenticity.
For current blockchain contract engines, the contract process is basically adopted for high-level language contracts to run. To avoid resource contention between contract processes, existing blockchain networks create a container for each smart contract and allocate a certain computational power resource for each container for running the contract process for the corresponding smart contract. Because of the isolation between the containers, resource disputes between contract processes can be avoided. However, the initiation time of different types of transactions in the blockchain network is uncontrollable, and the situation that part of intelligent contracts are called by a plurality of transactions simultaneously, the computational power resources of corresponding containers are insufficient, and part of intelligent contracts are not called in the same time period and the computational power resources of corresponding containers are idle is quite easy to occur, so that the running efficiency of the blockchain network is slow and the computational power resources are wasted.
Disclosure of Invention
The embodiment of the application provides a data processing method, a device, equipment and a readable storage medium based on a blockchain, which can dynamically allocate computing resources so as to improve the operation efficiency of the blockchain network.
In one aspect, the embodiment of the application provides a data processing method based on a blockchain, wherein a blockchain network comprises blockchain nodes and container cluster management nodes corresponding to the blockchain nodes; the container cluster management node comprises a vertical expansion and contraction component and a contract process container unit; the contract process container unit comprises a coroutine pool and an intelligent contract; the coroutine quantity contained in the coroutine pool is used for representing the maximum number of transactions for calling intelligent contracts in concurrent operation of the contract process container unit; the method is performed by a container cluster management node; comprising the following steps:
acquiring computing power resource occupation information corresponding to the contract process container unit through the vertical expansion and contraction component;
according to the computing power resource occupation information and the vertical expansion and contraction parameters, computing power resource quota adjustment processing is carried out on the contract process container unit, and an adjusted contract process container unit is obtained;
acquiring an adjusted computing power resource limit through the adjusted contract process container unit, determining the adjusted coroutine quantity corresponding to the coroutine pool according to the coroutine configuration file and the adjusted computing power resource limit, and carrying out coroutine quantity adjustment processing on the coroutine pool according to the adjusted coroutine quantity; and adjusting the computing power resource limit to be the computing power resource limit of the adjusted contract process container unit.
In one aspect, the embodiment of the application provides a data processing device, wherein a blockchain network includes blockchain nodes and container cluster management nodes corresponding to the blockchain nodes; the container cluster management node comprises a vertical expansion and contraction component and a contract process container unit; the contract process container unit comprises a coroutine pool and an intelligent contract; the coroutine quantity contained in the coroutine pool is used for representing the maximum number of transactions for calling intelligent contracts in concurrent operation of the contract process container unit; the device is operated by a container cluster management node; the device comprises:
the information acquisition module is used for acquiring the computing power resource occupation information corresponding to the contract process container unit through the vertical expansion and contraction component;
the credit adjustment module is used for carrying out credit adjustment processing on the contract process container unit according to the credit occupation information and the vertical expansion and contraction parameters to obtain an adjusted contract process container unit;
the credit acquisition module is used for acquiring the credit adjustment resource credit through the adjusted contract process container unit;
the assistant distance adjusting module is used for determining the corresponding adjustment assistant distance quantity of the assistant distance pool according to the assistant distance configuration file and the adjustment computing power resource limit, and carrying out assistant distance quantity adjustment processing on the assistant distance pool according to the adjustment assistant distance quantity; and adjusting the computing power resource limit to be the computing power resource limit of the adjusted contract process container unit.
The vertical expansion and contraction parameters comprise an occupied threshold value of computing power resource expansion and a maximum limit of computing power resource;
the limit adjustment module comprises:
the expansion unit is used for determining a pre-expansion computing power resource limit according to the computing power resource maximum limit, the computing power resource occupation information, the computing power resource expansion occupation threshold and the historical computing power resource limit if the computing power resource occupation information exceeds the computing power resource expansion occupation threshold; the historical computing power resource limit is the computing power resource limit of the contract process container unit;
the first adjusting unit is used for adjusting the computing power resource limit of the contract process container unit to be the pre-expansion computing power resource limit, and obtaining an adjusted contract process container unit.
Wherein, extension unit includes:
the computing subunit is used for determining the ratio of the computing power resource occupation information to the computing power resource expansion occupation threshold value as an expansion adjustment coefficient;
the computing subunit is further used for multiplying the expansion adjustment coefficient by the historical computing power resource limit to obtain a target computing power resource limit;
a determining subunit, configured to determine the target computing power resource quota as a pre-extended computing power resource quota if the target computing power resource quota is less than or equal to the computing power resource maximum quota;
And the determining subunit is further configured to determine the maximum computing power resource limit as a pre-expansion computing power resource limit if the target computing power resource limit is greater than the maximum computing power resource limit.
The vertical expansion and contraction parameters comprise an occupied threshold value of computing power resource reduction and a minimum limit of computing power resource;
the limit adjustment module comprises:
the reducing unit is used for determining a pre-reduced computing power resource limit according to the computing power resource minimum limit, the computing power resource occupation information, the computing power resource reduction occupation threshold and the historical computing power resource limit if the computing power resource occupation information is smaller than the computing power resource reduction occupation threshold; the historical computing power resource limit is the computing power resource limit of the contract process container unit;
and the second adjusting unit is used for adjusting the computing power resource limit of the contract process container unit into the pre-reduced computing power resource limit to obtain an adjusted contract process container unit.
Wherein, the adjustment computing power resource limit comprises M computing power resource limits, M is a positive integer; the computing power resource types corresponding to each computing power resource limit are different; the coroutine adjustment configuration file comprises corresponding limit weight coefficients and maximum coroutine quantity of M computing power resource limits respectively;
The coroutine adjustment module comprises:
the quantity determining unit is used for carrying out weighted summation rounding processing on the M computing power resource units according to the corresponding unit weight coefficients of the M computing power resource units respectively to obtain the quantity of the adjustment coroutines;
the cooperative distance adjusting unit is used for adjusting the cooperative distance quantity contained in the cooperative distance pool to be the adjusted cooperative distance quantity if the adjusted cooperative distance quantity is smaller than or equal to the maximum cooperative distance quantity;
and the cooperative distance adjusting unit is used for adjusting the cooperative distance quantity contained in the cooperative distance pool to be the maximum cooperative distance quantity if the cooperative distance quantity is adjusted to be larger than the maximum cooperative distance quantity.
The coroutine adjustment configuration file also comprises contract complexity coefficients corresponding to the intelligent contracts;
the above data processing apparatus further includes:
the priority determining module is used for acquiring the calling proportion corresponding to the intelligent contract; the calling proportion is determined according to the transaction quantity of calling intelligent contracts in the target time period and the total transaction quantity received by the container cluster management node;
the priority determining module is also used for multiplying the calling proportion and the contract complex coefficient to obtain a priority coefficient;
the priority determining module is also used for multiplying the priority coefficient by the target cooperative stroke number to obtain the priority adjustment cooperative stroke number;
The priority adjustment module is used for adjusting the cooperative distance quantity contained in the cooperative distance pool to be the priority adjustment cooperative distance quantity if the priority adjustment cooperative distance quantity is smaller than or equal to the maximum cooperative distance quantity;
the priority adjustment module is further configured to adjust the number of coroutines included in the coroutine pool to the maximum number of coroutines if the priority adjustment number of coroutines is greater than the maximum number of coroutines.
Wherein the contract process container unit further comprises a resource detection component;
the above data processing apparatus further includes:
the resource detection module is used for starting the contract process container unit and starting the resource detection component at the same time;
and the resource detection module is also used for acquiring the computing power resource occupation information corresponding to the contract process container unit through the resource detection component and sending the computing power resource occupation information to the vertical expansion and contraction component when the detection period is determined to be reached.
Wherein the container cluster management node further comprises a contract scheduler container unit;
the above data processing apparatus further includes:
the transaction processing module is used for receiving the business transaction sent by the blockchain node through the contract dispatcher container unit; the business transaction comprises a contract identifier corresponding to the intelligent contract;
the transaction processing module is also used for forwarding the business transaction to the contract process container unit according to the contract identification;
The transaction processing module is further used for acquiring a first coroutine from the coroutine in the idle state if the coroutine pool is determined to contain the coroutine in the idle state in the contract process container unit;
and the transaction processing module is also used for executing business transaction through the first coroutine and the intelligent contract to obtain a transaction execution result and sending the transaction execution result to the blockchain node.
Wherein, above-mentioned data processing apparatus still includes:
a contract deployment module for receiving a contract deployment transaction sent by the blockchain node through a contract scheduler container unit; the contract deployment transaction comprises a contract initialization request, an intelligent contract code corresponding to the intelligent contract and a resource adjustment configuration file; the resource adjustment file comprises a vertical expansion and contraction capacity parameter and a coroutine configuration file;
the first creating module is used for creating a vertical expansion and contraction object according to the vertical expansion and contraction parameters and creating a contract process container unit according to the vertical expansion and contraction object and contract deployment transaction; the contract process container unit comprises intelligent contract codes and a coroutine configuration file; the vertical expansion and contraction object is used for indicating the vertical expansion and contraction component to carry out calculation resource quota adjustment processing on the contract process container unit according to calculation resource occupation information corresponding to the contract process container unit;
The second creating module is used for creating a coroutine pool in the contract process container unit according to the coroutine configuration file and the computing power resource limit of the contract process container unit;
the contract initialization module is used for sending the contract deployment transaction to the contract process container unit through the contract dispatcher container unit, acquiring a second contract in an idle state in the contract process pool in the contract process container unit, executing a contract initialization request through the second contract and the intelligent contract code to obtain a contract initialization result, and sending the contract initialization result to the blockchain node; the contract initialization results are used to characterize deployment of the intelligent contracts in the contract process container unit.
Wherein the contract dispatcher container unit comprises an initial contract process container unit creation template and a container unit creator;
a first creation module comprising:
the first creating unit is used for creating a vertical expansion and contraction object according to the vertical expansion and contraction parameters;
the second creating unit is used for acquiring an initial contract process container unit creating template, writing the initial contract process container unit creating template according to the intelligent contract code, the coroutine configuration file and the vertical expansion and contraction object, and obtaining a deployment contract process container unit creating template;
The second creation unit is further used for creating the contract process container unit by operating the deployment contract process container unit template through the container unit creator.
Wherein the contract dispatcher container unit further comprises a container unit destroyer;
the above data processing apparatus further includes:
the destroying module is used for acquiring the calling condition of the intelligent contract in the target period through the container unit destroying device;
the destroying module is also used for sending a process closing signal to the contract process container unit through the container unit destroying device if the calling condition indicates that the intelligent contract meets the non-transaction calling condition;
the destroying module is further used for closing the contract process container unit when a process closing signal is received through the contract process container unit.
In one aspect, an embodiment of the present application provides a computer device, including: a processor, a memory, a network interface;
the processor is connected to the memory and the network interface, where the network interface is used to provide a data communication network element, the memory is used to store a computer program, and the processor is used to call the computer program to execute the method in the embodiment of the present application.
In one aspect, embodiments of the present application provide a computer readable storage medium having a computer program stored therein, the computer program being adapted to be loaded by a processor and to perform a method according to embodiments of the present application.
In one aspect, embodiments of the present application provide a computer program product or computer program comprising computer instructions stored in a computer-readable storage medium, the computer instructions being read from the computer-readable storage medium by a processor of a computer device, the computer instructions being executed by the processor, causing the computer device to perform a method according to an embodiment of the present application.
In the embodiment of the application, each blockchain node in the blockchain network can be correspondingly provided with a container cluster management node, the container cluster management node can comprise a vertical expansion and contraction component and a contract process container unit, the contract process container unit comprises a coroutine and an intelligent contract, and the coroutine comprises a coroutine quantity used for representing the maximum quantity of transactions for calling the intelligent contract in the concurrent operation of the contract process container unit; the container cluster management node can acquire the computing power resource occupation information corresponding to the contract process container unit through the vertical expansion and contraction component, and then adjust the computing power resource unit of the contract process container unit according to the computing power resource occupation information and the vertical expansion and contraction parameter to acquire an adjusted contract process container unit; then obtaining an adjusted computing power resource limit through the adjusted contract process container unit, determining the adjusted coroutine quantity corresponding to the coroutine pool according to the coroutine configuration file and the adjusted computing power resource limit, and carrying out coroutine quantity adjustment processing on the coroutine pool according to the adjusted coroutine quantity; and adjusting the computing power resource limit to be the computing power resource limit of the adjusted contract process container unit. The method provided by the embodiment of the application can automatically adjust the credit limit of the credit resources allocated to the contract process container unit according to the credit resource occupation condition of the contract process container unit, thereby avoiding the waste of the credit resources, and automatically adjust the size of the coroutine contained in the contract process container unit after the credit limit of the contract process container unit is adjusted, so that the concurrency degree of running transaction in the contract process container unit can be dynamically adjusted according to the credit limit change of the contract process container unit, and the running efficiency of the whole blockchain network is improved.
Drawings
In order to more clearly illustrate the embodiments of the application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of a network architecture according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a block chain based data processing method according to an embodiment of the present application;
FIG. 3 is a flowchart of a block chain based data processing method according to an embodiment of the present application;
FIG. 4 is a flowchart of a block chain based data processing method according to an embodiment of the present application;
FIG. 5 is a diagram of a blockchain-based contract engine namespace, provided in accordance with embodiments of the present application;
FIG. 6 is a flow diagram of smart contract deployment provided by an embodiment of the present application;
FIG. 7 is a flow chart of a dynamic adjustment of computing power resources according to an embodiment of the present application;
FIG. 8 is a schematic flow chart of a dynamically adjusting coroutine pool according to an embodiment of the present application;
FIG. 9 is a schematic flow chart of a dynamic priority adjustment coroutine pool according to an embodiment of the present application;
FIG. 10 is a block chain based data processing apparatus according to an embodiment of the present application;
fig. 11 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
For ease of understanding, the following simple explanation of partial nouns is first made:
1. blockchain (Block chain): in a narrow sense, the blockchain is a chain data structure taking a block as a basic unit, and the block uses a digital abstract to verify the transaction history acquired before, so that the blockchain is suitable for the requirements of tamper resistance and expandability in a distributed accounting scene; in a broad sense, blockchain also refers to distributed accounting techniques implemented by blockchain structures, including distributed consensus, privacy and security protection, point-to-point communication techniques, network protocols, smart contracts, and the like.
The goal of the blockchain is to implement a distributed data logging ledger that allows only additions and not deletions. The basic structure of the ledger floor is a linear linked list. The linked list is formed by serially connecting blocks, the Hash value of the preceding block is recorded in the following blocks, and whether each block (and the transaction in the block) is legal or not can be rapidly checked by calculating the Hash value. If a node in the network proposes to add a new block, a consensus acknowledgement must be made for the block via a consensus mechanism.
2. Block (block): the data packet carrying transaction data on the blockchain network is a data structure marked with a timestamp and a hash value corresponding to a preceding block, and the block verifies and confirms the transaction in the block through a consensus mechanism of the network. The Block includes a Block Header (Block Header) and a Block Body (Block Body), where the Block Header can record meta information of the current Block and includes data such as a current version number, a hash value corresponding to a previous Block, a timestamp, a random number, a hash value of a Merkle Root (Merkle Root), and the like. The block may record detailed data generated over a period of time, including all transaction records or other information generated during the creation of the block for which the current block is verified, and may be understood as a representation of the ledger. In addition, the detailed data of the block may include generating a unique Merkle Root record in the block header through a hash process of a Merkle Tree (Merkle Tree).
The successor Block, also called Parent Block (Parent Block), is a Block chain that performs temporal ordering by recording the hash value corresponding to the Block and the hash value corresponding to the Parent Block in the Block header.
3. Hash value (hash): also called information characteristic value or eigenvalue, hash value is generated by converting input data of arbitrary length into a password by hash algorithm and performing fixed output, and original input data cannot be retrieved by decrypting the hash value, which is a one-way encryption function. In a blockchain, each block (except the initial block) contains a hash value of the successor block, which is the potential core foundation and most important aspect in blockchain technology, which preserves the authenticity of the recorded and viewed data, as well as the integrity of the blockchain as a whole.
4. Smart Contract: an intelligent contract is a computer protocol that aims to propagate, verify, or execute contracts in an informative manner. The concept of intelligent contracts has three major elements of commitment, agreement and digital form, so that the application range of the blockchain can be expanded to all links of transaction, payment, settlement and clearing in the financial industry. Intelligent contracts refer to the immediate execution of corresponding contract terms when a pre-programmed condition is triggered, the working principle of which is similar to the if-then statement of a computer program. Smart contracts allow trusted transactions to be made without third parties, which transactions are traceable and irreversible.
5. Kubernetes (container cluster management system): kubernetes (which may be referred to simply as k8 s) is an open-source container orchestration platform for automated deployment, extension, and management of containerized applications. It provides a portable, extensible, self-healing operating environment that can operate in public, private and hybrid clouds. The Kubernetes can manage a plurality of containerized application programs, provide functions of load balancing, automatic telescoping, automatic recovery and the like, and enable deployment and management of the containerized application programs to be simpler and more efficient.
6. VPA (vertical expansion volume): kubernetes VPA (Vertical Pod Autoscaler) is an automated mechanism that automatically adjusts Pod's CPU and memory resources according to application resource requirements. The method can dynamically adjust the resources of the Pod according to the actual load condition of the application program, thereby avoiding the waste or shortage of the resources.
7. pod (container unit): pod of Kubernetes is the smallest deployable unit in Kubernetes, which is a collection of one or more containers that share network and storage resources and run on the same node. Pod is a basic building block of an application in Kubernetes, and may contain one or more containers that may cooperate to run the application or service. Containers in Pod may share the same network namespace, so that localhost communication may be used, or the same storage volume may be shared, so that data is shared. Pod can also be viewed as a logical host, which may have its own IP (Internet Protocol ) address and port, can communicate internally between containers, and can be exposed to external access through Kubernetes Service (service). Pod is an important concept in Kubernetes, which provides a flexible way to organize and deploy containerized applications while also allowing resource restriction and isolation of containers, thereby improving the reliability and security of the applications.
8. And (5) a journey-combining pool: coroutine Pool (Coroutine Pool) is a pooling technique for managing and scheduling coroutines. It can create a set of coroutines in the application, which can be reused when needed, avoiding the overhead of frequently creating and destroying coroutines. The use of the coroutine pool can improve the performance and throughput of the application program, reduce the use of the memory and the CPU, and avoid the resource waste and performance degradation caused by excessively creating coroutine.
Referring to fig. 1, fig. 1 is a schematic diagram of a network architecture according to an embodiment of the present application. Referring to fig. 1, fig. 1 is a schematic diagram of a blockchain network according to an embodiment of the present application.
The blockchain network as shown in fig. 1 may include, but is not limited to, a blockchain network to which the federated chain corresponds. The blockchain network may include a plurality of blockchain nodes, and the plurality of blockchain nodes may include a blockchain node 10a, a blockchain node 10b, a blockchain node 10c, a blockchain node 10d, …, and a blockchain node 10n. Each blockchain node can receive data sent by the outside during normal operation, perform blockchain uplink processing based on the received data, and also can send the data to the outside. To ensure data interworking between the various blockchain nodes, a data connection may exist between each blockchain node, such as between blockchain node 10a and blockchain node 10b, between blockchain node 10a and blockchain node 10c, and between blockchain node 10b and blockchain node 10 c.
It will be appreciated that data, transactions or block transfers may be made between blockchain nodes through the data connections described above. The blockchain network may implement data connection between blockchain nodes based on node identifiers, and for each blockchain node in the blockchain network, each blockchain node may store node identifiers of other blockchain nodes having a connection relationship with itself, so as to broadcast the acquired data or generated blocks to other blockchain nodes according to the node identifiers of the other blockchain nodes, for example, the blockchain node 10a may maintain a node identifier list as shown in table 1, where the node identifier list stores node names and node identifiers of the other nodes:
TABLE 1
The node identifier may be any of a protocol (Internet Protocol, IP) address for interconnection between networks, and any other information that can be used to identify a node in a blockchain network, and the IP address is only illustrated in table 1. For example, the blockchain node 10a may send information (e.g., a block) to the blockchain node 10b through the node identification bbb.bbb.bbb.bbb.bbb, and the blockchain node 10b may determine that the information was sent by the blockchain node 10a through the node identification aaa.aaa.aaa.
In a blockchain, a block must be consensus-passed through consensus nodes in the blockchain network before the block is uplink, and the block can be added to the blockchain after the consensus passes. It will be appreciated that when a blockchain is used in some contexts of a government or commercial establishment, not all participating nodes in the blockchain (i.e., blockchain nodes in the blockchain network described above) have sufficient resources and necessity to become consensus nodes of the blockchain. For example, in the blockchain network shown in fig. 1, blockchain node 10a, blockchain node 10b, blockchain node 10c, and blockchain node 10d may be considered as consensus nodes in the blockchain network. The consensus nodes in the blockchain network participate in consensus, namely, consensus is carried out on the blocks (comprising a batch of transactions), namely, voting is carried out on the blocks; while non-consensus nodes do not participate in consensus, but will help propagate block and vote messages, and synchronize status with each other, etc.
In the blockchain network shown in fig. 1, each blockchain node may correspond to a container cluster management node, e.g., blockchain node 10a may correspond to container cluster management node 100a, blockchain node 10b may correspond to container cluster management nodes 100b, …, and blockchain node 10n may correspond to container cluster management node 100n. The container cluster management node refers to a node integrated with a container cluster management system (i.e., k8 s), and a data connection exists between each blockchain node and its corresponding container cluster management node, for example, a data connection exists between the blockchain node 10c and the container cluster management node 100 c. The block chain link points and the corresponding container cluster management nodes can transmit data and transaction through the data connection. It should be understood that the above data connection is not limited to a connection manner, and may be directly or indirectly connected through a wired communication manner, may be directly or indirectly connected through a wireless communication manner, or may be connected through other connection manners, which is not limited herein.
It is to be appreciated that the container cluster management node is configured to deploy intelligent contracts in a blockchain network, and that the container cluster management node may include a vertical scaling component and a contract process container unit, wherein the contract process container unit includes a coroutine and an intelligent contract, and the coroutine includes a coroutine number that characterizes a maximum number of transactions that the contract process container unit concurrently runs a call to the intelligent contract. In the application, one contract process container unit corresponds to one intelligent contract, and different contract process container units correspond to different intelligent contracts. That is, when the blockchain node receives a service transaction requiring to call a certain intelligent contract, the service transaction can be sent to a contract process container unit which is contained in the container cluster management node and is deployed with the intelligent contract for execution, and because of isolation between different contract process container units, resource disputes with the call of other contracts can be avoided, and the contract execution efficiency is improved.
In addition, in order to avoid the waste of computational power resources caused by different calling conditions of different intelligent contracts, the application can automatically adjust the credit of computational power resources of the contract process container unit through the vertical expansion and contraction component, and automatically adjust the maximum number of concurrent operation transactions of the contract process container unit according to the credit change of the contract process container unit to adjust the comprised protocol Cheng Chida, thereby improving the overall operation efficiency of the blockchain network. Specifically, the container cluster management node can acquire computing power resource occupation information corresponding to the contract process container unit through the vertical expansion and contraction component; then, according to the computing power resource occupation information and the vertical expansion and contraction parameters, computing power resource quota adjustment processing is carried out on the contract process container unit, and an adjusted contract process container unit is obtained; and then, acquiring an adjusted computing power resource limit through the adjusted contract process container unit, determining the adjusted coroutine quantity corresponding to the coroutine pool according to the coroutine configuration file and the adjusted computing power resource limit, and carrying out coroutine quantity adjustment processing on the coroutine pool according to the adjusted coroutine quantity. And adjusting the computing power resource limit to be the computing power resource limit of the adjusted contract process container unit.
It will be appreciated that the data processing method provided by the embodiment of the present application may be performed by a computer device, including but not limited to the container cluster management node (which may be a terminal or a server) described above. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligence platforms. The terminal may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc.
It is to be appreciated that embodiments of the present application may be applied to a variety of scenarios including, but not limited to, cloud technology, artificial intelligence, intelligent transportation, etc. For example, the block link point system may perform consensus on some driving behavior data and the like sent by the vehicle-mounted terminal, and store the consensus on the vehicle-mounted terminal after the consensus passes.
It will be appreciated that in the specific embodiments of the present application, related data such as transaction data, status data, etc. are involved, and when the above embodiments of the present application are applied to specific products or technologies, user permissions or consents are required, and the collection, use and processing of related data is required to comply with the relevant laws and regulations and standards of the relevant region.
In order to facilitate understanding the above-mentioned resource adjustment process, please refer to fig. 2, fig. 2 is a schematic diagram of a data processing method based on a blockchain according to an embodiment of the present application. The container cluster management node 20 shown in fig. 2 may be any container cluster management node in the blockchain network shown in fig. 1, and the container cluster management node 20 may be the container cluster management node 10b.
As shown in fig. 2, the container cluster management node 20 includes a vertical scaling component 21 and a contract process container unit 22, where a smart contract, such as a smart contract a, may be deployed in the contract process container unit 22, and a co-program pool 23 may be included in the contract process container unit 22, where the co-program pool 23 includes a co-program number for characterizing the maximum number of transactions that the contract process container unit 22 concurrently runs to invoke the smart contract a, that is, when the contract process container unit 22 needs to occupy a co-program to invoke a method in the smart contract a when executing a transaction, such as the co-program pool 23 includes a co-program a and a co-program B, where the contract process container unit 22 may execute a transaction 1 through the co-program a and execute a transaction 2 through the co-program B, and if the contract process container unit 22 receives a transaction 3 during execution, the transaction 3 needs to wait for the co-program to be idle. It will be appreciated that other contract process container units may be included in the container cluster management node 20, where one smart contract is deployed in one contract process container unit and different contract process container units deploy different smart contracts.
As shown in fig. 2, during operation of the contract process container unit 22, the container cluster management node 20 may obtain the computing power resource occupation information of the contract process container unit 22 through the vertical scaling component 21. The computing power resource occupation information refers to occupation information of computing power resources, and the computing power resources can be one or more resources in system resources such as cpu resources and memory resources. Assuming that the computing power resource occupancy information is cpu occupancy rate of 0.85 and the current cpu resource size of the contract process container unit 22 is 100, the container cluster management node 22 may perform the processing of adjusting the computing power resource quota on the contract process container unit 22 according to the computing power resource occupancy information and the preset vertical expansion and contraction parameters. The vertical expansion and contraction parameter is a parameter for representing the adjustment rule of the computing power resource limit, and can be set according to practical situations, and the application is not limited herein. For example, when the computing power resource is a cpu resource, the vertical scaling parameter may include an expansion parameter 0.65 and a reduction parameter 0.15, where 0.85 is greater than 0.65, and the container cluster management unit 20 may expand the cpu resource of the contract process container unit 22 through the vertical scaling component 21, and assume that the adjusted cpu resource size of the contract process container unit 22 is 200. After the computational power resources of the contract process container unit 22 are increased, the corresponding coroutine pool can be expanded accordingly. As shown in fig. 2, the container cluster management node 22 may determine the adjustment coroutine number corresponding to the coroutine pool according to the computational power resource unit expanded by the contract process container unit 22 and the preset coroutine configuration file, for example, the adjustment coroutine number is 3, and the container cluster management node 22 may maintain coroutine a and coroutine B unchanged, and add coroutine C in the coroutine pool 23. The coroutine configuration file is a parameter for representing a coroutine number adjustment rule, and can be set according to actual situations, which is not limited in the present application. It will be appreciated that the adapted contract process container unit 22 receives 3 transactions, and can execute 3 transactions simultaneously through three contracts, without waiting.
It can be understood that, by the method provided by the embodiment of the application, the computing power resource limit corresponding to the contract process container unit corresponding to the intelligent contract which is not frequently called can be reduced, the computing power resource limit corresponding to the contract process container unit corresponding to the intelligent contract which is frequently called can be expanded, thereby realizing dynamic allocation of computing power resources, avoiding that part of computing power resources are idle, and in addition, when the computing power resource limit of the contract process container unit is expanded, the coroutine number of coroutine pools contained in the coroutine pool can be increased, and the concurrency of transactions is improved, so that the operation efficiency of the whole blockchain network is improved.
Further, referring to fig. 3, fig. 3 is a flowchart of a data processing method based on a blockchain according to an embodiment of the present application. Wherein the blockchain network comprises blockchain nodes and container cluster management nodes corresponding to the blockchain link nodes; the container cluster management node comprises a vertical expansion and contraction component and a contract process container unit; the contract process container unit comprises a coroutine pool and an intelligent contract; the coroutine quantity contained in the coroutine pool is used for representing the maximum number of transactions for calling intelligent contracts in concurrent operation of the contract process container unit; wherein the method may be performed by a container cluster management node (e.g., container cluster management node 100a in the embodiment described above with respect to fig. 1). The following will describe an example of the method performed by the container cluster management node, where the blockchain-based data processing method may at least include the following steps S101 to S103:
Step S101, computing power resource occupation information corresponding to the contract process container unit is obtained through the vertical expansion and contraction component.
Specifically, the container cluster management node refers to a node integrated with Kubernetes (hereinafter referred to as k8s for short), and in practical application, the container cluster management node may include a master server and a plurality of node (service) servers, where the master server is responsible for scheduling, managing and operating the k8s cluster, and the node server is an operation workload server in the k8s cluster. Pod is the smallest deployable unit in k8s, which is a combination of one or more containers, and a node server may be used to host the operation of the Pod (container unit) to carry the operation of the allocated Pod or pods. It will be appreciated that there is isolation between the different pod. The container units mentioned in the present application may be deployed in different node servers, or may be deployed in the same node server, where the present application is not limited thereto, and alternatively, functions provided by a master (management) server and a node (service) server may be integrated in the same server, where the present application is not limited thereto.
Specifically, the contract process container unit is a container unit that actually performs a contract task, and can continuously run a contract process for performing the contract task. In the application, an intelligent contract in a blockchain network is deployed in a contract process container unit, and the intelligent contracts deployed in different contract process container units are different. When the container cluster management node creates the contract process container unit, the container cluster management node allocates initial computing power resources for the contract process container unit, and in the operation process of the contract process container unit, the container cluster management node can dynamically adjust the computing power resources allocated for the contract process container unit in real time through the vertical expansion and contraction component. Wherein the vertical scaling component may be a VPA in a k8s cluster.
Specifically, the container cluster management node may first obtain, through the vertical expansion and contraction component, computing power resource occupation information of the contract process container unit, where the computing power resource occupation information may include occupation information of one or more computing power resources such as cpu resources and memory resources, and for example, the computing power resource occupation information may include cpu resource occupation rate.
Optionally, the contract process container unit includes a resource detecting component, and the computing power resource occupation information may be collected by the resource detecting component. The container cluster management node can start the resource detection assembly while starting the contract process container unit, and then acquire computing power resource occupation information corresponding to the contract process container unit through the resource detection assembly when the detection period is determined to be reached, and send the computing power resource occupation information to the vertical expansion and contraction assembly. The detection period may be started at a start time, and is determined as a detection period after a period of time, where the period of time may be selected according to practical situations, for example, one hour, ten minutes, one minute, and the like. One possible process of sending the computing power resource occupation information to the vertical expansion and contraction component may be sending the computing power resource occupation information from the contract process container unit to an interface service (i.e., an API server in the k8s cluster), and then forwarding the computing power resource occupation information to the vertical expansion and contraction component by the interface service.
Step S102, according to the computing power resource occupation information and the vertical expansion and contraction parameters, computing power resource quota adjustment processing is carried out on the contract process container unit, and an adjusted contract process container unit is obtained.
Specifically, the vertical expansion and contraction parameter corresponding to each contract process container unit may be set when the vertical expansion and contraction object is created for the contract process container unit, and the specific setting value and the setting parameter type may be adjusted based on the actual situation, which is not limited in this disclosure.
Specifically, the vertical expansion and contraction parameters may include an occupation threshold of computing power resource expansion and a maximum limit of computing power resource; according to the computing power resource occupation information and the vertical expansion and contraction parameters, computing power resource limit adjustment is carried out on the contract process container unit, and a feasible implementation process of the contract process container unit after adjustment can be as follows: if the computing power resource occupation information exceeds the computing power resource expansion occupation threshold, determining a pre-expansion computing power resource limit according to the computing power resource maximum limit, the computing power resource occupation information, the computing power resource expansion occupation threshold and the historical computing power resource limit; and adjusting the computing power resource limit of the contract process container unit into the pre-expansion computing power resource limit to obtain an adjusted contract process container unit. The historical computing power resource limit is the computing power resource limit of the contract process container unit, namely the corresponding quantity of computing power resources of the contract process container unit. The maximum credit is used for characterizing the maximum credit of the credit which can be distributed for the contract process container unit; the computing power resource expansion occupation threshold is used for representing the maximum value corresponding to the computing power resource occupation information when the computing power resource of the contract process container unit does not need to be adjusted. That is, when the computing power resource occupancy information is less than or equal to the computing power resource extension occupancy threshold, the computing power resources of the contract process container unit may not be adjusted.
The determining a feasible implementation process of the pre-expansion computing power resource limit according to the computing power resource maximum limit, the computing power resource occupation information, the computing power resource expansion occupation threshold and the historical computing power resource limit may be: determining the ratio of the computing power resource occupation information to the computing power resource expansion occupation threshold value as an expansion adjustment coefficient; multiplying the expansion adjustment coefficient by the historical computing power resource limit to obtain a target computing power resource limit; if the target computing power resource limit is smaller than or equal to the computing power resource maximum limit, determining the target computing power resource limit as a pre-expansion computing power resource limit; and if the target computing power resource limit is larger than the computing power resource maximum limit, determining the computing power resource maximum limit as the pre-expansion computing power resource limit. In order to facilitate understanding of the above resource expansion process, it is assumed that the computing power resource includes a cpu resource, at this time, the computing power resource expansion occupation threshold is a cpu occupation threshold of 0.5, the computing power resource maximum quota is a cpu maximum quota of 200mCPU (mCPU is a unit, meaning that a cpu core is abstracted into 1000 equal parts, each part is a millicore, i.e. one thousandth of a core, or millicore), at this time, the computing power resource occupation information is a cpu occupation ratio of 0.75, the historical computing power resource quota is a historical cpu quota of 100mCPU, then the expansion adjustment coefficient is 0.75/0.5=1.5, the target computing power resource quota is 1.5×100 mcpu=150 mCPU, because 150mCPU is less than 200mCPU, then the pre-expansion computing power resource quota is 150mCPU. At this time, the adjusted computing power resource limit of the contract process container unit is the pre-expansion computing power resource limit.
Specifically, the vertical expansion and contraction parameters may include a computational power resource reduction occupation threshold and a computational power resource minimum limit; according to the computing power resource occupation information and the vertical expansion and contraction parameters, computing power resource limit adjustment is carried out on the contract process container unit, and a feasible implementation process of the contract process container unit after adjustment can be as follows: if the computing power resource occupation information is smaller than the computing power resource reduction occupation threshold, determining a pre-reduction computing power resource limit according to the computing power resource minimum limit, the computing power resource occupation information, the computing power resource reduction occupation threshold and the historical computing power resource limit; the historical computing power resource limit is the computing power resource limit of the contract process container unit; and adjusting the computing power resource limit of the contract process container unit into a pre-reduced computing power resource limit to obtain an adjusted contract process container unit. The minimum limit of the computing power resources is used for representing the minimum limit of the computing power resources which can be distributed to the contract process container unit; the computing power resource reduction occupation threshold is used for representing the minimum value corresponding to the computing power resource occupation information when the computing power resource of the contract process container unit does not need to be adjusted. That is, when the computing power resource occupancy information is greater than or equal to the computing power resource extension occupancy threshold, the computing power resources of the contract process container unit may not be adjusted.
The determining a feasible implementation process of the pre-reduced computing power resource limit according to the computing power resource minimum limit, the computing power resource occupation information, the computing power resource reduction occupation threshold value and the historical computing power resource limit may be: determining the ratio of the computing power resource occupation information to the computing power resource reduction occupation threshold value as a reduction adjustment coefficient; multiplying the reduced adjustment coefficient by the historical computing power resource limit to obtain a target computing power resource limit; if the target computing power resource limit is greater than or equal to the computing power resource minimum limit, determining the target computing power resource limit as a pre-reduced computing power resource limit; and if the target computing power resource limit is smaller than the computing power resource minimum limit, determining the computing power resource minimum limit as the pre-reduced computing power resource limit. In order to facilitate understanding of the above resource reduction process, it is assumed that the computing power resource includes cpu resources, at this time, the computing power resource reduction occupation threshold is cpu occupation threshold 0.15, the computing power resource minimum limit is cpu minimum limit 2mCPU, at this time, the computing power resource occupation information is cpu occupation rate 0.75, the historical computing power resource limit is cpu historical 100mCPU, the expansion adjustment coefficient is 0.075/0.15=0.5, the target computing power resource limit is 0.5×100 mcpu=50 mCPU, because 50mCPU is greater than 2mCPU, the pre-reduction computing power resource limit is 50mCPU. At this time, the adjusted computing power resource limit of the contract process container unit is the pre-shrinking computing power resource limit.
Step S103, obtaining an adjusted computing power resource limit through the adjusted contract process container unit, determining the corresponding adjustment coroutine quantity of a coroutine pool according to a coroutine configuration file and the adjusted computing power resource limit, and carrying out coroutine quantity adjustment processing on the coroutine pool according to the adjustment coroutine quantity; and the adjusted computing power resource limit is the computing power resource limit of the adjusted contract process container unit.
Specifically, when executing a transaction in a contract process container unit, the container cluster management node needs to help to complete the call of a method in an intelligent contract required by the transaction through a coroutine, that is, when the coroutine pool contains X coroutines, at most, X transactions of the same intelligent contract can be called in parallel in the contract process container unit, and X is a positive integer. It can be understood that the number of coroutines included in the coroutine pool is related to the amount of computing power resources of the contract process container unit, and when the computing power resources are insufficient, the excessive number of coroutines can cause resource contention between coroutines, thereby affecting the execution efficiency. The relationship between the number of coroutines and the computing power resource limit contained in the coroutine pool can be embodied through a coroutine configuration file, and specific setting values and setting parameter types in the coroutine configuration file can be configured in advance according to actual conditions, so that the application is not limited herein.
Specifically, the adjusting the computing power resource limit may include M computing power resource limits, where M is a positive integer; the computing power resource types corresponding to each computing power resource limit are different; the coroutine adjustment configuration file can comprise corresponding limit weight coefficients and maximum coroutine quantity of M computing power resource limits respectively; the adjusting co-range number corresponding to the co-range pool is determined according to the adjusting computing power resource limit, and one possible implementation process of performing co-range number adjustment processing on the co-range pool according to the adjusting co-range number can be: according to the corresponding limit weight coefficients of the M computing power resource limits, carrying out weighted summation and rounding processing on the M computing power resource limits to obtain the adjustment range number; if the adjustment cooperative distance number is smaller than or equal to the maximum cooperative distance number, adjusting the cooperative distance number contained in the cooperative distance pool to be the adjustment cooperative distance number; if the adjustment coroutine number is larger than the maximum coroutine number, the coroutine number contained in the coroutine pool is adjusted to the maximum coroutine number. The coroutine number refers to the number of coroutines contained in the coroutine pool. In order to facilitate understanding of the coroutine adjustment process, assuming that the M computing power resource units include a cpu resource unit C and a memory resource unit M, where a unit weight coefficient corresponding to the cpu resource unit is C and a unit weight coefficient corresponding to the memory resource unit is M, performing weighted summation and rounding processing on the M computing power resource units to obtain an adjustment coroutine number, which may be: firstly, calculating c+m=s, if S is an integer, S is the adjustment range number, if S is not an integer, rounding down, if S is 3.1, the adjustment range number can be determined to be 3. In addition, the maximum number of coroutines refers to the maximum number of coroutines that the coroutines Cheng Chizhong can include, and when the number of coroutines is adjusted to be greater than the maximum number of coroutines, the number of coroutines in the coroutine pool can only be adjusted to the maximum number of coroutines.
Optionally, the amount of coroutines in the coroutine pool included in one contract process container unit may be related to the complexity of the intelligent contract, and if the method corresponding to the intelligent contract deployed in the contract process container unit is simpler, less computing force resources are required in execution implementation, and under the same computing force resource limit, the amount of concurrent execution of the transaction corresponding to the intelligent contract may be greater. Therefore, the coroutine adjustment configuration file also contains the contract complexity coefficient corresponding to the intelligent contract, and the contract complexity coefficient can be determined according to the contract complexity degree, the code difficulty and the like of the intelligent contract. At this time, the container cluster management node may further obtain a call proportion corresponding to the intelligent contract through the contract process container unit, where the call proportion is determined according to the number of transactions for calling the intelligent contract in the target time period and the total number of transactions received by the container cluster management node, for example, the container cluster management node receives 100 transactions within one hour, where 20 transactions are all calls of the same intelligent contract in the contract process container unit, and the call proportion corresponding to the intelligent contract is 20/100=0.2; then, multiplying the calling proportion and the contract complex coefficient to obtain a priority coefficient; multiplying the priority coefficient by the target cooperative stroke number to obtain the priority adjustment cooperative stroke number; if the priority adjustment cooperative distance number is smaller than or equal to the maximum cooperative distance number, adjusting the cooperative distance number contained in the cooperative distance pool to be the priority adjustment cooperative distance number; if the priority adjustment cooperative distance number is larger than the maximum cooperative distance number, the cooperative distance number contained in the cooperative distance pool is adjusted to be the maximum cooperative distance number.
Optionally, the container cluster management node may further include other contract process container units, where different contracts include different intelligent contracts, so that the container cluster management node may further include a contract dispatcher container unit, where the contract dispatcher container unit is configured to receive a transaction sent by the blockchain node, and then distribute the intelligent contract invoked according to a transaction requirement to the contract process container unit deployed with the intelligent contract. That is, the container cluster management node may receive, through the contract dispatcher container unit, a service transaction sent by the blockchain node, where the service transaction includes a contract identifier corresponding to the intelligent contract, and the container cluster management node may store an association relationship between the contract identifier and the contract process container unit; the container cluster management node may then forward the business transaction to the contract process container unit in the contract dispatcher container unit according to the contract identification; in the contract process container unit, if the coroutine pool is determined to contain coroutine in an idle state, acquiring a first coroutine from coroutine in the idle state; and executing business transaction through the first coroutine and the intelligent contract to obtain a transaction execution result, and sending the transaction execution result to the blockchain node.
The method provided by the embodiment of the application can automatically adjust the credit limit of the credit resources allocated to the contract process container unit according to the credit resource occupation condition of the contract process container unit, thereby avoiding the waste of the credit resources, and automatically adjust the size of the coroutine contained in the contract process container unit after the credit limit of the contract process container unit is adjusted, so that the concurrency degree of running transaction in the contract process container unit can be dynamically adjusted according to the credit limit change of the contract process container unit, and the running efficiency of the whole blockchain network is improved.
Further, referring to fig. 4, fig. 4 is a flowchart of a data processing method based on a blockchain according to an embodiment of the present application. Wherein the blockchain network comprises blockchain nodes and container cluster management nodes corresponding to the blockchain link nodes; the container cluster management node comprises a contract dispatcher container unit, a vertical expansion and contraction component and a contract process container unit; the contract process container unit comprises a coroutine pool and an intelligent contract; the coroutine quantity contained in the coroutine pool is used for representing the maximum number of transactions for calling intelligent contracts in concurrent operation of the contract process container unit; wherein the method may be performed by a container cluster management node (e.g., container cluster management node 100a in the embodiment described above with respect to fig. 1). The following description will be given by taking the embodiment of the present method as an example, where the blockchain-based data processing method may at least include the following steps S201 to S204:
Step S201, receiving a contract deployment transaction sent by a blockchain node through a contract dispatcher container unit; the contract deployment transaction comprises a contract initialization request, an intelligent contract code corresponding to the intelligent contract and a resource adjustment configuration file; the resource adjustment file comprises a vertical expansion and contraction parameter and a coroutine configuration file.
Specifically, the contract dispatcher container unit is used for scheduling all tasks requiring to invoke business transactions of the intelligent contract, wherein the intelligent contract is not deployed, but the contract file or the contract code of the intelligent contract deployed in the container cluster management node can be stored in the contract dispatcher container unit for reservation. It will be appreciated that the pod in k8s can be considered a logical host with its own IP address and port, and thus the blockchain node can send traffic directly to the contract scheduler container unit in the container cluster management node. The contract dispatcher container unit may include a network module therein that is responsible for receiving business transactions from the blockchain or contract deployment transactions for deploying the smart contracts.
In particular, the contract scheduler container unit is also used to create and destroy contract process container units. The contract manager of the blockchain wants to deploy intelligent contracts in the blockchain network, a contract deployment transaction comprising a contract initialization request, an intelligent contract code corresponding to the intelligent contract and a resource adjustment configuration file can be initiated to a blockchain link point, after the blockchain link point checks the legality of the contract deployment transaction, the contract deployment transaction can be sent to a contract dispatcher container unit in a container cluster management node, and then the container cluster management node can create a contract process container unit deployed with the intelligent contract through the contract dispatcher container unit.
Optionally, before creating the contract process container unit containing the intelligent contract, authority verification may be performed on the identity of the transaction initiating object, so as to avoid that personnel without deployment authority randomly deploy the intelligent contract in the blockchain network. Therefore, in the contract deployment transaction, transaction initiation object information can be further contained, and at the moment, the container cluster management node can perform deployment permission verification processing in the contract dispatcher container unit according to the transaction initiation object information to obtain a deployment permission verification result; if the deployment right verification result is the deployment right verification passing result, executing step S202; if the deployment permission verification result is a deployment permission verification failing result, sending permission verification failing prompt information to the blockchain node. The deployment permission verification process is performed according to the transaction initiating object information, and a feasible implementation process of the deployment permission verification result is obtained, which may be: searching a right object list, and if the transaction initiation object information is searched in the right object list, determining that the deployment right verification result is a deployment right verification passing result; if the transaction initiation object information is not found in the rights object list, determining that the deployment rights verification result is a deployment rights verification failure result. Wherein the rights object list contains object information having deployment rights.
Optionally, before creating the contract process container unit containing the intelligent contract, the security of the intelligent contract may be audited, so as to avoid the problems of transaction failure or unsafe caused by the situations of code loopholes of the intelligent contract, and the like. The container cluster management node can also comprise a contract auditing container unit, and can acquire an intelligent contract code from a contract deployment transaction through a contract dispatcher container unit and send the intelligent contract code to the contract auditing container unit; in the contract auditing container unit, performing code security verification processing on the intelligent contract code to obtain a security verification result, and sending the security verification result to the contract dispatcher container unit; if the security verification result is a security verification passing result, executing step S202 in the contract dispatcher container unit; if the security verification result is a security verification failure result, sending a security verification failure prompt message to the blockchain node through the contract dispatcher container unit. The code security verification process may be to perform security verification on the logic, grammar and other issues of the intelligent contract code, so as to ensure the security of the intelligent contract code.
Step S202, creating a vertical expansion and contraction object according to the vertical expansion and contraction parameter, and creating a contract process container unit according to the vertical expansion and contraction object and the contract deployment transaction; the contract process container unit contains the smart contract code and the coroutine configuration file.
Specifically, the vertical expansion and contraction object is used for indicating the vertical expansion and contraction component to perform computing power resource quota adjustment processing on the contract process container unit according to computing power resource occupation information corresponding to the contract process container unit.
Specifically, the contract dispatcher container unit comprises an initial contract process container unit creation template and a container unit creator; creating a vertical scaling object from the vertical scaling parameters, creating a contract process container unit from the vertical scaling object and the contract deployment transaction may be: creating a vertical expansion and contraction object according to the vertical expansion and contraction parameters; acquiring an initial contract process container unit creation template, writing the initial contract process container unit creation template according to the intelligent contract code, the coroutine configuration file and the vertical expansion and contraction object, and obtaining a deployment contract process container unit creation template; a contract process container unit is created by the container unit creator running a deployment contract process container unit template. Wherein the initial contract process container unit creation template may be a file configured in advance for creating the contract process container unit. The vertical expansion and contraction object is used for indicating the vertical expansion and contraction component to adjust the computing power resource limit corresponding to the contract process container unit according to the computing power resource occupation information corresponding to the contract process container unit and the vertical expansion and contraction parameter after the contract process container unit is started. The coroutine configuration file is used for indicating the contract process container unit to adjust the coroutine quantity in the coroutine pool after the computing power resource limit is adjusted.
Step S203, in the contract process container unit, a coroutine pool is created according to the coroutine configuration file and the computing power resource unit of the contract process container unit.
Specifically, the container cluster management node may initialize a coroutine pool in the contract process container unit, and then determine the coroutine number of the current coroutine pool according to the coroutine configuration file and the computing power resource limit of the contract process container unit. After that, the number of coroutines in the coroutine pool may be adjusted along with the adjustment of the computing power resource limit of the contract process container unit, and the adjustment process of the computing power resource limit, the determination process of the number of coroutines and the adjustment process of the number of coroutines may refer to the specific descriptions of step S101 to step S103 in the embodiment corresponding to fig. 3, which are not described herein again.
Step S204, the contract deployment transaction is sent to the contract process container unit through the contract dispatcher container unit, in the contract process container unit, a second coroutine in an idle state in the coroutine pool is obtained, the contract initialization request is executed through the second coroutine and the intelligent contract code, a contract initialization result is obtained, and the contract initialization result is sent to the blockchain node.
Specifically, the contract initialization result is used for characterizing the deployment condition of the intelligent contract in the contract process container unit. The contract initialization results may include a contract initialization success result for indicating that the intelligent contract deployment was successful and a contract initialization failure result for indicating that the intelligent contract deployment failed.
Specifically, the contract process container unit also needs to perform contract initialization after creation, and thus, a contract deployment transaction also needs to be sent from the contract scheduler container unit into the contract process container unit. In addition, the container cluster management node records the association relation between the contract identification of the intelligent contract and the contract process container unit in the contract dispatcher container unit, so that when the business transaction for calling the intelligent contract exists later, the business transaction can be sent to the contract process container unit according to the association relation in the contract dispatcher container unit.
Optionally, the contract dispatcher container unit further comprises a container unit destructor, and the calling condition of the intelligent contract in the target period can be obtained through the container unit destructor; if the calling condition indicates that the intelligent contract meets the transaction-free calling condition, a process closing signal is sent to a contract process container unit through a container unit destroying device; when a process shutdown signal is received by the contract process container unit, the contract process container unit is shutdown. The no-transaction call condition may be that a task transaction for calling the smart contract is not received in a target period, and this may indicate that the smart contract is not called all the time, so the contract process container unit where the smart contract is deployed may be closed, thereby releasing the corresponding computing power resource.
By adopting the method provided by the embodiment of the application, the intelligent contracts in the block chain are deployed in different contract process container units, and the problem of resource disputes during intelligent contract calling can be avoided because of isolation among the contract process container units. Optionally, in order to avoid that the intelligent contract is optionally deployed, the container cluster management node may further perform authority verification on a transaction initiation object corresponding to the contract deployment transaction before responding to the contract deployment transaction, and only the contract deployment transaction passing the authority verification may be responded. Optionally, in order to avoid that the environmental stability is affected by the leaky contracts, a contract auditing container unit may be added, and before responding to the contract deployment transaction, the container cluster management node needs to audit the contract deployment transaction by applying for the container unit through the contracts, so as to avoid that unsafe contracts affect the system environment. In addition, in order to avoid resource consumption caused by a large number of intelligent contract installations, a contract process container unit without task execution for a long time can be closed through a container unit consumer, so that dynamic and circulated scheduling of computing resources is ensured.
Further, the above data processing method may be implemented by a system architecture of different blockchain-based contract engine scheduling schemes, and for convenience of understanding, please refer to fig. 5, fig. 5 is a schematic diagram of a blockchain-based contract engine namespace according to an embodiment of the present application. The contract engine namespaces are a single namespaces in the Kubernetes, and function to realize the data processing methods proposed by the application. The namespaces in Kubernetes are a hierarchy of virtualized clusters that isolate and name the Kubernetes resources.
As shown in fig. 5, the contract engine namespace may include a contract process schedule pod, a contract audit pod, and a contract process pod. Wherein the contract process dispatch pod (i.e., the contract dispatcher container unit referred to in the various embodiments above) is responsible for scheduling all tasks of contract transactions, such as for distributing transactions of a specified contract to the appropriate contract process pod; the contract process pod (i.e., the contract process container unit mentioned in the above embodiments) is a pod that actually performs a contract task, which can continuously run a contract process for calling the smart contract method; the contract audit pod (i.e., the contract audit container unit referred to above in the corresponding embodiment of FIG. 4) is responsible for auditing the security of the contract.
As shown in fig. 5, the contract process scheduling pod may include a network module, an authentication module, VPA dynamic management, contract file management, a contract process pod creator, and a contract process pod destructor. Wherein the network module is responsible for receiving transactions from the blockchain (i.e., business transactions or contract deployment transactions sent by the blockchain nodes described above); the authentication module is responsible for verifying the rights of the transaction (i.e. performing the rights verification process as mentioned in the corresponding embodiment of fig. 4 above); the VPA dynamic management is used for dynamically managing the computing power resource limit of the closing process pod; contract file management is responsible for managing all contract files (contract codes); the contract process pod creator (i.e., the container unit creator described in the corresponding embodiment of fig. 4 above) is responsible for creating the contract process pod; the contract process pod destructor (i.e. the container unit destructor described in the embodiment corresponding to fig. 4 above) is responsible for destroying the contract process pod.
As shown in fig. 5, a network module, a contract main code, a contract SDK (Software Development Kit ), and a coroutine may be included in the contract process pod. The network module is used for receiving a transaction request from the contract process scheduler pod; the contract main code refers to contract main code written by contract developers, and the main code usually calls a contract SDK; the contract SDK is an SDK service provided by the smart contract, such as storing data, acquiring data, and the like; a coroutine pool is a structure supporting concurrency in a contract process, and each transaction in operation occupies one coroutine.
It will be appreciated that the contract engine namespaces shown in FIG. 5 can be deployed in the container cluster management node, and that the functionality provided by the contract process dispatch pod, the contract audit pod, and the contract process pod included therein can be implemented by the container cluster management node.
Further, by the data processing method and the contract engine namespace provided by the above embodiments, the intelligent contract can be deployed to the contract process pod in the contract engine namespace and VPA initialization can be performed. For ease of understanding, fig. 6 is a schematic flow chart of intelligent contract deployment according to an embodiment of the present application. As shown in fig. 6, the entire smart contract deployment process may include the following steps S301-S327:
In step S301, the blockchain node receives a contract deployment transaction sent by the terminal device.
Specifically, after the contract manager packs the written intelligent contract locally, parameters of an intelligent contract initialization method can be added into the intelligent contract through the terminal equipment, then the intelligent contract and the parameters are packed into contract deployment transaction, signature is carried out on the contract deployment transaction to obtain signature data, and then the contract deployment transaction and the signature data are sent to the blockchain node together.
Step S302, block link point auditing contract deployment transaction, if auditing is successful, executing step S403; if the audit fails, step S327 is performed.
Specifically, when the block chain link point auditing contract deploys transaction, signature data can be untagged, and if the untagging is successful, the auditing is determined to be successful; if the signing releasing fails, determining that the auditing fails.
In step S303, the block link sends the contract deployment transaction to the contract process scheduler pod.
Specifically, the contract process scheduler pod has its own IP and port, so the blockchain node can send the contract deployment transaction directly into the contract process scheduler pod in the k8s cluster.
In step S304, the network module of the contract process scheduler pod receives the contract deployment transaction.
In particular, the communication of the contract process scheduler pod is effected by the network module it contains, so that the contract process scheduler pod can receive the contract deployment transaction through the network module.
Step S305, the contract process scheduler pod authentication module performs authority verification, and if the authority verification is successful, step S306 is executed; if the rights verification fails, step S321 is performed.
Specifically, the contract process fetcher pod may perform authority verification on the contract deployment transaction through the authentication module, where the authority verification process may refer to the description of the deployment authority verification process in step S201 in the embodiment corresponding to fig. 4, and the description is not repeated here.
Step S306, contract audit pod carries out contract audit, if audit is successful, step S307 is executed; if the audit fails, step S322 is performed.
Specifically, the process of contract audit can refer to the related description of the code security verification process in step S201 in the embodiment corresponding to fig. 4, which is not repeated here.
In step S307, the contract process scheduler pod saves the contract file.
Specifically, the contract file may be generated based on information associated with the smart contract included in the contract deployment transaction, such as a smart contract code, a smart contract identification. The contract process scheduler pod saves the contract file for recording and review.
In step S308, the contract process scheduler pod adds VPA dynamic management for the pod to be created.
Specifically, the contract process scheduler pod adds VPA dynamic management to the pod to be created, which is to create a vertical expansion and contraction object for the pod to be created, and the implementation process can refer to the description of the creation process of the vertical expansion and contraction object in step S202 in the embodiment corresponding to fig. 4, which is not repeated here.
In step S309, the contract process scheduler pod creates a new contract process pod.
In step S310, the contract process scheduler pod initializes the coroutine pool and stores the coroutine configuration file.
Specifically, the contract process Pod initializes the coroutine pool according to the coroutine configuration file, and stores the coroutine configuration file, namely, sets the maximum coroutine number corresponding to the coroutine pool as a numerical value related to the CPU occupation proportion and the memory occupation proportion.
In step S311, the contract process scheduler pod distributes the contract deployment transaction to the contract process pod.
In step S312, the contract process pod network module receives a contract deployment transaction.
Step S313, determining whether the contract process pod has an idle coroutine available; if yes, go to step S315; if not, step S314 is performed.
Step S314, when waiting for a new idle routine, execute step S315.
In step S315, the contract process pod allocates an idle routine to execute an initialization method of the contract main code.
Specifically, the implementation process of step S309 to step S315 may refer to the specific description of step S202 to step 204 in the embodiment corresponding to fig. 4, which is not described herein.
Step S316, if a crash error occurs in the cooperative call process, executing step S317; if not, step S318 is performed.
In step S317, the contract process pod restores the current contract and encapsulates the cause of the crash error, and step S319 is executed.
In step S318, the contract process pod calls whether the initialization method of the contract main code is successful. If the initialization is successful, step S320 is executed; if the initialization fails, step S319 is performed.
Step S319, the contract process pod encapsulates the result of the execution error, and step S323 is executed.
Step S320, the contract process pod encapsulates the result of successful execution, and step S323 is executed.
In step S321, the contract process scheduler pod returns an error of failure in the permission check to the block link point, and step S323 is executed.
Step S322, the contract audit pod returns an error of contract audit failure to the block link point, and step S323 is executed.
In step S323, the contract process pod sends the execution result corresponding to the contract deployment transaction to the blockchain node, and releases the coroutine occupied by the contract deployment transaction.
Step S324, the block chain link point receives an execution result corresponding to the contract deployment transaction and initiates consensus of the execution result; all the block chain nodes perform consensus on the execution result, and if the consensus is successful, step S326 is executed; if the consensus fails, step S325 is performed.
Specifically, the execution result may be one of a result of a cause of a protocol crash error of the package, a result of an execution success of the package, a result of an execution failure of the package, an error of a permission check failure, or an error of a contract audit failure.
In step S325, the blockchain node returns a failure result of the consensus verification to the terminal device.
In step S326, the blockchain node returns the execution result of the contract deployment transaction to the terminal device.
Specifically, the blockchain node also writes the contract deployment transaction and the execution result into the blockchain ledger.
In step S327, the blockchain node returns an error to the terminal device that the audit transaction did not pass.
Further, by the data processing method and the contract engine namespace provided by the above embodiments, dynamic expansion and contraction of the contract process pod can be realized, that is, expansion or reduction of the amount of the computing power resource corresponding to the contract process pod is continuously performed along with the change of the occupancy rate of the computing power resource. For ease of understanding, please refer to fig. 7, fig. 7 is a flow chart illustrating a dynamic adjustment of computing power resources according to an embodiment of the present application. As shown in fig. 7, the entire process of dynamically adjusting the computing power resources may include the following steps S401-S410:
Step S401, preconfiguring a contract process pod template.
Specifically, the contract process pod template may be an initial contract process container unit creation template described in the embodiment corresponding to fig. 4, and the configured contract process pod template may be stored in the contract process dispatcher pod.
Step S402, acquiring the contract process pod template when creating a new contract process pod.
In step S403, the contract process fetcher pod modifies the contract-related information in the template to the related information of the new contract.
Specifically, the implementation process of step S402 to step S403 may refer to the specific description of step S202, which is not described herein.
In step S404, the contract process scheduler pod creates a VPA object for the new contract.
Specifically, the VPA object is the vertical expansion and contraction object described in the embodiment corresponding to fig. 4, and the creation process of the VPA object may refer to the description of the creation of the vertical expansion and contraction object in step S202 in the embodiment corresponding to fig. 4, which is not repeated here.
In step S405, the contract process scheduler pod specifies vertical scaling parameters in the HPA object.
Specifically, the vertical expansion and contraction parameters may include an occupation threshold of computing power resource expansion, an occupation threshold of computing power resource reduction, a maximum computing power resource limit, and a minimum computing power resource limit. For example, the vertical expansion and contraction parameter may be specified to be 80% of the cpu expansion occupation threshold, 20% of the cpu reduction occupation threshold, and 400mCPU of the maximum computing power resource, where the maximum computing power resource of the cpu of one contract process pod is 200m, and the minimum computing power resource of the cpu of 2mCPU, where the minimum computing power resource of the cpu of one contract process pod is 2mCPU.
Specifically, referring to table 2 below, table 2 is an example YAML (a file format) file of an HPA object for implementing the pod dynamic extension, which sets the maximum limit of the CPU and the memory of the contract process pod to a fixed ratio, as shown in table 2:
TABLE 2
It will be appreciated that the yaml file shown in Table 2 above defines a VPA object named example-VPA which automatically vertically scales the Pod container in the discover object named example-discover. The containerPolicies field specifies the policy at the container level. The maxAllowed field specifies the maximum value of the container's CPU and memory resource requests, here set to 2CPU (one CPU core) and 4Gi (one memory size unit) memory, respectively. The controlledValues field specifies the minimum values of the container's CPU and memory resource requests, here set to 100 CPU and 256Mi (a unit of memory size) memory, respectively. The controldresource field specifies the type of resource that needs to be controlled, here set to CPU and memory. The mode field specifies the mode of resource restriction, here set to "Max", indicating that the upper bound of the resource request is maxAllowed.
In step S406, the contract process pod is started.
In step S407, the resource detecting component in the contract process pod is started.
In step S408, the resource detection component sends the computing power resource occupation information to the API server in k8S in real time.
In step S409, the VPA automatically adjusts the computational power resources of the contract process pod according to the computational power resource occupation information.
Specifically, the API server may send the received computing power resource occupation information of the contract process pod to the VPA, and the VPA may adjust the amount of computing power resources corresponding to the contract process pod corresponding to the intelligent contract according to the computing power resource occupation information. The specific implementation process of adjusting the contract process pod computing power resource limit can be referred to the specific description of step S102 in the embodiment corresponding to fig. 3, and will not be described herein.
In step S410, the contract process pod destructor closes the contract process pod corresponding to the smart contract when the smart contract satisfies the no-transaction call condition.
Specifically, the implementation of step S410 may refer to the detailed description of the container unit closing contract process container unit in the embodiment corresponding to fig. 4, and the detailed description is omitted here.
According to the method provided by the embodiment of the application, each intelligent contract has only one k8s pod (contract process container unit), so that the waste of resources is avoided, and the reasonable utilization of resources is ensured.
Further, by the data processing method and the contract engine namespace provided by the above embodiments, dynamic adjustment of the coroutine pool in the contract process pod can be realized, that is, expansion or reduction of the coroutine number of the coroutine Cheng Chizhong is continuously performed along with the change of the computing power resource limit of the contract process pod. For ease of understanding, fig. 8 is a schematic flow chart of a dynamic adjustment coroutine pool according to an embodiment of the present application. As shown in fig. 8, the entire process of dynamically adjusting the coroutine pool may include the following steps S501-S509:
in step S501, the contract process pod starts.
In step S502, the contract process pod obtains the cpu coefficient c and the memory coefficient m.
In step S503, the contract process pod obtains the cpu quota C and the memory quota M of the current pod.
In step S504, the available size of the pool is calculated as s=c×c+m×m.
In step S505, the contract process pod sets the size of the coroutine pool to S.
Specifically, the implementation process of step S501 to step S505 may be referred to the specific description of step S103 in the embodiment corresponding to fig. 3, which is not described herein.
Step S506, when receiving the new transaction, if the number of corollary programs in the current corollary program pool is not lower than S, the transaction is put into a queue for waiting.
Specifically, whenever a contract process pod receives a new transaction, if it is determined that the number of coroutines in the current coroutine pool is not less than S, it indicates that all coroutines are occupied, and no empty coroutines can help the new transaction to be executed, so that the new transaction needs to be put into a queue for waiting until an empty coroutine is available.
In step S507, the contract process pod starts timer detection and signal detection of the closing process.
Specifically, the timer detection refers to a signal for detecting the timer, and the timer can generate a signal at intervals to prompt the contract process pod to detect whether the quota is changed. The signal of closing the process is generated by a container destruction unit in the contract scheduler container unit, and the contract process pod needs to be closed when the signal detection of closing the process is detected.
Step S508, if the timer arrives, executing step S503; if the timer does not arrive, step S509 is executed.
In step S509, a signal to close the process arrives, closing the contract process pod.
By the method provided by the embodiment of the application, when the computational power resource limit of the Pod is continuously changed, the size of the coroutine pool is automatically adjusted, the concurrency degree of the contract process is dynamically adjusted according to the change of the resource limit, the utilization rate of the contract process Pod can be improved as much as possible, and the contract process Pod is fully parallelized.
Further, by the data processing method and the contract engine namespace provided by the above embodiments, the priority dynamic adjustment of the coroutine in the contract process pod can be realized, that is, the coroutine number of the coroutine Cheng Chizhong is continuously expanded or reduced along with the change of the computing power resource limit and the contract priority of the contract process pod. For ease of understanding, fig. 9 is a schematic flow chart of a priority dynamic adjustment coroutine pool according to an embodiment of the present application. As shown in fig. 9, the entire process of dynamically adjusting the coroutine pool with priority may include the following steps S601-S610:
in step S601, the contract process pod starts.
In step S602, the contract process pod obtains the cpu coefficient c, the memory coefficient m, and the contract complexity coefficient k.
In step S603, the contract process pod obtains the cpu quota C and the memory quota M of the current pod.
In step S604, the contract process pod obtains the calling proportion p, and calculates the priority coefficient k×p.
In step S605, the available size of the equation pool is calculated as s=kpcc+kpcm.
In step S606, the contract process pod sets the size of the coroutine pool to S.
Specifically, the implementation process of step S601 to step S605 may be referred to the specific description of step S103 in the embodiment corresponding to fig. 3, which is not described herein.
In step S607, when receiving a new transaction, if the number of corollaries in the current corollaries pool is not lower than S, the transaction is put into a queue for waiting.
Specifically, whenever a contract process pod receives a new transaction, if it is determined that the number of coroutines in the current coroutine pool is not less than S, it indicates that all coroutines are occupied, and no empty coroutines can help the new transaction to be executed, so that the new transaction needs to be put into a queue for waiting until an empty coroutine is available.
In step S608, the contract process pod starts timer detection and signal detection of the shutdown process.
Specifically, the timer detection refers to a signal for detecting the timer, and the timer can generate a signal at intervals to prompt the contract process pod to detect whether the quota is changed. The signal of closing the process is generated by a container destruction unit in the contract scheduler container unit, and the contract process pod needs to be closed when the signal detection of closing the process is detected.
Step S609, if the timer arrives, step S603 is executed; if the timer has not arrived, step S610 is performed.
In step S610, the signal to close the process arrives, closing the contract process pod.
According to the method provided by the embodiment of the application, in the process of dynamically adjusting the protocol Cheng Chida, the complexity degree and the calling frequency of contracts are considered, the protocol Cheng Chida is controlled by the contract complexity coefficient and the calling proportion, the lifting utilization rate can be improved better, and the parallelization is sufficient.
Referring to fig. 10, fig. 10 is a schematic structural diagram of a data processing apparatus based on a blockchain according to an embodiment of the present application. The data processing apparatus may be a computer program (including program code) running on a computer device, for example the data processing apparatus is an application software; the data processing apparatus 1 may be used to perform corresponding steps in a blockchain-based data processing method provided by an embodiment of the present application. As shown in fig. 10, the data processing apparatus 1 may include: the system comprises an information acquisition module 101, a credit adjustment module 102, a credit acquisition module 103 and a co-journey adjustment module 104.
The information acquisition module 101 is configured to acquire computing power resource occupation information corresponding to the contract process container unit through the vertical expansion and contraction component;
the credit adjustment module 102 is configured to perform credit adjustment processing on the contract process container unit according to the credit occupation information and the vertical expansion and contraction parameter, so as to obtain an adjusted contract process container unit;
the credit acquisition module 103 is configured to acquire an adjusted credit resource credit through the adjusted contract process container unit;
the cooperative distance adjustment module 104 is configured to determine an adjusted cooperative distance number corresponding to the cooperative distance pool according to the cooperative distance configuration file and the adjustment computing power resource limit, and perform cooperative distance number adjustment processing on the cooperative distance pool according to the adjusted cooperative distance number; and adjusting the computing power resource limit to be the computing power resource limit of the adjusted contract process container unit.
The specific implementation manner of the information obtaining module 101, the credit adjusting module 102, the credit obtaining module 103, and the co-journey adjusting module 104 may refer to the specific description of the steps S101 to S103 in the embodiment corresponding to fig. 3, and the detailed description is omitted here.
The vertical expansion and contraction parameters comprise an occupied threshold value of computing power resource expansion and a maximum limit of computing power resource;
the credit adjustment module 102 includes: an extension unit 1021, and a first adjustment unit 1022.
An expansion unit 1021, configured to determine a pre-expansion computing power resource amount according to the computing power resource maximum amount, the computing power resource occupation information, the computing power resource expansion occupation threshold, and the historical computing power resource amount if the computing power resource occupation information exceeds the computing power resource expansion occupation threshold; the historical computing power resource limit is the computing power resource limit of the contract process container unit;
the first adjusting unit 1022 is configured to adjust the computing power resource unit of the contract process container unit to a pre-extended computing power resource unit, and obtain an adjusted contract process container unit.
The specific implementation manner of the extension unit 1021 and the first adjustment unit 1022 may refer to the specific description of step S102 in the embodiment corresponding to fig. 3, which is not repeated herein.
Wherein the extension unit 1021 includes: the calculation subunit 10211 and the determination subunit 10212.
A calculating subunit 10211, configured to determine, as an expansion adjustment coefficient, a ratio of the computing power resource occupation information to the computing power resource expansion occupation threshold;
the computing subunit 10211 is further configured to multiply the expansion adjustment coefficient with the historical computing power resource quota to obtain a target computing power resource quota;
a determining subunit 10212, configured to determine the target computing power resource quota as a pre-extended computing power resource quota if the target computing power resource quota is less than or equal to the computing power resource maximum quota;
the determining subunit 10212 is further configured to determine the maximum computing power resource quota as the pre-extended computing power resource quota if the target computing power resource quota is greater than the computing power resource maximum quota.
The specific implementation manner of the calculating subunit 10211 and the determining subunit 10212 may refer to the specific description of step S102 in the embodiment corresponding to fig. 3, which is not repeated here.
The vertical expansion and contraction parameters comprise an occupied threshold value of computing power resource reduction and a minimum limit of computing power resource;
the credit adjustment module 102 includes: the reduction unit 1023 and the second adjustment unit 1024.
The reducing unit 1023 is configured to determine a pre-reduced computing power resource amount according to the computing power resource minimum amount, the computing power resource occupation information, the computing power resource reduction occupation threshold, and the historical computing power resource amount if the computing power resource occupation information is smaller than the computing power resource reduction occupation threshold; the historical computing power resource limit is the computing power resource limit of the contract process container unit;
the second adjusting unit 1024 is configured to adjust the computing power resource unit of the contract process container unit to a pre-reduced computing power resource unit, and obtain an adjusted contract process container unit.
The specific implementation manner of the reduction unit 1023 and the second adjustment unit 1024 may refer to the specific description of step S102 in the embodiment corresponding to fig. 3, and will not be repeated here.
Wherein, the adjustment computing power resource limit comprises M computing power resource limits, M is a positive integer; the computing power resource types corresponding to each computing power resource limit are different; the coroutine adjustment configuration file comprises corresponding limit weight coefficients and maximum coroutine quantity of M computing power resource limits respectively;
the coroutine adjustment module 104 includes: a number determining unit 1041 and a cooperative distance adjusting unit 1042.
The number determining unit 1041 is configured to perform weighted summation rounding processing on the M computing power resource units according to the corresponding unit weight coefficients of the M computing power resource units, to obtain an adjusted coroutine number;
The cooperative distance adjusting unit 1042 is configured to adjust the cooperative distance number included in the cooperative distance pool to be the adjusted cooperative distance number if the adjusted cooperative distance number is smaller than or equal to the maximum cooperative distance number;
the cooperative distance adjusting unit 1042 is configured to adjust the cooperative distance number included in the cooperative distance pool to the maximum cooperative distance number if the adjusted cooperative distance number is greater than the maximum cooperative distance number.
The specific implementation manner of the number determining unit 1041 and the range adjusting unit 1042 may refer to the specific description of step S103 in the embodiment corresponding to fig. 3, and will not be repeated here.
The coroutine adjustment configuration file also comprises contract complexity coefficients corresponding to the intelligent contracts;
the data processing apparatus 1 further includes: the priority determination module 105 and the priority adjustment module 106.
The priority determining module 105 is configured to obtain a calling proportion corresponding to the intelligent contract; the calling proportion is determined according to the transaction quantity of calling intelligent contracts in the target time period and the total transaction quantity received by the container cluster management node;
the priority determining module 105 is further configured to multiply the calling proportion and the contract complexity coefficient to obtain a priority coefficient;
the priority determining module 105 is further configured to multiply the priority coefficient with the target cooperative distance number to obtain a priority adjustment cooperative distance number;
A priority adjustment module 106, configured to adjust the number of coroutines included in the coroutine pool to the priority adjustment number of coroutines if the priority adjustment number of coroutines is less than or equal to the maximum number of coroutines;
the priority adjustment module 106 is further configured to adjust the number of coroutines included in the coroutine pool to the maximum number of coroutines if the priority adjustment coroutine number is greater than the maximum number of coroutines.
The specific implementation manner of the priority determining module 105 and the priority adjusting module 106 may refer to the optional description of step S103 in the embodiment corresponding to fig. 3, which is not repeated here.
Wherein the contract process container unit further comprises a resource detection component;
the data processing apparatus 1 further includes: a resource detection module 107.
A resource detection module 107 for starting the resource detection component at the same time as starting the contract process container unit;
the resource detection module 107 is further configured to, when it is determined that the detection period is reached, obtain, by using the resource detection component, computing power resource occupation information corresponding to the contract process container unit, and send the computing power resource occupation information to the vertical expansion and contraction component.
The specific implementation manner of the resource detection module 107 may refer to the optional description of step S101 in the embodiment corresponding to fig. 3, which is not described herein.
Wherein the container cluster management node further comprises a contract scheduler container unit;
the data processing apparatus 1 further includes: a transaction processing module 108.
A transaction processing module 108 for receiving, by the contract scheduler container unit, a business transaction sent by the blockchain node; the business transaction comprises a contract identifier corresponding to the intelligent contract;
the transaction processing module 108 is further configured to forward the business transaction to the contract process container unit according to the contract identification;
the transaction processing module 108 is further configured to, in the contract process container unit, if it is determined that the coroutine pool includes a coroutine in an idle state, obtain a first coroutine from the coroutine in the idle state;
the transaction processing module 108 is further configured to execute a business transaction through the first coroutine and the smart contract, obtain a transaction execution result, and send the transaction execution result to the blockchain node.
The specific implementation manner of the transaction processing module 108 may refer to the optional description of step S103 in the embodiment corresponding to fig. 3, which is not described herein.
Wherein, the above-mentioned data processing apparatus 1, further include: a contract deployment module 109, a first creation module 110, a second creation module 111, and a contract initialization module 112.
A contract deployment module 109 for receiving, by the contract dispatcher container unit, a contract deployment transaction sent by the blockchain node; the contract deployment transaction comprises a contract initialization request, an intelligent contract code corresponding to the intelligent contract and a resource adjustment configuration file; the resource adjustment file comprises a vertical expansion and contraction capacity parameter and a coroutine configuration file;
a first creating module 110, configured to create a vertical expansion and contraction object according to the vertical expansion and contraction parameter, and create a contract process container unit according to the vertical expansion and contraction object and the contract deployment transaction; the contract process container unit comprises intelligent contract codes and a coroutine configuration file; the vertical expansion and contraction object is used for indicating the vertical expansion and contraction component to carry out calculation resource quota adjustment processing on the contract process container unit according to calculation resource occupation information corresponding to the contract process container unit;
a second creating module 111, configured to create, in the contract process container unit, a coroutine pool according to the coroutine configuration file and the computing power resource limit of the contract process container unit;
a contract initialization module 112, configured to send a contract deployment transaction to a contract process container unit through a contract dispatcher container unit, in the contract process container unit, obtain a second contract in an idle state in a contract pool, execute a contract initialization request through the second contract and an intelligent contract code, obtain a contract initialization result, and send the contract initialization result to a blockchain node; the contract initialization results are used to characterize deployment of the intelligent contracts in the contract process container unit.
The specific implementation manner of the contract deployment module 109, the first creation module 110, the second creation module 111, and the contract initialization module 112 may be referred to the specific description of step S201 to step S204 in the embodiment corresponding to fig. 4, and will not be described herein.
Wherein the contract dispatcher container unit comprises an initial contract process container unit creation template and a container unit creator;
the first creation module 110 includes: the first creation unit 1101 and the second creation unit 1102.
A first creating unit 1101, configured to create a vertical expansion-contraction object according to a vertical expansion-contraction parameter;
the second creating unit 1102 is configured to obtain an initial contract process container unit creating template, write the initial contract process container unit creating template according to the intelligent contract code, the coroutine configuration file and the vertical expansion and contraction object, and obtain a deployment contract process container unit creating template;
the second creating unit 1102 is further configured to execute the deployment contract process container unit template by using the container unit creator to create a contract process container unit.
The specific implementation manner of the first creating unit 1101 and the second creating unit 1102 may refer to the specific description of step S202 in the embodiment corresponding to fig. 4, which is not described herein.
Wherein the contract dispatcher container unit further comprises a container unit destroyer;
the data processing apparatus 1 further includes: and a destruction module 113.
The destroying module 113 is used for acquiring the calling condition of the intelligent contract in the target period through the container unit destroying device;
the destroying module 113 is further configured to send a process closing signal to the contract process container unit through the container unit destroyer if the calling condition indicates that the intelligent contract meets the no-transaction calling condition;
the destruction module 113 is further configured to close the contract process container unit when a process closing signal is received through the contract process container unit.
The specific implementation manner of the destruction module 113 may refer to the optional description of step S204 in the embodiment corresponding to fig. 4, which is not described herein.
Referring to fig. 11, fig. 11 is a schematic structural diagram of a computer device according to an embodiment of the application. As shown in fig. 11, the data processing apparatus 1 in the embodiment corresponding to fig. 10 described above may be applied to a computer device 1000, and the computer device 1000 may include: processor 1001, network interface 1004, and memory 1005, and in addition, the above-described computer device 1000 may further include: a user interface 1003, and at least one communication bus 1002. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display (Display), a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface, among others. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 1005 may also optionally be at least one storage device located remotely from the processor 1001. As shown in fig. 11, an operating system, a network communication module, a user interface module, and a device control application may be included in the memory 1005, which is one type of computer-readable storage medium.
In the computer device 1000 shown in fig. 11, the network interface 1004 may provide a network communication network element; while user interface 1003 is primarily used as an interface for providing input to a user; and the processor 1001 may be used to invoke a device control application stored in the memory 1005 to implement:
acquiring computing power resource occupation information corresponding to the contract process container unit through the vertical expansion and contraction component;
according to the computing power resource occupation information and the vertical expansion and contraction parameters, computing power resource quota adjustment processing is carried out on the contract process container unit, and an adjusted contract process container unit is obtained;
acquiring an adjusted computing power resource limit through the adjusted contract process container unit, determining the adjusted coroutine quantity corresponding to the coroutine pool according to the coroutine configuration file and the adjusted computing power resource limit, and carrying out coroutine quantity adjustment processing on the coroutine pool according to the adjusted coroutine quantity; and adjusting the computing power resource limit to be the computing power resource limit of the adjusted contract process container unit.
It should be understood that the computer device 1000 described in the embodiments of the present application may perform the description of the data processing method in any of the foregoing embodiments corresponding to fig. 3 and fig. 4, which is not repeated herein. In addition, the description of the beneficial effects of the same method is omitted.
Furthermore, it should be noted here that: the embodiment of the present application further provides a computer readable storage medium, in which the computer program executed by the aforementioned data processing apparatus 1 is stored, and the computer program includes program instructions, when executed by the aforementioned processor, can execute the description of the data processing method in any of the foregoing embodiments corresponding to fig. 3 and 4, and therefore, the description will not be repeated here. In addition, the description of the beneficial effects of the same method is omitted. For technical details not disclosed in the embodiments of the computer-readable storage medium according to the present application, please refer to the description of the method embodiments of the present application.
The computer readable storage medium may be the data processing apparatus provided in any one of the foregoing embodiments or an internal storage unit of the computer device, for example, a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash card (flash card) or the like, which are provided on the computer device. Further, the computer-readable storage medium may also include both internal storage units and external storage devices of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
Furthermore, it should be noted here that: embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium and executes the computer instructions to cause the computer device to perform the method provided by the corresponding embodiment of any of the preceding figures 3, 4.
The terms "and" comprise "used in the description and claims of embodiments of the application and in the drawings are used for distinguishing between different objects and not for describing a particular sequential order. Furthermore, the term "include" and any variations thereof is intended to cover a non-exclusive inclusion. For example, a process, method, apparatus, article, or device that comprises a list of steps or elements is not limited to the list of steps or modules but may, in the alternative, include other steps or modules not listed or inherent to such process, method, apparatus, article, or device.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied as electronic hardware, as a computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of network elements in the foregoing description to clearly illustrate the interchangeability of hardware and software. Whether these network elements are implemented in hardware or software depends on the specific application and design constraints of the solution. The skilled person may use different methods for implementing the described network elements for each specific application, but such implementation should not be considered to be beyond the scope of the present application.
The foregoing disclosure is illustrative of the present application and is not to be construed as limiting the scope of the application, which is defined by the appended claims.

Claims (15)

1. A data processing method based on a block chain is characterized in that a block chain network comprises block chain nodes and container cluster management nodes corresponding to the block chain link points; the container cluster management node comprises a vertical expansion and contraction component and a contract process container unit; the contract process container unit comprises a coroutine pool and an intelligent contract; the coroutine quantity contained in the coroutine pool is used for representing the maximum quantity of transactions for calling the intelligent contract by the concurrent operation of the contract process container unit; the method is performed by a container cluster management node; the method comprises the following steps:
acquiring computing power resource occupation information corresponding to the contract process container unit through the vertical expansion and contraction component;
performing computing power resource quota adjustment processing on the contract process container unit according to the computing power resource occupation information and the vertical expansion and contraction parameters to obtain an adjusted contract process container unit;
acquiring an adjusted computing power resource limit through the adjusted contract process container unit, determining an adjusted coroutine number corresponding to the coroutine pool according to a coroutine configuration file and the adjusted computing power resource limit, and performing coroutine number adjustment processing on the coroutine pool according to the adjusted coroutine number; and the adjusted computing power resource limit is the computing power resource limit of the adjusted contract process container unit.
2. The method of claim 1, wherein the vertical scaling parameters include a computing power resource extension occupancy threshold and a computing power resource maximum credit;
and adjusting the computing power resource limit of the contract process container unit according to the computing power resource occupation information and the vertical expansion and contraction parameters to obtain an adjusted contract process container unit, wherein the method comprises the following steps:
if the computing power resource occupation information exceeds the computing power resource expansion occupation threshold, determining a pre-expansion computing power resource limit according to the computing power resource maximum limit, the computing power resource occupation information, the computing power resource expansion occupation threshold and the historical computing power resource limit; the historical computing power resource limit is the computing power resource limit of the contract process container unit;
and adjusting the computing power resource limit of the contract process container unit into the pre-expansion computing power resource limit to obtain an adjusted contract process container unit.
3. The method of claim 2, wherein the determining the pre-extended computing power resource credit based on the computing power resource maximum credit, the computing power resource occupancy information, the computing power resource extended occupancy threshold, and the historical computing power resource credit comprises:
Determining the ratio of the computing power resource occupation information to the computing power resource expansion occupation threshold value as an expansion adjustment coefficient;
multiplying the expansion adjustment coefficient by the historical computing power resource limit to obtain a target computing power resource limit;
if the target computing power resource limit is smaller than or equal to the computing power resource maximum limit, determining the target computing power resource limit as a pre-expansion computing power resource limit;
and if the target computing power resource limit is larger than the computing power resource maximum limit, determining the computing power resource maximum limit as a pre-expansion computing power resource limit.
4. The method of claim 1, wherein the vertical scaling parameters include a reduced occupancy threshold for computing power resources and a minimum amount of computing power resources;
and adjusting the computing power resource limit of the contract process container unit according to the computing power resource occupation information and the vertical expansion and contraction parameters to obtain an adjusted contract process container unit, wherein the method comprises the following steps:
if the computing power resource occupation information is smaller than the computing power resource reduction occupation threshold, determining a pre-reduction computing power resource limit according to the computing power resource minimum limit, the computing power resource occupation information, the computing power resource reduction occupation threshold and the historical computing power resource limit; the historical computing power resource limit is the computing power resource limit of the contract process container unit;
And adjusting the computing power resource limit of the contract process container unit into the pre-shrinking computing power resource limit to obtain an adjusted contract process container unit.
5. The method of claim 1, wherein the adjusting the computing power resource amount comprises M computing power resource amounts, M being a positive integer; the computing power resource types corresponding to each computing power resource limit are different; the coroutine adjustment configuration file comprises corresponding limit weight coefficients and maximum coroutine quantity of the M computing power resource limits respectively;
the adjusting assistant distance quantity corresponding to the assistant distance pool is determined according to the adjusting calculation force resource limit, and the assistant distance quantity adjusting processing is carried out on the assistant distance pool according to the adjusting assistant distance quantity, and the adjusting processing comprises the following steps:
according to the corresponding limit weight coefficients of the M computing power resource limits, carrying out weighted summation and rounding processing on the M computing power resource limits to obtain the adjustment range number;
if the adjustment cooperative distance number is smaller than or equal to the maximum cooperative distance number, adjusting the cooperative distance number contained in the cooperative distance pool to be the adjustment cooperative distance number;
and if the adjustment cooperative stroke number is larger than the maximum cooperative stroke number, adjusting the cooperative stroke number contained in the cooperative stroke pool to the maximum cooperative stroke number.
6. The method of claim 1, wherein the coroutine adjustment profile further includes a contract complexity factor corresponding to the smart contract;
the method further comprises the steps of:
acquiring the calling proportion corresponding to the intelligent contract; the calling proportion is determined according to the transaction quantity of calling the intelligent contract in the target time period and the total transaction quantity received by the container cluster management node;
multiplying the calling proportion by the contract complexity coefficient to obtain a priority coefficient;
multiplying the priority coefficient by the target cooperative stroke number to obtain a priority adjustment cooperative stroke number;
if the priority adjustment cooperative distance number is smaller than or equal to the maximum cooperative distance number, adjusting the cooperative distance number contained in the cooperative distance pool to be the priority adjustment cooperative distance number;
and if the priority adjustment cooperative distance number is larger than the maximum cooperative distance number, adjusting the cooperative distance number contained in the cooperative distance pool to the maximum cooperative distance number.
7. The method of claim 1, wherein the contract process container unit further comprises a resource detection component;
the method further comprises the steps of:
starting the resource detection component while starting the contract process container unit;
And when the detection period is determined to be reached, acquiring computing power resource occupation information corresponding to the contract process container unit through the resource detection component, and sending the computing power resource occupation information to the vertical expansion and contraction component.
8. The method of claim 1, wherein the container cluster management node further comprises a contract scheduler container unit;
the method further comprises the steps of:
receiving, by the contract scheduler container unit, a business transaction sent by the blockchain node; the business transaction comprises a contract identifier corresponding to the intelligent contract;
forwarding the business transaction to the contract process container unit according to the contract identification;
if the contract process container unit determines that the coroutine pool contains coroutines in an idle state, acquiring a first coroutine from the coroutines in the idle state;
and executing the business transaction through the first coroutine and the intelligent contract to obtain a transaction execution result, and sending the transaction execution result to the blockchain node.
9. The method of claim 1, wherein the container cluster management node further comprises a contract scheduler container unit;
The method further comprises the steps of:
receiving, by the contract scheduler container unit, a contract deployment transaction sent by the blockchain node; the contract deployment transaction comprises a contract initialization request, an intelligent contract code corresponding to the intelligent contract and a resource adjustment configuration file; the resource adjustment file comprises a vertical expansion and contraction parameter and a coroutine configuration file;
creating a vertical expansion and contraction object according to the vertical expansion and contraction parameters, and creating a contract process container unit according to the vertical expansion and contraction object and the contract deployment transaction; the contract process container unit comprises the intelligent contract code and the coroutine configuration file; the vertical expansion and contraction object is used for indicating the vertical expansion and contraction component to adjust the computing power resource limit of the contract process container unit according to the computing power resource occupation information corresponding to the contract process container unit;
creating a coroutine pool in the contract process container unit according to the coroutine configuration file and the computing power resource limit of the contract process container unit;
the contract deployment transaction is sent to the contract process container unit through the contract scheduler container unit, a second contract in an idle state in the contract process pool is obtained in the contract process container unit, the contract initialization request is executed through the second contract and the intelligent contract code, a contract initialization result is obtained, and the contract initialization result is sent to the blockchain node; the contract initialization result is used for representing deployment situations of the intelligent contract in the contract process container unit.
10. The method of claim 9, wherein the contract dispatcher container unit includes an initial contract process container unit creation template and a container unit creator;
the creating a vertical expansion and contraction object according to the vertical expansion and contraction parameter, creating a contract process container unit according to the vertical expansion and contraction object and the contract deployment transaction, comprising:
creating a vertical expansion and contraction object according to the vertical expansion and contraction parameters;
the initial contract process container unit creation template is obtained, and the initial contract process container unit creation template is written according to the intelligent contract code, the coroutine configuration file and the vertical expansion and contraction object, so that a deployment contract process container unit creation template is obtained;
and operating the deployment contract process container unit template through the container unit creator to create a contract process container unit.
11. The method of claim 8, wherein the contract dispatcher container unit further comprises a container unit destroyer;
the method further comprises the steps of:
acquiring the calling condition of the intelligent contract in a target period through the container unit destroyer;
if the calling condition indicates that the intelligent contract meets the transaction-free calling condition, a process closing signal is sent to the contract process container unit through the container unit destructor;
And closing the contract process container unit when the process closing signal is received by the contract process container unit.
12. A data processing apparatus, wherein a blockchain network includes blockchain nodes and container cluster management nodes corresponding to the blockchain nodes; the container cluster management node comprises a vertical expansion and contraction component and a contract process container unit; the contract process container unit comprises a coroutine pool and an intelligent contract; the coroutine quantity contained in the coroutine pool is used for representing the maximum quantity of transactions for calling the intelligent contract by the concurrent operation of the contract process container unit; the device is operated by a container cluster management node; the device comprises:
the information acquisition module is used for acquiring the computing power resource occupation information corresponding to the contract process container unit through the vertical expansion and contraction component;
the credit adjustment module is used for carrying out credit adjustment processing on the contract process container unit according to the credit occupation information and the vertical expansion and contraction parameters to obtain an adjusted contract process container unit;
the credit acquisition module is used for acquiring the credit adjustment resource credit through the adjusted contract process container unit;
The coroutine adjustment module is used for determining the adjustment coroutine quantity corresponding to the coroutine pool according to the coroutine configuration file and the adjustment computing power resource limit, and carrying out coroutine quantity adjustment processing on the coroutine pool according to the adjustment coroutine quantity; and the adjusted computing power resource limit is the computing power resource limit of the adjusted contract process container unit.
13. A computer device, comprising: a processor, a memory, and a network interface;
the processor is connected to the memory, the network interface for providing data communication functions, the memory for storing program code, the processor for invoking the program code to perform the method of any of claims 1-11.
14. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program adapted to be loaded by a processor and to perform the method of any of claims 1-11.
15. A computer program product comprising computer programs/instructions which, when executed by a processor, are adapted to carry out the method of any one of claims 1-11.
CN202310955133.3A 2023-07-28 2023-07-28 Block chain-based data processing method, device, equipment and readable storage medium Pending CN116974764A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310955133.3A CN116974764A (en) 2023-07-28 2023-07-28 Block chain-based data processing method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310955133.3A CN116974764A (en) 2023-07-28 2023-07-28 Block chain-based data processing method, device, equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN116974764A true CN116974764A (en) 2023-10-31

Family

ID=88482832

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310955133.3A Pending CN116974764A (en) 2023-07-28 2023-07-28 Block chain-based data processing method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN116974764A (en)

Similar Documents

Publication Publication Date Title
CN110443704B (en) Method and device for sending resources in cross-link mode
CN111461723B (en) Data processing system, method and device based on block chain
CN110189121B (en) Data processing method and device, block chain client and block chain link point
CN110838065A (en) Transaction data processing method and device
CN110599177A (en) Transaction verification method and related equipment
CN111614761B (en) Block chain message transmission method, device, computer and readable storage medium
CN111368330B (en) Ethernet intelligent contract auditing system and method based on block chain
CN111985007A (en) Contract signing and executing method and device based on block chain
CN112381543A (en) Multiple signature transaction method, device and storage medium
CN110737425A (en) billing platform system application program establishing method and device
CN102197390B (en) Providing functionality to client services by implementing and binding contracts
CN116703601B (en) Data processing method, device, equipment and storage medium based on block chain network
CN111045928B (en) Interface data testing method, device, terminal and storage medium
CN110458541B (en) Object replacement method and device based on block chain
CN116974764A (en) Block chain-based data processing method, device, equipment and readable storage medium
CN116804949B (en) Block chain-based data processing method, device, equipment and readable storage medium
CN112001800B (en) Method and device for processing business in block chain system
CN106060032B (en) User data integration and reassignment method and system
CN115250354A (en) Resource allocation method, device, equipment and storage medium based on block chain network
CN116975158B (en) Request processing method, apparatus, computer device and storage medium
CN117040930B (en) Resource processing method, device, product, equipment and medium of block chain network
CN117032998B (en) Block chain-based data processing method and device and readable storage medium
CN116805947B (en) Block chain data processing method, device, equipment and computer readable storage medium
CN117056084B (en) Data processing method, device, equipment and medium based on hierarchical blockchain network
CN117057806B (en) Data processing method and device based on block chain and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication