akvo-rsr icon indicating copy to clipboard operation
akvo-rsr copied to clipboard

[Hierarchies] Improve performance of project_hierarchy endpoint

Open MichaelAkvo opened this issue 2 years ago • 0 comments

The endpoint is currently used to show the hierarchy of a program. Unfortunately, the entire hierarchy is loaded at once. That in itself wouldn't be too much of a problem, if a lot of extra data weren't loaded. Unfortunately, a lot of additional data is loaded, which doesn't seem to really be used and is certainly not useful when showing a hierarchy.

Right now, it takes about 8 seconds to load our biggest program that has 700 projects!

Options

We still have to check why all the extra data is included and if it makes sense to include it (I have a suspicion it doesn't).

1. Only load the hierarchy

If it's unnecessary, then we remove it and only load the hierarchy.

Still not my preferred option due to our 700 project monster program.

2. Load child on demand

If the extra data really is required, then only the children (not descendants) of the active item should be loaded on demand. On first load, that'll be the children of the program. Once the user clicks on a children, its children will then be retrieved from the backend and presented.

MichaelAkvo avatar Apr 19 '22 15:04 MichaelAkvo