Skip to content

perf(l1, l2): move post-execution trie updates to the background#4989

Merged
jrchatruc merged 37 commits into
mainfrom
perf/bg_trie_update-edgar-v2
Oct 27, 2025
Merged

perf(l1, l2): move post-execution trie updates to the background#4989
jrchatruc merged 37 commits into
mainfrom
perf/bg_trie_update-edgar-v2

Conversation

@edg-l

@edg-l edg-l commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

Motivation

This PR moves the trie portion of the apply_updates function to a background thread, improving block execution times. This background thread receives messages through a channel to apply new trie updates and does two things:

  • First, it updates the in-memory diff layers and notifies the process that sent the message (i.e. the block production thread) so it can continue with block execution.
  • Second, it performs the logic of persisting the bottom-most diff layer to disk. To do this, we first pause the ongoing thread in charge of generating the snapshots (i.e. FlatKeyValue) through a message, then persist the diff layer to disk, then notify again the thread to continue snapshot generation.

Description

Closes #issue_number

@edg-l
edg-l changed the base branch from main to perf/bg_trie_update October 22, 2025 14:10
@github-actions

github-actions Bot commented Oct 22, 2025

Copy link
Copy Markdown

Lines of code report

Total lines added: 91
Total lines removed: 27
Total lines changed: 118

Detailed view
+---------------------------------------------+-------+------+
| File                                        | Lines | Diff |
+---------------------------------------------+-------+------+
| ethrex/crates/networking/p2p/snap.rs        | 931   | +1   |
+---------------------------------------------+-------+------+
| ethrex/crates/storage/store_db/in_memory.rs | 630   | -2   |
+---------------------------------------------+-------+------+
| ethrex/crates/storage/store_db/rocksdb.rs   | 1544  | +90  |
+---------------------------------------------+-------+------+
| ethrex/crates/storage/trie_db/layering.rs   | 114   | -25  |
+---------------------------------------------+-------+------+

@jrchatruc
jrchatruc changed the base branch from perf/bg_trie_update to main October 22, 2025 19:12
@jrchatruc jrchatruc changed the title perf/bg_trie_update update v2 perf(l1, l2): move post-execution db store to the background Oct 23, 2025
@github-actions github-actions Bot added L1 Ethereum client L2 Rollup client performance Block execution throughput and performance in general labels Oct 23, 2025
@jrchatruc jrchatruc changed the title perf(l1, l2): move post-execution db store to the background perf(l1, l2): move post-execution trie updates to the background Oct 23, 2025
@jrchatruc
jrchatruc marked this pull request as ready for review October 23, 2025 18:29
@jrchatruc
jrchatruc requested a review from a team as a code owner October 23, 2025 18:29
@ethrex-project-sync ethrex-project-sync Bot moved this to In Review in ethrex_l1 Oct 23, 2025

@ilitteri ilitteri left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to test these changes in the L2

@github-project-automation github-project-automation Bot moved this to Requires Changes in ethrex_l2 Oct 24, 2025
@github-project-automation github-project-automation Bot moved this from In Review to In Progress in ethrex_l1 Oct 24, 2025
Comment thread crates/storage/store_db/in_memory.rs Outdated
Comment thread crates/storage/trie_db/layering.rs
Comment thread crates/storage/trie_db/layering.rs Outdated
Comment thread crates/storage/store_db/rocksdb.rs Outdated
Comment thread crates/storage/store_db/rocksdb.rs Outdated
Comment thread crates/storage/store_db/rocksdb.rs Outdated
Comment thread crates/storage/store_db/rocksdb.rs Outdated
@edg-l

edg-l commented Oct 27, 2025

Copy link
Copy Markdown
Contributor Author

Fixed conflicts and review comments

@ilitteri
ilitteri dismissed their stale review October 27, 2025 16:09

This is already being tested in the L2

This reverts commit d4f74f2.
@jrchatruc
jrchatruc enabled auto-merge October 27, 2025 17:52
@jrchatruc
jrchatruc added this pull request to the merge queue Oct 27, 2025
Merged via the queue into main with commit 96e6433 Oct 27, 2025
29 checks passed
@jrchatruc
jrchatruc deleted the perf/bg_trie_update-edgar-v2 branch October 27, 2025 18:38
@github-project-automation github-project-automation Bot moved this from Requires Changes to Done in ethrex_l2 Oct 27, 2025
@github-project-automation github-project-automation Bot moved this from In Progress to Done in ethrex_l1 Oct 27, 2025
@github-project-automation github-project-automation Bot moved this from Todo to Done in ethrex_performance Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

L1 Ethereum client L2 Rollup client performance Block execution throughput and performance in general

Projects

Status: Done
Status: Done
Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants