

GitHub - golang/groupcache: groupcache is a caching and cache-filling library, i...
source link: https://github.com/golang/groupcache
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

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:
- 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)
-
Is the value of "foo" in local memory because it's super hot? If so, use it.
-
Is the value of "foo" in local memory because peer #5 (the current peer) is the owner of it? If so, use it.
-
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.
Recommend
-
44
一个缓存系统,memcached的golang版本,这里先了解一下使用方式 使用示例 groupcache由于是框架,需要导入在编写业务代码才能运作 缓存方式可自定义:db,文件等 type TblCache st...
-
41
-
18
Caching in Python Using the LRU Cache Strategy by
-
8
一致性 Hash 常用于缓解分布式缓存系统扩缩容节点时造成的缓存大量失效的问题。一致性 Hash 与其说是一种 Hash 算法,其实更像是一种负载均衡策略。 GroupCache 是 golang 官方提供的一个分布式缓存库,其中包含了一个简单的一致性 Hash...
-
5
Picasso A powerful image downloading and caching library for Android For more information please see the website Download Download the latest AAR from
-
10
Modern Caching 101: What Is In-Memory Cache, When and How to Use It 13min. read
-
9
Today, I'll show you the Symfony Cache component, an easy way to add caching to your PHP applications. This helps improve the overall performance of your application by reducing the page load time.
-
6
Caching in Python With lru_cache There are many ways to achieve fast and responsive applications. Caching is one approach that, when used correctly, makes things much faster while decreasing the load on computing resourc...
-
5
blog.cloudflare.com Checking if the site connection is secure
-
12
Repository files navigationPrometheus Groupcache exporter This exporter implements the prometheus.Collector interface in order to expose Prometheus metrics for
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK