TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Groupcache: an alternative to memcached, written in Go

341 pointsby sferikalmost 12 years ago

14 comments

joshfraseralmost 12 years ago
For those that didn't catch it, this is from Brad Fitzpatrick, the same guy who made memcache
评论 #6122751 未加载
评论 #6126510 未加载
chetanahujaalmost 12 years ago
I&#x27;d be curious to hear performance numbers (assuming a reasonable front-end server to this library). I get it that the replicated in-memory caching part is valuable. But (from painful experiences with Java) I also fear that a GC based memory management system is anti-optimal for an in-memory cache of small objects, especially as the size of heap grows to beyond a couple of GB( * ).<p>(* ) <a href="http://cdn.parleys.com/p/5148922a0364bc17fc56c60f/GarbageCollection.pdf" rel="nofollow">http:&#x2F;&#x2F;cdn.parleys.com&#x2F;p&#x2F;5148922a0364bc17fc56c60f&#x2F;GarbageCol...</a>
评论 #6124009 未加载
评论 #6123408 未加载
评论 #6123394 未加载
borlakalmost 12 years ago
I really wouldn&#x27;t call this an alternative. If you are running memcached, it&#x27;s very unlikely you can switch to Groupcache.<p>Parts of your application may rely on the expiration feature. But the biggest change is the inability to overwrite a current cache key. Every application I&#x27;ve used does this constantly (object updates).<p>Groupcache in its current form is useful for a very narrow set of applications.
评论 #6122125 未加载
评论 #6122116 未加载
评论 #6123162 未加载
评论 #6121848 未加载
happyhappyalmost 12 years ago
I want to use this, but since the keys are immutable, how can I store data like sessions which can change and would sometimes have to be invalidated from the server side (i.e. you can&#x27;t simply change the session ID in the cookie and use a new cache entry, because bad-guy could still be holding on to an old stolen session ID)?<p>In general, how can one learn to think in an immutable fashion to effectively exploit this?
评论 #6121822 未加载
评论 #6122207 未加载
评论 #6125398 未加载
评论 #6122842 未加载
reesesalmost 12 years ago
Am I reading this as a distributed, immutable, weak hash table rather than what one would consider a &#x27;cache&#x27;?<p>Mind you, doing so avoids the hardest parts of caching (and especially distributed caching, which otherwise begins to underperform around ≥ 5-7 nodes), so I can see significant upside. No surprise stales, distribution update clogging, etc.
willvarfaralmost 12 years ago
I noticed this when he talked about speeding up the Google download servers. Very interesting :)<p>Its an alternative to memcache but not a direct replacement. I hope he adds CAS etc.<p>I hope they start using the kernel&#x27;s buffer cache as the backing store, or explain why its not a good idea: <a href="http://williamedwardscoder.tumblr.com/post/13363076806/buffcacher" rel="nofollow">http:&#x2F;&#x2F;williamedwardscoder.tumblr.com&#x2F;post&#x2F;13363076806&#x2F;buffc...</a>
评论 #6121876 未加载
评论 #6122827 未加载
评论 #6121892 未加载
评论 #6123123 未加载
buro9almost 12 years ago
<a href="http://talks.golang.org/2013/oscon-dl.slide#46" rel="nofollow">http:&#x2F;&#x2F;talks.golang.org&#x2F;2013&#x2F;oscon-dl.slide#46</a><p>&gt; 64 MB max per-node memory usage<p>So this is best used as a LRU cache of hot items.<p>It doesn&#x27;t compete&#x2F;replace memcache comprehensively, but it does attack the use of memcache as a relief for hot items.<p>I can see me mixing my Go programs with both groupcache and memcache.<p>Edit: I have glanced through the code and cannot see where the 64 MB per-node limit comes in. Anyone see that?
评论 #6122820 未加载
评论 #6122806 未加载
caspercalmost 12 years ago
How does its sharding by key algorithm work and how does it handle adding new peers? I was looking for at in the source, but couldn&#x27;t find anything related to it.
评论 #6125639 未加载
评论 #6125184 未加载
azthalmost 12 years ago
<a href="https://github.com/golang/groupcache/blob/master/sinks.go#L59" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;golang&#x2F;groupcache&#x2F;blob&#x2F;master&#x2F;sinks.go#L5...</a><p>Uh oh. The dreaded cast we see here <a href="http://how-bazaar.blogspot.co.nz/2013/07/stunned-by-go.html" rel="nofollow">http:&#x2F;&#x2F;how-bazaar.blogspot.co.nz&#x2F;2013&#x2F;07&#x2F;stunned-by-go.html</a>
justinhjalmost 12 years ago
I&#x27;m a bit confused about how you use this system with immutable keys. At face value it&#x27;s a great idea, but I need a simple example of how&#x27;s it is used to say retrieve a piece of data, then later update that to a new value.<p>Is this anything like how vector clocks are used, where the client uses the clocks to figure out which is the right state in a distributed system?
评论 #6123915 未加载
j_bakeralmost 12 years ago
I like the idea, but it seems like it would make deployment a pain. How do I spin up a new server without rebalancing and&#x2F;or restarting the world? Not to mention that now when I <i>do</i> need to restart the world, I can&#x27;t do so without also clearing my cache.
评论 #6125157 未加载
RyanZAGalmost 12 years ago
How does this compare to Hazelcast[1]? Seems like the same idea, but far less features?<p>[1] <a href="http://www.hazelcast.com/" rel="nofollow">http:&#x2F;&#x2F;www.hazelcast.com&#x2F;</a>
评论 #6123505 未加载
justinmaresalmost 12 years ago
It&#x27;d be interesting to compare this alternative to other solutions like Redis.<p>Has anyone used both&#x2F;either?
评论 #6123008 未加载
评论 #6122902 未加载
otterleyalmost 12 years ago
How do you set an item&#x27;s TTL? How do you set the maximum size of the process&#x27;s cache?
评论 #6122339 未加载