matthewwithanm / django-imagekit

Automated image processing for Django. Currently v4.0
http://django-imagekit.rtfd.org/
BSD 3-Clause "New" or "Revised" License
2.26k stars 276 forks source link

Check files for existence are extremely slow with Azure/S3 #524

Closed roman-rr closed 3 years ago

roman-rr commented 3 years ago

Example page has about 12 pictures. Every time when i reload a page, imagekit check for file existence and this is what happens.

When CACHE folder is on Azure Storage or S3 bucket:

IMAGEKIT_DEFAULT_FILE_STORAGE = 'storages.backends.azure_storage.AzureStorage'
AZURE_CACHE_CONTROL = "public,max-age=31536000,immutable"

ezgif-1-e3f9d40e3acc

When CACHE folder is on local filesystem:

IMAGEKIT_DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'

ezgif-1-0b25e28f1a0a

Of course is not a way to let user wait such a big delay on every page reload. And i need results as on local filesystem, but in same time store CACHE in clouds. I miss somethings important ?

vstoykov commented 3 years ago

Normally Django Imagekit is using the cache to not hit the storage everytime. Did you have configuration about the Django cache?

roman-rr commented 3 years ago

@vstoykov Yes, i probably miss that part. Could you please provide a sample of most common configuration for CACHE ?

vstoykov commented 3 years ago

You can read the documentation of Django for settings.CACHES

Also you can read the Django ImageKit documentation about caching

roman-rr commented 3 years ago

@vstoykov Thank you, i will try.

vstoykov commented 3 years ago

@roman-rr If there are still issues with that you can keep us in touch.