Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does groupcache in Go compare to redis and memcached?

Tags:

go

I was wondering if anyone with real life experience in groupcache and other memory caching tools such as redis and memcached knows how they compare to each other in terms of performance, ease of use, and other areas that are worth mentioning.

The reason I am asking is because I am interested in completely switching over to Go, but I don't have much experience with it and no experience with groupcache.

like image 718
Alex Avatar asked Jul 13 '15 17:07

Alex


People also ask

What is difference between Redis and Memcached?

Memcached is designed for simplicity while Redis offers a rich set of features that make it effective for a wide range of use cases. Understand your requirements and what each engine offers to decide which solution better meets your needs.

Should I use Memcache 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 Groupcache?

groupcache is a caching and cache-filling library, intended as a replacement for memcached in many cases. For API docs and examples, see http://godoc.org/github.com/mailgun/groupcache.


2 Answers

Currently, groupcache is a library written in Go whereas there are many language bindings for redis, etc.

groupcache was originally created to serve blobs of binary files for Google's static file servers.

groupcache was originally written by the author of memcache, Brad Fitzpatrick.

See also mention of Groupcache by the author in a presentation of the rewrite of dl.google.com from C++ to Go.

like image 69
Mark Avatar answered Sep 27 '22 22:09

Mark


Groupcache is not meant to be a full replacement for Redis or Memcached. Groupcache for example doesn't support updating an item or deleting it.

It's useful for "hot" items that you want to cache but are immutable.

Also, compared to Redis, it doesn't support any of the advanced features that Redis supports because it has a different intended usage scenario.

Unless you have such things, I'd recommend to stick to using Redis or Memcached.

Indeed, if you can trick your implementation into making each item immutable by following some logic (maybe address the items by a key which includes a timestamp?) then you might be able to work-around it but I guess it might be too much work compared to just using other solutions.

Hope this helps.

like image 43
dlsniper Avatar answered Sep 27 '22 22:09

dlsniper