Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

golang/groupcache

Repository files navigation

Summary

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

For API docs and examples, seehttp://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 massivelyreducing deployment/configuration pain. groupcache is a clientlibrary as well as a server. It connects to its own peers, forminga distributed cache.

  • comes with a cache filling mechanism. Whereas memcached just says"Sorry, cache miss", often resulting in a thundering herd ofdatabase (or whatever) loads from an unbounded number of clients(which has resulted in several fun outages), groupcache coordinatescache fills such that only one load in one process of an entirereplicated set of processes populates the cache, then multiplexesthe 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 expirationtimes, 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 multipleprocesses. This prevents memcached hot spotting where a machine'sCPU 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 ofGet("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 currentpeer) 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. Ifother callers come in, via the same process or via RPC requestsfrom peers, they block waiting for the load to finish and get thesame answer. If not, RPC to the peer that's the owner and getthe answer. If the RPC fails, just load it locally (still withlocal 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, partsof Google production monitoring systems, etc.

Presentations

Seehttp://talks.golang.org/2013/oscon-dl.slide

Help

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp