1

For our customer we're using the OnePica_ImageCdn extension which is working fine. Of course we're using the database for the setting 'File Result Cache'. The other option is using file based cache which will be a lot slower.

But still the database driven cache generates a lot of queries. The shop of our customer is pretty big and with a lot of content which results in an average of 25k cpm on the imageCdn caching table in MySQL. We would like to reduce this. Redis cache en Varnish cache are already set up for this webshop. Redis cache isn't doing anything for the CDN cache at the moment but Varnish is of course.

I think it would be useful if the OnePica_ImageCdn extension uses Redis cache as the first caching layer but this isn't supported by the extension as far as I know.

So what do you guys suggest as an approach to reduce the database load on the imageCdn caching table in MySQL?

PS. the magento installation is CE 1.8.1.0 with all the security patches applied of course.

1
  • I'd like to add that this question is not about the third party module OnePica_ImageCdn itself. It is mentioned by the OP, but the core of the question is about caching tactics in general.
    – 7ochem
    Feb 26, 2016 at 10:23

1 Answer 1

1

Solution for your issue

In general, when you develop a system that needs to be scalable you must reduce as much as possible the number of write database queries or any external API calls.

The best approach in this particular is not to use caching at all:

  1. Create a registry of images that exists on external server (database is fine, as soon as you don't write on client request)
  2. Generate various resized sizes in the background via shell script (like in Magento 2.0)
  3. Upload them all in bulk and only when you update them (product change, new store view added, etc).
  4. Use registry to check if you have specific image pre-warmed, otherwise, just show a picture placeholder.

This kind of approach requires more development work for you, but it worth it, as then you'll be able to scale and don't need to maintain any images locally.

Even better scalable approach

Write a microservice that generates images on the fly, when you need them and remove this logic from Magento at all, but that is a different story.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.