-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance Improvements in User Stats Processing #124
Conversation
This PR would need a squash due to my extensive commits |
@JGreenlee @TeachMeTW I looked at this a while ago and came up with a plan (or two) but didn't have time to implement. The key here is to really dig into the user model and understand that the user stats consists of two separate parts:
Reading the first is super fast, because it is a single small table We should fix this by:
|
Ah I think it was |
@shankari I made progress in regards to the lazy loading, the only thing I'd need to figure out is how to stop it from refreshing the ui. I tried to use Patch() but seems to not work fully as intended yet; I'll keep at it. See below: 8mb.video-WNJ-MZ7G6LG7.mp4 |
@shankari Progress, discussed with @JGreenlee to help resolve some of the issues I was facing; now loads without reloading the entire thing. 8mb.video-P0Y-tuqh2oNa.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to work, and I want to get it out to staging ASAP so that we can test and move to production (and unblock everybody). We can always return and polish later.
But I do have some questions for me to understand your changes better
# Create a Patch object to append data progressively | ||
patched_data = Patch() | ||
patched_data['data'] = processed_data | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand how this is used. I see that the patched_data
object is created here, but I don't see it used anywhere else in this PR. I even see that line 129 references this Patch
object in a comment, but I don't see any of the Patch
object methods, such as append
.
Are we actually using patch
? If not, what are we doing for lazy loading?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this was a relic of a prior iteration I made; I can remove/clean this section in another PR.
Squash merging this as well, make sure to pull the changes before starting on the next PR, @TeachMeTW |
Reverted #124 and Added Logging
Revert "Reverted #124 and Added Logging"
Description
This pull request introduces several performance improvements to the data page:
Changes Made
1. Timer Integration
Added timing to measure the execution time of the
add_user_stats
function and other functions.2. Lazy Loading Implementation
Replaced sequential user processing with batch processing; batches can be set in add_user_stats in db_utils for default value changes or in render_content in data.py
Each batch of 10 takes about ~7 seconds of processing.