From: thepipeline_xyz
The Monad blockchain implements an optimistic parallel execution algorithm, which was first developed over a year and a half ago by Monad Labs [00:01:16]. This approach clarifies that transactions within a block are linearly ordered, with the ultimate goal of reaching the final state after executing each transaction as if done sequentially, but in a shorter timeframe [00:01:39].
How it Works
The optimistic parallel execution algorithm is relatively simple [00:01:58]:
- Parallel Execution: A batch of transactions are run simultaneously, generating “pending results” [00:02:02].
- Record Inputs/Outputs: Each pending result includes a record of the inputs and outputs for its respective transaction [00:02:07].
- Ordered Commitment: These pending results are then committed in the original, linear order of the transactions [00:02:14].
- Conflict Resolution: If, during the commitment phase, an input for a pending result is found to have been invalidated (e.g., due to a conflict with an earlier committed transaction), that specific transaction is re-scheduled for execution [00:02:20]. Further commitments are paused until the re-executed transaction is processed [00:02:28].
This method is also known as “optimistic concurrency control” [00:02:38]. Re-execution due to conflicts is often inexpensive because the necessary inputs are typically already in cache, leading to quick cache lookups [00:02:47].
Observed Impact and Bottlenecks
Despite its intuitive design, Monad’s implementation of the optimistic parallel execution algorithm, done over a year and a half ago, did not yield significant performance improvements compared to serial execution [00:03:08].
The primary bottleneck identified was state access [00:03:32].
- Transactions have dependencies on accounts and storage slots [00:03:35].
- This state is typically stored on an SSD in Ethereum and other EVM-compatible blockchains [00:03:41].
- The cost of reading from an SSD is substantial [00:03:48], ranging from 80 to 100 microseconds or more, which is orders of magnitude longer than executing a simple smart contract [00:10:25].
- Existing databases used by EVM-compatible blockchains for state storage (like Pebble DB or RocksDB) do not support parallel access efficiently [00:04:02].
- When multiple virtual machines attempt parallel reads to the database, they still bottleneck, effectively leading to single-file execution [00:04:05].
Beyond Parallel Execution: The Need for Deeper Optimizations
The realization that parallel execution alone wasn’t enough to achieve true performance gains led Monad to explore other optimizations in EVM implementations [00:04:26]. It’s akin to putting a Lamborghini body on a Toyota Corolla engine; the external parallelization doesn’t matter if the underlying components are slow [00:08:10].
The key to unlocking performance gains for parallel execution lies in fundamental optimization techniques specific to blockchain databases and other parts of the execution stack [00:04:47].
Key areas of focus include:
- Custom State Database: Monad developed its own custom database to allow for parallel access to state [00:04:51]. This is critical because standard general-purpose databases (like B+ tree or LSM trees) are not optimized for the specific access patterns of blockchain state [00:13:34]. A custom database can leverage the high performance of modern SSDs, which can support 500,000 I/O operations per second, but only if the software is designed to extract that performance [00:14:17].
- Separation of Execution and Consensus: By decoupling execution from consensus, more time is allowed for both processes to run in parallel, significantly increasing the budget for execution [00:17:47]. In Ethereum, only about 100 milliseconds out of a 12-second block time is allocated to execution, which is a mere 1% [00:19:17].
- Micro-optimizations: Monad performs numerous micro-optimizations, such as optimizing translation lookaside buffers (TLBs), which might individually offer small gains (e.g., 5%), but accumulate to significant speedups [00:30:09]. This involves deep analysis at the assembly instruction level [00:30:53].
The focus on these comprehensive, ground-up optimizing blockchain performance strategies is why Monad’s tagline is “no shortcuts” [00:20:35]. It’s about performing the necessary fundamental engineering and scientific work, constantly measuring and experimenting, rather than relying on intuitive but unverified assumptions [00:33:32].