Repository navigation
feat(controller): assign region cells to instances - #56
Closed
TheMeinerLP wants to merge 3 commits into
Closed
TheMeinerLP wants to merge 3 commits into
TheMeinerLP wants to merge 3 commits into
Conversation
A pool with a sharding section gets its cells spread over the Ready instances, kept stable and moved when an instance fails. The cells API resolves block coordinates to the owning instance. Adds grus cells.
/region <x> <z> asks the controller which instance owns the block position in GRUS_SHARD_POOL and connects the player to it.
Contributor
Author
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.
Stacked on #55 (private servers); retarget to main once that is merged. The diff against main contains #55 until then.
Problem
A big world has to be served by more than one instance, but nothing knew which instance is responsible for which
part of the map. A proxy could not send a player to the right server for a position.
Approach
A pool can declare
shardingwith a static list of cells (name plus chunk bounds). The controller gives everycell to exactly one Ready instance and keeps that assignment while the instance stays Ready. When an instance
fails or disappears its cells move to the Ready instance that serves the fewest. The assignment is stored as the
instance label
grus.olf/cellsand every change publishespool.cells.GET /v1/pools/{pool}/cellslists cell, bounds, instance and address;GET /v1/pools/{pool}/cells/at?x=&z=takes block coordinates and answers with the owner (404 outside every cell, 409 while the cell has no Ready
instance).
grus cells <pool>shows the table. The Velocity plugin gets/region <x> <z>(permissiongrus.region), enabled byGRUS_SHARD_POOL; it connects the player to the owning server.Known limits: cells are not rebalanced when a new instance becomes Ready later (stable beats even), and
splitting or merging cells with the load is spec only (comment in the model).
The CRD schema for
sharding.cellschanged from names to objects; the schema test covers it. OpenAPI and theweb types are regenerated (separate commit, only the generated types file).
Testing
Controller tests with a fake clock and fake driver (spread, stability, failover, removal, lookup), API, model,
client and CLI tests, and a Velocity unit test for URL building and answer parsing.
:grus-velocity:testand:grus-sdk:testpass.