The user profile images are stored in a separate fileserver, and I am thinking of caching them in memcached. The memcached server is local to the app, and each image is less than 1MB.
But I saw over here that using memcached for images is a bad idea. Is it really? I am really not convinced.
Any best practices and suggestions? I am using SpyMemcached Java Client.
Database query results caching, persistent session caching, web page caching, and caching of frequently used objects such as images, files, and metadata are all popular examples of caching with Redis.
Architecture. Redis uses a single core and shows better performance than Memcached in storing small datasets when measured in terms of cores. Memcached implements a multi-threaded architecture by utilizing multiple cores. Therefore, for storing larger datasets, Memcached can perform better than Redis.
Image caching essentially means downloading an image to the local storage in the app's cache directory (or any other directory that is accessible to the app) and loading it from local storage next time the image loads.
Linux automatically caches files that are read from disk. Caching proxies like Squid are also good at caching images.
So... there are certainly are better tools for the job. On the other hand, nginx recently added memcached support. Without context, it's really hard to judge that recommendation.
They might mean "Don't serve images from memcached via a PHP script", in which case, they're absolutely correct -- PHP adds tons of overhead. But I don't necessarily see how using Nginx's memcache feature to store and serve images would be a bad thing.
Edit: It appears that facebook may have cached profile images in memcached at one point.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With