groupcache README

The project's README from github.com/golang/groupcache. As one markdown file: README.md.

groupcache

Summary

groupcache is a distributed caching and cache-filling library, intended as a replacement for a pool of memcached nodes in many cases.

For API docs and examples, see http://godoc.org/github.com/golang/groupcache

Comparison to memcached

Like memcached, groupcache:

Unlike memcached, groupcache:

Loading process

In a nutshell, a groupcache lookup of Get("foo") looks like:

(On machine #5 of a set of N machines running the same code)

  1. Is the value of "foo" in local memory because it's super hot? If so, use it.

  2. Is the value of "foo" in local memory because peer #5 (the current peer) is the owner of it? If so, use it.

  3. Amongst all the peers in my set of N, am I the owner of the key "foo"? (e.g. does it consistent hash to 5?) If so, load it. If other callers come in, via the same process or via RPC requests from peers, they block waiting for the load to finish and get the same answer. If not, RPC to the peer that's the owner and get the answer. If the RPC fails, just load it locally (still with local dup suppression).

Users

groupcache is in production use by dl.google.com (its original user), parts of Blogger, parts of Google Code, parts of Google Fiber, parts of Google production monitoring systems, etc.

Presentations

See http://talks.golang.org/2013/oscon-dl.slide

Help

Use the golang-nuts mailing list for any discussion or questions.

groupcache (golang/groupcache)

Searching Database…

What is this?groupcache is a distributed caching and cache-filling library for Go, built as a replacement for a pool of memcached nodes in many cases.
Is this a standalone server like memcached, or something I embed in my code?It's a Go library, not a separate server. It's a client library as well as a server that connects to its own peers, forming a distributed cache directly inside your application processes.
How do I add it to a project?Import it as a Go package and configure a group of peers; check the API docs and examples for wiring it into your app.
Do I need Go, or can I use it from another language?Go only — the library is currently only available for Go, and the author says it's very unlikely to be ported to another language.
Can I update or expire a cached value once it's set?No. groupcache does not support versioned values, cache expiration, or explicit evictions, so there's no CAS or Increment/Decrement either — once key 'foo' is 'bar', it must always be 'bar'.
Who actually relies on this in production?Google uses it internally: dl.google.com (its original user), parts of Blogger, Google Code, Google Fiber, and Google's production monitoring systems.
How does groupcache avoid the thundering herd problem memcached has on cache misses?It coordinates cache fills so that only one load, in one process across the whole replicated set, populates the cache for a given key, then multiplexes the loaded value to every other caller waiting on it.
What happens if the peer that owns a key is unreachable?If the RPC to the owning peer fails, the requesting node just loads the value locally instead, still deduplicating concurrent local loads.
How does groupcache pick which node owns a given key?It shards by key using consistent hashing across the set of peers, similar to how memcached shards, so each key maps deterministically to one owning node.
Does groupcache help with 'hot' keys that get hammered by traffic?Yes — it automatically mirrors super-hot items to multiple processes, preventing the hot-spotting issue where one memcached machine's CPU or NIC gets overloaded by a popular key.
Creator
golang
Size
0.1 MB
Stars
13.3K
Updated
CommitNov 29
Age
13y
Commits · 90 Days