zieren / wasted-youth-tracker

Limit kids' time on their (Windows) PC and get a summary of the window titles.
GNU General Public License v3.0
5 stars 0 forks source link

Improve performance on e.g. RasPi #14

Closed zieren closed 2 years ago

zieren commented 3 years ago

The 15 second sample interval is currently hardcoded in the client and, even worse, implicitly hardcoded on the server.

zieren commented 3 years ago

This is now configurable. But the server still implicitly uses 15s by specifying e.g. 20s in queries for continuous use. The server should instead compute the range from the config value, using the same default as the client.

zieren commented 3 years ago

It would be nice to reduce the number of records written to the database. E.g. given that most records are identical to the previous one (except for the timestamp), we could update the previous line with the new timestamp and somehow indicate that the resulting gap, which may be as largre as this condition holds, is not due to a shutdown/logoff. Ideas for that:

zieren commented 3 years ago

Storing time ranges instead of individual samples increases complexity of all queries, but would likely improve performance and reduce storage.

As storage is not a problem, an alternative might be to cache the common "how much time was spent" query. We should first check the actual query cost in the logs, as there may be other expensive queries.

zieren commented 2 years ago

This is fixed by the schema change.