PretendoNetwork / nex-go

Barebones PRUDP/NEX server library written in Go
GNU Affero General Public License v3.0
74 stars 16 forks source link

[Enhancement]: Sync packet processing #66

Closed wolfendale closed 5 months ago

wolfendale commented 5 months ago

Checked Existing

What enhancement would you like to see?

When the server needs to send a lot of data to the client, usually as part of a fragmented payload, it does it so quickly that most packets are left unprocessed and need to be resent. Especially for large payloads, this can result in multiple resends with the server waiting longer between each attempt.

This seems to be because of some internal buffer that the console has for incoming packets. In my tests it seemed that (at least in the friends server) that buffer only allows 4 elements, so a request to update_and_get_all_information for a user with 100 friends (24 packets worth of data) sends up with some packets being resent 6 times and the whole request takes around 18 seconds.

NOTE: the buffer seems to be specifically for data packets as in my testing I saw ping packets be acknowledged at the same time as a group of 4 data packets

We need a way to make sure that we don't overwhelm clients with packets. A simple way to do this would be to add a delay to each data packet in a fragmented response.

Any other details to share? (OPTIONAL)

No response