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

Investigate usage of SQLite database #242

Open
JurgenR opened this issue May 20, 2024 · 0 comments
Open

Investigate usage of SQLite database #242

JurgenR opened this issue May 20, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@JurgenR
Copy link
Owner

JurgenR commented May 20, 2024

Currently the Python shelve module is used for storing shares and transfers but this ties the cache to the implementation, if a change needs to be made to the Transfer, SharedItem, SharedDirectory objects then some migration code needs to be written.

Using an SQLite database would be cleaner, but comes with its own set of problems. If done right this could also remove the need to store all shared files and transfer in memory.

There's a case to be made to split cache into cache and storage, with flexibility to mix different types.

Assume a collection of 5 million shared files as a target (this seems roughly the max amount of shared files seen in rooms by users). Transfers are a bit hard to quantify.

Speed

When connected to the distributed network the client will receive many search requests. Because shared items are currently stored in memory this is very fast, using an SQLite database would slow this down significantly. There are libraries available to be able to make SQL queries asynchronously and querying the local shares is already done as part of a task. The queries don't actually need to be super fast like implemented today, but they also cannot be slow (eg.: 3s+). If a query on millions of records takes 250ms than this could be considered fine.

More worrying is the insertion and deletion of shared items during scanning, insertion of millions of records can be very slow.

Migration

If changes need to be made to the database there needs to be some easy way to do migrations.

The changes could include some migration hooks, try finding a library that does versioning.

@JurgenR JurgenR added the enhancement New feature or request label May 20, 2024
@JurgenR JurgenR added this to the v2 milestone May 20, 2024
@JurgenR JurgenR self-assigned this May 20, 2024
@JurgenR JurgenR changed the title Investigation usage of SQLite database Investigate usage of SQLite database Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant