• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

consistenthash/H29-Jan-2019-193113

groupcachepb/H29-Jan-2019-10175

lru/H29-Jan-2019-232158

singleflight/H29-Jan-2019-15196

testpb/H29-Jan-2019-300244

.gitignoreH A D29-Jan-20193

.travis.ymlH A D29-Jan-2019210 2015

LICENSEH A D29-Jan-201910 KiB192155

README.mdH A D29-Jan-20192.7 KiB7449

byteview.goH A D29-Jan-20193.6 KiB176121

byteview_test.goH A D29-Jan-20193.7 KiB148124

groupcache.goH A D29-Jan-201912.8 KiB492316

groupcache_test.goH A D29-Jan-201912 KiB457330

http.goH A D29-Jan-20196.1 KiB228156

http_test.goH A D29-Jan-20194.1 KiB167125

peers.goH A D29-Jan-20192.6 KiB8638

sinks.goH A D29-Jan-20197 KiB323224

README.md

1# groupcache
2
3## Summary
4
5groupcache is a caching and cache-filling library, intended as a
6replacement for memcached in many cases.
7
8For API docs and examples, see http://godoc.org/github.com/golang/groupcache
9
10## Comparison to memcached
11
12### **Like memcached**, groupcache:
13
14 * shards by key to select which peer is responsible for that key
15
16### **Unlike memcached**, groupcache:
17
18 * does not require running a separate set of servers, thus massively
19   reducing deployment/configuration pain.  groupcache is a client
20   library as well as a server.  It connects to its own peers.
21
22 * comes with a cache filling mechanism.  Whereas memcached just says
23   "Sorry, cache miss", often resulting in a thundering herd of
24   database (or whatever) loads from an unbounded number of clients
25   (which has resulted in several fun outages), groupcache coordinates
26   cache fills such that only one load in one process of an entire
27   replicated set of processes populates the cache, then multiplexes
28   the loaded value to all callers.
29
30 * does not support versioned values.  If key "foo" is value "bar",
31   key "foo" must always be "bar".  There are neither cache expiration
32   times, nor explicit cache evictions.  Thus there is also no CAS,
33   nor Increment/Decrement.  This also means that groupcache....
34
35 * ... supports automatic mirroring of super-hot items to multiple
36   processes.  This prevents memcached hot spotting where a machine's
37   CPU and/or NIC are overloaded by very popular keys/values.
38
39 * is currently only available for Go.  It's very unlikely that I
40   (bradfitz@) will port the code to any other language.
41
42## Loading process
43
44In a nutshell, a groupcache lookup of **Get("foo")** looks like:
45
46(On machine #5 of a set of N machines running the same code)
47
48 1. Is the value of "foo" in local memory because it's super hot?  If so, use it.
49
50 2. Is the value of "foo" in local memory because peer #5 (the current
51    peer) is the owner of it?  If so, use it.
52
53 3. Amongst all the peers in my set of N, am I the owner of the key
54    "foo"?  (e.g. does it consistent hash to 5?)  If so, load it.  If
55    other callers come in, via the same process or via RPC requests
56    from peers, they block waiting for the load to finish and get the
57    same answer.  If not, RPC to the peer that's the owner and get
58    the answer.  If the RPC fails, just load it locally (still with
59    local dup suppression).
60
61## Users
62
63groupcache is in production use by dl.google.com (its original user),
64parts of Blogger, parts of Google Code, parts of Google Fiber, parts
65of Google production monitoring systems, etc.
66
67## Presentations
68
69See http://talks.golang.org/2013/oscon-dl.slide
70
71## Help
72
73Use the golang-nuts mailing list for any discussion or questions.
74