groupcache

groupcache是一个缓存和缓存填充库,用于在许多情况下替代memcached。(groupcache is a caching and cache-filling library, intended as a replacement for memcached in many cases.)

Github星跟蹤圖

groupcache是一个缓存和缓存填充库,用于在许多情况下替代memcached。

groupcache由dl.google.com(其原始用户),Blogger的部分,Google代码的部分,Google Fiber的部分,Google生产监控系统的部分等在生产中使用。

与memcached进行比较
groupcache像memcached的地方:
  • 按键分片,选择哪个对等方负责该密钥
groupcache与memcached不同之处:
  • 不需要运行单独的服务器集,从而大大减少部署/配置的痛苦。 groupcache是一个客户机库,也是一个服务器。它连接到自己的对等点。
  • 配有缓存填充机制。而memcached只是说“抱歉,缓存未命中”,经常导致从无限数量的客户端(这导致了几个有趣的中断)的数据库(或任何)加载的群组,groupcache协调缓存填充,使得只有一个负载整个复制过程集合的一个过程填充高速缓存,然后将加载的值复用到所有调用者。
  • 不支持版本值。如果键“foo”是值“bar”,键“foo”必须始终为“bar”。既没有缓存到期时间,也没有显式缓存驱逐。因此,也没有CAS,也没有增量/递减。这也意味着groupcache ....
  • 支持将超级热点自动镜像到多个进程。这样可以防止机器的CPU和/或NIC由非常受欢迎的键/值过载的memcached热点。
  • 目前只适用于Go。作者不太可能(bradfitz@)将代码移植到任何其他语言。

概覽

名稱與所有者golang/groupcache
主編程語言Go
編程語言Go (語言數: 1)
平台
許可證Apache License 2.0
發布數0
創建於2013-07-22 21:55:07
推送於2023-11-28 19:10:33
最后一次提交2021-03-31 15:47:55
星數12.7k
關注者數476
派生數1.4k
提交數69
已啟用問題?
問題數84
打開的問題數25
拉請求數33
打開的拉請求數17
關閉的拉請求數35
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?

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:

  • shards by key to select which peer is responsible for that key

Unlike memcached, groupcache:

  • does not require running a separate set of servers, thus massively
    reducing deployment/configuration pain. groupcache is a client
    library as well as a server. It connects to its own peers, forming
    a distributed cache.

  • comes with a cache filling mechanism. Whereas memcached just says
    "Sorry, cache miss", often resulting in a thundering herd of
    database (or whatever) loads from an unbounded number of clients
    (which has resulted in several fun outages), groupcache coordinates
    cache fills such that only one load in one process of an entire
    replicated set of processes populates the cache, then multiplexes
    the loaded value to all callers.

  • does not support versioned values. If key "foo" is value "bar",
    key "foo" must always be "bar". There are neither cache expiration
    times, nor explicit cache evictions. Thus there is also no CAS,
    nor Increment/Decrement. This also means that groupcache....

  • ... supports automatic mirroring of super-hot items to multiple
    processes. This prevents memcached hot spotting where a machine's
    CPU and/or NIC are overloaded by very popular keys/values.

  • is currently only available for Go. It's very unlikely that I
    (bradfitz@) will port the code to any other language.

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.

去到頂部