This repository was archived by the owner on Dec 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
11 multi proxy support for load balancing and scalability #72
Merged
twisti-dev
merged 33 commits into
master
from
11-multi-proxy-support-for-load-balancing-and-scalability
Jul 22, 2025
Merged
11 multi proxy support for load balancing and scalability #72
twisti-dev
merged 33 commits into
master
from
11-multi-proxy-support-for-load-balancing-and-scalability
Jul 22, 2025
Conversation
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
Introduce a new synchronizing protocol phase to support efficient, batched synchronization of arbitrary values and sets over Netty. - Define `SyncRegistry` API and `CommonSyncRegistryImpl` for creation, registration and freezing of `SyncValue` and `SyncSet` instances. - Implement `BasicSyncValue`, `RateLimitedSyncValue` (using `MutableStateFlow.debounce`) and `SyncSetImpl` for change tracking and listener notification. - Add `SyncValueChangePacket`, `SyncSetDeltaPacket` and their batch counterparts (`ClientboundBatchSyncValuePacket`, `ClientboundBatchSyncSetPacket`) with optimized in-place `SurfByteBuf` encoding (reserve‐length placeholder + patch length) to eliminate temporary buffer allocations. - Introduce a new `ConnectionProtocol.SYNCHRONIZING` phase with corresponding packet listeners, protocol builders (`SynchronizingProtocols`) and transition logic in `NettyPacketProcessor` and `ConnectionImpl`. - Refactor the Pre-Running phase to transition into Synchronizing (replace “ReadyToRun” packets with “ProceedToSynchronizing” equivalents). - Add `BeforeStartTaskScope` and Spring integration (`CloudBeforeStartTaskHandler`, `SyncRegistryFreezeHandler`, `CloudSynchronizeTaskManager`) to register and execute plugin-defined initial synchronization tasks in order. - Centralize coroutine exception handling in `BaseScope`, name before-start tasks, and establish proper `equals`/`hashCode` for `ConnectionImpl`. - Update client and standalone server implementations to await synchronizing completion before entering the Running phase. This patch establishes a robust, low-GC-overhead framework for keeping shared state in sync between client and server.
…updates and transactional support
…ith enhanced operations
…ineTransactionalAspect
…nownSyncValues initialization
…clean up PrePlayerJoinTask interface
…-registration handler
… configuration keys
…of class and simplify task registration
…ith Paper API naming conventions
… to latest versions
…ing consistency across modules
…ad-safe collections and simplify connection handling logic
…t packet listener components
…rderComparator for task sorting
…r registration and unregistration
…ort-for-load-balancing-and-scalability
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements multi-proxy support for load balancing and scalability. The changes include adding velocity configuration reflection, new server validation tasks, enhanced proxy management with secret handling, and comprehensive sync registry functionality for real-time state synchronization across the cloud infrastructure.
- Adds velocity configuration proxy with forwarding secret management
- Implements comprehensive sync registry system with rate-limited sync values and sync sets
- Introduces multi-stage packet handling with synchronizing protocol between login and running states
Reviewed Changes
Copilot reviewed 206 out of 208 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/reflection/VelocityConfigurationProxy.kt | Adds reflection proxy for velocity configuration to access forwarding secrets |
| surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/player/ValidateVelocityPlayerJoin.kt | Implements player join validation checking server availability |
| surf-cloud-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/netty/network/VelocitySpecificPacketListenerExtension.kt | Enhances velocity packet listener with proxy registration and secret management |
| surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/sync/SyncRegistryImpl.kt | Implements comprehensive sync registry for distributed state management |
| surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/ProxySecretHolder.kt | Manages proxy secrets with dynamic/manual configuration options |
Comments suppressed due to low confidence (1)
surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/netty/server/connection/ServerConnectionListener.kt:207
- [nitpick] The error message 'Cannot broadcast responding packets' could be more descriptive. Consider explaining why responding packets cannot be broadcast and suggest alternatives.
require(packet !is RespondingNettyPacket<*>) { "Cannot broadcast responding packets" }
...e/surf-cloud-core-common/src/main/kotlin/dev/slne/surf/cloud/core/common/sync/SyncSetImpl.kt
Show resolved
Hide resolved
...dalone/src/main/kotlin/dev/slne/surf/cloud/standalone/player/punishment/PunishmentService.kt
Show resolved
Hide resolved
surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/spark/SparkHook.kt
Show resolved
Hide resolved
...kotlin/dev/slne/surf/cloud/velocity/netty/network/VelocitySpecificPacketListenerExtension.kt
Show resolved
Hide resolved
surf-cloud-standalone/src/main/kotlin/dev/slne/surf/cloud/standalone/sync/SyncRegistryImpl.kt
Show resolved
Hide resolved
...-velocity/src/main/kotlin/dev/slne/surf/cloud/velocity/listener/player/ConnectionListener.kt
Show resolved
Hide resolved
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.