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

PM4: Reduce sending latency by skipping RakLib buffering #3325

Closed
dktapps opened this issue Feb 24, 2020 · 1 comment
Closed

PM4: Reduce sending latency by skipping RakLib buffering #3325

dktapps opened this issue Feb 24, 2020 · 1 comment
Labels
Category: Network Related to the internal network architecture Performance Resolution: Implemented Type: Enhancement Contributes features or other improvements to PocketMine-MP

Comments

@dktapps
Copy link
Member

dktapps commented Feb 24, 2020

In PM4, packets are buffered at the Minecraft layer for batch compression and flushed every 50ms. RakLib then buffers for an additional 10ms, which creates unnecessary extra latency considering that we know that there won't be any more packets to buffer because we already buffered them.

@dktapps dktapps added Category: Network Related to the internal network architecture Performance Line: Bleeding Edge labels Feb 24, 2020
@dktapps dktapps added the Type: Enhancement Contributes features or other improvements to PocketMine-MP label Nov 10, 2024
@dktapps
Copy link
Member Author

dktapps commented Mar 26, 2025

This could be achieved by using the immediate mode of RakLib.

However, currently PM doesn't implement NetworkSession immediate in a usable way: it will cause packets to jump the session queue, which may cause packets to be sent in the wrong order, as some packets may be awaiting async compression.

This should be fixable by adding a flag to the NetworkSession to immediately flush all completed batches when ready, up until the most recent batch in the queue to have been marked as immediate-flush.

@dktapps dktapps moved this to Todo in Network improvements Mar 26, 2025
dktapps added a commit that referenced this issue Apr 5, 2025
…ket is ready

instead of skipping queues and forcing sync compression as previously seen.

this maintains proper packet order and allows immediate-flush to be used to reduce latency in-game.

Small servers won't notice any difference, but for larger ones it may make a difference, since the buffer time effectively depends on the amount of load RakLib is under.
closes #3325
@dktapps dktapps closed this as completed Apr 5, 2025
@github-project-automation github-project-automation bot moved this from Todo to Done in Network improvements Apr 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Network Related to the internal network architecture Performance Resolution: Implemented Type: Enhancement Contributes features or other improvements to PocketMine-MP
Projects
Development

No branches or pull requests

1 participant