offspot / metrics

Metrics subsystem for Kiwix Hotspot
GNU General Public License v3.0
0 stars 1 forks source link

Backend is incredibly slow to serve HTTP requests when processing is enabled #78

Closed rgaudin closed 11 months ago

rgaudin commented 11 months ago

First request to metrics home takes just under a minute to display… when served on my laptop. It's even longer on the Pi. Refreshing the page takes about 30s. All of this is on a fresh, empty database.

The reload delay might be partly due to the fact that nothing's cached in the browser since there's no webserver doing it and it's not implemented in the code 🤓

Might be due to a configuration issue though…

docker run \
  -v $PWD/mounts/data:/data 
  -v $PWD/mounts/conf:/conf 
  -v $PWD/mounts/log:/var/log/metrics \
  -e ALLOWED_ORIGINS=http://localhost \
  -e PACKAGE_CONF_FILE=/conf/packages.yaml \
  -e "DATABASE_URL=sqlite+pysqlite:////data/database.db" \
  -e LOGWATCHER_DATA_FOLDER=/data/logwatcher \
  -e REVERSE_PROXY_LOGS_LOCATION=/var/log/metrics \
  --rm -it --name metrics \
  -p 80:80 \
  ghcr.io/offspot/metrics:dev
rgaudin commented 11 months ago
Screenshot 2023-12-20 at 12 31 42

On the Pi

Screenshot 2023-12-20 at 12 12 48
benoit74 commented 11 months ago

This is extremely weird because these files are already compiled by Vite, they are just static files. Let's have a look, maybe we will need this proxy in front in the end ^^

benoit74 commented 11 months ago

Issue disappears if you set PROCESSING_DISABLED="True" environment variable. This is why I did not catched this before. But this is not really the purpose of metrics 🤣

rgaudin commented 11 months ago

Indeed 😅