Parallel Execution

Celestium adopts Parallel Execution to maximize throughput and utilize modern multi-core processors effectively. By executing multiple transactions simultaneously, Celestium significantly improves performance compared to traditional blockchains that rely on serial transaction processing.


Understanding Parallel Execution

In most blockchains, transactions are executed sequentially. Each transaction updates the global state, and the result of one transaction can affect the next. This approach ensures correctness but creates a performance bottleneck.

Parallel execution allows multiple transactions to be executed concurrently, provided they do not interfere with each other.


Optimistic Execution Model

Celestium employs an optimistic execution model to parallelize transaction processing:

  1. Transactions are optimistically executed in parallel without waiting for prior transactions in the block to complete.

  2. Each transaction tracks the state it reads and writes (read-set and write-set).

  3. After execution, the outputs are merged in block order:

    • If two transactions access different parts of the state, they merge seamlessly.

    • If two transactions conflict (e.g., they modify the same account), the later transaction is re-executed with updated state.

This model ensures that the final state is identical to sequential execution, preserving Ethereum compatibility.


Example of Parallel Execution

Consider a block with these transactions:

  1. Tx1: Alice sends 10 CLT to Bob.

  2. Tx2: Charlie deploys a smart contract.

  3. Tx3: Bob interacts with a DeFi protocol.

Parallel Execution:

  • Tx1 updates Alice and Bob’s balances.

  • Tx2 deploys a contract, unrelated to Tx1 or Tx3.

  • Tx3 involves Bob’s balance, which depends on Tx1.

What happens:

  • Tx1 and Tx2 execute in parallel.

  • Tx3 starts optimistically but fails because it reads Bob’s balance before Tx1 completes.

  • After Tx1 is finalized, Tx3 is re-executed with the correct balance.


Dependency Management

Celestium uses static analysis and runtime checks to manage dependencies:

  • Static Analysis: Before execution, Celestium predicts potential conflicts based on transaction input data.

  • Runtime Conflict Detection: After execution, read-sets and write-sets are compared to detect conflicts. Conflicting transactions are automatically re-executed.

This hybrid approach minimizes unnecessary re-executions and maximizes parallelism.


Benefits of Parallel Execution

Benefit

Impact

Increased Throughput

Multiple transactions processed simultaneously.

Reduced Latency

Faster execution, especially for non-conflicting transactions.

Efficient Resource Utilization

Full use of modern multi-core CPUs.

Ethereum Compatibility

Execution results are identical to serial processing.


Performance Considerations

  • Transactions with independent state (e.g., transfers between different users) benefit the most.

  • High-conflict transactions (e.g., interacting with the same contract) may require re-execution, but Celestium’s conflict detection minimizes the overhead.


Parallel Execution vs. Asynchronous Execution

Feature

Parallel Execution

Asynchronous Execution

Focus

Execution parallelism

Decoupling consensus from execution

Key Benefit

Increased throughput

Extended execution budget

Compatibility

Ethereum-compatible

Ethereum-compatible


Parallel Execution in Practice

When processing a block, Celestium’s execution engine:

  1. Analyzes transactions for potential conflicts.

  2. Executes independent transactions in parallel.

  3. Detects conflicts and re-executes affected transactions if needed.

  4. Merges results in block order to ensure final state consistency.

This approach allows Celestium to achieve high throughput while maintaining the deterministic nature of blockchain state transitions.

Last updated