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

[Feature] Store all blob binaries (images) outside of Stash's SQLite database #2271

Closed
ALonelyJuicebox opened this issue Jan 31, 2022 · 6 comments · Fixed by #3187
Closed
Labels
improvement Something needed tweaking.

Comments

@ALonelyJuicebox
Copy link

As this project scales and as we add more and more performers/studios/etc to our databases, the database size of our Stash databases is becoming a bit bloated with these blobs.

Given the size of the images, there's no performance gain in storing the images in the database itself over storing them on the filesystem.

I'm of the opinion that we should migrate towards storing these images in the /generated/ folder instead, only storing a reference to the file path in the database itself.

Thanks!

@ghost
Copy link

ghost commented Jan 31, 2022

I don't disagree. However, we would need some way to export images. Unlike content in generated, the images in the db can't be regenereated on demand, so they need to be separated from generated content.

@deezero
Copy link

deezero commented Mar 9, 2022

Which would be a good option for that ?

  • create a new structure (/var/lib/stash/database) with subfolders like generated so it's another top level storage.
    • maybe then put the sqlite file in the root of that (/var/lib/stash/database/stash-go.sqlite).
  • put it in the existing config directory ({CONF_DIR}/static) again with generated style sub directories.

it could default to {CONF_DIR}/static or similar but be configurable.

@WithoutPants
Copy link
Collaborator

I'd introduce a new location setting for image storage - defaulting to images. The folder would be sub-divided based on object types (performer, scene, etc).

@deezero
Copy link

deezero commented Mar 10, 2022

I was wondering about segmenting the path, so something like images/performer/6/3/b/63b84b824d1835a59d2a7e514daa9109.png

stash doesn't usually get a performance hit from the mega directories (like in generated) since it doesn't list them, but doing backups is slower because of it, since generated is considered more like a cache you wouldn't normally back it up, but this would be first class data so segmented directories could be helpful for backups.

@WithoutPants
Copy link
Collaborator

WithoutPants commented Mar 10, 2022

For storing images for objects (scene covers, performer images etc), I think dividing by database id would be better. Segmenting the path would be suitable for objects that we see large numbers of, such as scenes, galleries and images.

@WithoutPants
Copy link
Collaborator

This will allow setting gallery covers without relying on the current cover.jpg detection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Something needed tweaking.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants