Repository navigation
timesync: time coordinator, O(N) instead of O(N²) sync traffic - #460
Closed
KonradBreitsprecherBkd wants to merge 3 commits into
Closed
KonradBreitsprecherBkd wants to merge 3 commits into
KonradBreitsprecherBkd wants to merge 3 commits into
Conversation
…O(N²) to O(N) Today every synchronized participant broadcasts its NextSimTask to every other synchronized participant, which costs O(N²) messages per simulation step. With Experimental.TimeSynchronization.TimeCoordinator set on one participant, all synchronized participants send their NextSimTask to the coordinator only. The coordinator grants the next time advance, as a NextSimTask, to the participants whose next step is the earliest in the simulation. That is the same rule as the distributed algorithm, so the order of simulation steps does not change. The API is unchanged. - Announced in service discovery (TimeSyncCoordinator=1); participants switch to coordinated mode when they discover the coordinator. - New capability "time-coordination". A synchronized participant without it aborts the simulation, as does a second coordinator or a coordinator that joins after the virtual time has started. - Supports sync and async step handlers, dynamic step sizes and autonomous hop-on / hop-off. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Konrad Breitsprecher <Konrad.Breitsprecher@vector.com>
…ment window --time-coordinator makes Participant0 the time coordinator. Participant0 also prints wall and CPU time of 1000 steps after 100 warm-up steps, which excludes participant creation, connection setup and service discovery. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Konrad Breitsprecher <Konrad.Breitsprecher@vector.com>
"Coordinated" is the lifecycle's OperationMode::Coordinated. Rename everything that referred to the time coordinator as "coordinated" or as a bare "coordinator": identifiers (SetTimeCoordinator, IsFollowingTimeCoordinator, _timeCoordinatorName), test names, log messages, docs and the changelog. The discovery key becomes TimeSyncIsTimeCoordinator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Konrad Breitsprecher <Konrad.Breitsprecher@vector.com>
Contributor
Author
|
Superseded by #461: this PR was closed automatically when its branch was renamed to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Naming: always time coordinator, so it isn't confused with the coordinated lifecycle (
OperationMode::Coordinated).Virtual time synchronization sends every NextSimTask to every other synchronized participant: O(N²) messages per step. One participant can now be the time coordinator (
Experimental.TimeSynchronization.TimeCoordinator: true). Everyone else reports to it and waits for its grant: O(N) per step. The API is unchanged. The time coordinator is a normal participant with a TimeSyncService and a step handler.sequenceDiagram participant P1 participant C as Time coordinator participant P2 P1->>C: NextSimTask(t) P2->>C: NextSimTask(t) Note over C: T_min = min(next of all)<br/>grant only to participants at T_min C->>P1: grant(T_min) C->>P2: grant(T_min)NextSimTask, soTimeConfigurationwaits for a single entry: the time coordinator's grant.TimeSyncIsTimeCoordinator=1). Participants start following the time coordinator when they discover it.time-coordination. A synchronized peer without it aborts the simulation (same asautonomous-synchronous). So does a second time coordinator, or a time coordinator that joins after the virtual time has started.Evidence
Before / After: the same 1000 steps, with and without
--time-coordinator, 2–32 participants, no messages besides time sync.Release build, one Windows machine with 32 logical cores, all participants as threads in one process. Each point is the median of 5 runs, measured over 1000 steps after 100 warm-up steps. CPU time is the processor time of all participants together.
To reproduce:
SilKitDemoBenchmark --number-participants 32 --message-count 0 [--time-coordinator](Release).Tests:
Test_TimeCoordinator(new): lockstep, mixed step sizes (only the fast participant is granted), dynamic step boundary, no grant until all have reported, hop-on clamping, hop-off.Test_TimeSyncService: switching to the time coordinator, targeted reports, a peer's broadcast is ignored, a missing capability, a second time coordinator, an autonomous time coordinator.ITest_TimeCoordinator(new):Merge Danger
Door: two-way
Opt-in. Without
TimeCoordinator: trueon some participant, nothing changes on the wire. The only change visible to peers is the newtime-coordinationcapability.Blast Radius: small
Older SIL Kit versions can't take part in a simulation that has a time coordinator. That simulation aborts with an error naming the participant. Simulations without a time coordinator are unaffected. One mode change happens while the participant runs: switching from P2P to the time coordinator when it is discovered before time starts. That window is covered by unit tests, but not by a mixed-timing integration test.
🤖 Generated with Claude Code