Skip to content

Inefficient gameprofile lookups while using velocity's modern forwarding #10648

Description

@bridgelol

Timings or Profile link

N/A

Description of issue

Upon examining (after getting rate limited lol), I noticed paper nodes are making mojang api calls upon every player join which was interesting to me as velocity should forward all of this info.

Upon digging deeper I realized this is completely redundant.

ServerLoginPacketListenerImpl#callPlayerPreLoginEvents(GameProfile) gets called on all occasions, upon forwarding using velocity, or just generic standalone paper.

What's interesting is that the this call always gets executed even when it shouldn't need to.

image
image

This call ultimately results in either;
#1 The usercache needing to lookup this gameprofile again
#2 A mojang api call (this is the main issue, however saving some CPU usage in case #1 is also nice).

If you have 3 joint sub-servers on your velocity network that all run on the same public ip, it is pretty easy to get rate limited, as I discovered the hard way 👍

What I recommend (and I will be creating a PR for this, however I'd first like some feedback to confirm I'm not entirely delusional and am missing a use case for this call while using velocity):

If this call was made with the origin of velocity modern forwarding and the AsyncPlayerPreLoginEvent didn't modify the player profile, we no longer execute this call.

Plugin and Datapack List

not important

Server config files

Not important

Paper version

All

Other

As you can see here https://github.com/PaperMC/Velocity/blob/368d1a7c1250b4138f683e64ebb6aadfe7a4b1b3/proxy/src/main/java/com/velocitypowered/proxy/connection/PlayerDataForwarding.java#L73

All necessary gameprofile properties are being forwarded

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions