Skip to content

perf: eliminate plot expansion server stalls - #26

Merged
WieszczY85 merged 3 commits into
mainfrom
experimental/async-runtime
Oct 7, 2026
Merged

WieszczY85 merged 3 commits into
mainfrom
experimental/async-runtime

Conversation

@WieszczY85

Copy link
Copy Markdown
Member

What changed

  • keeps protection events lock-free during healthy plot mutations by serving the previous immutable cache snapshot until publication completes (RCU-style)
  • preserves fail-closed protection after a real cache publication failure until recovery succeeds
  • removes runtime JDBC reads from plot commands, access checks, claim/unclaim, member management, flags and rename paths in favor of the atomic cache
  • moves claim/unclaim/member/flag/rename persistence and audit writes to async workers
  • captures Bukkit/permission-derived values before dispatching database work off-thread
  • moves /plx export, /plx import and DB-backed cache reload work off the server thread
  • delays GUI refreshes until async mutations have completed and the new snapshot is published
  • updates concurrency tests to verify that a reserved chunk purchase no longer freezes protection globally

Why

The chunk purchase transaction itself was already worker-side, but ProtectionCoordinator intentionally failed every protection decision while a purchase/mutation was in progress. As movement/interactions are protected through that coordinator, expanding one plot could cancel events server-wide and look exactly like a short lag spike or rollback. The new model keeps the last known-good immutable snapshot readable while the next version is persisted and published.

Bukkit/WorldGuard/Vault operations that are not guaranteed thread-safe deliberately remain on the server thread; JDBC and cache loading do not.

Verification

The previous test failure was caused by an assertion explicitly requiring protection to be blocked during economy withdrawal. That assertion was updated to the new snapshot semantics. The full repository verification then passed.

@WieszczY85
WieszczY85 merged commit fb4fc97 into main Oct 7, 2026
3 checks passed
@WieszczY85
WieszczY85 deleted the experimental/async-runtime branch October 7, 2026 16:04
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.

1 participant