MongoDB 用于数据缓存, 什么 nosql 适合

coolesting · 2013年06月26日 · 最后由 ruby_sky 回复于 2013年06月27日 · 4463 次阅读

主要缓存关系数据库查询结果,要定时刷新,清除,没必要备份,

我打算用 memcache,大家推荐,thanks

memcache

#1 楼 @xieren58 很多功能不必要的,作为缓存,不需要长久保存,也不怕丢失。也不关心数据类型

redis + sentinel

近期 RR 刚吐槽过 Redis 作缓存远远不如 memcache

#8 楼 @bhuztez 是个 podcast …… ruby rogus

明明说了「近期」

哦,确实有歧义……

#9 楼 @blacktulip 有博客吗,连接 where where

#12 楼 @luikore 恩是在这期,多少分钟忘了

#11 楼 @coolesting #13 楼 @blacktulip 下面有主题和时间的对应挺好找的...

#14 楼 @luikore 啊…… 我没上过网站,都是直接在 podcast app 里面听的,学习了……

#12 楼 @luikore 16:07 – NoSQL ? 这个,好像不是

JAMES: Yeah, it’s correct. I actually am pretty familiar with Memcached/Redis scenario. So, Redis is great and I love Redis and it does lots of different names. But using it as a cache like Memcached is, is really dumb in my opinion because like Katrina says, it’s not as easy to just set a boundary. And what’s way worse is Redis’ expiration of keys. It’s not near as intelligent as Memcached’s expiration of keys. Memcache will favor the stuff that hasn’t been hit in a long time, whereas in Redis, if I recall correctly, a read has no effect on the time to whatever or things like that. In my opinion, Memcached is still, by far, the better caching system. But Redis has other features that may get valuable, in my opinion.

我擦!!!居然有 transcript!!!

其实就是 redis 当缓存用要手动刷新 expire 而已,客户端可以自动加 expire 指令不用操心的...

另外当 cache 也不能忽略其它功能啊,memcached 的功能太素了几乎啥都干不了

#18 楼 @blacktulip 在下面,你不知道的啊,

#20 楼 @coolesting 不知道啊,没上过网站啊,刚刚看你贴了才发现的

#19 楼 @luikore 不是 Do one thing and do it well 才是好的么...

#22 楼 @blacktulip 我也这么看法,功能太杂,反而变得累赘,失了原意,原质,原本应有的性能。

#19 楼 @luikore 配置 Redis 用 LRU 就不用关心 expire 拉。

#23 楼 @coolesting #22 楼 @blacktulip do one thing 只是手段,do it well 才是目的啊 你可以对比下两者的代码量,可以发现 memcached 的代码其实不少,但很多都花在没用的事情上了... 例如兼容 windows. redis 才是专注搞功能和性能,对 windows 就直接告诉你用 cygwin 编译。

memcached 场景变复杂后,就要自己重造一些 redis 早就提供的功能挺郁闷的

#24 楼 @quakewang cool, 这样就全方面胜过 memcached 了

http://redis.io/topics/config

maxmemory-policy allkeys-lru

#25 楼 @luikore 可是这样配置了之后,又想用 redis 当 db 用的时候就出问题了。

#27 楼 @luikore 看到了..

When Redis is used as a cache in this way, if the application also requires the use Redis as a store, it is strongly suggested to create two Redis instances, one as a cache, configured in this way, and one as a store, configured accordingly to your persistence needs and only holding keys that are not about cached data.

#26 楼 @hooopo 我也认同,本来就想要一个 cache 而已,结果成了 store

#29 楼 @coolesting 其实你应该两个都用用,分别 benchmark 一下,然后来 enlighten 我们...

#29 楼 @coolesting 如果你只要 cache 字符串,而且规则很简单,就可以用 memcached, 但如果要 cache 其他数据结构如 list 或者 hash 或者 set, 用 memcached 就要自己多做很多工作还没 redis 快。

话说我现在就开着一个限制了最大内存加持久化的 redis 实例当缓存用,缓存那些计算量大的业务数据避免应用重启又重算 - -||

hooopo 安装好 homeland docker 后找不到后台入口 提及了此话题。 02月27日 00:54
需要 登录 后方可回复, 如果你还没有账号请 注册新账号