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

Performance degradation in cache DB #40

Open
rigon opened this issue Aug 5, 2023 · 1 comment · May be fixed by #58
Open

Performance degradation in cache DB #40

rigon opened this issue Aug 5, 2023 · 1 comment · May be fixed by #58
Labels
investigation Look for new options without knowing the way performance How to improve performance of the application

Comments

@rigon
Copy link
Owner

rigon commented Aug 5, 2023

Performance of saving to bbolt degrades when the DB grows in size, even when it is just updating an existing entry. This is more noticeable when updating the thumb flag.

@rigon rigon added the investigation Look for new options without knowing the way label Oct 19, 2023
@rigon rigon changed the title Performance degradation to cache DB Performance degradation in cache DB Oct 19, 2023
@rigon
Copy link
Owner Author

rigon commented Oct 19, 2023

This happens because the underlying structure of indexes are maps. When reading/writing a key from an index, what effectively happens is reading the entire map from the DB, decoding into memory, make the necessary changes, encode in binary format and write it back to the DB.

Because the thumbnail flag only have two states (true of false), all photos will be referenced or by one (true) or the other (false). If the number of photos grows, so do the maps in the indexes.

In scenario where the thumbnails are already generated but the cache needs to update the thumbnail flag, what will happen is coping all the references from one key (false) to another (true), in batches. Each time a batch is ready to be committed, it must read, decode, apply changes, encode, write.

See timshannon/bolthold#105 and timshannon/bolthold#106

@rigon rigon added the performance How to improve performance of the application label Nov 13, 2023
@rigon rigon linked a pull request Nov 13, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigation Look for new options without knowing the way performance How to improve performance of the application
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant