Skip to content

starknet_patricia_storage: spawn a task or not based on config#12174

Open
nimrod-starkware wants to merge 1 commit intonimrod/parallel-reads/config-fieldfrom
nimrod/parallel-reads/spawn-based-on-config
Open

starknet_patricia_storage: spawn a task or not based on config#12174
nimrod-starkware wants to merge 1 commit intonimrod/parallel-reads/config-fieldfrom
nimrod/parallel-reads/spawn-based-on-config

Conversation

@nimrod-starkware
Copy link
Contributor

@nimrod-starkware nimrod-starkware commented Feb 1, 2026

Note

Medium Risk
Changes the runtime execution model for storage reads (threadpool vs async runtime), which can affect latency/throughput and potential runtime blocking if misconfigured.

Overview
Makes RocksDB read offloading configurable. RocksDbStorage now stores RocksDbStorageConfig and conditionally uses tokio::spawn_blocking for get/mget only when spawn_blocking_reads is enabled; otherwise reads execute directly.

Config defaults and deployment configs are updated to set committer_config.storage_config.inner_storage_config.spawn_blocking_reads to true, and the config schema default is changed accordingly.

Written by Cursor Bugbot for commit 695d081. This will update automatically on new commits. Configure here.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

nimrod-starkware commented Feb 1, 2026

@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/config-field branch from ff7c5e0 to 87029a0 Compare February 2, 2026 08:36
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/spawn-based-on-config branch from a1b79bf to 1729e41 Compare February 2, 2026 08:36
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/spawn-based-on-config branch from 1729e41 to b32ebca Compare February 2, 2026 09:09
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/config-field branch 2 times, most recently from a594575 to a8d8b53 Compare February 3, 2026 13:08
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/spawn-based-on-config branch from b32ebca to 58b2329 Compare February 3, 2026 13:08
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/config-field branch from a8d8b53 to 7b94b0e Compare February 3, 2026 14:59
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/spawn-based-on-config branch from 58b2329 to 198f552 Compare February 3, 2026 14:59
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/config-field branch from 7b94b0e to bcc7298 Compare February 3, 2026 15:30
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/spawn-based-on-config branch from 198f552 to 48301ce Compare February 3, 2026 15:30
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/spawn-based-on-config branch 2 times, most recently from e03a849 to 8222312 Compare February 9, 2026 14:27
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/config-field branch from ee9db12 to 17fb5a6 Compare February 9, 2026 14:27
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/spawn-based-on-config branch from 8222312 to 07499bc Compare February 9, 2026 15:13
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/config-field branch from 17fb5a6 to 04de417 Compare February 9, 2026 15:13
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/spawn-based-on-config branch from 07499bc to 8192046 Compare February 10, 2026 08:44
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/config-field branch from 04de417 to 93549f6 Compare February 10, 2026 08:44
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/spawn-based-on-config branch from 8192046 to 1e4407b Compare February 10, 2026 09:07
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/config-field branch from 93549f6 to 001b426 Compare February 10, 2026 09:07
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/spawn-based-on-config branch from 1e4407b to e990000 Compare February 10, 2026 09:44
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/config-field branch from 001b426 to 67b6567 Compare February 10, 2026 09:44
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/config-field branch from 67b6567 to fa080d5 Compare February 10, 2026 12:34
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/spawn-based-on-config branch from e990000 to e7cd356 Compare February 10, 2026 12:34
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/spawn-based-on-config branch from e7cd356 to 4a46808 Compare February 17, 2026 07:13
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/config-field branch from fa080d5 to 03cf6b6 Compare February 17, 2026 07:13
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/config-field branch from 03cf6b6 to fdf98af Compare February 19, 2026 09:21
@nimrod-starkware nimrod-starkware force-pushed the nimrod/parallel-reads/spawn-based-on-config branch from 4a46808 to 695d081 Compare February 19, 2026 09:21
Copy link
Contributor

@ArielElp ArielElp left a comment

Choose a reason for hiding this comment

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

@ArielElp reviewed 4 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on nimrod-starkware).


crates/starknet_patricia_storage/src/rocksdb_storage.rs line 315 at r2 (raw file):

                    .map(|r| r.map(|opt| opt.map(DbValue)).map_err(|e| e.into()))
                    .collect::<Result<Vec<_>, PatriciaStorageError>>()
            })

can you factor this out into a function and call it in both cases? Cursor suggested:

fn multi_get(
    db: &DB,
    keys: impl IntoIterator<Item = impl AsRef<[u8]>>,
) -> Result<Vec<Option<DbValue>>, PatriciaStorageError> {
    db.multi_get(keys)
        .into_iter()
        .map(|r| r.map(|opt| opt.map(DbValue)).map_err(|e| e.into()))
        .collect()
}
        if self.config.spawn_blocking_reads {
            let db = self.db.clone();
            let keys: Vec<Vec<u8>> = keys.iter().map(|k| k.0.clone()).collect();
            Ok(spawn_blocking(move || multi_get(&db, keys.iter().map(|k| k.as_slice())))
                .await??)
        } else {
            Ok(multi_get(&self.db, keys.iter().map(|k| k.0.as_slice()))?)
        }

Code quote:

            let db = self.db.clone();
            let keys: Vec<Vec<u8>> = keys.iter().map(|k| k.0.clone()).collect();
            Ok(spawn_blocking(move || {
                let raw_keys = keys.iter().map(|k| k.as_slice());
                db.multi_get(raw_keys)
                    .into_iter()
                    .map(|r| r.map(|opt| opt.map(DbValue)).map_err(|e| e.into()))
                    .collect::<Result<Vec<_>, PatriciaStorageError>>()
            })

Copy link
Contributor Author

@nimrod-starkware nimrod-starkware left a comment

Choose a reason for hiding this comment

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

@nimrod-starkware made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on ArielElp).


crates/starknet_patricia_storage/src/rocksdb_storage.rs line 315 at r2 (raw file):

Previously, ArielElp wrote…

can you factor this out into a function and call it in both cases? Cursor suggested:

fn multi_get(
    db: &DB,
    keys: impl IntoIterator<Item = impl AsRef<[u8]>>,
) -> Result<Vec<Option<DbValue>>, PatriciaStorageError> {
    db.multi_get(keys)
        .into_iter()
        .map(|r| r.map(|opt| opt.map(DbValue)).map_err(|e| e.into()))
        .collect()
}
        if self.config.spawn_blocking_reads {
            let db = self.db.clone();
            let keys: Vec<Vec<u8>> = keys.iter().map(|k| k.0.clone()).collect();
            Ok(spawn_blocking(move || multi_get(&db, keys.iter().map(|k| k.as_slice())))
                .await??)
        } else {
            Ok(multi_get(&self.db, keys.iter().map(|k| k.0.as_slice()))?)
        }

Done in next PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments