tasking-manager
tasking-manager copied to clipboard
Add pyinstrument for performance benchmarking
To enable performance testing, support for pyinstrument should be added to the backend. This can be then run optionally via an additional parameter to the REST API call. This also needs way to export the results outside of docker.
This should only be available during local development & not in any of the public facing instances 👍
But could go to the staging server temporarily if necessary for performance issue investigations
My plan was to have this in a "perf" branch, not develop or main.
I won't be deployed anywhere in that case 👍 Just for local testing.
However, if you merge the branch then we want to make sure pyinstrument is not included in production by using Python dependency groups and having a multistage dockerfile that uses different groups for each build target
I don't plan to make any code changes other than whatever it takes to get some performance statistics. It shouldn't effect the docker image at all, I used pdm to install the module manually.
We need to have the pyinstrument integration in two places:
- one in Fast API migration and
- also in the current codebase
so that we do the performance comparison between both the setups
cc @kaditya97 @robsavoye @spwoodcock
Here are the references what I prefer for setting up pyinstrument in flask and fastapi
@kaditya97 - here is some previous work on profiling https://github.com/hotosm/tasking-manager/tree/develop/scripts/profiler