Resolve "Admin dashboard"
Closes #454 (closed)
Performance
Tested the performance of with 60k users and 1m user log entries. All with random joined_date and timestamp in the last 365 days. The endpoint response time is 360ms on my device, which is acceptable for now because it will take a while before we will reach 1m log entries. I experimented a bit with some indexes, but was not able to speed things up. All suggestions are of course welcome. In the future we might want want to cache this data and use periodic job to refresh the cache.
Testing
- I used the fill_users table management command to create 60k users. To increase the speed you can comment out the
user.set_password(password)
method. I used the this queryupdate auth_user set date_joined= NOW() + (random() * (NOW()+'-365 days' - NOW())) + '0 days' where true
to randomize the signup dates. - I used this script to create random user log signed in events.
from django.contrib.auth import get_user_model from baserow.core.models import UserLogEntry User = get_user_model() for i in range(0, 10000): user = User.objects.all().order_by("?")[0:100] ul = [] for u in user: ul.append(UserLogEntry(actor_id=u.id, action="SIGNED_IN")) UserLogEntry.objects.bulk_create(ul)
update core_userlogentry set timestamp= NOW() + (random() * (NOW()+'-365 days' - NOW())) + '0 days' where true
Related merge requests
Edited by Bram Wiepjes