Skip to content

Higher resolution studies of CPU usage #551

@bwbush

Description

@bwbush

Problem statement

Analysis and simulation has highlighted that Linear Leios has some fairly stringent constraints on CPU usage. Previous simulation work has demonstrated the feasibility of (1) the "happy path" for Plutus and non-Plutus workloads and (2) resilience to attacks involving late release of transactions and/or EBs. However, these conclusion are based on several assumptions that may require further investigation:

  1. The Rust simulator faithfully represents and sequences the CPU operations and threading that would occur on the a node under a wide variety of conditions (happy path, heavy Plutus, attacks, etc.).
    • The Rust simulator does not model the ledger or UTxO set.
    • The Rust simulator does not model updates to the memory pool in detail.
    • The Rust simulator may be overly optimistic in that it is performing operations before sufficient information is available (e.g., conflicting txs might be applied on different threads in parallel even though that couldn't occur in a real node).
  2. The CPU costs of Apply and Reapply that were derived from measuring Cardano mainnet with db-analyser are accurate enough for use in modeling Leios. - We already know that these data are extremely noisy.
    • We don't have sufficient evidence that that Plutus cost model corresponds directly and linearly to CPU usage.
    • It is likely that the existing ledger state, the size of ledger's active UTxO set, and the number of transaction inputs/outputs strongly affect the ledger-update time.
  3. A unified memory pool is possible even though transactions with size or Plutus that exceeds the RB limits would have to appear in an EB.
    • An "oversize" transaction (required to be in an EB) might have to be re-applied whenever a smaller transaction (suitable for an RB) is inserted before it in the memory pool.
    • At the very least, a sophisticated data structure or index would be needed for the memory pool, and that might incur extra CPU cost.

Proposed tasks

  • Carefully review the existing Apply and Reapply operations in cardano-node and other implementations in order to assess . . .
    • how much Leios will affect these, and
    • what opportunities for parallelism, caching, memorization, etc. are feasible for Leios.
  • Revisit the db-analyser tool and data set.
    • Alter db-analyser to provide finer-grained output of measured ledger-update and transaction-validation operations.
    • Study the relationships between Plutus units and actual CPU usage, in the context of the complexity of the script context.
    • Study the relationship between the size of the ledger's active UTxO set and the Reapply time.
    • Study the relationship between the number of a transactions inputs/outputs and the Reapply time.
  • Consider upgrading the Rust simulator and/or the Haskell prototype to more faithfully model of CPU usage.
    • Run both optimistic vs pessimistic simulations of application and re-application of transactions to ledger.
  • Develop a fine-grained mathematical model for constraints on sequencing CPU-intensive operations.
    • Prove that RB production/liveness will not be affected by CPU bottlenecks.
    • Quantify how much throughput can be reduced by CPU bottlenecks.
    • Apply the model to attacks aimed at overwhelming a node's CPUs (or forcing it into single-threaded operation) by triggering highly concentrated Apply/Reapply operations just prior to voting, block production, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions