Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you choose between Memcached, Redis and Varnish?

I am really very confused about Memcached, Redis and Varnish. I know they are used for caching, but I don't know how much they help, and how you know which one to use.

And lastly, I would like know what you would use for a site with user-uploaded pictures and videos? If it helps I am using the Django framework.

like image 348
Robin Avatar asked Mar 01 '14 18:03

Robin


People also ask

Should I use Memcached or Redis?

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.

What is the difference between Redis and Varnish?

That being said, the primary difference is that Redis is a key => value store that stores the value of X to a defined key, whereas Varnish is a web application accelerator / caching HTTP reverse proxy. While both provide caching, they both perform entirely different tasks.

Why Redis is better than memcache?

When storing data, Redis stores data as specific data types, whereas Memcached only stores data as strings. Because of this, Redis can change data in place without having to re-upload the entire data value. This reduces network overhead.


1 Answers

Varnish is the odd one out, it's a server that runs as a reverse proxy in front of the real webserver (apache, nginx, etc.) and it stores the response of the server separately and could decide to serve it for a subsequent request without passing the request to the backend (the webserver), so simply it's like HTML caching.

Memcached and redis are actually data storage servers, specifically key-value storage servers. In terms of python you could say it's one huge 'dictionary', you set values with a key and retrieve them by key. There's few differences between both of them, you can simply Google memcached vs redis.

like image 145
Mohammad AbuShady Avatar answered Nov 11 '22 11:11

Mohammad AbuShady