online-go / online-go.com

Source code for the Online-Go.com web interface
https://online-go.com/
GNU Affero General Public License v3.0
1.24k stars 345 forks source link

Overview page network improvements #1875

Open benjaminpjones opened 2 years ago

benjaminpjones commented 2 years ago

The ui/overview api is getting a little heavy, and the reason is largely fields that aren't being used. As an example, I have a sizeable but not-unheard-of number of ongoing games (23 correspondence) and it is now taking almost a second to download the data held at ui/overview. I suspect this is because the data is 761kB compressed (>4MB uncompressed). For a rough estimate of how much data actually gets displayed, the resulting HTML ends up being less than 40kB.

The top 3 fields by size account for 97% of the payload:

It is possible that ~these fields~active_games.json can just be removed since much of the same data comes via socket connections. If not totally removed, I still believe we can send this data in a much more compact manner.

Screenshots Screen Shot 2022-05-21 at 8 51 48 PM Screen Shot 2022-05-21 at 9 21 23 PM
anoek commented 2 years ago

Yeah I think we can, I'm checking with the mobile devs to see if they use this endpoint at all how it is, if they do I'll just create a new endpoint for the web UI that doesn't include the game data.

BHydden commented 2 years ago

a sizeable but not-unheard-of number of ongoing games (23 correspondence) and it is now taking almost a second to download the data 

23 you say? I wonder how long /overview takes to load for @Sofia-mal haha

benjaminpjones commented 2 years ago

This endpoint is very similar to players/%%/full, and last I checked that one was about 11s for @Sofia-mal's page 😂

dexonsmith commented 8 months ago

As noted in #2455 (the incoming dup), parts of these data are used to seed the sort-by-clock (to avoid "lively" animations as gobans shuffle around while the sockets connect). However: