wger icon indicating copy to clipboard operation
wger copied to clipboard

Performance of `api/v2/exercisebaseinfo/?limit=900`

Open bbkz opened this issue 8 months ago • 1 comments

Use case

In my setup, when i open /exercise/overview/ it takes 2-3 minutes to load the content of api/v2/exercisebaseinfo/?limit=900. I run it on raspberry's and similar, so it may just be a hardware limitation.

Workaround

So i came up with the following workaround. I set EXERCISE_CACHE_TTL to 25 hours and run a cronjob every 24 hours to warm up the cache:

python3 manage.py warmup-exercise-api-cache --force

This way it will reset the TTL of the exercise cache every 24 hours. This work fine and it is blazing fast now ;-) I think updating a exercise will warmup it's cache induvidually so, i don't have to wait till the next day for the updates (but i am not sure).

Proposal

It would be nice if the warmup-exercise-api-cache could be refactured similar to sync_exercises, so that celery task can be created. This would eliminate the fact that a cronjob is needed to warmup the cache.

bbkz avatar Jun 11 '24 15:06 bbkz