RoyDefined / WebDoomer

WebDoomer is a fast and efficient Zandronum and QZandronum server browser as a web app.
GNU General Public License v3.0
4 stars 0 forks source link

Backend server fetching slow and prone to much packet loss #8

Closed RoyDefined closed 7 months ago

RoyDefined commented 7 months ago

Describe the bug The code was written to create a new socket for every single endpoint that data is being requested from: https://github.com/RoyDefined/WebDoomer/blob/09e2beb63d585c1cee263d337416b754a138851f/src/WebDoomer/WebDoomer/Services/Zandronum/Server/ZandronumServerService.cs#L31

This is likely the cause for the incredibly slow fetching that is happening on the deployed server as this requires a lot of task scheduling and asynchronous waiting. Instead the backend should collect the data from all the servers from a single socket and determine the responding server by checking the endPoint that is given by the receive method: https://github.com/RoyDefined/WebDoomer/blob/09e2beb63d585c1cee263d337416b754a138851f/src/WebDoomer/WebDoomer/Services/Zandronum/Server/ZandronumServerService.cs#L47

Steps to reproduce N/A

Expected behavior This should improve the fetching of servers and speed it up.

Screenshots N/A

Additional context N/A

RoyDefined commented 7 months ago

This one ended up being a lot harder to improve than what I expected. The main issue I had was that after changing the system to a single socket, many packets were dropping which resulted in only a partial server list. In the end I do use multiple sockets but the work is now more evenly divided and it also works more strict with the timeout which should now happen at a more reasonable rate.

This should be working properly as of c6e7041

RoyDefined commented 7 months ago

I'm going to have to reopen this issue as the current solution doesn't work in a way that I am happy with. While this fix works, it works a lot less well on lower end computers and this does include wherever the application is deployed to. The main issue is that packets are still dropping and after further investigating it appears that the main issue is the main buffers that the sockets work with. Increasing and toying around with these buffers made a huge difference, but I do need to find the perfect configuration and implement a proper change before I can truly close this issue again.

RoyDefined commented 7 months ago

Should be working correctly in 02e6760. I am keeping this issue open for any additional changes until the next version is released.

RoyDefined commented 7 months ago

Tested a deployed version and this works properly now.