Go中的groupcache与redis和memcached相比如何?

huangapple go评论143阅读模式
英文:

How does groupcache in Go compare to redis and memcached?

问题

我想知道有没有在groupcache和其他内存缓存工具(如redis和memcached)方面有实际经验的人,他们对比起来在性能、易用性和其他值得一提的方面有何区别。

我之所以问这个问题,是因为我对完全转向Go语言很感兴趣,但我对它并不很熟悉,也没有使用过groupcache。

英文:

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.

答案1

得分: 8

目前,groupcache是一个用Go语言编写的库,而redis等有许多语言绑定。

groupcache最初是为了为Google的静态文件服务器提供二进制文件块而创建的。

groupcache最初是由memcache的作者Brad Fitzpatrick编写的。

另请参见作者在将dl.google.com从C++重写为Go的演示中提到的Groupcache

英文:

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.

答案2

得分: 4

有出色的Go客户端可用于Redis和Memcache。使用Go语言并不意味着不能使用这些工具。

选择最符合应用功能需求的工具。这些工具在功能上有一些重叠,但大部分情况下它们并不是彼此的替代品。对于像我这样的第三方来说,如果不了解更多关于你的应用、生产环境、经验等方面的信息,很难对这些工具进行推荐。

英文:

There are excellent Go clients for Redis and Memcache. There's no reason to rule these tools out because you are using Go.

Pick the tool that best meets the functionality requirements of your application. There is some overlap in the functionality of these tools, but for the most part they are not replacements for each other. It's impossible for a third party like me to make a recommendation between these tools without knowing a lot more about your application, production environment, experience and more.

答案3

得分: 4

Groupcache并不是Redis或Memcached的完全替代品。例如,Groupcache不支持更新或删除项目。

它适用于你想要缓存但是不可变的“热”项目。

此外,与Redis相比,它不支持Redis支持的任何高级功能,因为它有不同的预期使用场景。

除非你有这些需求,否则我建议继续使用Redis或Memcached。

确实,如果你可以通过一些逻辑(例如通过包含时间戳的键来寻址项目)来使每个项目都不可变,那么你可能能够解决这个问题,但我猜这可能比使用其他解决方案要麻烦得多。

希望对你有所帮助。

英文:

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.

答案4

得分: 1

在这个话题中有一个有趣的补充:

Mailgun创建了原始Brad Fitzpatrick库的修改版本:
https://github.com/mailgun/groupcache

它提供了键的删除和过期功能。它也进行了一些现代化的改进(自从原始版本发布以来,go模块已经出现)。

这是我找到的博客文章:
https://www.mailgun.com/blog/golangs-superior-cache-solution-memcached-redis/

他们声称在生产环境中使用这个库。

英文:

There is interesting addition in the topic:

Mailgun created modified version of the original Brad Fitzpatrick's library:
https://github.com/mailgun/groupcache

It provides key removals and expiry. It is also bit modernized (go modules arrived since original was born..).

Here is the blog entry which led me to it:
https://www.mailgun.com/blog/golangs-superior-cache-solution-memcached-redis/

They claim to use the library on production.

huangapple
  • 本文由 发表于 2015年7月14日 01:13:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/31389484.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定