-
Notifications
You must be signed in to change notification settings - Fork 14
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
Make the database updates more performant #15
Comments
I'll do this |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
The database is being accessed many times, which slows down the database and server quite heavily.
Solution
Make a list of all the non-live updates - incVisitCount, incInfoCount etc.
Design an asynchronous batch updating functionality for the frequent non-live updates. e.g incInfoCount should keep an in-memory count inside the driver and flush them all every 5-10 seconds.
NOTE Before the design, check if there's a better way to handle it in the connector libraries (e.g
Knex
) instead of implementing our own.EDIT
After checking, there's no such functionality in Knex. The
PostgresStorageDriver
should implement a batch-update mechanism for incInfoCount and incVisitCount. each of these should save its own cache and flush it every 10 seconds. Their usage in routes should also be non-blocking.The text was updated successfully, but these errors were encountered: