Skip to content
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

Evaluate Batch Updates versus Bulk Updates #1511

Merged
merged 3 commits into from
Jan 7, 2025
Merged

Evaluate Batch Updates versus Bulk Updates #1511

merged 3 commits into from
Jan 7, 2025

Conversation

terrazoon
Copy link
Contributor

@terrazoon terrazoon commented Jan 2, 2025

Description

In order to do bulk updates we need the primary key for the notification table (notification.id), which we currently do not have.

Right now we are doing batch updates, which seem to work great. But the question is how much can they scale. If they can't scale, we have to switch to bulk updates which requires running a query to fetch all the notification_ids, or storing all the notification_ids in redis.

Add a debug statement to see the elapsed time of each batch update. Currently we are doing batch updates of 1000. If the time for the query is 200 ms, we can process 2500 records or so per second, which is 150k records a minute, which is nuts because right now we are doing far less than 1000 records a minute. Conversely, if the time for the query is 2 minutes we need to start switching to bulk updates immediately.

Seeing how long the 1000 record batches take gives us a feel for how worthwhile it would be to switch to bulk updates. It will also provide us data if we want to try batch sides of 2000, 5000, 10000 etc.

Security Considerations

N/A

Copy link
Contributor

@ccostino ccostino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @terrazoon!

@terrazoon terrazoon merged commit f466cf2 into main Jan 7, 2025
7 checks passed
@terrazoon terrazoon deleted the notify-api-1494 branch January 7, 2025 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants