feat: replace concurrent scheduler with sequential scheduler#887
Conversation
How to use the Graphite Merge QueueAdd the label graphite/merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
winton-library
left a comment
There was a problem hiding this comment.
I left some comments, I think it's only worth to take a look if the new architecture for cardinal is still a long way to go.
| _ context.Context, | ||
| _ *connect.Request[cardinalv1.GetStateRequest], | ||
| ) (*connect.Response[cardinalv1.GetStateResponse], error) { | ||
| worldState, err := d.world.world.ToProto() |
There was a problem hiding this comment.
I was thinking about this ToProto function. I check the caller and it boils down to snapshot use and debug.
Since the snapshot path runs on the tick goroutine itself (after Tick() returns), there's no data-integrity issue there because nothing is mutating state while it serializes. But GetState runs on the HTTP handler goroutine with no lock. Doesn't that mean it can return an inconsistent state for the engineer's debugging session?
There was a problem hiding this comment.
yeah ur right, I'm reworking snapshots, will take a look at this again in the future. added to backlog for now.
❌ 2 Tests Failed:
View the top 2 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |

TL;DR
The PR title sums it up basically.
Rationale
Entity operations (create, destroy, etc.) aren't concurrent safe and require locks to synchronize. The concurrent scheduler brings better performance when systems touch different components, but when it comes to entity operations, all systems effectively become sequential. Tested on Rampage, a sequential scheduler cuts down tick execution time by roughly half just from the lack of lock contention.