Skip to content

feat: Cache and reuse registry data across rounds#10639

Merged
alin-at-dfinity merged 4 commits into
masterfrom
alin/reuse-NetworkTopology
Jul 7, 2026
Merged

feat: Cache and reuse registry data across rounds#10639
alin-at-dfinity merged 4 commits into
masterfrom
alin/reuse-NetworkTopology

Conversation

@alin-at-dfinity

Copy link
Copy Markdown
Contributor

Cache previously read registry values (NetworkTopology, OwnSubnetInfo and RegistryExecutionSettings) along with the registry version they were read at. On the next registry read (during the next execution round), if the same registry version is requested, return the cached values.

Reading the registry is now about 50% of the (admittedly already low) DSM overhead (~20 ms of a total ~40 ms; which is still 10% of the average 400 ms round).

This is the first step of consolidating the various SystemMetadata fields populated from the registry under NetworkTopology (for network-wide information), on the one hand; and a similar SubnetTopology (for subnet-related information), on the other.

Once all this consolidation is complete, we can reuse the two structs (wrapped in Arcs in SystemMetadata) from one ReplicatedState to the next, iff they use the same registry version.
…struct

Bundle `SystemMetadata` fields `own_subnet_features`, `own_resource_limits` and `node_public_keys` into an `OwnSubnetInfo` struct, in preparation for easy reuse across `ReplicatedStates` using the same registry version.
Cache previously read registry values (`NetworkTopology`, `OwnSubnetInfo` and `RegistryExecutionSettings`) along with the registry version they were read at. On the next registry read (during the next execution round), if the same registry version is being requested, return the cached values.

Reading the registry is now about 50% of the (admittedly already low) DSM overhead (~20 ms of a total ~40 ms; which is still 10% of the average 400 ms round).
@alin-at-dfinity alin-at-dfinity requested a review from a team as a code owner July 2, 2026 14:22
@github-actions github-actions Bot added the feat label Jul 2, 2026
@zeropath-ai

zeropath-ai Bot commented Jul 2, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to 8a97392.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► rs/messaging/src/message_routing.rs
    Introduce RegistryReader with caching of registry data and Arc-based data sharing
► rs/messaging/src/message_routing.rs
    Replace direct registry reads with RegistryReader in BatchProcessorImpl
► rs/messaging/src/message_routing.rs
    Add CachedRegistryData structure and RegistryReader methods
► rs/messaging/src/message_routing.rs
    Update BatchProcessor and tests to use RegistryReader
► rs/messaging/src/message_routing/tests.rs
    Update tests to utilize RegistryReader in various scenarios
► rs/messaging/src/state_machine.rs
    Switch StateMachine to use Arc and Arc types in signatures
► rs/messaging/src/state_machine.rs
    Update implementation to assign Arc values directly
► rs/messaging/src/state_machine/tests.rs
    Adjust test fixtures and assertions for Arc-based topology/types
► rs/messaging/src/message_routing/tests.rs
    Adjust tests to call RegistryReader.read_registry and .try_to_read_registry via new interface
► rs/messaging/src/message_routing/tests.rs
    Extend tests with caching behavior verification for RegistryReader

Comment thread rs/messaging/src/message_routing.rs
Base automatically changed from alin/bundle-OwnSubnetInfo to master July 7, 2026 05:26
@alin-at-dfinity alin-at-dfinity added this pull request to the merge queue Jul 7, 2026
Merged via the queue into master with commit 638a25c Jul 7, 2026
37 checks passed
@alin-at-dfinity alin-at-dfinity deleted the alin/reuse-NetworkTopology branch July 7, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants