Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Movement Batching Implementation #20930

Open
manstfu opened this issue Dec 16, 2024 · 1 comment
Open

Feature: Movement Batching Implementation #20930

manstfu opened this issue Dec 16, 2024 · 1 comment

Comments

@manstfu
Copy link
Contributor

manstfu commented Dec 16, 2024

Describe your feature request or suggestion in detail

SMSG_COMPRESSED_MOVES optimization

Describe a possible solution to your feature or suggestion in detail

No response

Additional context

First, we knew we had to move compression handling from map threads to network threads. Doing this would allow us to enable aggressive compression all while actually improving the performance of the world service. This required a complete rework of how we send packets.

Second, we quickly noticed that one of our biggest bandwidth consumers was movement opcodes, which accounted for up to 50% of our total outbound traffic. Players in busy areas could receive thousands of movement opcodes per second. We came up with a solution which uses the previously unimplemented SMSG_COMPRESSED_MOVES opcode. This opcode can combine an infinite number of small packets into a single big packet, we call it “Movement Batching”. This new system will batch together every movement packet in the same server tick into one packet, significantly reducing overhead. Initially only active in major cities, it was eventually expanded to include the entire world (only in busy areas, excluding raids, battlegrounds and arenas).

Cherry picked logfile entries of how much bandwidth we are saving:
image

SMSG_COMPRESSED_UPDATE_OBJECT: 472876 bytes uncompressed, 134385 bytes compressed.
SMSG_COMPRESSED_MOVES: 307635 bytes uncompressed, 16132 bytes compressed. (about 1500 packets combined into one)

Conclusion: Due to the changes and improvements made, we saw a reduction of approximately 33% in bandwidth, as well as improving overall server performance. We feel much more confident that bandwidth will no longer be an issue in future server launches. Obviously we could always upgrade our bandwidth cap if necessary, but that would have required downtime. Optimizing your code is always the better option.

Source

@kambire
Copy link

kambire commented Dec 16, 2024

Does this cause any loss of quality in the player's view? Are there any noticeable shaking or visual differences?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants