Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.

Conversation

@twisti-dev
Copy link
Contributor

No description provided.

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.
@twisti-dev twisti-dev added this to the Pre-release milestone Jun 8, 2025
@twisti-dev twisti-dev requested a review from Copilot June 8, 2025 09:03
@twisti-dev twisti-dev self-assigned this Jun 8, 2025
@twisti-dev twisti-dev added the status: in progress Issue is currently being worked on label Jun 8, 2025
@twisti-dev twisti-dev linked an issue Jun 8, 2025 that may be closed by this pull request

This comment was marked as outdated.

twisti-dev added 21 commits June 8, 2025 16:48
@twisti-dev twisti-dev changed the title DRAFT: 11 multi proxy support for load balancing and scalability 11 multi proxy support for load balancing and scalability Jul 22, 2025
@twisti-dev twisti-dev marked this pull request as ready for review July 22, 2025 10:03
@twisti-dev twisti-dev requested a review from Copilot July 22, 2025 10:03
@twisti-dev twisti-dev removed the status: in progress Issue is currently being worked on label Jul 22, 2025
@twisti-dev twisti-dev moved this from Triage to In review in Public Bug Tracker Jul 22, 2025

This comment was marked as outdated.

@twisti-dev twisti-dev requested a review from Copilot July 22, 2025 10:11

This comment was marked as outdated.

@twisti-dev twisti-dev requested a review from Copilot July 22, 2025 11:01
Copy link
Contributor

Copilot AI left a 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" }

@twisti-dev twisti-dev merged commit 83a271a into master Jul 22, 2025
@github-project-automation github-project-automation bot moved this from In review to Done in Public Bug Tracker Jul 22, 2025
@twisti-dev twisti-dev deleted the 11-multi-proxy-support-for-load-balancing-and-scalability branch July 22, 2025 11:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Multi-Proxy Support for Load Balancing and Scalability

2 participants