Aelysium-Group / rusty-connector

A player and server connection manager for Velocity based Minecraft Networks!
GNU General Public License v3.0
77 stars 17 forks source link

Family input changes after a player joins a family even when balancing algorithm would keep it in the same place. #18

Closed TheDeafCreeper closed 1 year ago

TheDeafCreeper commented 1 year ago

I don't think this is a bug persay, but when a player joins a server it will always move the current server pointer even if the balancing algorithm results in the current server being the best one to join.

Main thing this impacts is the MOST_CONNECTION algorithm, as if two players join a family with multiple servers within a few seconds of each other (basically until the family re-sorts itself), they end up in different servers.

Current Behavior (Family set to MOST_CONNECTION)

Before First Player Joins
---| 1. [Server1](127.0.0.1:25566) [0 (8 <> 8) w-0] <<<<<
---| 2. [Server2](127.0.0.1:25567) [0 (8 <> 8) w-0]

After First Player Joins
---| 1. [Server1](127.0.0.1:25566) [1 (8 <> 8) w-0] 
---| 2. [Server2](127.0.0.1:25567) [0 (8 <> 8) w-0] <<<<<

Expected Behavior (Family set to MOST_CONNECTION)

Before First Player Joins
---| 1. [Server1](127.0.0.1:25566) [0 (8 <> 8) w-0] <<<<<
---| 2. [Server2](127.0.0.1:25567) [0 (8 <> 8) w-0]

After First Player Joins
---| 1. [Server1]127.0.0.1:25566) [1 (8 <> 8) w-0] <<<<<
---| 2. [Server2](127.0.0.1:25567) [0 (8 <> 8) w-0]

The current behavior works fine for ROUND_ROBIN and LEAST_CONNECTION as when a player joins a server the "correct" server will change, however MOST_CONNECTION want's everyone in the same server until it fills up.

TheDeafCreeper commented 1 year ago

Oh wait this might actually just be in the algorithm (darn copy paste)

TheDeafCreeper commented 1 year ago

Well it was sort of that, but also because it's persistent so it is force iterated. I'll make a PR with a fix for non persistent MOST_CONNECTION families though.

nathan-i-martin commented 1 year ago

Something that I think needs to be addressed eventually for the MOST_CONNECTION algorithm is that. If a server is full, the load balancer will still put it at the top. When in reality it should be either moved to the bottom of the stack or removed completely until it no-longer becomes full. Otherwise, the only way to allow players to join that particular family is to enable persistence with a crazy high attempt number